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 Show.PointRowView extends Marionette.CompositeView | |
template: "folders/templates/dialogRegion/_point" | |
itemViewContainer: ".PointTypesContainer" | |
itemViewOptions: -> | |
PointTypeID: @model.get("PointTypeID") | |
eventpoint: @model.get("eventpoint") | |
tagName: "li" | |
className: "control-group" | |
constructor: (options) -> |
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
## Customer.rb | |
def self.references | |
includes(:account) | |
end | |
def self.forms | |
includes(:forms) | |
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
# models/delivery.rb | |
class Delivery < ActiveRecord::Base | |
has_one :order | |
has_one :customer, :through => :order | |
accepts_nested_attributes_for :order | |
attr_accessible :note, :position, :crew_ids, :order_attributes | |
end | |
# models/order.rb |
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
var FadeTransitionRegion = Backbone.Marionette.Region.extend({ | |
show: function(view){ | |
this.ensureEl(); | |
view.render(); | |
this.close(function() { | |
if (this.currentView && this.currentView !== view) { return; } | |
this.currentView = view; |
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
## /backbone/apps | |
## /backbone/entities | |
## /backbone/mixins | |
## /backbone/components | |
## Example Component as a class instantiated from an app's controller | |
## /backbone/components/pattern_selector/pattern_selector.js | |
@YOURAPP.module "Components", (Components, App, Backbone, Marionette, $, _) -> | |
class Components.PatternSelector |
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
CanSing = | |
sing: -> | |
console.log "I am #{@name} la la la" | |
include = (ctr, mixin) -> | |
console.log "including", ctr | |
for key of mixin | |
ctr.prototype[key] = mixin[key] | |
class Man |
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
do (Backbone) -> | |
_.extend Backbone.Marionette.Application::, | |
register: (instance, id) -> | |
@_registry ?= {} | |
@_registry[id] = instance | |
unregister: (instance, id) -> | |
delete @_registry[id] |
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
_delegate = Backbone.Marionette.View::delegateEvents | |
_close = Backbone.Marionette.View::close | |
_.extend Backbone.Marionette.View::, | |
delegateEvents: (events) -> | |
_delegate.call(@, events) | |
@bindShortCuts() | |
bindShortCuts: -> | |
for key, method of _.result(@, "shortCuts") |
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
#mixin = | |
#bar: -> alert "bar" | |
class Bar | |
#bar: -> alert "bar" | |
#baz: (b) -> console.log "baz", b, @ | |
Bar.baz = (b) -> console.log "baz", b, @ | |
class Foo extends Bar |
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 List.Event extends Marionette.ItemView | |
template: "events/list/templates/_event" | |
tagName: "tr" | |
triggers: | |
"click button" : "edit:event:clicked" | |
OlderNewer