Replace mock-up of sidebar with first draft of dynamic sidebar functionality.
authorTodd Larsen <tlarsen@google.com>
Wed, 24 Sep 2008 06:00:28 +0000
changeset 200 8e3a18cead22
parent 199 14ede160ef16
child 201 bc7f0ac07fcb
Replace mock-up of sidebar with first draft of dynamic sidebar functionality.
app/soc/templates/soc/base.html
app/soc/views/helpers/response_helpers.py
--- a/app/soc/templates/soc/base.html	Wed Sep 24 05:58:45 2008 +0000
+++ b/app/soc/templates/soc/base.html	Wed Sep 24 06:00:28 2008 +0000
@@ -70,65 +70,9 @@
     Google Open Source Programs
     {% endblock %}
     </a>
-      <ul>
-       <li>
-<a href="/user/profile">User (Sign In)</a>
-   <span title=" No Profile or Roles sidebar menu items until user signs in " class="popup">
-<small>*</small>
-   </span>
-
-       </li>
-      </ul>
-{% if is_admin %}
-	  <ul>
-	      <li>Developer
-                    <ul>
-                        <li>
-              <a href="/site/home/edit">Site Settings</a>
-                       </li>
-                       <li>
-            <a href="/site/user/lookup">Look Up User</a>
-                        </li>
-                       <li>
-            <a href="/site/user/profile">Create New User</a>
-                        </li>
-                       <li>
-            <a href="/site/user/list">Users List</a>
-                        </li>
-                    </ul>
-	      </li>
-	  </ul>
+{% if sidebar_menu_html %}
+{{ sidebar_menu_html|safe }}
 {% endif %}
-      <ul>
-       <li>
-<a href="/program/gsoc2009/home">Google Summer of Code</a>
-        <ul>
-         <li>
-<a href="/program/gsoc2009/community">Community</a>
-         </li>
-         <li>
-<a href="/program/gsoc2009/docs/faqs">Program FAQs</a>
-         </li>
-         <li>
-<a href="/program/gsoc2009/docs/tos">Terms of Service</a>
-         </li>
-        </ul>
-       </li>
-       <li>
-<a href="/program/ghop2008/home">Google Highly Open Participation</a>
-        <ul>
-         <li>
-<a href="/program/ghop2008/community">Community</a>
-         </li>
-         <li>
-<a href="/program/ghop2008/docs/faqs">Program FAQs</a>
-         </li>
-         <li>
-<a href="/program/ghop2008/docs/rules">Contest Rules</a>
-         </li>
-        </ul>
-       </li>
-      </ul>
      </li>
     </ul>
 {% endblock %}
--- a/app/soc/views/helpers/response_helpers.py	Wed Sep 24 05:58:45 2008 +0000
+++ b/app/soc/views/helpers/response_helpers.py	Wed Sep 24 06:00:28 2008 +0000
@@ -41,7 +41,9 @@
 
 from soc.logic import system
 from soc.logic.site import id_user
+from soc.logic.site import sidebar
 
+from soc.views.helpers import html_menu
 from soc.views.helpers import request_helpers
 from soc.views.helpers import template_helpers
 
@@ -107,6 +109,7 @@
       'is_debug': True if system.isDebug() is True
       'sign_in': a Google Account login URL
       'sign_out': a Google Account logout URL
+      'sidebar_menu_html': an HTML string that renders the sidebar menu
     }
   """
   if context is None:
@@ -125,6 +128,12 @@
   context['sign_out'] = context.get(
       'sign_out', users.create_logout_url(request.path))
 
+  if not context.get('sidebar_menu_html'):
+    # pass the currently constructed context as keyword arguments to
+    # all of the sidebar builder functions
+    context['sidebar_menu_html'] = str(html_menu.UlMenu(
+      sidebar.buildSidebar(**context)))
+
   return context