diff options
-rw-r--r-- | templates/base.html | 4 | ||||
-rw-r--r-- | templates/warningmgr/index.html | 8 | ||||
-rw-r--r-- | warningmgr/urls.py | 6 | ||||
-rw-r--r-- | warningmgr/views.py | 10 |
4 files changed, 19 insertions, 9 deletions
diff --git a/templates/base.html b/templates/base.html index 5b17f60..730b27e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,8 +30,8 @@ </a> {% block header %} <ul class="nav"> - <li><a href="{% url warning_list %}">{% trans "queue" %}</a></li> - <li><a href="{% url warning_list_reviewed %}">{% trans "reviewed" %}</a></li> + <li {% if not reviewed %}class="active"{% endif %}><a href="{% url warning_list %}">{% trans "queue" %}</a></li> + <li {% if reviewed %}class="active"{% endif %}><a href="{% url warning_list_reviewed %}">{% trans "reviewed" %}</a></li> </ul> <ul class="nav pull-right"> {% if user.is_authenticated %} diff --git a/templates/warningmgr/index.html b/templates/warningmgr/index.html index 9445b0b..853208e 100644 --- a/templates/warningmgr/index.html +++ b/templates/warningmgr/index.html @@ -14,8 +14,6 @@ {% block content %} {% autoescape on %} -<h1>Warnings</h1> - {% if user.is_authenticated %} <form action="{% url multi_action %}" method="post"> {% csrf_token %} @@ -80,7 +78,11 @@ Action: <select name="action"> </form> {% endif %} {% else %} - <p>No warnings have been recorded.</p> + {% if reviewed %} + <p>No warnings have been reviewed.</p> + {% else %} + <p>No warnings are in the queue.</p> + {% endif %} {% endif %} {% endautoescape %} diff --git a/warningmgr/urls.py b/warningmgr/urls.py index e3da6b7..806cffd 100644 --- a/warningmgr/urls.py +++ b/warningmgr/urls.py @@ -7,7 +7,7 @@ from django.conf.urls.defaults import * from django.views.generic import DetailView, ListView from warningmgr.models import WarningItem -from warningmgr.views import WarningListView +from warningmgr.views import WarningListView, ReviewedWarningListView urlpatterns = patterns('', url(r'^$', @@ -15,9 +15,7 @@ urlpatterns = patterns('', template_name='warningmgr/index.html'), name='warning_list'), url(r'^reviewed/$', - ListView.as_view( - queryset=WarningItem.objects.order_by('-build__created_date').filter(status__in='AIR'), - context_object_name='warning_list', + ReviewedWarningListView.as_view( template_name='warningmgr/index.html'), name='warning_list_reviewed'), url(r'^multi_action/$', 'warningmgr.views.multi_action', name='multi_action'), diff --git a/warningmgr/views.py b/warningmgr/views.py index c82fdb2..e4c47ed 100644 --- a/warningmgr/views.py +++ b/warningmgr/views.py @@ -71,3 +71,13 @@ class WarningListView(ListView): def get_queryset(self): return WarningItem.objects.filter(status__in=self.request.session.get('status_filter', 'NA')).order_by('-build__created_date') + +class ReviewedWarningListView(WarningListView): + + def get_context_data(self, **kwargs): + context = super(WarningListView, self).get_context_data(**kwargs) + context['reviewed'] = True + return context + + def get_queryset(self): + return WarningItem.objects.filter(status__in=self.request.session.get('status_filter', 'AIR')).order_by('-build__created_date') |