From 5ea14e190998e067748bfedec59eb7c268bd50a3 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 19 Jan 2010 10:12:38 +0000 Subject: Add a hierarchy to actions - #72 git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@48 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864 --- locale/fr/LC_MESSAGES/django.po | 10 +++++++--- main/actions.py | 9 ++++++--- main/views.py | 7 ++++--- templates/base.html | 11 +++++++++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 5ee9925..31b5c21 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-01-18 00:36+0100\n" +"POT-Creation-Date: 2010-01-19 00:40+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,10 +20,14 @@ msgid "View" msgstr "Voir" #: main/actions.py:33 +msgid "Contribute" +msgstr "Participer" + +#: main/actions.py:34 msgid "Add a new point of interest" msgstr "Ajout d'un point remarquable" -#: main/actions.py:34 templates/edit_route.html:8 +#: main/actions.py:35 templates/edit_route.html:8 msgid "Add a new route" msgstr "Ajout d'un nouveau trajet" @@ -251,7 +255,7 @@ msgstr "Commencer le tracé" msgid "Stop drawing" msgstr "Arrêter le tracé" -#: templates/base.html:29 +#: templates/base.html:36 msgid "This site uses Chimère" msgstr "Ce site utilise Chimère" diff --git a/main/actions.py b/main/actions.py index 4bd3ea1..d2cd409 100644 --- a/main/actions.py +++ b/main/actions.py @@ -29,6 +29,9 @@ class Action: def __init__(self, id, path, label): self.id, self.path, self.label = id, EXTRA_URL + path, label -actions = [Action('view', '', _('View')), - Action('edit', 'edit', _('Add a new point of interest')), - Action('edit_route', 'edit_route', _('Add a new route'))] +actions = ((Action('view', '', _('View')), []), + (Action('contribute', 'edit', _('Contribute')), + (Action('edit', 'edit', _('Add a new point of interest')), + Action('edit_route', 'edit_route', _('Add a new route'))) + ), + ) diff --git a/main/views.py b/main/views.py index d19c345..ce41c40 100644 --- a/main/views.py +++ b/main/views.py @@ -62,7 +62,7 @@ def index(request): request.session['last_visit'] != today: request.session['last_visit'] = today display_welcome = True - response_dct = {'actions':actions, 'action_selected':'view', + response_dct = {'actions':actions, 'action_selected':('view',), 'error_message':'', 'sub_categories':subcategories, 'extra_head':extra + getMapJS(), @@ -107,7 +107,7 @@ def edit(request): form = MarkerForm() # get the « manualy » declared_fields. Ie: properties declared_fields = form.declared_fields.keys() - response_dct = {'actions':actions, 'action_selected':'edit', + response_dct = {'actions':actions, 'action_selected':('contribute', 'edit'), 'error_message':'', 'media_path':settings.MEDIA_URL, 'extra_url':settings.EXTRA_URL, @@ -143,7 +143,8 @@ def editRoute(request): form = RouteForm() # get the « manualy » declared_fields. Ie: properties declared_fields = form.declared_fields.keys() - response_dct = {'actions':actions, 'action_selected':'edit_route', + response_dct = {'actions':actions, + 'action_selected':('contribute', 'edit_route'), 'error_message':'', 'media_path':settings.MEDIA_URL, 'map_layer':settings.MAP_LAYER, diff --git a/templates/base.html b/templates/base.html index ffa6025..b03563a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -15,8 +15,15 @@ {% block top %}{% endblock %}
    -{% for action in actions %} - {{ action.label }} +{% for action, subactions in actions %} + + {{ action.label }} + {% ifequal action.id action_selected.0 %}{% if subactions %}{% endif %}{% endifequal %} + {% endfor %}
-- cgit v1.2.3