Skip to content

Commit

Permalink
Transformed the macro() of the Flash messages into a regular include(…
Browse files Browse the repository at this point in the history
…) template
  • Loading branch information
javiereguiluz committed Aug 31, 2015
1 parent f481eef commit d01311b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 39 deletions.
8 changes: 1 addition & 7 deletions app/Resources/views/admin/blog/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{% extends 'admin/layout.html.twig' %}

{#
Import macros used for displaying flash messages.
See http://twig.sensiolabs.org/doc/tags/import.html
#}
{% import 'helper/messages.html.twig' as helper %}

{% block body_id 'admin_post_edit' %}

{% block main %}
<h1>{{ 'title.edit_post'|trans({'%id%': post.id}) }}</h1>

{{ helper.render_flash_messages() }}
{{ include('default/_flash_messages.html.twig') }}

{{ include('admin/blog/_form.html.twig', {
form: edit_form,
Expand Down
8 changes: 1 addition & 7 deletions app/Resources/views/admin/blog/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{% extends 'admin/layout.html.twig' %}

{#
Import macros used for displaying flash messages.
See http://twig.sensiolabs.org/doc/tags/import.html
#}
{% import 'helper/messages.html.twig' as helper %}

{% block body_id 'admin_post_index' %}

{% block main %}
<h1>{{ 'title.post_list'|trans }}</h1>

{{ helper.render_flash_messages() }}
{{ include('default/_flash_messages.html.twig') }}

<table class="table table-striped">
<thead>
Expand Down
12 changes: 12 additions & 0 deletions app/Resources/views/default/_flash_messages.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="messages">
{% for message in app.session.flashBag.get('success') %}
{# Bootstrap alert, see http://getbootstrap.com/components/#alerts #}
<div class="alert alert-dismissible alert-success" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>

{{ message|trans }}
</div>
{% endfor %}
</div>
25 changes: 0 additions & 25 deletions app/Resources/views/helper/messages.html.twig

This file was deleted.

0 comments on commit d01311b

Please sign in to comment.