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.
33 lines
673 B
33 lines
673 B
11 years ago
|
class app.views.Document extends app.View
|
||
|
@el: document
|
||
|
|
||
|
@shortcuts:
|
||
|
help: 'onHelp'
|
||
|
escape: 'onEscape'
|
||
|
superLeft: 'onBack'
|
||
|
superRight: 'onForward'
|
||
|
|
||
|
init: ->
|
||
|
@addSubview @nav = new app.views.Nav,
|
||
|
@addSubview @sidebar = new app.views.Sidebar
|
||
|
@addSubview @content = new app.views.Content
|
||
|
|
||
|
@setTitle()
|
||
|
@activate()
|
||
|
return
|
||
|
|
||
|
setTitle: (title) ->
|
||
|
@el.title = if title then "DevDocs/#{title}" else 'DevDocs'
|
||
|
|
||
|
onHelp: ->
|
||
|
app.router.show '/help#shortcuts'
|
||
|
|
||
|
onEscape: ->
|
||
|
if app.doc then window.location = '/' else app.router.show '/'
|
||
|
|
||
|
onBack: ->
|
||
|
history.back()
|
||
|
|
||
|
onForward: ->
|
||
|
history.forward()
|