Skip to content

Instantly share code, notes, and snippets.

@whitmanc
Created April 29, 2012 23:29
Show Gist options
  • Save whitmanc/2554009 to your computer and use it in GitHub Desktop.
Save whitmanc/2554009 to your computer and use it in GitHub Desktop.
#
# THE HTML
#
<div class="modal in" id="myStorybooksModal">
<div class="modal-header">
<h3 id="modal-title">
Create or Open App...
</h3>
</div>
<div class="modal-body" id="storybooks">
...
</div>
<div class="modal-footer">
<a href="#" class="btn">Exit</a>
<div class="btn btn-primary open-storybook">
Open
</div>
</div>
</div>
#
# COFFEESCRIPT/BACKBONE
#
class App.Views.StorybookIndex extends Backbone.View
template: JST["app/templates/storybooks/index"]
events:
'click .storybook': 'selectStorybook'
'click .open-storybook': 'openStorybook'
# When user clicks an item from the list of storybooks
selectStorybook: (e) ->
...
# Calls in here works fine
openStorybook: (e) ->
e.preventDefault()
alert "hello"
initialize: ->
@collection.on('reset', @render, this)
render: ->
$(@el).html(@template(storybooks: @collection))
this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment