Skip to content

Instantly share code, notes, and snippets.

@dmuskat
Created August 16, 2012 16:37
Show Gist options
  • Select an option

  • Save dmuskat/3371526 to your computer and use it in GitHub Desktop.

Select an option

Save dmuskat/3371526 to your computer and use it in GitHub Desktop.
#
# Displays a test item
#
class views.Item extends Backbone.View
tagName: 'div'
className: 'test-item'
template: getTemplate 'template-item-page'
render: ->
prompt = @model.itemImage.prompt.replace("<![CDATA[", "").replace("]]>", "")
html = @template.render
testName: 'TEST-NAME'
studentName: 'STUDENT-NAME'
questionNumber: 'NUMBER'
prompt: prompt
@$el.html(html)
calculatorButtonModel = new models.ToggleButton
calculatorButton = new views.ToggleButton
el: @$ '#top-toolbar-calc'
model: calculatorButtonModel
#############################################################
# This code block would go inside a function called from here
#
menu = new models.Menu
menuId: 'calculator-menu'
basic = new models.MenuItem
htmlId: 'basic-calulator'
scientific = new models.MenuItem
htmlId: 'scientific-calulator'
options = [basic, scientific]
menu.set 'options',options
menuView = new views.Menu
model: menu
menuView.render()
#
# End of code block
# Not sure if I need this : $('body').append(menuView.$el)
#############################################################
return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment