Closes #32.
Showing the changes to assets/javascripts (4 of 11 files). Show all
Unified · Split
| @@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines | |||
| 24 | result | 24 | result |
| 25 | 25 | ||
| 26 | app.news = [ | 26 | app.news = [ |
| 27 | [ 1393027200000, # February 22, 2013 | 27 | [ 1394236800000, # March 8, 2013 |
| 28 | """ Added path bar. """, | ||
| 29 | ], [ | ||
| 30 | 1393027200000, # February 22, 2013 | ||
| 28 | """ New <a href="/c/">C</a> documentation """, | 31 | """ New <a href="/c/">C</a> documentation """, |
| 29 | ], [ | 32 | ], [ |
| 30 | 1392508800000, # February 16, 2013 | 33 | 1392508800000, # February 16, 2013 |
| @@ -0,0 +1,5 @@ | |||
| 1 | app.templates.path = (doc, type, entry) -> | ||
| 2 | html = """<a href="#{doc.fullPath()}" class="_path-item _icon-#{doc.slug}">#{doc.name}</a>""" | ||
| 3 | html += """<a href="#{type.fullPath()}" class="_path-item">#{type.name}</a>""" if type | ||
| 4 | html += """<span class="_path-item">#{entry.name}</span>""" if entry | ||
| 5 | html | ||
| @@ -11,6 +11,7 @@ class app.views.Document extends app.View · 10 unmodified lines | |||
| 11 | @addSubview @nav = new app.views.Nav, | 11 | @addSubview @nav = new app.views.Nav, |
| 12 | @addSubview @sidebar = new app.views.Sidebar | 12 | @addSubview @sidebar = new app.views.Sidebar |
| 13 | @addSubview @content = new app.views.Content | 13 | @addSubview @content = new app.views.Content |
| 14 | @addSubview @path = new app.views.Path unless app.isSingleDoc() or app.isMobile() | ||
| 14 | 15 | ||
| 15 | @setTitle() | 16 | @setTitle() |
| 16 | @activate() | 17 | @activate() |
| @@ -0,0 +1,36 @@ | |||
| 1 | class app.views.Path extends app.View | ||
| 2 | @className: '_path' | ||
| 3 | |||
| 4 | @events: | ||
| 5 | click: 'onClick' | ||
| 6 | |||
| 7 | @routes: | ||
| 8 | after: 'afterRoute' | ||
| 9 | |||
| 10 | render: (args...) -> | ||
| 11 | @show() | ||
| 12 | @html @tmpl 'path', args... | ||
| 13 | |||
| 14 | show: -> | ||
| 15 | $.prepend $('._app'), @el unless @el.parentNode | ||
| 16 | |||
| 17 | hide: -> | ||
| 18 | $.remove @el if @el.parentNode | ||
| 19 | |||
| 20 | onClick: (event) => | ||
| 21 | @clicked = true if link = $.closestLink event.target, @el | ||
| 22 | |||
| 23 | afterRoute: (route, context) => | ||
| 24 | if context.type | ||
| 25 | @render context.doc, context.type | ||
| 26 | else if context.entry | ||
| 27 | if context.entry.isIndex() | ||
| 28 | @render context.doc | ||
| 29 | else | ||
| 30 | @render context.doc, context.entry.getType(), context.entry | ||
| 31 | else | ||
| 32 | @hide() | ||
| 33 | |||
| 34 | if @clicked | ||
| 35 | @clicked = null | ||
| 36 | app.document.sidebar.reset() | ||