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
This commit is contained in:
Thierry Carrez 2017-03-16 15:38:34 +01:00
parent 45cce87287
commit 0a77592bd9
4 changed files with 15 additions and 3 deletions

View File

@ -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,

View File

@ -13,13 +13,15 @@
Session suggestion is now closed.
{% endif %}
{% for topic in reviewable_topics %}
<a class=roundedButton href="/cfp/topic/{{ topic.id }}">Review topic: {{ topic.name }}</A>
<a class=roundedButton href="/cfp/topic/{{ topic.id }}">Review {% if multitopic %}topic: {{ topic.name }}{% else %}proposed sessions{% endif %}</A>
{% endfor %}
<table>
<tr>
{% if multitopic %}
<th><a class="nolink"
href="" onclick="ts_resortTable(this); return false;">Topic<img
class="sortarrow" src="/media/arrowBlank" height="6" width="9"></a></th>
{% endif %}
<th><a class="nolink"
href="" onclick="ts_resortTable(this); return false;">Title<img
class="sortarrow" src="/media/arrowBlank" height="6" width="9"></a>
@ -33,7 +35,9 @@ Session suggestion is now closed.
</tr>
{% for proposal in proposals %}
<tr>
{% if multitopic %}
<td>{{ proposal.topic.name }}</td>
{% endif %}
<td>
<a href="/cfp/details/{{ proposal.id }}">{{ proposal.title }}</a>
</td>

View File

@ -13,7 +13,7 @@
{% block content %}
<script type="text/javascript" src="/media/sorting.js"></script>
<div class="span-8">
<h2>{{ topic.name }}</h2>
<h2>{% if multitopic %}{{ topic.name }}{% else %}Review proposed sessions{% endif %}</h2>
<a class=roundedButton href=/>Back to proposals list</A>
{% if sched %}
<a class=roundedButton href="/scheduling/{{ topic.id }}">Scheduling</A>
@ -22,7 +22,9 @@
</div>
<table>
<tr>
{% if multitopic %}
<th>Topic</th>
{% endif %}
<th><a class="nolink"
href="" onclick="ts_resortTable(this); return false;">Title<img
class="sortarrow" src="/media/arrowBlank" height="6" width="9"></a>
@ -37,6 +39,7 @@
</tr>
{% for proposal in proposals %}
<tr>
{% if multitopic %}
<td>
{% if proposal.scheduled %}
{{ proposal.topic.name }}
@ -44,6 +47,7 @@
<a href="/cfp/switch/{{ proposal.id }}">{{ proposal.topic.name }}</a>
{% endif %}
</td>
{% endif %}
<td>
<a href="/cfp/details/{{ proposal.id }}">{{ proposal.title }}</a>
</td>

View File

@ -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})