Changeset - 9491eb545fef
[Not reviewed]
default
0 1 0
Mads Kiilerich - 8 years ago 2017-10-22 00:42:12
mads@kiilerich.com
styling: map pylonslib flash message categories to bootstrap alert classes

Error messages where shown without styling because they use the alert-error
class which doesn't exist in Bootstrap.

Pylonslib only support a few hardcoded categories. Map them to corresponding
Bootstrap classes.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/base/flash_msg.html
Show inline comments
 
<div class="flash_msg">
 
    <% messages = h.flash.pop_messages() %>
 
    % if messages:
 
        <% alert_categories = {'warning': 'alert-warning', 'notice': 'alert-info', 'error': 'alert-danger', 'success': 'alert-success'} %>
 
        % for message in messages:
 
            <div class="alert alert-dismissable alert-${message.category}">
 
            <div class="alert alert-dismissable ${alert_categories[message.category]}" role="alert">
 
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="icon-cancel-circled"></i></button>
 
              ${message}
 
            </div>
 
        % endfor
 
    % endif
 
    <script>
 
    if (typeof jQuery != 'undefined') {
 
        $(".alert").alert();
 
    }
 
    </script>
 
</div>
0 comments (0 inline, 0 general)