diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 249: Add bread crumbs to all project views

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

Commit Message

Zygmunt Krynicki Oct. 3, 2011, 4:48 p.m. UTC
------------------------------------------------------------
revno: 249
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: trunk
timestamp: Mon 2011-10-03 16:05:03 +0200
message:
  Add bread crumbs to all project views
modified:
  lava_projects/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_projects/views.py'
--- lava_projects/views.py	2011-10-03 12:35:31 +0000
+++ lava_projects/views.py	2011-10-03 14:05:03 +0000
@@ -49,14 +49,21 @@ 
     return HttpResponse(t.render(c))
 
 
+@BreadCrumb("List of all projects", project_root)
 def project_list(request):
     return object_list(
         request,
         queryset=Project.objects.accessible_by_principal(request.user),
         template_name="lava_projects/project_list.html",
+        extra_context={
+            'bread_crumb_trail': BreadCrumbTrail.leading_to(project_list)
+        },
         template_object_name="project")
 
 
+@BreadCrumb("{project}", 
+            parent=project_root,
+            needs=['project_identifier'])
 def project_detail(request, identifier):
     # A get by identifier, looking at renames, if needed.
     try:
@@ -81,10 +88,16 @@ 
         'project': project,
         'former_identifier': former_identifier, 
         'belongs_to_user': project.is_owned_by(request.user),
+        'bread_crumb_trail': BreadCrumbTrail.leading_to(
+            project_detail,
+            project=project,
+            project_identifier=project.identifier)
     })
     return HttpResponse(t.render(c))
 
 
+@BreadCrumb("Register new project",
+            parent=project_root)
 @login_required
 def project_register(request):
     if request.method == 'POST':
@@ -109,10 +122,14 @@ 
     t = loader.get_template(template_name)
     c = RequestContext(request, {
         'form': form,
+        'bread_crumb_trail': BreadCrumbTrail.leading_to(project_register),
     })
     return HttpResponse(t.render(c))
 
 
+@BreadCrumb("Reconfigure",
+            parent=project_detail,
+            needs=['project_identifier'])
 @login_required
 def project_update(request, identifier):
     project = get_object_or_404(
@@ -143,10 +160,17 @@ 
     c = RequestContext(request, {
         'form': form,
         'project': project,
+        'bread_crumb_trail': BreadCrumbTrail.leading_to(
+            project_update,
+            project=project,
+            project_identifier=project.identifier)
     })
     return HttpResponse(t.render(c))
 
 
+@BreadCrumb("Change identifier",
+            parent=project_update,
+            needs=['project_identifier'])
 @login_required
 def project_rename(request, identifier):
     project = get_object_or_404(
@@ -181,5 +205,9 @@ 
     c = RequestContext(request, {
         'form': form,
         'project': project,
+        'bread_crumb_trail': BreadCrumbTrail.leading_to(
+            project_rename,
+            project=project,
+            project_identifier=project.identifier)
     })
     return HttpResponse(t.render(c))