summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-10-27 20:15:38 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-10-27 20:15:38 +0100
commit3b3c4e8ee8d6a2e8c62744528244fabbbb5551a9 (patch)
tree9ed923da6572871e2251b1ba2ec0ace5f21e9894
parentee1d3724faa185df45f06b68b77690de481a59f5 (diff)
downloadChimère-3b3c4e8ee8d6a2e8c62744528244fabbbb5551a9.tar.bz2
Chimère-3b3c4e8ee8d6a2e8c62744528244fabbbb5551a9.zip
Templates: Remove "submited" templatetags and manage it inside template. More appropriate message after submission.
-rw-r--r--chimere/templates/chimere/blocks/submited.html19
-rw-r--r--chimere/templates/chimere/edit.html4
-rw-r--r--chimere/templates/chimere/edit_route.html2
-rw-r--r--chimere/templatetags/chimere_tags.py8
4 files changed, 19 insertions, 14 deletions
diff --git a/chimere/templates/chimere/blocks/submited.html b/chimere/templates/chimere/blocks/submited.html
index 5e4e546..7692d79 100644
--- a/chimere/templates/chimere/blocks/submited.html
+++ b/chimere/templates/chimere/blocks/submited.html
@@ -1,6 +1,19 @@
{% load i18n %}
+{% load url from future %}
<div class='edit' id='submited-window'>
- <p>{% trans "Your new proposition/modification has been submited. A moderator will treat your submission shortly. Thanks!" %}</p>
+ {% if is_modification %}
+ {% if can_write %}
+ <p>{% trans "Your modification has been taken into account." %}</p>
+ {% else %}
+ <p>{% trans "Your modification has been submited. A moderator will treat your submission shortly. Thanks!" %}</p>
+ {% endif %}
+ {% else %}
+ {% if can_write %}
+ <p>{% trans "Your new proposition has been added." %}</p>
+ {% else %}
+ <p>{% trans "Your new proposition has been submited. A moderator will treat your submission shortly. Thanks!" %}</p>
+ {% endif %}
+ {% endif %}
</div>
<script type='text/javascript'>
$(function(){
@@ -11,7 +24,7 @@
buttons:{
"{% trans "Add a new item" %}":
function() {
- window.location = "{{edit_url}}";
+ window.location = "{% url "chimere:edit" %}";
},
"{% trans "Continue edition of this item" %}":
function() {
@@ -19,7 +32,7 @@
},
"{% trans "Return to the map" %}":
function() {
- window.location = "{{index_url}}";
+ window.location = "{% url "chimere:index" %}";
}
}
});
diff --git a/chimere/templates/chimere/edit.html b/chimere/templates/chimere/edit.html
index f16577c..8322c50 100644
--- a/chimere/templates/chimere/edit.html
+++ b/chimere/templates/chimere/edit.html
@@ -17,12 +17,12 @@
{% block content %}
{{ block.super }}
- {% if submited %}{% submited %}{% endif %}
+ {% if submited %}{% include "chimere/blocks/submited.html" %}{% endif %}
{% if error_message %}<fieldset class='edit errorlist'>
<legend>{% trans "Error" %}</legend>
<p>{{ error_message }}</p>
</fieldset>{% endif %}
- {% if is_modification and can_write %}<div class='warning'><p>{% trans "You have write rigths for this map. Your modifications will be taking into account immediately." %}</p></div>{% endif %}
+ {% if is_modification and can_write %}<div class='warning'><p>{% trans "You have write rights for this map. Your modifications will be taking into account immediately." %}</p></div>{% endif %}
<fieldset class='edit'>
<legend>{% if is_modification %}{% trans "Modify a point of interest" %}{% else %}{% trans "Add a point of interest" %}{% endif %}</legend>
<form enctype="multipart/form-data" method='post' action='.'>
diff --git a/chimere/templates/chimere/edit_route.html b/chimere/templates/chimere/edit_route.html
index 4dbb0d4..669be7a 100644
--- a/chimere/templates/chimere/edit_route.html
+++ b/chimere/templates/chimere/edit_route.html
@@ -17,7 +17,7 @@
{% block content %}
{{ block.super }}
- {% if submited %}{% submited %}{% endif %}
+ {% if submited %}{% include "chimere/blocks/submited.html" %}{% endif %}
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{% if is_modification and is_superuser %}<div class='warning'><p>{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}</p></div>{% endif %}
<fieldset class='edit'>
diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py
index 375797a..7c13ab0 100644
--- a/chimere/templatetags/chimere_tags.py
+++ b/chimere/templatetags/chimere_tags.py
@@ -33,14 +33,6 @@ def display_maps(context):
context_data['map_name'] = context["map_name"]
return context_data
-@register.inclusion_tag('chimere/blocks/submited.html', takes_context=True)
-def submited(context):
- """
- Submited message.
- """
- return {"edit_url":reverse('chimere:edit'),
- "index_url":reverse('chimere:index')}
-
def get_news(map=None):
# Retrieve news
news = News.objects.filter(available=True, is_front_page=True)