Created
April 29, 2012 23:29
-
-
Save whitmanc/2554009 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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