From 0a77592bd990843fe605227863cf0118a9909513 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Thu, 16 Mar 2017 15:38:34 +0100 Subject: [PATCH] Simplify UI in case there is just one topic When only one topic is available, havign a column to display topic (or mentioning topic) is a bit confusing. Simplify the UI so that you can safely ignore this concept if there is only one topic available. Change-Id: I69ddef83b586a81df75e04579125681cbe067151 --- cfp/models.py | 2 +- cfp/templates/cfplist.html | 6 +++++- cfp/templates/topiclist.html | 6 +++++- cfp/views.py | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cfp/models.py b/cfp/models.py index 4344977..1ff409a 100644 --- a/cfp/models.py +++ b/cfp/models.py @@ -60,7 +60,7 @@ class Proposal(models.Model): description = models.TextField( help_text="The detailed subject and goals for your proposed session. " "This is mandatory.") - topic = models.ForeignKey(Topic, + topic = models.ForeignKey(Topic, default=1, help_text="The topic the session belongs in. Click 'Help' below" " for more details. This is mandatory.") blueprints = models.CharField(max_length=400, blank=True, diff --git a/cfp/templates/cfplist.html b/cfp/templates/cfplist.html index 5777776..bf17f03 100644 --- a/cfp/templates/cfplist.html +++ b/cfp/templates/cfplist.html @@ -13,13 +13,15 @@ Session suggestion is now closed. {% endif %} {% for topic in reviewable_topics %} -Review topic: {{ topic.name }} +Review {% if multitopic %}topic: {{ topic.name }}{% else %}proposed sessions{% endif %} {% endfor %} +{% if multitopic %} +{% endif %} {% for proposal in proposals %} +{% if multitopic %} +{% endif %} diff --git a/cfp/templates/topiclist.html b/cfp/templates/topiclist.html index c3b9b57..6424350 100644 --- a/cfp/templates/topiclist.html +++ b/cfp/templates/topiclist.html @@ -13,7 +13,7 @@ {% block content %}
-

{{ topic.name }}

+

{% if multitopic %}{{ topic.name }}{% else %}Review proposed sessions{% endif %}

Back to proposals list {% if sched %} Scheduling @@ -22,7 +22,9 @@
TopicTitle @@ -33,7 +35,9 @@ Session suggestion is now closed.
{{ proposal.topic.name }} {{ proposal.title }}
+{% if multitopic %} +{% endif %} {% for proposal in proposals %} +{% if multitopic %} +{% endif %} diff --git a/cfp/views.py b/cfp/views.py index f5d779b..15745e0 100644 --- a/cfp/views.py +++ b/cfp/views.py @@ -30,17 +30,20 @@ from cfp.utils import linkify, is_editable, topiclead @login_required def list(request): + multitopic = Topic.objects.count() > 1 proposals = Proposal.objects.all() reviewable_topics = Topic.objects.filter( lead_username=request.user.username) request.session['lastlist'] = "" return TemplateResponse(request, "cfplist.html", {'proposals': proposals, + 'multitopic': multitopic, 'reviewable_topics': reviewable_topics}) @login_required def topiclist(request, topicid): + multitopic = Topic.objects.count() > 1 topic = Topic.objects.get(id=topicid) if not topiclead(request.user, topic): return HttpResponseForbidden("Forbidden") @@ -48,6 +51,7 @@ def topiclist(request, topicid): request.session['lastlist'] = "cfp/topic/%s" % topicid return TemplateResponse(request, "topiclist.html", {'proposals': proposals, + 'multitopic': multitopic, 'sched': 'scheduling' in settings.INSTALLED_APPS, 'topic': topic})
TopicTitle @@ -37,6 +39,7 @@
{% if proposal.scheduled %} {{ proposal.topic.name }} @@ -44,6 +47,7 @@ {{ proposal.topic.name }} {% endif %} {{ proposal.title }}