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
class Foo extends Backbone.Model | |
toJSON: -> | |
{ foo: @attributes } |
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
class FooView extends Backbone.View | |
"#button click": "displayBarView" | |
displayBarView: -> | |
new BarView(el: @$("#bar_view")).render() |
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
class FooView extends Backbone.View | |
"#button click": "displayBarView" | |
render: -> | |
# Do the normal rendering | |
@barView = new BarView(el: @$("#bar_view")) | |
displayBarView: -> | |
@barView.display() |
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
class Foo extends Backbone.Model | |
defaults: | |
name: "joe" | |
bazzes: [] |
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
describe "Foo", -> | |
beforeEach -> | |
@foo1 = new Foo | |
@foo2 = new Foo | |
@foo1.get("bazzes").push "baz" | |
it "should not put foo1's bazzes in foo2", -> | |
expect(@foo2.get("bazzes").length).toEqual 0 |
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
class Foo extends Backbone.Model | |
defaults: -> | |
name: "joe" | |
bazzes: [] |
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
require 'tilt' | |
ENV['COFFEESCRIPT_SOURCE_PATH'] = Rails.root.join( | |
"app", "assets", "javascripts", "vendor", "coffee-script.js") | |
class BareCoffeeScriptTemplate < Sprockets::CoffeeScriptTemplate | |
def evaluate(scope, locals, &block) | |
@output ||= CoffeeScript.compile(data, :bare => true) | |
end | |
end |
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
// This is a manifest file that'll be compiled into including all the files listed below. | |
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically | |
// be included in the compiled file accessible from http://example.com/assets/application.js | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// the compiled file. | |
// | |
//= require jquery | |
//= require jquery_ujs | |
//= require_tree . |
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
class Fruit | |
plant: -> alert "I am in the ground" |
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
class Apple extends Fruit | |
plant: -> alert "I am an apple tree" |