Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Better flashes (also translated) [skip ci]
James Coleab9c991530e5
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 2f605947fe..61967435fb 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -6,7 +6,6 @@ use Config;use FireflyIII\Models\Tag;use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;use Input;-use Log;use Preferences;use Session;use Steam;@@ -76,7 +75,6 @@ class HomeController extends Controller*/public function index(ARI $repository){- Log::debug('You are at index.');$types = Config::get('firefly.accountTypesByIdentifier.asset');$count = $repository->countAccounts($types);bcscale(2);@@ -85,13 +83,13 @@ class HomeController extends Controllerreturn redirect(route('new-user.index'));}- $title = 'Firefly';- $subTitle = trans('firefly.welcomeBack');- $mainTitleIcon = 'fa-fire';- $transactions = [];- $frontPage = Preferences::get('frontPageAccounts', []);+ $title = 'Firefly';+ $subTitle = trans('firefly.welcomeBack');+ $mainTitleIcon = 'fa-fire';+ $transactions = [];+ $frontPage = Preferences::get('frontPageAccounts', []);/** @var Carbon $start */- $start = session('start', Carbon::now()->startOfMonth());+ $start = session('start', Carbon::now()->startOfMonth());/** @var Carbon $end */$end = session('end', Carbon::now()->endOfMonth());$showTour = Preferences::get('tour', true)->data;diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 6d090a6714..926f2fd235 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -38,6 +38,13 @@ return ['new_budget' => 'New budget','new_bill' => 'New bill','block_account_logout' => 'You have been logged out. Blocked accounts cannot use this site. Did you register with a valid email address?',+ 'flash_success' => 'Success!',+ 'flash_info' => 'Message',+ 'flash_warning' => 'Warning!',+ 'flash_error' => 'Error!',+ 'flash_info_multiple' => 'There is one message|There are :count messages',+ 'flash_error_multiple' => 'There is one error|There are :count errors',+// export data:'import_and_export' => 'Import and export',diff --git a/resources/views/partials/flashes.twig b/resources/views/partials/flashes.twigindex f62c45ce61..c80789ed0e 100644--- a/resources/views/partials/flashes.twig+++ b/resources/views/partials/flashes.twig@@ -1,61 +1,81 @@+<!-- SUCCESS MESSAGE (ALWAYS SINGULAR) -->{% if Session.has('success') %}<div class="alert alert-success alert-dismissible" role="alert">- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span></button>- <strong>Success!</strong> {{ Session.get('success') }}+ <button type="button" class="close" data-dismiss="alert">+ <span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span>+ </button>+ <strong>{{ 'flash_success'|_ }}</strong> {{ session('success') }}</div>{% endif %}+<!-- INFO MESSAGE (CAN BE MULTIPLE) -->{% if Session.has('info') %}-<div class="alert alert-info alert-dismissible" role="alert">- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span></button>+ <button type="button" class="close" data-dismiss="alert">+ <span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span>+ </button>- {% if Session.get('info') is iterable and Session.get('info')|length > 1 %}- <strong>{{ Session.get('info')|length }} messages:</strong>+ <!-- MULTIPLE INFO MESSAGE -->+ {% if session('info') is iterable and session('info')|length > 1 %}+ <strong>+ {{ Lang.choice('firefly.flash_info_multiple', session('info')|length, {count: session('info')|length}) }}:</strong><ul class="list-unstyled">- {% for err in Session.get('info') %}- <li>{{ err }}</li>+ {% for inf in session('info') %}+ <li>{{ inf|raw }}</li>{% endfor %}</ul>{% endif %}- {% if Session.get('info') is iterable and Session.get('info')|length == 1 %}- <strong>Message:</strong> {{ Session.get('info')[0]|raw }}+ <!-- SET OF MULTIPLE INFO MESSAGES, BUT THERE IS JUST ONE -->+ {% if session('info') is iterable and session('info')|length == 1 %}+ <strong>{{ 'flash_info'|_ }}:</strong> {{ session('info')[0]|raw }}{% endif %}-- {% if Session.get('info') is not iterable %}- <strong>Message:</strong> {{ Session.get('info')|raw }}+ <!-- SINGLE INFO MESSAGE -->+ {% if session('info') is not iterable %}+ <strong>{{ 'flash_info'|_ }}:</strong> {{ session('info')|raw }}{% endif %}</div>{% endif %}+<!-- WARNING MESSAGE (ALWAYS SINGULAR) -->{% if Session.has('warning') %}<div class="alert alert-warning alert-dismissible" role="alert">- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span></button>- <strong>Warning!</strong> {{ Session.get('warning') }}+ <button type="button" class="close" data-dismiss="alert">+ <span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span>+ </button>+ <strong>{{ 'flash_warning'|_ }}</strong> {{ session('warning') }}</div>{% endif %}+<!-- ERROR MESSAGE (CAN BE MULTIPLE) -->{% if Session.has('error') %}<div class="alert alert-danger alert-dismissible" role="alert">- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span></button>+ <button type="button" class="close" data-dismiss="alert">+ <span aria-hidden="true">×</span><span class="sr-only">{{ 'close'|_ }}</span>+ </button>- {% if Session.get('error') is iterable and Session.get('error')|length > 1 %}- <strong>{{ Session.get('error')|length }} errors:</strong>+ <!-- MULTIPLE ERRORS (BAD) -->+ {% if session('error') is iterable and session('error')|length > 1 %}+ <strong>+ {{ Lang.choice('firefly.flash_error_multiple', session('error')|length, {count: session('error')|length}) }}:+ </strong><ul class="list-unstyled">- {% for err in Session.get('error') %}+ {% for err in session('error') %}<li>{{ err }}</li>{% endfor %}</ul>{% endif %}- {% if Session.get('error') is iterable and Session.get('error')|length == 1 %}- <strong>Error!</strong>- {{ Session.get('error')[0]|raw }}++ <!-- SET OF MULTIPLE ERRORS, BUT THERE IS JUST ONE -->+ {% if session('error') is iterable and session('error')|length == 1 %}+ <strong>{{ 'flash_error'|_ }}</strong>+ {{ session('error')[0]|raw }}{% endif %}- {% if Session.get('error') is not iterable %}- <strong>Error!</strong> {{ Session.get('error')|raw }}+ <!-- SINGLE ERROR -->+ {% if session('error') is not iterable %}+ <strong>{{ 'flash_error'|_ }}</strong> {{ session('error')|raw }}{% endif %}</div>