Fix #1411 Cannot cloe alert

This commit is contained in:
Nicolas Le Goff
2013-08-08 12:03:26 +02:00
parent 72aaa24ce5
commit 9ecfc82b9f
4 changed files with 44 additions and 30 deletions

View File

@@ -46,5 +46,14 @@
</div> </div>
</div> </div>
</div> </div>
{% block scripts %}{% endblock %} {% block scripts %}
<script type="text/javascript">
// close alerts
$(document).on("click", ".alert .alert-block-close a", function(e){
e.preventDefault();
$(this).closest('.alert').alert('close');
return false;
});
</script>
{% endblock %}
{% endblock %} {% endblock %}

View File

@@ -138,9 +138,7 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro flashes() %} {% macro alert(type, message) %}
{% for type in app.getAvailableFlashTypes %}
{% for message in app.getFlash(type) %}
<div class="alert alert-{{ type }}"> <div class="alert alert-{{ type }}">
{% set sign = "icon-exclamation-sign" %} {% set sign = "icon-exclamation-sign" %}
@@ -160,6 +158,13 @@
</tr> </tr>
</table> </table>
</div> </div>
{% endmacro %}
{% macro flashes() %}
{% import _self as login %}
{% for type in app.getAvailableFlashTypes %}
{% for message in app.getFlash(type) %}
{{ login.alert(type, message) }}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}

View File

@@ -257,8 +257,8 @@ ul {
border-left: 1px solid darken(@warningBackground, 20%); border-left: 1px solid darken(@warningBackground, 20%);
} }
.alert .close { .alert-block-close a {
position: static; color: @white;
} }
.alert table { .alert table {

View File

@@ -269,20 +269,20 @@
// Form states and alerts // Form states and alerts
// ------------------------- // -------------------------
@warningText: #c09853; @warningText: @white;
@warningBackground: #fcf8e3; @warningBackground: @grayDark;
@warningBorder: darken(spin(@warningBackground, -10), 3%); @warningBorder: darken(spin(@warningBackground, -10), 3%);
@errorText: #b94a48; @errorText: @white;
@errorBackground: #f2dede; @errorBackground: #c9322b;
@errorBorder: darken(spin(@errorBackground, -10), 3%); @errorBorder: darken(spin(@errorBackground, -10), 3%);
@successText: #468847; @successText: @white;
@successBackground: #dff0d8; @successBackground: #1f914f;
@successBorder: darken(spin(@successBackground, -10), 5%); @successBorder: darken(spin(@successBackground, -10), 5%);
@infoText: #3a87ad; @infoText: @white;
@infoBackground: #d9edf7; @infoBackground: #4889af;
@infoBorder: darken(spin(@infoBackground, -10), 7%); @infoBorder: darken(spin(@infoBackground, -10), 7%);