From 6820aaea13301c789d4c9525a60200f0456031a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89lie=20Bouttier?=
Date: Sat, 4 Nov 2017 21:37:53 +0100
Subject: [PATCH] handle closed cfp
---
cfp/templates/cfp/closed.html | 18 ++++++++++++++++++
cfp/templates/cfp/proposal_dashboard.html | 2 ++
cfp/templates/cfp/proposal_talk_details.html | 2 ++
cfp/views.py | 2 ++
4 files changed, 24 insertions(+)
create mode 100644 cfp/templates/cfp/closed.html
diff --git a/cfp/templates/cfp/closed.html b/cfp/templates/cfp/closed.html
new file mode 100644
index 0000000..3fc2bc3
--- /dev/null
+++ b/cfp/templates/cfp/closed.html
@@ -0,0 +1,18 @@
+{% extends 'base.html' %}
+{% load i18n %}
+
+{% block proposetab %} class="active"{% endblock %}
+
+{% block content %}
+
+
+{% trans "Sorry, the Call for Participation is closed!" %}
+
+{% url 'proposal-mail-token' as mail_token_url %}
+{% blocktrans %}If you already have submitted a talk and you want to edit it, please click here.{% endblocktrans %}
+
+{% endblock %}
diff --git a/cfp/templates/cfp/proposal_dashboard.html b/cfp/templates/cfp/proposal_dashboard.html
index c1d3b28..0fabb3c 100644
--- a/cfp/templates/cfp/proposal_dashboard.html
+++ b/cfp/templates/cfp/proposal_dashboard.html
@@ -71,7 +71,9 @@
{% trans "No proposals." %}
{% endfor %}
+{% if conference.opened_categories.exists %}
{% trans "New proposal" %}
+{% endif %}
{% endblock %}
diff --git a/cfp/templates/cfp/proposal_talk_details.html b/cfp/templates/cfp/proposal_talk_details.html
index 5707479..7a0fd6a 100644
--- a/cfp/templates/cfp/proposal_talk_details.html
+++ b/cfp/templates/cfp/proposal_talk_details.html
@@ -13,9 +13,11 @@
{% trans "My profile" %}
+ {% if conference.opened_categories.exists %}
{% trans "New proposal" %}
+ {% endif %}
{% trans "Edit this proposal" %}
diff --git a/cfp/views.py b/cfp/views.py
index 416c6e9..b02ad68 100644
--- a/cfp/views.py
+++ b/cfp/views.py
@@ -143,6 +143,8 @@ def proposal_home(request):
categories = TalkCategory.objects.filter(site=request.conference.site)
else:
categories = request.conference.opened_categories
+ if not categories.exists():
+ return render(request, 'cfp/closed.html')
speaker_form = ParticipantForm(request.POST or None, conference=request.conference, social=False)
talk_form = TalkForm(request.POST or None, categories=categories)
if request.method == 'POST' and all(map(lambda f: f.is_valid(), [speaker_form, talk_form])):