Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash messages not displayed as part of page.html #1743

Closed
aliceh75 opened this issue Jun 4, 2014 · 3 comments
Closed

Flash messages not displayed as part of page.html #1743

aliceh75 opened this issue Jun 4, 2014 · 3 comments

Comments

@aliceh75
Copy link
Contributor

aliceh75 commented Jun 4, 2014

Flash messages added programatically server side (using ckan.lib.helpers.flash_notice, etc.) are not displayed on the page.

The issue was caused by commit 4ec3ac0 which added a Jinja block block_inner within the section that displayed the flash messages in page.html. The block in question caused the variable flash_messages to become out of scope, and thus no flash messages are ever displayed.

The fix is simple: simply move the assignment of flash_messages within the block:

--- a/ckan/templates/page.html
+++ b/ckan/templates/page.html
@@ -21,9 +21,9 @@
       <div id="content" class="container">
         {% block main_content %}
           {% block flash %}
-            {% set flash_messages = h.flash.pop_messages() | list %}
             <div class="flash-messages">
               {% block flash_inner %}
+                {% set flash_messages = h.flash.pop_messages() | list %}
                 {% for message in flash_messages %}
                   <div class="alert fade in {{ message.category }}">
                     {{ h.literal(message) }}
@aliceh75
Copy link
Contributor Author

aliceh75 commented Jun 5, 2014

The h.flash.pop_messages() | list construct was moved directly into the for loop instead - see the pull request.

@aliceh75
Copy link
Contributor Author

aliceh75 commented Jun 6, 2014

Fix has been merged into master.

@nigelbabu
Copy link
Contributor

This change was introduced in master, but not 2.2. Removing backport labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants