codecombat/app/views/docs/ComponentsDocumentationView.coffee

36 lines
1.2 KiB
CoffeeScript
Raw Normal View History

2014-07-25 16:06:04 -04:00
CocoView = require 'views/kinds/CocoView'
template = require 'templates/docs/components-documentation-view'
CocoCollection = require 'collections/CocoCollection'
LevelComponent = require 'models/LevelComponent'
class ComponentDocsCollection extends CocoCollection
url: '/db/level.component?project=system,name,description,dependencies,propertyDocumentation,code'
model: LevelComponent
comparator: 'system'
module.exports = class ComponentsDocumentationView extends CocoView
id: 'components-documentation-view'
template: template
2014-07-25 16:06:04 -04:00
className: 'tab-pane'
collapsed: true
events:
'click #toggle-all-component-code': 'onToggleAllCode'
constructor: (options) ->
super(options)
@componentDocs = new ComponentDocsCollection()
@supermodel.loadCollection @componentDocs, 'components'
getRenderData: ->
c = super()
c.components = @componentDocs.models
2014-07-14 14:18:17 -04:00
c.marked = marked
c.codeLanguage = me.get('aceConfig')?.language ? 'javascript'
c
onToggleAllCode: (e) ->
@collapsed = not @collapsed
@$el.find('.collapse').collapse(if @collapsed then 'hide' else 'show')
@$el.find('#toggle-all-component-code').toggleClass 'active', not @collapsed