mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Better notifications.
This commit is contained in:
@@ -272,19 +272,15 @@ class TransactionController extends Controller
|
|||||||
// save attachments:
|
// save attachments:
|
||||||
$att->saveAttachmentsForModel($journal);
|
$att->saveAttachmentsForModel($journal);
|
||||||
|
|
||||||
if ($att->getErrors()->count() > 0) {
|
// flash errors
|
||||||
// todo moet beter
|
if (count($att->getErrors()->get('attachments')) > 0) {
|
||||||
Session::flash('error', '<ul>' . join('', $att->getErrors()->get('attachments', '<li>:message</li>')) . '</ul>');
|
Session::flash('error', $att->getErrors()->get('attachments'));
|
||||||
}
|
}
|
||||||
if ($att->getMessages()->count() > 0) {
|
// flash messages
|
||||||
// todo moet beter
|
if (count($att->getMessages()->get('attachments')) > 0) {
|
||||||
Session::flash('info', '<ul>' . join('', $att->getMessages()->get('attachments', '<li>:message</li>')) . '</ul>');
|
Session::flash('info', $att->getMessages()->get('attachments'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// do something with the messages?
|
|
||||||
|
|
||||||
|
|
||||||
// rescan journal, UpdateJournalConnection
|
// rescan journal, UpdateJournalConnection
|
||||||
event(new JournalSaved($journal));
|
event(new JournalSaved($journal));
|
||||||
|
|
||||||
@@ -325,13 +321,20 @@ class TransactionController extends Controller
|
|||||||
// save attachments:
|
// save attachments:
|
||||||
$att->saveAttachmentsForModel($journal);
|
$att->saveAttachmentsForModel($journal);
|
||||||
|
|
||||||
if ($att->getErrors()->count() > 0) {
|
// one error
|
||||||
// todo moet beter
|
if ($att->getErrors()->count() == 1) {
|
||||||
Session::flash('error', '<ul>' . join('', $att->getErrors()->get('attachments', '<li>:message</li>')) . '</ul>');
|
Session::flash('error', join('', $att->getErrors()->get('attachments')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($att->getErrors()->count() > 1) {
|
||||||
|
// todo moet beter
|
||||||
|
Session::flash('error', '<ul class="list-unstyled">' . join('', $att->getErrors()->get('attachments', '<li>:message</li>')) . '</ul>');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($att->getMessages()->count() > 0) {
|
if ($att->getMessages()->count() > 0) {
|
||||||
// todo moet beter
|
// todo moet beter
|
||||||
Session::flash('info', '<ul>' . join('', $att->getMessages()->get('attachments', '<li>:message</li>')) . '</ul>');
|
Session::flash('info', '<ul class="list-unstyled">' . join('', $att->getMessages()->get('attachments', '<li>:message</li>')) . '</ul>');
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new JournalSaved($journal));
|
event(new JournalSaved($journal));
|
||||||
|
|||||||
@@ -6,10 +6,29 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if Session.has('info') %}
|
{% if Session.has('info') %}
|
||||||
|
|
||||||
<div class="alert alert-info alert-dismissible" role="alert">
|
<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>
|
||||||
<strong>Info:</strong> {{ Session.get('info')|raw }}
|
|
||||||
|
{% if Session.get('info') is iterable and Session.get('info')|length > 1 %}
|
||||||
|
<strong>{{ Session.get('info')|length }} messages:</strong>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
{% for err in Session.get('info') %}
|
||||||
|
<li>{{ err }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% if Session.get('info') is iterable and Session.get('info')|length == 1 %}
|
||||||
|
<strong>Message:</strong>
|
||||||
|
{{ Session.get('info')[0]|raw }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if Session.get('info') is not iterable %}
|
||||||
|
<strong>Message:</strong> {{ Session.get('info')|raw }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if Session.has('warning') %}
|
{% if Session.has('warning') %}
|
||||||
@@ -22,6 +41,23 @@
|
|||||||
{% if Session.has('error') %}
|
{% if Session.has('error') %}
|
||||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
<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>
|
||||||
<strong>Error!</strong> {{ Session.get('error')|raw }}
|
|
||||||
|
{% if Session.get('error') is iterable and Session.get('error')|length > 1 %}
|
||||||
|
<strong>{{ Session.get('error')|length }} errors:</strong>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
{% for err in Session.get('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 }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if Session.get('error') is not iterable %}
|
||||||
|
<strong>Error!</strong> {{ Session.get('error')|raw }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user