diff options
author | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-11-24 00:36:13 +0000 |
---|---|---|
committer | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-11-24 00:36:13 +0000 |
commit | 6c847e3c20d75f91525733e959f00098840dbc6d (patch) | |
tree | 57ff1031c73006b3d6a58f148efd48cded74c2b9 | |
parent | 128a8cf8e2d7238dea16b1ffac507eb2b7c6c6c5 (diff) | |
download | Chimère-6c847e3c20d75f91525733e959f00098840dbc6d.tar.bz2 Chimère-6c847e3c20d75f91525733e959f00098840dbc6d.zip |
Provide a description for categories - #61
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@41 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
-rw-r--r-- | locale/fr/LC_MESSAGES/django.po | 137 | ||||
-rw-r--r-- | main/models.py | 3 | ||||
-rw-r--r-- | main/views.py | 15 | ||||
-rw-r--r-- | static/main_map.js | 15 | ||||
-rw-r--r-- | static/styles.css | 27 | ||||
-rw-r--r-- | templates/category_detail.html | 6 | ||||
-rw-r--r-- | templates/main_map.html | 4 | ||||
-rw-r--r-- | templates/welcome.html | 4 | ||||
-rw-r--r-- | urls.py | 2 |
9 files changed, 149 insertions, 64 deletions
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 173caba..f8b2303 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: 2009-01-21 00:21+0100\n" +"POT-Creation-Date: 2009-11-24 00:48+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -27,30 +27,31 @@ msgstr "Ajout d'un point remarquable" msgid "Add a new route" msgstr "Ajout d'un nouveau trajet" -#: main/forms.py:36 +#: main/forms.py:37 msgid "New submission for" -msgstr "" +msgstr "Nouvelle proposition pour" -#: main/forms.py:39 +#: main/forms.py:40 #, python-format msgid "The new item \"%s\" has been submited in the category: " msgstr "Le nouvel élément « %s » a été proposé dans la catégorie : " -#: main/forms.py:41 +#: main/forms.py:42 msgid "To valid, precise or unvalid this item: " msgstr "Pour valider, préciser ou rejeter cet élément : " -#: main/forms.py:186 main/models.py:260 +#: main/forms.py:197 main/models.py:282 msgid "Area" msgstr "Zone" -#: main/models.py:35 main/models.py:48 main/models.py:60 main/models.py:72 -#: main/models.py:110 main/models.py:178 main/models.py:246 main/models.py:271 +#: main/models.py:35 main/models.py:48 main/models.py:69 main/models.py:82 +#: main/models.py:94 main/models.py:133 main/models.py:201 main/models.py:268 +#: main/models.py:293 msgid "Name" msgstr "Nom" -#: main/models.py:36 main/models.py:49 main/models.py:73 main/models.py:116 -#: main/models.py:184 main/models.py:248 main/models.py:273 +#: main/models.py:36 main/models.py:70 main/models.py:95 main/models.py:139 +#: main/models.py:207 main/models.py:270 main/models.py:295 msgid "Available" msgstr "Disponible" @@ -62,132 +63,149 @@ msgstr "Date" msgid "News" msgstr "Nouvelle" -#: main/models.py:50 main/models.py:76 main/models.py:247 main/models.py:272 +#: main/models.py:52 main/models.py:59 main/models.py:97 +msgid "Color theme" +msgstr "Thème de couleur" + +#: main/models.py:57 +msgid "Code" +msgstr "Code" + +#: main/models.py:58 main/models.py:71 main/models.py:99 main/models.py:269 +#: main/models.py:294 msgid "Order" msgstr "Ordre" -#: main/models.py:55 main/models.py:71 templates/edit.html:18 +#: main/models.py:64 +msgid "Color" +msgstr "Couleur" + +#: main/models.py:72 +msgid "Description" +msgstr "Description" + +#: main/models.py:77 main/models.py:93 templates/edit.html:18 #: templates/edit_route.html:18 msgid "Category" msgstr "Catégorie" -#: main/models.py:61 main/models.py:113 main/models.py:181 +#: main/models.py:83 main/models.py:136 main/models.py:204 #: templates/edit.html:37 templates/edit_route.html:38 msgid "Image" msgstr "Image" -#: main/models.py:66 main/models.py:74 +#: main/models.py:88 main/models.py:96 msgid "Icon" msgstr "Icone" -#: main/models.py:77 +#: main/models.py:100 msgid "Marker" msgstr "Point d'intérêt" -#: main/models.py:78 main/models.py:180 main/models.py:197 +#: main/models.py:101 main/models.py:203 main/models.py:220 #: templates/edit_route.html:32 msgid "Route" msgstr "Trajet" -#: main/models.py:79 +#: main/models.py:102 msgid "Both" msgstr "Mixte" -#: main/models.py:80 +#: main/models.py:103 msgid "Item type" msgstr "Type d'élément" -#: main/models.py:85 main/models.py:111 main/models.py:179 +#: main/models.py:108 main/models.py:134 main/models.py:202 msgid "Subcategory" msgstr "Sous-catégorie" -#: main/models.py:112 +#: main/models.py:135 msgid "Localisation" msgstr "Localisation" -#: main/models.py:115 main/models.py:183 +#: main/models.py:138 main/models.py:206 msgid "Submited" msgstr "Soumis" -#: main/models.py:117 main/models.py:185 +#: main/models.py:140 main/models.py:208 msgid "Disabled" msgstr "Désactivé" -#: main/models.py:121 main/models.py:189 +#: main/models.py:144 main/models.py:212 msgid "Status" msgstr "État" -#: main/models.py:129 main/models.py:295 +#: main/models.py:152 main/models.py:317 msgid "Point of interest" msgstr "Point d'intérêt" -#: main/models.py:249 +#: main/models.py:271 msgid "Upper left corner" msgstr "Coin en haut à gauche" -#: main/models.py:251 +#: main/models.py:273 msgid "Lower right corner" msgstr "Coin en bas à droite" -#: main/models.py:274 +#: main/models.py:296 msgid "Text" msgstr "Texte" -#: main/models.py:275 +#: main/models.py:297 msgid "Long text" msgstr "Texte long" -#: main/models.py:276 +#: main/models.py:298 msgid "Password" msgstr "Mot de passe" -#: main/models.py:280 +#: main/models.py:302 msgid "Type" msgstr "Type" -#: main/models.py:285 main/models.py:297 +#: main/models.py:307 main/models.py:319 msgid "Property model" msgstr "Modèle de propriété" -#: main/models.py:298 +#: main/models.py:320 msgid "Value" msgstr "Valeur" -#: main/models.py:302 +#: main/models.py:324 msgid "Property" msgstr "Propriété" -#: main/widgets.py:93 +#: main/widgets.py:103 msgid "Latitude" msgstr "Latitude" -#: main/widgets.py:93 +#: main/widgets.py:103 msgid "Longitude" msgstr "Longitude" -#: main/widgets.py:117 +#: main/widgets.py:127 msgid "Invalid point" msgstr "Point invalide" -#: main/widgets.py:143 +#: main/widgets.py:153 msgid "Creation mode" msgstr "Mode création" -#: main/widgets.py:144 +#: main/widgets.py:154 msgid "" "To start drawing the route click on the toggle button : \"Start drawing\"." msgstr "" "Pour commencer le dession cliquez sur le bouton : « Commencer le tracé » " -#: main/widgets.py:145 +#: main/widgets.py:155 msgid "Then click on the map to begin the drawing." msgstr "Puis cliquez sur la carte pour commencer le dessin." -#: main/widgets.py:146 +#: main/widgets.py:156 msgid "You can add points by clicking again." msgstr "Vous pouvez ajouter des points en cliquant de nouveau." -#: main/widgets.py:147 +#: main/widgets.py:157 msgid "" "To finish the drawing double click. When the drawing is finished you can " "edit it." @@ -195,7 +213,7 @@ msgstr "" "Pour finir le tracé double-cliquez. Quand le tracé est fini vous pouvez " "toujours l'éditer." -#: main/widgets.py:149 +#: main/widgets.py:159 msgid "" "While creating to undo a drawing click again on the toggle button \"Stop " "drawing\"." @@ -203,24 +221,24 @@ msgstr "" "En mode création vous pouvez annuler un tracé en appuyant sur le bouton « " "Arrêter le tracé »" -#: main/widgets.py:154 +#: main/widgets.py:164 msgid "Modification mode" msgstr "Mode modification" -#: main/widgets.py:155 +#: main/widgets.py:165 msgid "To move a point click on it and drag it to the desired position." msgstr "" "Pour bouger un point, cliquez dessus, maintenez le click pour le déposer à " "la position désirée" -#: main/widgets.py:156 +#: main/widgets.py:166 msgid "" "To delete a point move the mouse cursor over it and press the \"d\" key." msgstr "" "Pour supprimer un point, mettez le curseur de la souris sur celui-ci et " "appuyez sur le touche « d »" -#: main/widgets.py:157 +#: main/widgets.py:167 msgid "" "To add a point click in the middle of a segment and drag the new point to " "the desired position" @@ -229,18 +247,22 @@ msgstr "" "maintenez le bouton appuyé et déplacez le nouveau point à la position " "désirée." -#: main/widgets.py:166 +#: main/widgets.py:176 msgid "Start drawing" msgstr "Commencer le tracé" -#: main/widgets.py:166 +#: main/widgets.py:176 msgid "Stop drawing" msgstr "Arrêter le tracé" -#: templates/base.html:27 templates/main_map.html:48 +#: templates/base.html:27 templates/main_map.html:54 msgid "This site uses Chimère" msgstr "Ce site utilise Chimère" +#: templates/category_detail.html:6 templates/welcome.html:15 +msgid "Close" +msgstr "Fermer" + #: templates/edit.html:9 msgid "Add a new site" msgstr "Ajouter un nouveau site" @@ -266,24 +288,28 @@ msgid "Propose" msgstr "Proposez" #: templates/main_map.html:14 templates/main_map.html.py:19 -#: templates/main_map.html:29 +#: templates/main_map.html:30 msgid "Zoom to" msgstr "Zoomer sur" -#: templates/main_map.html:22 +#: templates/main_map.html:20 +msgid "Tell me more..." +msgstr "En savoir plus..." + +#: templates/main_map.html:23 msgid "Display markers and routes waiting for validation" msgstr "" "Afficher les points remarquables et les trajets en attente de validation" -#: templates/main_map.html:38 +#: templates/main_map.html:43 msgid "Permalink" msgstr "Lien permanent" -#: templates/main_map.html:48 +#: templates/main_map.html:54 msgid "Welcome message" msgstr "Message d'accueil" -#: templates/main_map.html:48 +#: templates/main_map.html:54 msgid "Map" msgstr "Carte" @@ -310,6 +336,3 @@ msgstr "" "message toutes les nouvelles vont être affichées. Vous pouvez les ajouter " "dans les pages d'administration." -#: templates/welcome.html:15 -msgid "Close" -msgstr "Fermer" diff --git a/main/models.py b/main/models.py index ee0d11c..f56f854 100644 --- a/main/models.py +++ b/main/models.py @@ -55,7 +55,7 @@ class Color(models.Model): """Color """ code = models.CharField(_("Code"), max_length=6) - order = models.IntegerField(_("Ordre")) + order = models.IntegerField(_("Order")) color_theme = models.ForeignKey(ColorTheme, verbose_name=_("Color theme")) def __unicode__(self): return self.code @@ -69,6 +69,7 @@ class Category(models.Model): name = models.CharField(_("Name"), max_length=150) available = models.BooleanField(_("Available")) order = models.IntegerField(_("Order")) + description = models.CharField(_("Description"), max_length=5000) def __unicode__(self): return self.name class Meta: diff --git a/main/views.py b/main/views.py index aba24f0..d19c345 100644 --- a/main/views.py +++ b/main/views.py @@ -30,8 +30,8 @@ from django.core import serializers from chimere import settings from chimere.main.actions import actions -from chimere.main.models import SubCategory, PropertyModel, Marker, Route, \ - News, Area, Color +from chimere.main.models import Category, SubCategory, PropertyModel, Marker, \ + Route, News, Area, Color from chimere.main.widgets import getMapJS, PointChooserWidget, \ RouteChooserWidget, URL_OSM_JS, URL_OSM_CSS @@ -186,6 +186,17 @@ def getDetail(request, marker_id): response_dct= {'media_path':settings.MEDIA_URL, 'marker':marker} return render_to_response('detail.html', response_dct) +def getDescriptionDetail(request, category_id): + ''' + Get the description for a category + ''' + try: + category = Category.objects.filter(id=int(category_id))[0] + except (ValueError, IndexError): + return HttpResponse('no results') + response_dct= {'media_path':settings.MEDIA_URL, 'category':category} + return render_to_response('category_detail.html', response_dct) + def getGeoObjects(request, category_ids, status='A'): ''' Get the JSON for a route diff --git a/static/main_map.js b/static/main_map.js index 7a9e070..bf69a9a 100644 --- a/static/main_map.js +++ b/static/main_map.js @@ -296,6 +296,21 @@ function setDetail(response){ } } +/* show the detail of a category */ +function displayCategoryDetail(category_id) { + var uri = "/" + extra_url + "getDescriptionDetail/" + category_id; + OpenLayers.loadURL(uri, '', this, setCategoryDetail); +} + +/* update the category detail panel from an http response */ +function setCategoryDetail(response){ + if (response.responseText.indexOf('no results') == -1) { + document.getElementById('category_detail').innerHTML = + response.responseText; + show('category_detail'); + } +} + /* new permalink createParams method - update when facilities are given to personalize the permalink */ function createParams(center, zoom, layers) { diff --git a/static/styles.css b/static/styles.css index b29314e..5bb4377 100644 --- a/static/styles.css +++ b/static/styles.css @@ -184,17 +184,40 @@ height:90%; width:280px; } -#detail_footer{ +.detail_footer{ text-align:center; } -#detail_footer a{ +.detail_footer a{ color:white; background-color:purple; display:block; text-decoration:None; } +#category_detail{ +display:None; +padding:6px 10px; +border: 1px solid black; +position:absolute; +z-index:5; +top:120px; +bottom:180px; +left:100px; +right:50px; +margin-right:360px; +background-color:#FFF; +opacity:0.9; +-moz-border-radius:10px; +-webkit-border-radius:10px; +border-radius:10px; +} + +#category_desc_content{ +overflow:auto; +height:88%; +} + #map{ position:absolute; border: 1px solid black; diff --git a/templates/category_detail.html b/templates/category_detail.html new file mode 100644 index 0000000..0211989 --- /dev/null +++ b/templates/category_detail.html @@ -0,0 +1,6 @@ +{% load i18n %} +<h2>{{ category.name }}</h2> +<div id='category_desc_content'> +{{ category.description|safe }} +</div> +<div class='detail_footer'><a href='javascript:hide("category_detail");'>{% trans "Close" %}</a></div> diff --git a/templates/main_map.html b/templates/main_map.html index 882e0f2..164d0ae 100644 --- a/templates/main_map.html +++ b/templates/main_map.html @@ -17,6 +17,7 @@ lst_{{category.id}}.push("{{sub_category.id}}");{% endfor %} <img alt='{{sub_category.name}}' src='{{media_path}}{{sub_category.icon.image}}'/> {% trans sub_category.name %}</label> <img class='zoom_image' alt='{% trans "Zoom to" %} {{sub_category.name}}' src='{{media_path}}icons/zoom.png' onclick='zoomToCategory({{sub_category.id}})'/></li>{% endfor %} + {%if category.description%}<li><a href='#' onclick='displayCategoryDetail({{category.id}});'>{%trans "Tell me more..."%}</a></li>{%endif%} </ul> </li>{% endfor %} <li id='display_submited'><input type='checkbox' onclick='loadGeoObjects()' name='display_submited' id='display_submited_check'/> {% trans "Display markers and routes waiting for validation"%}</li> @@ -32,6 +33,9 @@ lst_{{category.id}}.push("{{sub_category.id}}");{% endfor %} <div id='detail'> </div> +<div id='category_detail'> +</div> + {{welcome}}{% endblock %} {% block content %}<div id='map'></div> <script type='text/javascript'><!-- diff --git a/templates/welcome.html b/templates/welcome.html index 8d15f8e..463f880 100644 --- a/templates/welcome.html +++ b/templates/welcome.html @@ -12,5 +12,5 @@ {%endfor%} </div>{%endif%} </div> -<div id='detail_footer'><a href='javascript:hide("welcome");'>{% trans "Close" %}</a></div> -</div>
\ No newline at end of file +<div class='detail_footer'><a href='javascript:hide("welcome");'>{% trans "Close" %}</a></div> +</div> @@ -17,6 +17,8 @@ urlpatterns = patterns('', (r'^' + EXTRA_URL + r'submited/(?P<action>\w+)/$$', 'chimere.main.views.submited'), (r'^' + EXTRA_URL + r'getDetail/(?P<marker_id>\d+)/$', 'chimere.main.views.getDetail'), + (r'^' + EXTRA_URL + r'getDescriptionDetail/(?P<category_id>\d+)/$', + 'chimere.main.views.getDescriptionDetail'), (r'^' + EXTRA_URL + 'getGeoObjects/(?P<category_ids>\w+)/$', 'chimere.main.views.getGeoObjects'), (r'^' + EXTRA_URL + 'getGeoObjects/(?P<category_ids>\w+)/(?P<status>\w+)$', |