-
-
Save BrianGenisio/1472549 to your computer and use it in GitHub Desktop.
Trying to get basic CoffeeScript/Backbone working
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
window.app = | |
models: {} | |
views: {} | |
class app.models.OfferClass extends Backbone.Model | |
class app.models.OfferClasses extends Backbone.Collection | |
model: app.models.OfferClass | |
url: "/offerClasses" | |
class app.views.OfferClassesView extends Backbone.View | |
initialize: -> | |
@model = @model || new app.models.OfferClasses() | |
@render() | |
render: -> | |
@model.each @addToDropDown | |
@ | |
addToDropDown: (offerClass) -> | |
$(@el).append($("<option></option>"). | |
attr("value","theKey2"). | |
text(offerClass.get("name"))) | |
head.ready -> | |
model = new app.models.OfferClasses() | |
view = new app.views.OfferClassesView model: model, el: $('#offer-class-list') | |
model.fetch() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment