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
{ | |
"document" : { | |
"dynamic": "strict", | |
"properties" : { | |
"name" : { "type" : "string" }, | |
"external_id" : { | |
"type" : "string", | |
"index" : "not_analyzed" | |
}, | |
"internal_id" : { "type" : "long" }, |
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 DigitalAssetsCollection = Backbone.Collection.extend({ | |
model: Backbone.Model, | |
initialize: function(undefined, options) { | |
this.parent = options && options.parent; | |
if ( !this.parent ) { | |
throw "a parent product must be provided at initialization"; | |
} | |
_.bindAll(this, "url"); | |
}, |
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 DigitalAssetsCollection = Backbone.Collection.extend({ | |
model: Backbone.Model, | |
initialize: function(undefined, options) { | |
Backbone.Collection.prototype.initialize.apply(this, arguments); | |
this.parent = options && options.parent; | |
if ( !this.parent ) { | |
throw "a parent product must be provided at initialization"; | |
} | |
}, | |
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 NestedCollection = Backbone.Collection.extend({ | |
// Takes parent and nestedPath, corresponding to the parent | |
// of this nested collection, and the name of the nested | |
// resource to be used in the url for this collection. | |
initialize: function(undefined, options) { | |
Backbone.Collection.prototype.initialize.apply(this, arguments); | |
this.parent = options && options.parent; | |
if ( !this.parent || ! this.nestedPath ) { | |
throw "a parent model, corresponding to the parent of this Nested, " + | |
"must be provided at initialization, as well as the nestedPath"; |
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 NestedCollection = Backbone.Collection.extend({ | |
// Takes parent and nestedPath, corresponding to the parent | |
// of this nested collection, and the name of the nested | |
// resource to be used in the url for this collection. | |
initialize: function(undefined, options) { | |
Backbone.Collection.prototype.initialize.apply(this, arguments); | |
this.parent = options && options.parent; | |
if ( !this.parent || ! this.nestedPath ) { | |
throw "a parent model, corresponding to the parent of this Nested, " + | |
"must be provided at initialization, as well as the nestedPath"; |
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 Mixin = { | |
mixedInFunction: function() { | |
console.log("I'm a mixed-in function!"); | |
} | |
} | |
var ModelWithMixin = Backbone.Model.extend(_.extend({ | |
initialize: function() { | |
console.log("I'm a constructor!"); | |
} |
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 NestedModelMixin = { | |
initialize: function(undefined, options) { | |
this.parent = options && options.parent; | |
if ( !this.parent || ! this.nestedPath ) { | |
throw "a parent model, corresponding to the parent of this Nested, " + | |
"must be provided at initialization, as well as the nestedPath"; | |
} | |
}, | |
// Path to query against is the root path of the parent model, plus the collection key, e.g. |
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 DigitalAssetsCollection = Backbone.Collection.extend({ | |
mixins: [ NestedModelMixin, PageableCollectionMixin ] | |
}); |
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 PageableViewMixin { | |
events: { | |
"click a.nextPage": "nextPage", | |
"click a.prevPage": "prevPage" | |
}, | |
nextPage: function(e) { | |
// paging logic | |
}, | |
prevPage: function(e) { | |
// paging logic |
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
define(["backbone", "backbone.marionette", "backbone.epoxy", "views/mixins/epoxyCustomBindingHandlers", "views/mixins/epoxyCustomBindingFilters"], | |
function(Backbone, Marionette, Epoxy, EpoxyCustomBindingHandlers, EpoxyCustomBindingFilters) { | |
// Base set of functions that can be mixed into standard views such as ItemViews, CompositeViews, etc. | |
return { | |
bindingHandlers: EpoxyCustomBindingHandlers, | |
bindingFilters: EpoxyCustomBindingFilters, |
OlderNewer