diff sat_website/views.py @ 27:eda4deefecd1

reorganisation of the menu using submenus
author souliane <souliane@mailoo.org>
date Wed, 21 Jan 2015 20:07:20 +0100
parents d42dd630476f
children b45621706d83
line wrap: on
line diff
--- a/sat_website/views.py	Mon Jan 19 21:22:40 2015 +0100
+++ b/sat_website/views.py	Wed Jan 21 20:07:20 2015 +0100
@@ -27,12 +27,29 @@
 from collections import OrderedDict
 import screenshots, social_contract, utils
 
-CATEGORIES = OrderedDict([("features", _(u"Features")),
-              ("frontends", _(u"Frontends")),
-              ("screenshots", _(u"Screenshots & Videos")),
-              ("community", _(u"Community")),
-              ("developers", _(u"Developers corner")),
-              ("social_contract", _(u"Social contract"))])
+CATEGORIES = OrderedDict([('frontends', (_(u"Presentation"),
+                                OrderedDict([("features", _(u"Features")),
+                                             ("frontends", _(u"Frontends")),
+                                             ("screenshots", _(u"Screenshots & Videos")),
+                                             ]))),
+                          ('principles', (_(u"Technical area"),
+                                OrderedDict([("principles", _(u"Principles")),
+                                             ("specifications", _(u"Specifications")),
+                                             ("screenshots_tech", _(u"Screenshots & Videos")),
+                                             ("downloads", _(u"Downloads")),
+                                             ("developers", _(u"Developers corner")),
+                                             ]))),
+                          ('community', (_(u"Community"),
+                                OrderedDict([("community", _(u"Get in touch")),
+                                             ("association", _(u"Association")),
+                                             ("links", _(u"Links")),
+                                             ]))),
+                          ])
+
+CATEGORIES_RIGHT = OrderedDict([("adhesion", _(u"Adhesion")),
+                                ("social_contract", _(u"Social contract")),
+                                ])
+
 
 def overview(request):
     return render_to_response('sat_website/overview.html')
@@ -42,10 +59,12 @@
     context = {
                "available_languages": ['fr', 'en'],
                "categories": CATEGORIES,
+               "categories_right": CATEGORIES_RIGHT,
                "category": category,
                "latest_dl_path": latest_dl_path,
                "latest_version": latest_version,
               }
+
     context.update(csrf(request))
 
     if not category or category == "overview":
@@ -53,11 +72,17 @@
     elif category == "screenshots":
         context["screenshots"] = screenshots.screenshots
         context["screencasts"] = screenshots.screencasts
-        return render_to_response('sat_website/screenshots.html', context)
+    elif category == "screenshots_tech":
+        context["screenshots"] = screenshots.screencasts
+        context["screencasts"] = screenshots.screencasts
     elif category == "social_contract":
         context["SOCIAL_CONTRACT"] = social_contract.get_social_contract()
-        return render_to_response('sat_website/social_contract.html', context)
-    elif category in CATEGORIES.keys():
+
+    def all_keys(cats):
+        subcats = [value[1].keys() for value in cats.values() if isinstance(value, tuple)]
+        return sum(subcats, cats.keys())
+
+    if category in all_keys(CATEGORIES) or category in all_keys(CATEGORIES_RIGHT):
         return render_to_response('sat_website/%s.html' % (category,), context)
     else:
         raise Http404