mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
839 B
44 lines
839 B
11 years ago
|
class app.views.Path extends app.View
|
||
|
@className: '_path'
|
||
9 years ago
|
@attributes:
|
||
|
role: 'complementary'
|
||
11 years ago
|
|
||
|
@events:
|
||
|
click: 'onClick'
|
||
|
|
||
|
@routes:
|
||
|
after: 'afterRoute'
|
||
|
|
||
|
render: (args...) ->
|
||
|
@html @tmpl 'path', args...
|
||
8 years ago
|
@show()
|
||
|
return
|
||
11 years ago
|
|
||
|
show: ->
|
||
8 years ago
|
@prependTo app.el unless @el.parentNode
|
||
|
return
|
||
11 years ago
|
|
||
|
hide: ->
|
||
|
$.remove @el if @el.parentNode
|
||
8 years ago
|
return
|
||
11 years ago
|
|
||
|
onClick: (event) =>
|
||
|
@clicked = true if link = $.closestLink event.target, @el
|
||
8 years ago
|
return
|
||
11 years ago
|
|
||
|
afterRoute: (route, context) =>
|
||
|
if context.type
|
||
|
@render context.doc, context.type
|
||
|
else if context.entry
|
||
|
if context.entry.isIndex()
|
||
|
@render context.doc
|
||
|
else
|
||
|
@render context.doc, context.entry.getType(), context.entry
|
||
|
else
|
||
|
@hide()
|
||
|
|
||
|
if @clicked
|
||
|
@clicked = null
|
||
|
app.document.sidebar.reset()
|
||
8 years ago
|
return
|