diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 385: define "me" page actions in settings, so that extensions can add stuff

Message ID 20120805220410.12982.66103.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Aug. 5, 2012, 10:04 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
  Spring Zhang (qzhang)
Related merge proposals:
  https://code.launchpad.net/~qzhang/lava-server/user-notification/+merge/113166
  proposed by: Spring Zhang (qzhang)
  review: Approve - Michael Hudson-Doyle (mwhudson)
  review: Resubmit - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 385 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2012-08-06 10:03:21 +1200
message:
  define "me" page actions in settings, so that extensions can add stuff
modified:
  lava_server/settings/common.py
  lava_server/templates/me.html
  lava_server/views.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/settings/common.py'
--- lava_server/settings/common.py	2012-05-11 20:11:09 +0000
+++ lava_server/settings/common.py	2012-07-09 09:37:58 +0000
@@ -154,3 +154,8 @@ 
 # This is fixed in south 0.7.1, if we upgrade past that it's safe to
 # remove this line.
 SKIP_SOUTH_TESTS = True
+
+ME_PAGE_ACTIONS = [
+    ("django.contrib.auth.views.password_change", "Change your password"),
+    ("django.contrib.auth.views.logout", "Sign out"),
+    ]

=== modified file 'lava_server/templates/me.html'
--- lava_server/templates/me.html	2011-11-22 16:58:50 +0000
+++ lava_server/templates/me.html	2012-07-09 09:37:58 +0000
@@ -5,10 +5,9 @@ 
 {% block sidebar %}
 <h3>{% trans "Actions" %}</h3>
 <ul>
-  <li><a href="{% url django.contrib.auth.views.logout %}"
-    >{% trans "Sign out" %}</a></li>
-  <li><a href="{% url django.contrib.auth.views.password_change %}"
-    >{% trans "Change your password" %}</a></li>
+  {% for action in actions %}
+    <li><a href="{{ action.0 }}">{{ action.1 }}</a></li>
+  {% endfor %}
 </ul>
 {% endblock %}
 

=== modified file 'lava_server/views.py'
--- lava_server/views.py	2012-02-15 21:53:07 +0000
+++ lava_server/views.py	2012-08-05 21:58:27 +0000
@@ -18,6 +18,7 @@ 
 
 from django.conf import settings
 from django.contrib.auth.decorators import login_required
+from django.core.urlresolvers import reverse
 from django.http import HttpResponse, HttpResponseServerError
 from django.template import Context, loader, RequestContext
 from django.utils.translation import ugettext as _
@@ -50,9 +51,13 @@ 
             parent=index)
 @login_required
 def me(request):
+    actions = []
+    for view, text in settings.ME_PAGE_ACTIONS:
+        actions.append((reverse(view), text))
     data = {
         'bread_crumb_trail': BreadCrumbTrail.leading_to(
-            me, you=request.user.get_full_name() or request.user.username)
+            me, you=request.user.get_full_name() or request.user.username),
+        'actions': actions,
     }
     context = RequestContext(request, data)
     template = loader.get_template('me.html')