added function to set messages in JavaScript

This commit is contained in:
Oskar Hahn 2012-04-17 13:41:43 +02:00
parent 6aa241b268
commit 56f1a15cac
2 changed files with 15 additions and 2 deletions

View File

@ -11,3 +11,10 @@ $(function () {
} }
}); });
}); });
function new_message(text, type) {
message = $('#dummy-notification').clone(true);
$(message).show().addClass(type).children('em').html(text);
$('#notifications').append(message);
}

View File

@ -50,7 +50,13 @@
<div id="wrapper"> <div id="wrapper">
<div id="content"> <div id="content">
{% if messages %} <div id="notifications">
<div id="dummy-notification" class="notification" style="display:none">
<a class="close" href="#">
<img alt="close" title="{% trans 'Close this notification' %}" src="{% static 'images/icons/cross.png' %}">
</a>
<em></em>
</div>
{% for message in messages %} {% for message in messages %}
<div class="notification {% if message.tags %}{{ message.tags }}{% endif %}"> <div class="notification {% if message.tags %}{{ message.tags }}{% endif %}">
<a class="close" href="#"> <a class="close" href="#">
@ -64,7 +70,7 @@
$(this).hide("fast"); $(this).hide("fast");
}); });
</script> </script>
{% endif %} </div>
{% block content %} {% block content %}
{% endblock %} {% endblock %}
<div id="footer"> <div id="footer">