Closed
Bug 781664
Opened 13 years ago
Closed 13 years ago
Implement Django/Jinja system for Style Guide navigation
Categories
(www.mozilla.org :: General, defect, P1)
www.mozilla.org
General
Tracking
(Not tracked)
RESOLVED
FIXED
Future
People
(Reporter: rik, Assigned: sgarrity)
References
Details
(Whiteboard: u=dev c=django p=3)
We'll need a clever way to do a 3-level hierarchy, breadcrumbs and prev/next navigtion for the Style Guide. See http://mozilla.seanmartell.com/guide/index.php?directory=.¤tPic=1 for the visuals.
My first idea for this would be to register this info in urls.py to keep it DRY and build some Jinja helpers to render the data from urls.py. But I just thought about this for 30 seconds so it might not be the best way.
Comment 1•13 years ago
|
||
I think that might work quite well, actually.
```
from app import views
urlpatterns = patterns('',
hierarchy('rootname', views.root,
node('nodename', views.node1,
node('anothernode', views.node2),
node('anothernode', views.node3)
),
node('nodename', views.node4,
node('anothernode', views.node5),
node('anothernode', views.node6)
)
),
)
```
You could have hierarchy build the final urlconf and pass appropriate values for the next, prev, and breadcrumb order as named parameters to the view function:
```
def node4(request, next=None, prev=None, breadcrumb=None):
return render(request, 'some.template.html', {'next': next, 'prev': prev, 'breadcrumb': breadcrumb)
```
And then helpers in a base template would use the info:
```
<ul class="breadcrumb">
{% for name, link in breadcrumbs %}
<li><a href="{{ link }}">{{ name }}</a></li>
{% endfor %}
</ul>
```
There's some cleaning that can be done to avoid having a bunch of cookie-cutter views that just pass those parameters in, but I think the overall idea is rather sound.
Assignee | ||
Comment 2•13 years ago
|
||
mkelly, I have a very basic static template started for this in a branch: https://github.com/sgarrity/bedrock/blob/bug-781030-styleguide/apps/styleguide/templates/styleguide/base.html
Could you help me get what you've proposed in comment #1 implemented? I'm still new enough with django that I get hung up on some of the basics.
Updated•13 years ago
|
Whiteboard: [sp-2012-08-28] u=dev c=django
Updated•13 years ago
|
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
Updated•13 years ago
|
Whiteboard: [sp-2012-08-28] u=dev c=django → u=dev c=django
Target Milestone: --- → Future
Updated•13 years ago
|
Assignee: nobody → anthony
Assignee | ||
Comment 3•13 years ago
|
||
Another feature request - output a class indicating which <li> items have children (sub-menus) under them. Something like .has-children
Updated•13 years ago
|
Priority: -- → P1
Updated•13 years ago
|
Whiteboard: u=dev c=django → u=dev c=django p=3
Reporter | ||
Comment 4•13 years ago
|
||
Pull request updated at https://github.com/mozilla/bedrock/pull/345
Reporter | ||
Comment 5•13 years ago
|
||
This is ready for the python part. mkelly did the work in https://github.com/mozilla/bedrock/pull/392. This is in the style-guide branch for now. https://github.com/mozilla/bedrock/tree/style-guide
I think we're waiting on a couple of design changes to launch this. Don't know if there's a bug open for it.
Assignee: anthony → mkelly
Comment 6•13 years ago
|
||
Steven Garrity was handling the changes and tweaks last time I checked, he'll know where this is at currently and what work remains.
Assignee: mkelly → steven
Comment 7•13 years ago
|
||
Commits pushed to master at https://github.com/mozilla/bedrock
https://github.com/mozilla/bedrock/commit/acfab237e7a00d6324c38b79c5a8cf5c2ea21b3d
Implement a DRY navigation for styleguide
fix bug 781664
https://github.com/mozilla/bedrock/commit/7eb0c1ec74e9f5024304c3493991542730f8c0bf
Bug 781664: Simplify hierarchy code a bit.
Reduces the hierarchy code into a single class.
https://github.com/mozilla/bedrock/commit/7db8ed6513588c8408151f8369d333380a00537e
Bug 781664: Add tests for hierarchy.
https://github.com/mozilla/bedrock/commit/e3d0b7d24c826f907f1f1cb790ab8f85a4a881ba
Bug 781664: Add PageRoot and update prev/next.
Adds the PageRoot object to be used at the root of a
PageNode tree. PageRoot builds a flat list of nodes
using a depth-first search in preorder, and uses this
list to determine what previous and next return, as
well as for building the urlconf.
https://github.com/mozilla/bedrock/commit/3292de6e1a654ab92e7abd37ca7d3fde572351d0
Bug 781664: Review fixes.
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 8•13 years ago
|
||
Commit pushed to master at https://github.com/mozilla/bedrock
https://github.com/mozilla/bedrock/commit/9eeba2582b912bb3e9d28ec2ac7225a61f7a2364
Python 2.6 does not support assertRaises as a context manager.
bug 781664
Reporter | ||
Comment 9•13 years ago
|
||
This has been pushed to production.
You need to log in
before you can comment on or make changes to this bug.
Description
•