Skip to content

Commit f6c8077

Browse files
committed
Added various things which lets us use Django's messages framework to give feedback to users. This includes adding the messages middleware in settings.py, adding a message display are at the top of the page base template, and adding style setting for message display.
- Legacy-Id: 4964
1 parent 4400ae2 commit f6c8077

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

ietf/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
'django.contrib.sessions.middleware.SessionMiddleware',
102102
'django.contrib.auth.middleware.AuthenticationMiddleware',
103103
'django.contrib.auth.middleware.RemoteUserMiddleware',
104+
'django.contrib.messages.middleware.MessageMiddleware',
104105
'django.middleware.doc.XViewMiddleware',
105106
'ietf.middleware.SQLLogMiddleware',
106107
'ietf.middleware.SMTPExceptionMiddleware',
@@ -120,6 +121,7 @@
120121
'django.core.context_processors.debug',
121122
'django.core.context_processors.i18n',
122123
'django.core.context_processors.request',
124+
'django.contrib.messages.context_processors.messages',
123125
'ietf.context_processors.server_mode',
124126
'ietf.context_processors.revision_info',
125127
'ietf.context_processors.rfcdiff_prefix',
@@ -134,6 +136,7 @@
134136
'django.contrib.admin',
135137
'django.contrib.admindocs',
136138
'django.contrib.humanize',
139+
'django.contrib.messages',
137140
'south',
138141
'workflows',
139142
'permissions',

ietf/templates/base.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2-
{% comment %}
2+
{% comment %}<!--
33
44
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
55
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
@@ -33,7 +33,7 @@
3333
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
36-
{% endcomment %}
36+
-->{% endcomment %}
3737
{% load ietf_filters %}
3838
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3939
<head>
@@ -85,7 +85,13 @@
8585
</td>
8686
<td>
8787

88-
<div style="padding:0 8px 0 8px;">
88+
{% if messages %}
89+
<ul class="messages">
90+
{% for message in messages %}
91+
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
92+
{% endfor %}
93+
</ul>
94+
{% endif %}
8995
{% block content %}
9096
{% endblock %}
9197

static/css/base2.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,10 @@ form table .help {
194194

195195
.ballot-content h2.ad-ballot-comment { background: #2647A0; color: #fff; padding: 2px 4px; font-size: 108%; margin-top: 0;}
196196

197+
ul.messages { border: solid black 1px; margin: 0.4em 0; padding: 1em; }
198+
li.debug { margin: 0.5em; background-color: #ccf; }
199+
li.info { margin: 0.5em; background-color: #ff8; }
200+
li.success { margin: 0.5em; background-color: #4f4; }
201+
li.warning { margin: 0.5em; background-color: #fc8; color: black;}
202+
li.error { margin: 0.5em; background-color: #f44; }
203+

0 commit comments

Comments
 (0)