diff --git a/bower.json b/bower.json index 7cf640ffc3..8031c07f4a 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,7 @@ "description": "Make your Backbone.js apps dance with a composite application architecture!", "homepage": "http://marionettejs.org", "main": "./lib/core/backbone.marionette.js", - "version": "2.1.0", + "version": "2.2.0", "keywords": [ "backbone", "framework", diff --git a/changelog.md b/changelog.md index 860a4ce908..33e2fd2645 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,46 @@ +### v2.2.0 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v2.1.0...v2.2.0) + +* Features + + * Normalize region selectors hash to allow a user to use the `@ui.` syntax + * `Marionette.triggerMethodOn` + * `triggerMethodOn` invokes `triggerMethod` on a specific context + * Marionette.Error + * `captureStackTrace` cleans up stack traces + * add view _behaviors reference to associated behaviors + * enabling you to easily test and spy and your behaviors + * CollectionViews now receive events from emptyViews in the childEvents hash + * Regions now receive `swapOut` and `beforeSwapOut` events. + * Region constructor now can take a `el` as an option when calling `addRegion ` + * Region reset leaves `el` intact + * Application has `this.options` + * Application has `initialize` method + * Behaviors no longer wrap view methods + +* Bug Fixes + + * LayoutView’s regions are scoped inside it’s `el` + * Fix inconsistent Marionette.Object constructor implementation. + * emptyView instances now proxy their events up to the collection / compositeView + * collection / compositeView does not listen to collection add/remove/reset events until after render. + * Marionette.normalizeUIKeys no longer mutates UI hash + +* Better Errors + + * View destroyed error now includes the view cid in the error message. + * Throw an error when Marionette.bindEntityEvents is not an object or funcunction + * Throw a descriptive error for `collectionViews` + * If you do not pass a valid `collectionView` instance you are now given a logical error. + +* Documentation Improvements + + * New API docs are in progress + * Examples have been cleaned up + +### v2.2.0-pre.2 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v2.1.0...v2.2.0-pre.2) + +### v2.2.0-pre [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v2.1.0...v2.2.0-pre) + ### v2.1.0 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v2.0.3...v2.1.0) * Features diff --git a/lib/backbone.marionette.js b/lib/backbone.marionette.js index 5ab61c7e06..8952355e97 100644 --- a/lib/backbone.marionette.js +++ b/lib/backbone.marionette.js @@ -1,6 +1,6 @@ // MarionetteJS (Backbone.Marionette) // ---------------------------------- -// v2.1.0 +// v2.2.0 // // Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license @@ -19,6 +19,7 @@ (function(root, factory) { + /* istanbul ignore next */ if (typeof define === 'function' && define.amd) { define(['backbone', 'underscore'], function(Backbone, _) { return (root.Marionette = factory(root, Backbone, _)); @@ -34,6 +35,7 @@ }(this, function(root, Backbone, _) { 'use strict'; + /* istanbul ignore next */ // Backbone.BabySitter // ------------------- // v0.1.4 @@ -172,6 +174,8 @@ }; return Backbone.ChildViewContainer; })(Backbone, _); + + /* istanbul ignore next */ // Backbone.Wreqr (Backbone.Marionette) // ---------------------------------- // v1.3.1 @@ -489,7 +493,7 @@ var Marionette = Backbone.Marionette = {}; - Marionette.VERSION = '2.1.0'; + Marionette.VERSION = '2.2.0'; Marionette.noConflict = function() { root.Marionette = previousMarionette; @@ -509,12 +513,6 @@ // For slicing `arguments` in functions var slice = Array.prototype.slice; - function throwError(message, name) { - var error = new Error(message); - error.name = name || 'Error'; - throw error; - } - // Marionette.extend // ----------------- @@ -563,22 +561,47 @@ return normalizedHash; }; + // utility method for parsing @ui. syntax strings + // into associated selector + Marionette.normalizeUIString = function(uiString, ui) { + return uiString.replace(/@ui\.[a-zA-Z_$0-9]*/g, function(r) { + return ui[r.slice(4)]; + }); + }; // allows for the use of the @ui. syntax within // a given key for triggers and events - // swaps the @ui with the associated selector + // swaps the @ui with the associated selector. + // Returns a new, non-mutated, parsed events hash. Marionette.normalizeUIKeys = function(hash, ui) { if (typeof(hash) === 'undefined') { return; } - _.each(_.keys(hash), function(v) { - var pattern = /@ui\.[a-zA-Z_$0-9]*/g; - if (v.match(pattern)) { - hash[v.replace(pattern, function(r) { - return ui[r.slice(4)]; - })] = hash[v]; - delete hash[v]; + hash = _.clone(hash); + + _.each(_.keys(hash), function(key) { + var normalizedKey = Marionette.normalizeUIString(key, ui); + if (normalizedKey !== key) { + hash[normalizedKey] = hash[key]; + delete hash[key]; + } + }); + + return hash; + }; + + // allows for the use of the @ui. syntax within + // a given value for regions + // swaps the @ui with the associated selector + Marionette.normalizeUIValues = function(hash, ui) { + if (typeof(hash) === 'undefined') { + return; + } + + _.each(hash, function(val, key) { + if (_.isString(val)) { + hash[key] = Marionette.normalizeUIString(val, ui); } }); @@ -611,7 +634,7 @@ // // `this.triggerMethod("foo:bar")` will trigger the "foo:bar" event and // call the "onFooBar" method. - Marionette.triggerMethod = (function() { + Marionette.triggerMethod = function(event) { // split the event name on the ":" var splitter = /(^|:)(\w)/gi; @@ -622,29 +645,41 @@ return eventName.toUpperCase(); } - // actual triggerMethod implementation - var triggerMethod = function(event) { - // get the method name from the event name - var methodName = 'on' + event.replace(splitter, getEventName); - var method = this[methodName]; - var result; + // get the method name from the event name + var methodName = 'on' + event.replace(splitter, getEventName); + var method = this[methodName]; + var result; - // call the onMethodName if it exists - if (_.isFunction(method)) { - // pass all arguments, except the event name - result = method.apply(this, _.tail(arguments)); - } + // call the onMethodName if it exists + if (_.isFunction(method)) { + // pass all arguments, except the event name + result = method.apply(this, _.tail(arguments)); + } - // trigger the event, if a trigger method exists - if (_.isFunction(this.trigger)) { - this.trigger.apply(this, arguments); - } + // trigger the event, if a trigger method exists + if (_.isFunction(this.trigger)) { + this.trigger.apply(this, arguments); + } - return result; - }; + return result; + }; + + // triggerMethodOn invokes triggerMethod on a specific context + // + // e.g. `Marionette.triggerMethodOn(view, 'show')` + // will trigger a "show" event or invoke onShow the view. + Marionette.triggerMethodOn = function(context, event) { + var args = _.tail(arguments, 2); + var fnc; + + if (_.isFunction(context.triggerMethod)) { + fnc = context.triggerMethod; + } else { + fnc = Marionette.triggerMethod; + } - return triggerMethod; - })(); + return fnc.apply(context, [event].concat(args)); + }; // DOMRefresh // ---------- @@ -723,7 +758,7 @@ var method = target[methodName]; if (!method) { - throwError('Method "' + methodName + + throw new Marionette.Error('Method "' + methodName + '" was configured as an event handler, but does not exist.'); } @@ -757,6 +792,14 @@ function iterateEvents(target, entity, bindings, functionCallback, stringCallback) { if (!entity || !bindings) { return; } + // type-check bindings + if (!_.isFunction(bindings) && !_.isObject(bindings)) { + throw new Marionette.Error({ + message: 'Bindings must be an object or function.', + url: 'marionette.functions.html#marionettebindentityevents' + }); + } + // allow the bindings to be a function if (_.isFunction(bindings)) { bindings = bindings.call(target); @@ -797,6 +840,42 @@ })(Marionette); + var errorProps = ['description', 'fileName', 'lineNumber', 'name', 'message', 'number']; + + Marionette.Error = Marionette.extend.call(Error, { + urlRoot: 'http://marionettejs.com/docs/' + Marionette.VERSION + '/', + + constructor: function(message, options) { + if (_.isObject(message)) { + options = message; + message = options.message; + } else if (!options) { + options = {}; + } + + var error = Error.call(this, message); + _.extend(this, _.pick(error, errorProps), _.pick(options, errorProps)); + + this.captureStackTrace(); + + if (options.url) { + this.url = this.urlRoot + options.url; + } + }, + + captureStackTrace: function() { + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Marionette.Error); + } + }, + + toString: function() { + return this.name + ': ' + this.message + (this.url ? ' See: ' + this.url : ''); + } + }); + + Marionette.Error.extend = Marionette.extend; + // Callbacks // --------- @@ -893,10 +972,9 @@ // A Base Class that other Classes should descend from. // Object borrows many conventions and utilities from Backbone. Marionette.Object = function(options) { - this.options = _.extend({}, _.result(this, 'options'), options); - this.initialize(this.options); + this.initialize.apply(this, arguments); }; Marionette.Object.extend = Marionette.extend; @@ -948,7 +1026,10 @@ this.el = this.el instanceof Backbone.$ ? this.el[0] : this.el; if (!this.el) { - throwError('An "el" must be specified for a region.', 'NoElError'); + throw new Marionette.Error({ + name: 'NoElError', + message: 'An "el" must be specified for a region.' + }); } this.$el = this.getEl(this.el); @@ -992,8 +1073,10 @@ return this._buildRegionFromRegionClass(regionConfig); } - throwError('Improper region configuration type. Please refer ' + - 'to http://marionettejs.com/docs/marionette.region.html#region-configuration-types'); + throw new Marionette.Error({ + message: 'Improper region configuration type.', + url: 'marionette.region.html#region-configuration-types' + }); }, // Build the region from a string selector like '#foo-region' @@ -1073,13 +1156,17 @@ // only destroy the view if we don't want to preventDestroy and the view is different var _shouldDestroyView = !preventDestroy && isDifferentView; + // show the view if the view is different or if you want to re-show the view + var _shouldShowView = isDifferentView || forceShow; + + if (isChangingView) { + this.triggerMethod('before:swapOut', this.currentView); + } + if (_shouldDestroyView) { this.empty(); } - // show the view if the view is different or if you want to re-show the view - var _shouldShowView = isDifferentView || forceShow; - if (_shouldShowView) { // We need to listen for if a view is destroyed @@ -1095,11 +1182,10 @@ } this.triggerMethod('before:show', view); + Marionette.triggerMethodOn(view, 'before:show'); - if (_.isFunction(view.triggerMethod)) { - view.triggerMethod('before:show'); - } else { - this.triggerMethod.call(view, 'before:show'); + if (isChangingView) { + this.triggerMethod('swapOut', this.currentView); } this.attachHtml(view); @@ -1110,12 +1196,7 @@ } this.triggerMethod('show', view); - - if (_.isFunction(view.triggerMethod)) { - view.triggerMethod('show'); - } else { - this.triggerMethod.call(view, 'show'); - } + Marionette.triggerMethodOn(view, 'show'); return this; } @@ -1130,7 +1211,7 @@ } if (!this.$el || this.$el.length === 0) { - throwError('An "el" ' + this.$el.selector + ' must exist in DOM'); + throw new Marionette.Error('An "el" ' + this.$el.selector + ' must exist in DOM'); } }, @@ -1264,16 +1345,10 @@ addRegion: function(name, definition) { var region; - var isObject = _.isObject(definition); - var isString = _.isString(definition); - var hasSelector = !!definition.selector; - - if (isString || (isObject && hasSelector)) { - region = Marionette.Region.buildRegion(definition, Marionette.Region); - } else if (_.isFunction(definition)) { - region = Marionette.Region.buildRegion(definition, Marionette.Region); - } else { + if (definition instanceof Marionette.Region) { region = definition; + } else { + region = Marionette.Region.buildRegion(definition, Marionette.Region); } this.triggerMethod('before:add:region', name, region); @@ -1440,7 +1515,10 @@ var template = Backbone.$(templateId).html(); if (!template || template.length === 0) { - throwError('Could not find template: "' + templateId + '"', 'NoTemplateError'); + throw new Marionette.Error({ + name: 'NoTemplateError', + message: 'Could not find template: "' + templateId + '"' + }); } return template; @@ -1468,8 +1546,10 @@ // custom rendering and template handling for all of Marionette. render: function(template, data) { if (!template) { - throwError('Cannot render the template since its false, null or undefined.', - 'TemplateNotFoundError'); + throw new Marionette.Error({ + name: 'TemplateNotFoundError', + message: 'Cannot render the template since its false, null or undefined.' + }); } var templateFunc; @@ -1499,12 +1579,8 @@ // of this.options // at some point however this may be removed this.options = _.extend({}, _.result(this, 'options'), _.isFunction(options) ? options.call(this) : options); - // parses out the @ui DSL for events - this.events = this.normalizeUIKeys(_.result(this, 'events')); - if (_.isObject(this.behaviors)) { - new Marionette.Behaviors(this); - } + this._behaviors = Marionette.Behaviors(this); Backbone.View.apply(this, arguments); @@ -1540,13 +1616,22 @@ return _.extend(target, templateHelpers); }, - + // normalize the keys of passed hash with the views `ui` selectors. + // `{"@ui.foo": "bar"}` normalizeUIKeys: function(hash) { var ui = _.result(this, 'ui'); var uiBindings = _.result(this, '_uiBindings'); return Marionette.normalizeUIKeys(hash, uiBindings || ui); }, + // normalize the values of passed hash with the views `ui` selectors. + // `{foo: "@ui.bar"}` + normalizeUIValues: function(hash) { + var ui = _.result(this, 'ui'); + var uiBindings = _.result(this, '_uiBindings'); + return Marionette.normalizeUIValues(hash, uiBindings || ui); + }, + // Configure `triggers` to forward DOM events to view // events. `triggers: {"click .foo": "do:foo"}` configureTriggers: function() { @@ -1560,36 +1645,7 @@ // Configure the triggers, prevent default // action and stop propagation of DOM events _.each(triggers, function(value, key) { - - var hasOptions = _.isObject(value); - var eventName = hasOptions ? value.event : value; - - // build the event handler function for the DOM event - triggerEvents[key] = function(e) { - - // stop the event in its tracks - if (e) { - var prevent = e.preventDefault; - var stop = e.stopPropagation; - - var shouldPrevent = hasOptions ? value.preventDefault : prevent; - var shouldStop = hasOptions ? value.stopPropagation : stop; - - if (shouldPrevent && prevent) { prevent.apply(e); } - if (shouldStop && stop) { stop.apply(e); } - } - - // build the args for the event - var args = { - view: this, - model: this.model, - collection: this.collection - }; - - // trigger the event - this.triggerMethod(eventName, args); - }; - + triggerEvents[key] = this._buildViewTrigger(value); }, this); return triggerEvents; @@ -1601,25 +1657,33 @@ this._delegateDOMEvents(events); this.bindEntityEvents(this.model, this.getOption('modelEvents')); this.bindEntityEvents(this.collection, this.getOption('collectionEvents')); + + _.each(this._behaviors, function(behavior) { + behavior.bindEntityEvents(this.model, behavior.getOption('modelEvents')); + behavior.bindEntityEvents(this.collection, behavior.getOption('collectionEvents')); + }, this); + return this; }, // internal method to delegate DOM events and triggers - _delegateDOMEvents: function(events) { - events = events || this.events; + _delegateDOMEvents: function(eventsArg) { + var events = eventsArg || this.events; if (_.isFunction(events)) { events = events.call(this); } // normalize ui keys events = this.normalizeUIKeys(events); + if(_.isUndefined(eventsArg)) {this.events = events;} var combinedEvents = {}; // look up if this view has behavior events var behaviorEvents = _.result(this, 'behaviorEvents') || {}; var triggers = this.configureTriggers(); + var behaviorTriggers = _.result(this, 'behaviorTriggers') || {}; // behavior events will be overriden by view events and or triggers - _.extend(combinedEvents, behaviorEvents, events, triggers); + _.extend(combinedEvents, behaviorEvents, events, triggers, behaviorTriggers); Backbone.View.prototype.delegateEvents.call(this, combinedEvents); }, @@ -1629,8 +1693,15 @@ undelegateEvents: function() { var args = slice.call(arguments); Backbone.View.prototype.undelegateEvents.apply(this, args); + this.unbindEntityEvents(this.model, this.getOption('modelEvents')); this.unbindEntityEvents(this.collection, this.getOption('collectionEvents')); + + _.each(this._behaviors, function(behavior) { + behavior.unbindEntityEvents(this.model, behavior.getOption('modelEvents')); + behavior.unbindEntityEvents(this.collection, behavior.getOption('collectionEvents')); + }, this); + return this; }, @@ -1640,9 +1711,10 @@ // Internal helper method to verify whether the view hasn't been destroyed _ensureViewIsIntact: function() { if (this.isDestroyed) { - var err = new Error('Cannot use a view thats already been destroyed.'); - err.name = 'ViewDestroyedError'; - throw err; + throw new Marionette.Error({ + name: 'ViewDestroyedError', + message: 'View (cid: "' + this.cid + '") has already been destroyed and cannot be used.' + }); } }, @@ -1668,12 +1740,24 @@ // remove the view from the DOM this.remove(); + + // Call destroy on each behavior after + // destroying the view. + // This unbinds event listeners + // that behaviors have registerd for. + _.invoke(this._behaviors, 'destroy', args); + return this; }, + bindUIElements: function() { + this._bindUIElements(); + _.invoke(this._behaviors, this._bindUIElements); + }, + // This method binds the elements specified in the "ui" hash inside the view's code with // the associated jQuery selectors. - bindUIElements: function() { + _bindUIElements: function() { if (!this.ui) { return; } // store the ui hash in _uiBindings so they can be reset later @@ -1697,6 +1781,11 @@ // This method unbinds the elements specified in the "ui" hash unbindUIElements: function() { + this._unbindUIElements(); + _.invoke(this._behaviors, this._unbindUIElements); + }, + + _unbindUIElements: function() { if (!this.ui || !this._uiBindings) { return; } // delete all of the existing ui bindings @@ -1709,9 +1798,63 @@ delete this._uiBindings; }, + // Internal method to create an event handler for a given `triggerDef` like + // 'click:foo' + _buildViewTrigger: function(triggerDef) { + var hasOptions = _.isObject(triggerDef); + + var options = _.defaults({}, (hasOptions ? triggerDef : {}), { + preventDefault: true, + stopPropagation: true + }); + + var eventName = hasOptions ? options.event : triggerDef; + + return function(e) { + if (e) { + if (e.preventDefault && options.preventDefault) { + e.preventDefault(); + } + + if (e.stopPropagation && options.stopPropagation) { + e.stopPropagation(); + } + } + + var args = { + view: this, + model: this.model, + collection: this.collection + }; + + this.triggerMethod(eventName, args); + }; + }, + + setElement: function() { + var ret = Backbone.View.prototype.setElement.apply(this, arguments); + + // proxy behavior $el to the view's $el. + // This is needed because a view's $el proxy + // is not set until after setElement is called. + _.invoke(this._behaviors, 'proxyViewProperties', this); + + return ret; + }, + // import the `triggerMethod` to trigger events with corresponding // methods if the method exists - triggerMethod: Marionette.triggerMethod, + triggerMethod: function() { + var args = arguments; + var triggerMethod = Marionette.triggerMethod; + + var ret = triggerMethod.apply(this, args); + _.each(this._behaviors, function(b) { + triggerMethod.apply(b, args); + }); + + return ret; + }, // Imports the "normalizeMethods" to transform hashes of // events=>function references/names to a hash of events=>function references @@ -1797,8 +1940,10 @@ } if (!template) { - throwError('Cannot render the template since it is null or undefined.', - 'UndefinedTemplateError'); + throw new Marionette.Error({ + name: 'UndefinedTemplateError', + message: 'Cannot render the template since it is null or undefined.' + }); } // Add in entity data and template helpers @@ -1813,7 +1958,7 @@ }, // Attaches the content of a given view. - // This method can be overriden to optimize rendering, + // This method can be overridden to optimize rendering, // or to render in a non standard way. // // For example, using `innerHTML` instead of `$el.html` @@ -1840,6 +1985,7 @@ }); /* jshint maxstatements: 14 */ + /* jshint maxlen: 200 */ // Collection View // --------------- @@ -1860,11 +2006,16 @@ var initOptions = options || {}; this.sort = _.isUndefined(initOptions.sort) ? true : initOptions.sort; + if (initOptions.collection && !(initOptions.collection instanceof Backbone.Collection)) { + throw new Marionette.Error('The Collection option passed to this view needs to be an instance of a Backbone.Collection'); + } + + this.once('render', this._initialEvents); + this._initChildViewStorage(); Marionette.View.apply(this, arguments); - this._initialEvents(); this.initRenderBuffer(); }, @@ -1891,23 +2042,24 @@ _triggerBeforeShowBufferedChildren: function() { if (this._isShown) { - _.invoke(this._bufferedChildren, 'triggerMethod', 'before:show'); + _.each(this._bufferedChildren, _.partial(this._triggerMethodOnChild, 'before:show')); } }, _triggerShowBufferedChildren: function() { if (this._isShown) { - _.each(this._bufferedChildren, function (child) { - if (_.isFunction(child.triggerMethod)) { - child.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(child, 'show'); - } - }); + _.each(this._bufferedChildren, _.partial(this._triggerMethodOnChild, 'show')); + this._bufferedChildren = []; } }, + // Internal method for _.each loops to call `Marionette.triggerMethodOn` on + // a child view + _triggerMethodOnChild: function(event, childView) { + Marionette.triggerMethodOn(childView, event); + }, + // Configured the initial events that the collection view // binds to. _initialEvents: function() { @@ -1938,14 +2090,8 @@ }, // Override from `Marionette.View` to trigger show on child views - onShowCalled: function(){ - this.children.each(function(child){ - if (_.isFunction(child.triggerMethod)) { - child.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(child, 'show'); - } - }); + onShowCalled: function() { + this.children.each(_.partial(this._triggerMethodOnChild, 'show')); }, // Render children views. Override this method to @@ -2029,8 +2175,12 @@ // rendered empty, and then a child is added to the collection. destroyEmptyView: function() { if (this._showingEmptyView) { + this.triggerMethod('before:remove:empty'); + this.destroyChildren(); delete this._showingEmptyView; + + this.triggerMethod('remove:empty'); } }, @@ -2042,7 +2192,7 @@ // Render and show the emptyView. Similar to addChild method // but "child:added" events are not fired, and the event from // emptyView are not forwarded - addEmptyView: function(child, EmptyView){ + addEmptyView: function(child, EmptyView) { // get the emptyViewOptions, falling back to childViewOptions var emptyViewOptions = this.getOption('emptyViewOptions') || @@ -2055,10 +2205,13 @@ // build the empty view var view = this.buildChildView(child, EmptyView, emptyViewOptions); + // Proxy emptyView events + this.proxyChildEvents(view); + // trigger the 'before:show' event on `view` if the collection view // has already been shown - if (this._isShown){ - this.triggerMethod.call(view, 'before:show'); + if (this._isShown) { + Marionette.triggerMethodOn(view, 'before:show'); } // Store the `emptyView` like a `childView` so we can properly @@ -2070,8 +2223,8 @@ // call the 'show' method if the collection view // has already been shown - if (this._isShown){ - this.triggerMethod.call(view, 'show'); + if (this._isShown) { + Marionette.triggerMethodOn(view, 'show'); } }, @@ -2085,7 +2238,10 @@ var childView = this.getOption('childView'); if (!childView) { - throwError('A "childView" must be specified', 'NoChildViewError'); + throw new Marionette.Error({ + name: 'NoChildViewError', + message: 'A "childView" must be specified' + }); } return childView; @@ -2153,12 +2309,8 @@ this.children.add(view); this.renderChildView(view, index); - if (this._isShown && !this.isBuffering){ - if (_.isFunction(view.triggerMethod)) { - view.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(view, 'show'); - } + if (this._isShown && !this.isBuffering) { + Marionette.triggerMethodOn(view, 'show'); } this.triggerMethod('add:child', view); @@ -2201,7 +2353,7 @@ }, // check if the collection is empty - isEmpty: function(collection) { + isEmpty: function() { return !this.collection || this.collection.length === 0; }, @@ -2340,18 +2492,16 @@ // Bind only after composite view is rendered to avoid adding child views // to nonexistent childViewContainer - this.once('render', function() { - if (this.collection) { - this.listenTo(this.collection, 'add', this._onCollectionAdd); - this.listenTo(this.collection, 'remove', this._onCollectionRemove); - this.listenTo(this.collection, 'reset', this._renderChildren); - - if (this.sort) { - this.listenTo(this.collection, 'sort', this._sortViews); - } - } - }); + if (this.collection) { + this.listenTo(this.collection, 'add', this._onCollectionAdd); + this.listenTo(this.collection, 'remove', this._onCollectionRemove); + this.listenTo(this.collection, 'reset', this._renderChildren); + + if (this.sort) { + this.listenTo(this.collection, 'sort', this._sortViews); + } + } }, // Retrieve the `childView` to be used when rendering each of @@ -2362,7 +2512,10 @@ var childView = this.getOption('childView') || this.constructor; if (!childView) { - throwError('A "childView" must be specified', 'NoChildViewError'); + throw new Marionette.Error({ + name: 'NoChildViewError', + message: 'A "childView" must be specified' + }); } return childView; @@ -2425,7 +2578,7 @@ }, // Attaches the content of the root. - // This method can be overriden to optimize rendering, + // This method can be overridden to optimize rendering, // or to render in a non standard way. // // For example, using `innerHTML` instead of `$el.html` @@ -2476,8 +2629,10 @@ } if (container.length <= 0) { - throwError('The specified "childViewContainer" was not found: ' + - containerView.childViewContainer, 'ChildViewContainerMissingError'); + throw new Marionette.Error({ + name: 'ChildViewContainerMissingError', + message: 'The specified "childViewContainer" was not found: ' + containerView.childViewContainer + }); } } else { @@ -2614,6 +2769,10 @@ _.extend(regions, regionOptions); + // Normalize region selectors hash to allow + // a user to use the @ui. syntax. + regions = this.normalizeUIValues(regions); + this.addRegions(regions); }, @@ -2626,8 +2785,8 @@ }); }, - // Enable easy overiding of the default `RegionManager` - // for customized region interactions and buisness specific + // Enable easy overriding of the default `RegionManager` + // for customized region interactions and business specific // view logic for better control over single regions. getRegionManager: function() { return new Marionette.RegionManager(); @@ -2697,6 +2856,11 @@ this.stopListening(); }, + proxyViewProperties: function (view) { + this.$el = view.$el; + this.el = view.el; + }, + // import the `triggerMethod` to trigger events with corresponding // methods if the method exists triggerMethod: Marionette.triggerMethod, @@ -2713,19 +2877,19 @@ // Borrow Backbones extend implementation // this allows us to setup a proper - // inheritence pattern that follow in suite + // inheritance pattern that follows suit // with the rest of Marionette views. Behavior.extend = Marionette.extend; return Behavior; })(_, Backbone); - /* jshint maxlen: 143, nonew: false */ + /* jshint maxlen: 143 */ // Marionette.Behaviors // -------- // Behaviors is a utility class that takes care of - // glueing your behavior instances to their given View. + // gluing your behavior instances to their given View. // The most important part of this class is that you // **MUST** override the class level behaviorsLookup // method for things to work properly. @@ -2733,6 +2897,11 @@ Marionette.Behaviors = (function(Marionette, _) { function Behaviors(view, behaviors) { + + if (!_.isObject(view.behaviors)) { + return {}; + } + // Behaviors defined on a view can be a flat object literal // or it can be a function that returns an object. behaviors = Behaviors.parseBehaviors(view, behaviors || _.result(view, 'behaviors')); @@ -2741,76 +2910,13 @@ // calling the methods first on each behavior // and then eventually calling the method on the view. Behaviors.wrap(view, behaviors, _.keys(methods)); + return behaviors; } var methods = { - setElement: function(setElement, behaviors) { - setElement.apply(this, _.tail(arguments, 2)); - - // proxy behavior $el to the view's $el. - // This is needed because a view's $el proxy - // is not set until after setElement is called. - _.each(behaviors, function(b) { - b.$el = this.$el; - b.el = this.el; - }, this); - - return this; - }, - - destroy: function(destroy, behaviors) { - var args = _.tail(arguments, 2); - destroy.apply(this, args); - - // Call destroy on each behavior after - // destroying the view. - // This unbinds event listeners - // that behaviors have registerd for. - _.invoke(behaviors, 'destroy', args); - return this; - }, - - bindUIElements: function(bindUIElements, behaviors) { - bindUIElements.apply(this); - _.invoke(behaviors, bindUIElements); - }, - - unbindUIElements: function(unbindUIElements, behaviors) { - unbindUIElements.apply(this); - _.invoke(behaviors, unbindUIElements); - }, - - triggerMethod: function(triggerMethod, behaviors) { - var args = _.tail(arguments, 2); - triggerMethod.apply(this, args); - - _.each(behaviors, function(b) { - triggerMethod.apply(b, args); - }); - }, - - delegateEvents: function(delegateEvents, behaviors) { - var args = _.tail(arguments, 2); - delegateEvents.apply(this, args); - - _.each(behaviors, function(b) { - Marionette.bindEntityEvents(b, this.model, Marionette.getOption(b, 'modelEvents')); - Marionette.bindEntityEvents(b, this.collection, Marionette.getOption(b, 'collectionEvents')); - }, this); - - return this; - }, - - undelegateEvents: function(undelegateEvents, behaviors) { - var args = _.tail(arguments, 2); - undelegateEvents.apply(this, args); - - _.each(behaviors, function(b) { - Marionette.unbindEntityEvents(b, this.model, Marionette.getOption(b, 'modelEvents')); - Marionette.unbindEntityEvents(b, this.collection, Marionette.getOption(b, 'collectionEvents')); - }, this); - - return this; + behaviorTriggers: function(behaviorTriggers, behaviors) { + var triggerBuilder = new BehaviorTriggersBuilder(this, behaviors); + return triggerBuilder.buildBehaviorTriggers(); }, behaviorEvents: function(behaviorEvents, behaviors) { @@ -2865,9 +2971,10 @@ // } // ``` behaviorsLookup: function() { - throw new Error('You must define where your behaviors are stored.' + - 'See https://github.com/marionettejs/backbone.marionette' + - '/blob/master/docs/marionette.behaviors.md#behaviorslookup'); + throw new Marionette.Error({ + message: 'You must define where your behaviors are stored.', + url: 'marionette.behaviors.html#behaviorslookup' + }); }, // Takes care of getting the behavior class @@ -2909,6 +3016,44 @@ } }); + // Class to build handlers for `triggers` on behaviors + // for views + function BehaviorTriggersBuilder(view, behaviors) { + this._view = view; + this._viewUI = _.result(view, 'ui'); + this._behaviors = behaviors; + this._triggers = {}; + } + + _.extend(BehaviorTriggersBuilder.prototype, { + // Main method to build the triggers hash with event keys and handlers + buildBehaviorTriggers: function() { + _.each(this._behaviors, this._buildTriggerHandlersForBehavior, this); + return this._triggers; + }, + + // Internal method to build all trigger handlers for a given behavior + _buildTriggerHandlersForBehavior: function(behavior, i) { + var ui = _.extend({}, this._viewUI, _.result(behavior, 'ui')); + var triggersHash = _.clone(_.result(behavior, 'triggers')) || {}; + + triggersHash = Marionette.normalizeUIKeys(triggersHash, ui); + + _.each(triggersHash, _.partial(this._setHandlerForBehavior, behavior, i), this); + }, + + // Internal method to create and assign the trigger handler for a given + // behavior + _setHandlerForBehavior: function(behavior, i, eventName, trigger) { + // Unique identifier for the `this._triggers` hash + var triggerKey = trigger.replace(/^\S+/, function(triggerName) { + return triggerName + '.' + 'behaviortriggers' + i; + }); + + this._triggers[triggerKey] = this._view._buildViewTrigger(eventName); + } + }); + return Behaviors; })(Marionette, _); @@ -2985,7 +3130,7 @@ var method = controller[methodName]; if (!method) { - throwError('Method "' + methodName + '" was not found on the controller'); + throw new Marionette.Error('Method "' + methodName + '" was not found on the controller'); } this.route(route, methodName, _.bind(method, controller)); @@ -3002,14 +3147,20 @@ // Stores and starts up `Region` objects, includes an // event aggregator as `app.vent` Marionette.Application = function(options) { + this.options = options; this._initializeRegions(options); this._initCallbacks = new Marionette.Callbacks(); this.submodules = {}; _.extend(this, options); this._initChannel(); + this.initialize.apply(this, arguments); }; _.extend(Marionette.Application.prototype, Backbone.Events, { + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function() {}, + // Command execution, facilitated by Backbone.Wreqr.Commands execute: function() { this.commands.execute.apply(this.commands, arguments); @@ -3179,9 +3330,6 @@ // within a module. this.app = app; - // By default modules start with their parents. - this.startWithParent = true; - if (_.isFunction(this.initialize)) { this.initialize(moduleName, app, this.options); } @@ -3193,6 +3341,9 @@ // can be used as an event aggregator or pub/sub. _.extend(Marionette.Module.prototype, Backbone.Events, { + // By default modules start with their parents. + startWithParent: true, + // Initialize is an empty function by default. Override it with your own // initialization logic when extending Marionette.Module. initialize: function() {}, diff --git a/lib/backbone.marionette.map b/lib/backbone.marionette.map index f083e1da14..4f1e27d445 100644 --- a/lib/backbone.marionette.map +++ b/lib/backbone.marionette.map @@ -1 +1 @@ -{"version":3,"file":"lib/backbone.marionette.min.js","sources":["?"],"names":["root","factory","define","amd","Backbone","_","Marionette","exports","require","module","this","throwError","message","name","error","Error","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict","previousWreqr","Wreqr","Handlers","options","_wreqrHandlers","initialize","Model","Events","setHandlers","handlers","handler","context","isObject","callback","setHandler","config","trigger","hasHandler","getHandler","Array","slice","removeHandler","removeAllHandlers","CommandStorage","_commands","getCommands","commandName","commands","command","instances","addCommand","push","clearCommands","Commands","storageType","constructor","_initializeStorage","on","_executeCommands","execute","storage","StorageType","RequestResponse","request","EventAggregator","EA","Channel","channelName","vent","reqres","reset","off","stopListening","connectEvents","hash","_connect","connectCommands","connectRequests","type","fn","eventName","bind","radio","Radio","_channels","_proxyMethods","channel","_getChannel","system","messageSystems","proxyMethod","messageSystem","previousMarionette","Deferred","$","getOption","target","optionName","value","undefined","proxyGetOption","normalizeMethods","normalizedHash","normalizeUIKeys","ui","keys","v","pattern","match","replace","r","actAsCollection","object","listProperty","list","result","triggerMethod","getEventName","prefix","toUpperCase","splitter","event","methodName","MonitorDOMRefresh","documentElement","handleShow","_isShown","triggerDOMRefresh","handleRender","_isRendered","isInDOM","contains","el","listenTo","document","bindFromStrings","entity","evt","methodNames","split","bindToFunction","unbindFromStrings","unbindToFunction","iterateEvents","bindings","functionCallback","stringCallback","bindEntityEvents","unbindEntityEvents","proxyBindEntityEvents","proxyUnbindEntityEvents","Callbacks","_deferred","_callbacks","contextOverride","promise","cb","ctx","then","run","resolve","callbacks","Controller","destroy","Object","Region","$el","getEl","buildRegion","regionConfig","DefaultRegionClass","isString","_buildRegionFromSelector","selector","regionClass","_buildRegionFromObject","_buildRegionFromRegionClass","RegionClass","omit","region","parentEl","find","show","_ensureElement","showOptions","isDifferentView","currentView","preventDestroy","forceShow","isChangingView","_shouldDestroyView","empty","_shouldShowView","once","render","attachHtml","innerHTML","appendChild","_destroyView","isDestroyed","attachView","hasView","RegionManager","_regions","addRegions","regionDefinitions","defaults","regions","definition","addRegion","hasSelector","_store","get","getRegions","clone","removeRegion","_remove","removeRegions","emptyRegions","_setLength","TemplateCache","templateId","templateCaches","cachedTemplate","load","clear","i","compiledTemplate","template","loadTemplate","compileTemplate","html","rawTemplate","Renderer","data","templateFunc","View","bindAll","events","behaviors","Behaviors","onShowCalled","getTemplate","serializeModel","toJSON","mixinTemplateHelpers","templateHelpers","uiBindings","configureTriggers","triggers","triggerEvents","hasOptions","e","prevent","preventDefault","stop","stopPropagation","shouldPrevent","shouldStop","collection","delegateEvents","_delegateDOMEvents","combinedEvents","behaviorEvents","undelegateEvents","_ensureViewIsIntact","err","unbindUIElements","bindUIElements","_uiBindings","ItemView","serializeData","partial","items","serializeCollection","_renderTemplate","attachElContent","CollectionView","childViewEventPrefix","initOptions","sort","isUndefined","_initChildViewStorage","_initialEvents","initRenderBuffer","elBuffer","createDocumentFragment","_bufferedChildren","startBuffering","isBuffering","endBuffering","_triggerBeforeShowBufferedChildren","attachBuffer","_triggerShowBufferedChildren","invoke","child","_onCollectionAdd","_onCollectionRemove","_sortViews","destroyEmptyView","ChildView","getChildView","indexOf","addChild","children","removeChildView","checkEmpty","_renderChildren","resortView","orderChanged","item","_index","destroyChildren","isEmpty","showEmptyView","showCollection","EmptyView","getEmptyView","_showingEmptyView","addEmptyView","emptyViewOptions","buildChildView","renderChildView","childView","childViewOptions","_updateIndices","_addChildView","increment","laterView","proxyChildEvents","ChildViewClass","collectionView","buffer","append","_insertBefore","_insertAfter","findPosition","before","childViews","map","identity","rootEvent","childEvents","splice","CompositeView","isRendered","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","LayoutView","_firstRender","_initializeRegions","_reInitializeRegions","regionManager","_buildRegions","getRegion","that","_initRegionManager","regionOptions","getRegionManager","Behavior","parseBehaviors","wrap","setElement","b","_behaviorsEvents","viewUI","_events","behaviorUI","whitespace","join","eventKey","behaviorsLookup","getBehaviorClass","behaviorClass","chain","BehaviorClass","behavior","nestedBehaviors","flatten","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","_processOnRoute","appRoute","route","_addAppRoute","routeName","routeArgs","routePath","invert","onRoute","routeNames","reverse","Application","_initCallbacks","submodules","_initChannel","addInitializer","initializer","start","_regionManager","moduleNames","moduleDefinition","ModuleClass","Module","getClass","unshift","create","optionRegions","moduleName","app","_setupInitializersAndFinalizers","startWithParent","_initializerCallbacks","addFinalizer","_finalizerCallbacks","_isInitialized","mod","addDefinition","customArgs","_runModuleDefinition","moduleDefinitions","parentModule","_getModule","_addModuleDefinition","def","moduleClass","_getDefine","_getStartWithParent","_addStartWithParent","swp","startWithParentIsConfigured"],"mappings":";;;;;;;;;;;;;;;;;;;;CAmBC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAQL,GAAKM,WAAaL,EAAQD,EAAMI,EAAUC,SAE/C,IAAuB,mBAAZE,SAAyB,CACzC,GAAIH,GAAWI,QAAQ,YACnBH,EAAIG,QAAQ,aAChBC,QAAOF,QAAUN,EAAQD,EAAMI,EAAUC,OAEzCL,GAAKM,WAAaL,EAAQD,EAAMA,EAAKI,SAAUJ,EAAKK,IAGtDK,KAAM,SAASV,EAAMI,EAAUC,GAC/B,YA6dA,SAASM,GAAWC,EAASC,GAC3B,GAAIC,GAAQ,GAAIC,OAAMH,EAEtB,MADAE,GAAMD,KAAOA,GAAQ,QACfC,GAtdR,SAAUV,EAAUC,GAElB,GAAIW,GAA6BZ,EAASa,kBA8H1C,OAxHAb,GAASa,mBAAqB,SAASb,EAAUC,GAG/C,GAAIa,GAAY,SAASC,GACvBT,KAAKU,UACLV,KAAKW,iBACLX,KAAKY,kBACLZ,KAAKa,gBACLlB,EAAEmB,KAAKL,EAAOT,KAAKe,IAAKf,MAI1BL,GAAEqB,OAAOR,EAAUS,WAKjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAYnB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Ac9V,EAAIpE,GAG3BvC,KAAKod,oBAAoBP,EAAc9c,EAAQoc,IAGjDgB,oBAAqB,SAASH,EAAKjd,GACjC,GAAIsd,EAEJ,OAAI1d,GAAE6C,WAAWwa,IAASA,EAAI/b,oBAAqBrB,GAAW+b,QAC5D0B,EAAMtd,EAAOoF,YAAYlE,UAAUkb,gBAC5Bxc,EAAE0T,YAAYgK,IAAO,EAAOA,GAGjC1d,EAAEiE,SAASoZ,IACbK,EAAML,EAAIb,gBACHxc,EAAE0T,YAAYgK,IAAO,EAAOA,IAG9B,GAGTH,WAAY,SAASF,GACnB,OAAIrd,EAAE6C,WAAWwa,IAAUA,EAAI/b,oBAAqBrB,GAAW+b,OAI3Dhc,EAAEiE,SAASoZ,GACNA,EAAIxd,OAGN,KAPEwd,GAUXI,oBAAqB,SAASP,EAAc9c,EAAQoc,GAClDpc,EAAOoc,gBAAkBpc,EAAOoc,iBAAmBA,EAE9Cpc,EAAOoc,kBAAqBpc,EAAOud,8BAIxCvd,EAAOud,6BAA8B,EAErCT,EAAazB,eAAe,SAASjY,GAC/BpD,EAAOoc,iBACTpc,EAAOub,MAAMnY,SAOdvD"} \ No newline at end of file +{"version":3,"file":"lib/backbone.marionette.min.js","sources":["?"],"names":["root","factory","define","amd","Backbone","_","Marionette","exports","require","module","this","previousChildViewContainer","ChildViewContainer","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","each","add","extend","prototype","view","customIndex","viewCid","cid","model","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","values","remove","any","key","call","method","apply","tail","arguments","args","isFunction","length","size","methods","concat","toArray","VERSION","noConflict","previousWreqr","Wreqr","Handlers","options","_wreqrHandlers","initialize","Model","Events","setHandlers","handlers","handler","name","context","isObject","callback","setHandler","config","trigger","hasHandler","getHandler","Array","slice","removeHandler","removeAllHandlers","CommandStorage","_commands","getCommands","commandName","commands","command","instances","addCommand","push","clearCommands","Commands","storageType","constructor","_initializeStorage","on","_executeCommands","execute","storage","StorageType","RequestResponse","request","EventAggregator","EA","Channel","channelName","vent","reqres","reset","off","stopListening","connectEvents","hash","_connect","connectCommands","connectRequests","type","fn","eventName","bind","radio","Radio","_channels","_proxyMethods","channel","Error","_getChannel","system","messageSystems","proxyMethod","messageSystem","previousMarionette","Deferred","$","getOption","target","optionName","value","undefined","proxyGetOption","normalizeMethods","normalizedHash","normalizeUIString","uiString","ui","replace","r","normalizeUIKeys","clone","keys","normalizedKey","normalizeUIValues","val","isString","actAsCollection","object","listProperty","list","result","triggerMethod","event","getEventName","match","prefix","toUpperCase","splitter","methodName","triggerMethodOn","fnc","MonitorDOMRefresh","documentElement","handleShow","_isShown","triggerDOMRefresh","handleRender","_isRendered","isInDOM","contains","el","listenTo","document","bindFromStrings","entity","evt","methodNames","split","bindToFunction","unbindFromStrings","unbindToFunction","iterateEvents","bindings","functionCallback","stringCallback","message","url","bindEntityEvents","unbindEntityEvents","proxyBindEntityEvents","proxyUnbindEntityEvents","errorProps","urlRoot","error","pick","captureStackTrace","toString","Callbacks","_deferred","_callbacks","contextOverride","promise","cb","ctx","then","run","resolve","callbacks","Controller","destroy","Object","Region","$el","getEl","buildRegion","regionConfig","DefaultRegionClass","_buildRegionFromSelector","selector","regionClass","_buildRegionFromObject","_buildRegionFromRegionClass","RegionClass","omit","region","parentEl","find","show","_ensureElement","showOptions","isDifferentView","currentView","preventDestroy","forceShow","isChangingView","_shouldDestroyView","_shouldShowView","empty","once","render","attachHtml","innerHTML","appendChild","_destroyView","isDestroyed","attachView","hasView","RegionManager","_regions","addRegions","regionDefinitions","defaults","regions","definition","addRegion","_store","get","getRegions","removeRegion","_remove","removeRegions","emptyRegions","_setLength","TemplateCache","templateId","templateCaches","cachedTemplate","load","clear","i","compiledTemplate","template","loadTemplate","compileTemplate","html","rawTemplate","Renderer","data","templateFunc","View","bindAll","_behaviors","Behaviors","onShowCalled","getTemplate","serializeModel","toJSON","mixinTemplateHelpers","templateHelpers","uiBindings","configureTriggers","triggers","triggerEvents","_buildViewTrigger","delegateEvents","events","_delegateDOMEvents","collection","behavior","eventsArg","isUndefined","combinedEvents","behaviorEvents","behaviorTriggers","undelegateEvents","_ensureViewIsIntact","unbindUIElements","invoke","bindUIElements","_bindUIElements","_uiBindings","_unbindUIElements","triggerDef","hasOptions","preventDefault","stopPropagation","e","setElement","ret","b","ItemView","serializeData","partial","items","serializeCollection","_renderTemplate","attachElContent","CollectionView","childViewEventPrefix","initOptions","sort","Collection","_initialEvents","_initChildViewStorage","initRenderBuffer","elBuffer","createDocumentFragment","_bufferedChildren","startBuffering","isBuffering","endBuffering","_triggerBeforeShowBufferedChildren","attachBuffer","_triggerShowBufferedChildren","_triggerMethodOnChild","childView","_onCollectionAdd","_onCollectionRemove","_sortViews","child","destroyEmptyView","ChildView","getChildView","indexOf","addChild","children","removeChildView","checkEmpty","_renderChildren","resortView","orderChanged","item","_index","destroyChildren","isEmpty","showEmptyView","showCollection","EmptyView","getEmptyView","_showingEmptyView","addEmptyView","emptyViewOptions","buildChildView","proxyChildEvents","renderChildView","childViewOptions","_updateIndices","_addChildView","increment","laterView","ChildViewClass","collectionView","buffer","append","_insertBefore","_insertAfter","findPosition","before","childViews","map","identity","rootEvent","childEvents","splice","CompositeView","isRendered","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","LayoutView","_firstRender","_initializeRegions","_reInitializeRegions","regionManager","_buildRegions","getRegion","that","_initRegionManager","regionOptions","getRegionManager","Behavior","proxyViewProperties","behaviors","parseBehaviors","wrap","BehaviorTriggersBuilder","_view","_viewUI","_triggers","triggerBuilder","buildBehaviorTriggers","_behaviorsEvents","viewUI","_events","behaviorUI","whitespace","join","eventKey","behaviorsLookup","getBehaviorClass","behaviorClass","chain","BehaviorClass","nestedBehaviors","flatten","_buildTriggerHandlersForBehavior","triggersHash","_setHandlerForBehavior","triggerKey","triggerName","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","_processOnRoute","appRoute","route","_addAppRoute","routeName","routeArgs","routePath","invert","onRoute","routeNames","reverse","Application","_initCallbacks","submodules","_initChannel","addInitializer","initializer","start","_regionManager","moduleNames","moduleDefinition","ModuleClass","Module","getClass","unshift","create","optionRegions","moduleName","app","_setupInitializersAndFinalizers","startWithParent","_initializerCallbacks","addFinalizer","_finalizerCallbacks","_isInitialized","mod","stop","addDefinition","customArgs","_runModuleDefinition","moduleDefinitions","parentModule","_getModule","_addModuleDefinition","def","moduleClass","_getDefine","_getStartWithParent","_addStartWithParent","swp","startWithParentIsConfigured"],"mappings":";;;;;;;;;;;;;;;;;;;;CAmBC,SAASA,EAAMC,GAGd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAQL,GAAKM,WAAaL,EAAQD,EAAMI,EAAUC,SAE/C,IAAuB,mBAAZE,SAAyB,CACzC,GAAIH,GAAWI,QAAQ,YACnBH,EAAIG,QAAQ,aAChBC,QAAOF,QAAUN,EAAQD,EAAMI,EAAUC,OAEzCL,GAAKM,WAAaL,EAAQD,EAAMA,EAAKI,SAAUJ,EAAKK,IAGtDK,KAAM,SAASV,EAAMI,EAAUC,GAC/B,cAWA,SAAUD,EAAUC,GAElB,GAAIM,GAA6BP,EAASQ,kBA8H1C,OAxHAR,GAASQ,mBAAqB,SAASR,EAAUC,GAG/C,GAAIQ,GAAY,SAASC,GACvBJ,KAAKK,UACLL,KAAKM,iBACLN,KAAKO,kBACLP,KAAKQ,gBACLb,EAAEc,KAAKL,EAAOJ,KAAKU,IAAKV,MAI1BL,GAAEgB,OAAOR,EAAUS,WAKjBF,IAAK,SAASG,EAAMC,GAClB,GAAIC,GAAUF,EAAKG,GAYnB,OAVAhB,MAAKK,OAAOU,GAAWF,EAEnBA,EAAKI,QACPjB,KAAKM,cAAcO,EAAKI,MAAMD,KAAOD,GAGnCD,IACFd,KAAKO,eAAeO,GAAeC,GAErCf,KAAKQ,gBACER,MAITkB,YAAa,SAASD,GACpB,MAAOj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,gBAC5Ble,EAAE2S,YAAY0M,IAAO,EAAOA,GAGjCrf,EAAE6D,SAASmb,IACbK,EAAML,EAAId,gBACHle,EAAE2S,YAAY0M,IAAO,EAAOA,IAG9B,GAGTH,WAAY,SAASF,GACnB,OAAIhf,EAAEwC,WAAWwc,IAAUA,EAAI/d,oBAAqBhB,GAAWyd,OAI3D1d,EAAE6D,SAASmb,GACNA,EAAInf,OAGN,KAPEmf,GAUXI,oBAAqB,SAASP,EAAcze,EAAQ8d,GAClD9d,EAAO8d,gBAAkB9d,EAAO8d,iBAAmBA,EAE9C9d,EAAO8d,kBAAqB9d,EAAOkf,8BAIxClf,EAAOkf,6BAA8B,EAErCT,EAAa1B,eAAe,SAASha,GAC/B/C,EAAO8d,iBACT9d,EAAOid,MAAMla,SAOdlD"} \ No newline at end of file diff --git a/lib/backbone.marionette.min.js b/lib/backbone.marionette.min.js index 874319c569..871c2d52db 100644 --- a/lib/backbone.marionette.min.js +++ b/lib/backbone.marionette.min.js @@ -1,6 +1,6 @@ // MarionetteJS (Backbone.Marionette) // ---------------------------------- -// v2.1.0 +// v2.2.0 // // Copyright (c)2014 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license @@ -18,6 +18,6 @@ -!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(c,d){return a.Marionette=b(a,c,d)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(a,c,d)}else a.Marionette=b(a,a.Backbone,a._)}(this,function(a,b,c){"use strict";function d(a,b){var c=new Error(a);throw c.name=b||"Error",c}!function(a,b){var c=a.ChildViewContainer;return a.ChildViewContainer=function(a,b){var c=function(a){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),b.each(a,this.add,this)};b.extend(c.prototype,{add:function(a,b){var c=a.cid;return this._views[c]=a,a.model&&(this._indexByModel[a.model.cid]=c),b&&(this._indexByCustom[b]=c),this._updateLength(),this},findByModel:function(a){return this.findByModelCid(a.cid)},findByModelCid:function(a){var b=this._indexByModel[a];return this.findByCid(b)},findByCustom:function(a){var b=this._indexByCustom[a];return this.findByCid(b)},findByIndex:function(a){return b.values(this._views)[a]},findByCid:function(a){return this._views[a]},remove:function(a){var c=a.cid;return a.model&&delete this._indexByModel[a.model.cid],b.any(this._indexByCustom,function(a,b){return a===c?(delete this._indexByCustom[b],!0):void 0},this),delete this._views[c],this._updateLength(),this},call:function(a){this.apply(a,b.tail(arguments))},apply:function(a,c){b.each(this._views,function(d){b.isFunction(d[a])&&d[a].apply(d,c||[])})},_updateLength:function(){this.length=b.size(this._views)}});var d=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return b.each(d,function(a){c.prototype[a]=function(){var c=b.values(this._views),d=[c].concat(b.toArray(arguments));return b[a].apply(b,d)}}),c}(a,b),a.ChildViewContainer.VERSION="0.1.4",a.ChildViewContainer.noConflict=function(){return a.ChildViewContainer=c,this},a.ChildViewContainer}(b,c),function(a,b){var c=a.Wreqr,d=a.Wreqr={};return a.Wreqr.VERSION="1.3.1",a.Wreqr.noConflict=function(){return a.Wreqr=c,this},d.Handlers=function(a,b){var c=function(a){this.options=a,this._wreqrHandlers={},b.isFunction(this.initialize)&&this.initialize(a)};return c.extend=a.Model.extend,b.extend(c.prototype,a.Events,{setHandlers:function(a){b.each(a,function(a,c){var d=null;b.isObject(a)&&!b.isFunction(a)&&(d=a.context,a=a.callback),this.setHandler(c,a,d)},this)},setHandler:function(a,b,c){var d={callback:b,context:c};this._wreqrHandlers[a]=d,this.trigger("handler:add",a,b,c)},hasHandler:function(a){return!!this._wreqrHandlers[a]},getHandler:function(a){var b=this._wreqrHandlers[a];if(b)return function(){var a=Array.prototype.slice.apply(arguments);return b.callback.apply(b.context,a)}},removeHandler:function(a){delete this._wreqrHandlers[a]},removeAllHandlers:function(){this._wreqrHandlers={}}}),c}(a,b),d.CommandStorage=function(){var c=function(a){this.options=a,this._commands={},b.isFunction(this.initialize)&&this.initialize(a)};return b.extend(c.prototype,a.Events,{getCommands:function(a){var b=this._commands[a];return b||(b={command:a,instances:[]},this._commands[a]=b),b},addCommand:function(a,b){var c=this.getCommands(a);c.instances.push(b)},clearCommands:function(a){var b=this.getCommands(a);b.instances=[]}}),c}(),d.Commands=function(a){return a.Handlers.extend({storageType:a.CommandStorage,constructor:function(b){this.options=b||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var c=Array.prototype.slice.call(arguments);a.Handlers.prototype.constructor.apply(this,c)},execute:function(a,b){a=arguments[0],b=Array.prototype.slice.call(arguments,1),this.hasHandler(a)?this.getHandler(a).apply(this,b):this.storage.addCommand(a,b)},_executeCommands:function(a,c,d){var e=this.storage.getCommands(a);b.each(e.instances,function(a){c.apply(d,a)}),this.storage.clearCommands(a)},_initializeStorage:function(a){var c,d=a.storageType||this.storageType;c=b.isFunction(d)?new d:d,this.storage=c}})}(d),d.RequestResponse=function(a){return a.Handlers.extend({request:function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1);return this.hasHandler(a)?this.getHandler(a).apply(this,b):void 0}})}(d),d.EventAggregator=function(a,b){var c=function(){};return c.extend=a.Model.extend,b.extend(c.prototype,a.Events),c}(a,b),d.Channel=function(){var c=function(b){this.vent=new a.Wreqr.EventAggregator,this.reqres=new a.Wreqr.RequestResponse,this.commands=new a.Wreqr.Commands,this.channelName=b};return b.extend(c.prototype,{reset:function(){return this.vent.off(),this.vent.stopListening(),this.reqres.removeAllHandlers(),this.commands.removeAllHandlers(),this},connectEvents:function(a,b){return this._connect("vent",a,b),this},connectCommands:function(a,b){return this._connect("commands",a,b),this},connectRequests:function(a,b){return this._connect("reqres",a,b),this},_connect:function(a,c,d){if(c){d=d||this;var e="vent"===a?"on":"setHandler";b.each(c,function(c,f){this[a][e](f,b.bind(c,d))},this)}}}),c}(d),d.radio=function(a){var c=function(){this._channels={},this.vent={},this.commands={},this.reqres={},this._proxyMethods()};b.extend(c.prototype,{channel:function(a){if(!a)throw new Error("Channel must receive a name");return this._getChannel(a)},_getChannel:function(b){var c=this._channels[b];return c||(c=new a.Channel(b),this._channels[b]=c),c},_proxyMethods:function(){b.each(["vent","commands","reqres"],function(a){b.each(d[a],function(b){this[a][b]=e(this,a,b)},this)},this)}});var d={vent:["on","off","trigger","once","stopListening","listenTo","listenToOnce"],commands:["execute","setHandler","setHandlers","removeHandler","removeAllHandlers"],reqres:["request","setHandler","setHandlers","removeHandler","removeAllHandlers"]},e=function(a,b,c){return function(d){var e=a._getChannel(d)[b],f=Array.prototype.slice.call(arguments,1);return e[c].apply(e,f)}};return new c}(d),a.Wreqr}(b,c);var e=a.Marionette,f=b.Marionette={};f.VERSION="2.1.0",f.noConflict=function(){return a.Marionette=e,this},b.Marionette=f,f.Deferred=b.$.Deferred;var g=Array.prototype.slice;return f.extend=b.Model.extend,f.getOption=function(a,b){if(a&&b){var c;return c=a.options&&void 0!==a.options[b]?a.options[b]:a[b]}},f.proxyGetOption=function(a){return f.getOption(this,a)},f.normalizeMethods=function(a){var b={};return c.each(a,function(a,d){c.isFunction(a)||(a=this[a]),a&&(b[d]=a)},this),b},f.normalizeUIKeys=function(a,b){return"undefined"!=typeof a?(c.each(c.keys(a),function(c){var d=/@ui\.[a-zA-Z_$0-9]*/g;c.match(d)&&(a[c.replace(d,function(a){return b[a.slice(4)]})]=a[c],delete a[c])}),a):void 0},f.actAsCollection=function(a,b){var d=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];c.each(d,function(d){a[d]=function(){var a=c.values(c.result(this,b)),e=[a].concat(c.toArray(arguments));return c[d].apply(c,e)}})},f.triggerMethod=function(){function a(a,b,c){return c.toUpperCase()}var b=/(^|:)(\w)/gi,d=function(d){var e,f="on"+d.replace(b,a),g=this[f];return c.isFunction(g)&&(e=g.apply(this,c.tail(arguments))),c.isFunction(this.trigger)&&this.trigger.apply(this,arguments),e};return d}(),f.MonitorDOMRefresh=function(a){function d(a){a._isShown=!0,f(a)}function e(a){a._isRendered=!0,f(a)}function f(a){a._isShown&&a._isRendered&&g(a)&&c.isFunction(a.triggerMethod)&&a.triggerMethod("dom:refresh")}function g(c){return b.$.contains(a,c.el)}return function(a){a.listenTo(a,"show",function(){d(a)}),a.listenTo(a,"render",function(){e(a)})}}(document.documentElement),function(a){function b(a,b,e,f){var g=f.split(/\s+/);c.each(g,function(c){var f=a[c];f||d('Method "'+c+'" was configured as an event handler, but does not exist.'),a.listenTo(b,e,f)})}function e(a,b,c,d){a.listenTo(b,c,d)}function f(a,b,d,e){var f=e.split(/\s+/);c.each(f,function(c){var e=a[c];a.stopListening(b,d,e)})}function g(a,b,c,d){a.stopListening(b,c,d)}function h(a,b,d,e,f){b&&d&&(c.isFunction(d)&&(d=d.call(a)),c.each(d,function(d,g){c.isFunction(d)?e(a,b,g,d):f(a,b,g,d)}))}a.bindEntityEvents=function(a,c,d){h(a,c,d,e,b)},a.unbindEntityEvents=function(a,b,c){h(a,b,c,g,f)},a.proxyBindEntityEvents=function(b,c){return a.bindEntityEvents(this,b,c)},a.proxyUnbindEntityEvents=function(b,c){return a.unbindEntityEvents(this,b,c)}}(f),f.Callbacks=function(){this._deferred=f.Deferred(),this._callbacks=[]},c.extend(f.Callbacks.prototype,{add:function(a,b){var d=c.result(this._deferred,"promise");this._callbacks.push({cb:a,ctx:b}),d.then(function(c){b&&(c.context=b),a.call(c.context,c.options)})},run:function(a,b){this._deferred.resolve({options:a,context:b})},reset:function(){var a=this._callbacks;this._deferred=f.Deferred(),this._callbacks=[],c.each(a,function(a){this.add(a.cb,a.ctx)},this)}}),f.Controller=function(a){this.options=a||{},c.isFunction(this.initialize)&&this.initialize(this.options)},f.Controller.extend=f.extend,c.extend(f.Controller.prototype,b.Events,{destroy:function(){var a=g.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.triggerMethod.apply(this,["destroy"].concat(a)),this.stopListening(),this.off(),this},triggerMethod:f.triggerMethod,getOption:f.proxyGetOption}),f.Object=function(a){this.options=c.extend({},c.result(this,"options"),a),this.initialize(this.options)},f.Object.extend=f.extend,c.extend(f.Object.prototype,{initialize:function(){},destroy:function(){this.triggerMethod("before:destroy"),this.triggerMethod("destroy"),this.stopListening()},triggerMethod:f.triggerMethod,getOption:f.proxyGetOption,bindEntityEvents:f.proxyBindEntityEvents,unbindEntityEvents:f.proxyUnbindEntityEvents}),c.extend(f.Object.prototype,b.Events),f.Region=function(a){if(this.options=a||{},this.el=this.getOption("el"),this.el=this.el instanceof b.$?this.el[0]:this.el,this.el||d('An "el" must be specified for a region.',"NoElError"),this.$el=this.getEl(this.el),this.initialize){var c=g.apply(arguments);this.initialize.apply(this,c)}},c.extend(f.Region,{buildRegion:function(a,b){return c.isString(a)?this._buildRegionFromSelector(a,b):a.selector||a.el||a.regionClass?this._buildRegionFromObject(a,b):c.isFunction(a)?this._buildRegionFromRegionClass(a):void d("Improper region configuration type. Please refer to http://marionettejs.com/docs/marionette.region.html#region-configuration-types")},_buildRegionFromSelector:function(a,b){return new b({el:a})},_buildRegionFromObject:function(a,d){var e=a.regionClass||d,f=c.omit(a,"selector","regionClass");a.selector&&!f.el&&(f.el=a.selector);var g=new e(f);return a.parentEl&&(g.getEl=function(d){if(c.isObject(d))return b.$(d);var e=a.parentEl;return c.isFunction(e)&&(e=e()),e.find(d)}),g},_buildRegionFromRegionClass:function(a){return new a}}),c.extend(f.Region.prototype,b.Events,{show:function(a,b){this._ensureElement();var d=b||{},e=a!==this.currentView,f=!!d.preventDestroy,g=!!d.forceShow,h=!!this.currentView,i=!f&&e;i&&this.empty();var j=e||g;return j?(a.once("destroy",c.bind(this.empty,this)),a.render(),h&&this.triggerMethod("before:swap",a),this.triggerMethod("before:show",a),c.isFunction(a.triggerMethod)?a.triggerMethod("before:show"):this.triggerMethod.call(a,"before:show"),this.attachHtml(a),this.currentView=a,h&&this.triggerMethod("swap",a),this.triggerMethod("show",a),c.isFunction(a.triggerMethod)?a.triggerMethod("show"):this.triggerMethod.call(a,"show"),this):this},_ensureElement:function(){c.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),this.$el&&0!==this.$el.length||d('An "el" '+this.$el.selector+" must exist in DOM")},getEl:function(a){return b.$(a)},attachHtml:function(a){this.el.innerHTML="",this.el.appendChild(a.el)},empty:function(){var a=this.currentView;if(a)return this.triggerMethod("before:empty",a),this._destroyView(),this.triggerMethod("empty",a),delete this.currentView,this},_destroyView:function(){var a=this.currentView;a.destroy&&!a.isDestroyed?a.destroy():a.remove&&a.remove()},attachView:function(a){return this.currentView=a,this},hasView:function(){return!!this.currentView},reset:function(){return this.empty(),this.$el&&(this.el=this.$el.selector),delete this.$el,this},getOption:f.proxyGetOption,triggerMethod:f.triggerMethod}),f.Region.extend=f.extend,f.RegionManager=function(a){var b=a.Controller.extend({constructor:function(b){this._regions={},a.Controller.call(this,b)},addRegions:function(a,b){c.isFunction(a)&&(a=a.apply(this,arguments));var d={};return c.each(a,function(a,e){c.isString(a)&&(a={selector:a}),a.selector&&(a=c.defaults({},a,b));var f=this.addRegion(e,a);d[e]=f},this),d},addRegion:function(b,d){var e,f=c.isObject(d),g=c.isString(d),h=!!d.selector;return e=g||f&&h?a.Region.buildRegion(d,a.Region):c.isFunction(d)?a.Region.buildRegion(d,a.Region):d,this.triggerMethod("before:add:region",b,e),this._store(b,e),this.triggerMethod("add:region",b,e),e},get:function(a){return this._regions[a]},getRegions:function(){return c.clone(this._regions)},removeRegion:function(a){var b=this._regions[a];return this._remove(a,b),b},removeRegions:function(){var a=this.getRegions();return c.each(this._regions,function(a,b){this._remove(b,a)},this),a},emptyRegions:function(){var a=this.getRegions();return c.each(a,function(a){a.empty()},this),a},destroy:function(){return this.removeRegions(),a.Controller.prototype.destroy.apply(this,arguments)},_store:function(a,b){this._regions[a]=b,this._setLength()},_remove:function(a,b){this.triggerMethod("before:remove:region",a,b),b.empty(),b.stopListening(),delete this._regions[a],this._setLength(),this.triggerMethod("remove:region",a,b)},_setLength:function(){this.length=c.size(this._regions)}});return a.actAsCollection(b.prototype,"_regions"),b}(f),f.TemplateCache=function(a){this.templateId=a},c.extend(f.TemplateCache,{templateCaches:{},get:function(a){var b=this.templateCaches[a];return b||(b=new f.TemplateCache(a),this.templateCaches[a]=b),b.load()},clear:function(){var a,b=g.call(arguments),c=b.length;if(c>0)for(a=0;c>a;a++)delete this.templateCaches[b[a]];else this.templateCaches={}}}),c.extend(f.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var a=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(a),this.compiledTemplate},loadTemplate:function(a){var c=b.$(a).html();return c&&0!==c.length||d('Could not find template: "'+a+'"',"NoTemplateError"),c},compileTemplate:function(a){return c.template(a)}}),f.Renderer={render:function(a,b){a||d("Cannot render the template since its false, null or undefined.","TemplateNotFoundError");var c;return(c="function"==typeof a?a:f.TemplateCache.get(a))(b)}},f.View=b.View.extend({constructor:function(a){c.bindAll(this,"render"),this.options=c.extend({},c.result(this,"options"),c.isFunction(a)?a.call(this):a),this.events=this.normalizeUIKeys(c.result(this,"events")),c.isObject(this.behaviors)&&new f.Behaviors(this),b.View.apply(this,arguments),f.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled)},getTemplate:function(){return this.getOption("template")},serializeModel:function(a){return a.toJSON.apply(a,g.call(arguments,1))},mixinTemplateHelpers:function(a){a=a||{};var b=this.getOption("templateHelpers");return c.isFunction(b)&&(b=b.call(this)),c.extend(a,b)},normalizeUIKeys:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return f.normalizeUIKeys(a,d||b)},configureTriggers:function(){if(this.triggers){var a={},b=this.normalizeUIKeys(c.result(this,"triggers"));return c.each(b,function(b,d){var e=c.isObject(b),f=e?b.event:b;a[d]=function(a){if(a){var c=a.preventDefault,d=a.stopPropagation,g=e?b.preventDefault:c,h=e?b.stopPropagation:d;g&&c&&c.apply(a),h&&d&&d.apply(a)}var i={view:this,model:this.model,collection:this.collection};this.triggerMethod(f,i)}},this),a}},delegateEvents:function(a){return this._delegateDOMEvents(a),this.bindEntityEvents(this.model,this.getOption("modelEvents")),this.bindEntityEvents(this.collection,this.getOption("collectionEvents")),this},_delegateDOMEvents:function(a){a=a||this.events,c.isFunction(a)&&(a=a.call(this)),a=this.normalizeUIKeys(a);var d={},e=c.result(this,"behaviorEvents")||{},f=this.configureTriggers();c.extend(d,e,a,f),b.View.prototype.delegateEvents.call(this,d)},undelegateEvents:function(){var a=g.call(arguments);return b.View.prototype.undelegateEvents.apply(this,a),this.unbindEntityEvents(this.model,this.getOption("modelEvents")),this.unbindEntityEvents(this.collection,this.getOption("collectionEvents")),this},onShowCalled:function(){},_ensureViewIsIntact:function(){if(this.isDestroyed){var a=new Error("Cannot use a view thats already been destroyed.");throw a.name="ViewDestroyedError",a}},destroy:function(){if(!this.isDestroyed){var a=g.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.isDestroyed=!0,this.triggerMethod.apply(this,["destroy"].concat(a)),this.unbindUIElements(),this.remove(),this}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var a=c.result(this,"_uiBindings");this.ui={},c.each(c.keys(a),function(b){var c=a[b];this.ui[b]=this.$(c)},this)}},unbindUIElements:function(){this.ui&&this._uiBindings&&(c.each(this.ui,function(a,b){delete this.ui[b]},this),this.ui=this._uiBindings,delete this._uiBindings)},triggerMethod:f.triggerMethod,normalizeMethods:f.normalizeMethods,getOption:f.proxyGetOption,bindEntityEvents:f.proxyBindEntityEvents,unbindEntityEvents:f.proxyUnbindEntityEvents}),f.ItemView=f.View.extend({constructor:function(){f.View.apply(this,arguments)},serializeData:function(){var a={};return this.model?a=c.partial(this.serializeModel,this.model).apply(this,arguments):this.collection&&(a={items:c.partial(this.serializeCollection,this.collection).apply(this,arguments)}),a},serializeCollection:function(a){return a.toJSON.apply(a,g.call(arguments,1))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.triggerMethod("render",this),this},_renderTemplate:function(){var a=this.getTemplate();if(a!==!1){a||d("Cannot render the template since it is null or undefined.","UndefinedTemplateError");var b=this.serializeData();b=this.mixinTemplateHelpers(b);var c=f.Renderer.render(a,b,this);return this.attachElContent(c),this}},attachElContent:function(a){return this.$el.html(a),this},destroy:function(){return this.isDestroyed?void 0:f.View.prototype.destroy.apply(this,arguments)}}),f.CollectionView=f.View.extend({childViewEventPrefix:"childview",constructor:function(a){var b=a||{};this.sort=c.isUndefined(b.sort)?!0:b.sort,this._initChildViewStorage(),f.View.apply(this,arguments),this._initialEvents(),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this._triggerBeforeShowBufferedChildren(),this.attachBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerBeforeShowBufferedChildren:function(){this._isShown&&c.invoke(this._bufferedChildren,"triggerMethod","before:show")},_triggerShowBufferedChildren:function(){this._isShown&&(c.each(this._bufferedChildren,function(a){c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")}),this._bufferedChildren=[])},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(a){this.destroyEmptyView();var b=this.getChildView(a),c=this.collection.indexOf(a);this.addChild(a,b,c)},_onCollectionRemove:function(a){var b=this.children.findByModel(a);this.removeChildView(b),this.checkEmpty()},onShowCalled:function(){this.children.each(function(a){c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")})},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this.triggerMethod("render",this),this},resortView:function(){this.render()},_sortViews:function(){var a=this.collection.find(function(a,b){var c=this.children.findByModel(a);return!c||c._index!==b},this);a&&this.resortView()},_renderChildren:function(){this.destroyEmptyView(),this.destroyChildren(),this.isEmpty(this.collection)?this.showEmptyView():(this.triggerMethod("before:render:collection",this),this.startBuffering(),this.showCollection(),this.endBuffering(),this.triggerMethod("render:collection",this))},showCollection:function(){var a;this.collection.each(function(b,c){a=this.getChildView(b),this.addChild(b,a,c)},this)},showEmptyView:function(){var a=this.getEmptyView();if(a&&!this._showingEmptyView){this.triggerMethod("before:render:empty"),this._showingEmptyView=!0;var c=new b.Model;this.addEmptyView(c,a),this.triggerMethod("render:empty")}},destroyEmptyView:function(){this._showingEmptyView&&(this.destroyChildren(),delete this._showingEmptyView)},getEmptyView:function(){return this.getOption("emptyView")},addEmptyView:function(a,b){var d=this.getOption("emptyViewOptions")||this.getOption("childViewOptions");c.isFunction(d)&&(d=d.call(this));var e=this.buildChildView(a,b,d);this._isShown&&this.triggerMethod.call(e,"before:show"),this.children.add(e),this.renderChildView(e,-1),this._isShown&&this.triggerMethod.call(e,"show")},getChildView:function(){var a=this.getOption("childView");return a||d('A "childView" must be specified',"NoChildViewError"),a},addChild:function(a,b,d){var e=this.getOption("childViewOptions");c.isFunction(e)&&(e=e.call(this,a,d));var f=this.buildChildView(a,b,e);return this._updateIndices(f,!0,d),this._addChildView(f,d),f},_updateIndices:function(a,b,c){this.sort&&(b?(a._index=c,this.children.each(function(b){b._index>=a._index&&b._index++})):this.children.each(function(b){b._index>=a._index&&b._index--}))},_addChildView:function(a,b){this.proxyChildEvents(a),this.triggerMethod("before:add:child",a),this.children.add(a),this.renderChildView(a,b),this._isShown&&!this.isBuffering&&(c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")),this.triggerMethod("add:child",a)},renderChildView:function(a,b){return a.render(),this.attachHtml(this,a,b),a},buildChildView:function(a,b,d){var e=c.extend({model:a},d);return new b(e)},removeChildView:function(a){return a&&(this.triggerMethod("before:remove:child",a),a.destroy?a.destroy():a.remove&&a.remove(),this.stopListening(a),this.children.remove(a),this.triggerMethod("remove:child",a),this._updateIndices(a,!1)),a},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},attachBuffer:function(a,b){a.$el.append(b)},attachHtml:function(a,b,c){a.isBuffering?(a.elBuffer.appendChild(b.el),a._bufferedChildren.push(b)):a._insertBefore(b,c)||a._insertAfter(b)},_insertBefore:function(a,b){var c,d=this.sort&&b0)for(a=0;c>a;a++)delete this.templateCaches[b[a]];else this.templateCaches={}}}),c.extend(e.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var a=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(a),this.compiledTemplate},loadTemplate:function(a){var c=b.$(a).html();if(!c||0===c.length)throw new e.Error({name:"NoTemplateError",message:'Could not find template: "'+a+'"'});return c},compileTemplate:function(a){return c.template(a)}}),e.Renderer={render:function(a,b){if(!a)throw new e.Error({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var c;return(c="function"==typeof a?a:e.TemplateCache.get(a))(b)}},e.View=b.View.extend({constructor:function(a){c.bindAll(this,"render"),this.options=c.extend({},c.result(this,"options"),c.isFunction(a)?a.call(this):a),this._behaviors=e.Behaviors(this),b.View.apply(this,arguments),e.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled)},getTemplate:function(){return this.getOption("template")},serializeModel:function(a){return a.toJSON.apply(a,f.call(arguments,1))},mixinTemplateHelpers:function(a){a=a||{};var b=this.getOption("templateHelpers");return c.isFunction(b)&&(b=b.call(this)),c.extend(a,b)},normalizeUIKeys:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return e.normalizeUIKeys(a,d||b)},normalizeUIValues:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return e.normalizeUIValues(a,d||b)},configureTriggers:function(){if(this.triggers){var a={},b=this.normalizeUIKeys(c.result(this,"triggers"));return c.each(b,function(b,c){a[c]=this._buildViewTrigger(b)},this),a}},delegateEvents:function(a){return this._delegateDOMEvents(a),this.bindEntityEvents(this.model,this.getOption("modelEvents")),this.bindEntityEvents(this.collection,this.getOption("collectionEvents")),c.each(this._behaviors,function(a){a.bindEntityEvents(this.model,a.getOption("modelEvents")),a.bindEntityEvents(this.collection,a.getOption("collectionEvents"))},this),this},_delegateDOMEvents:function(a){var d=a||this.events;c.isFunction(d)&&(d=d.call(this)),d=this.normalizeUIKeys(d),c.isUndefined(a)&&(this.events=d);var e={},f=c.result(this,"behaviorEvents")||{},g=this.configureTriggers(),h=c.result(this,"behaviorTriggers")||{};c.extend(e,f,d,g,h),b.View.prototype.delegateEvents.call(this,e)},undelegateEvents:function(){var a=f.call(arguments);return b.View.prototype.undelegateEvents.apply(this,a),this.unbindEntityEvents(this.model,this.getOption("modelEvents")),this.unbindEntityEvents(this.collection,this.getOption("collectionEvents")),c.each(this._behaviors,function(a){a.unbindEntityEvents(this.model,a.getOption("modelEvents")),a.unbindEntityEvents(this.collection,a.getOption("collectionEvents"))},this),this},onShowCalled:function(){},_ensureViewIsIntact:function(){if(this.isDestroyed)throw new e.Error({name:"ViewDestroyedError",message:'View (cid: "'+this.cid+'") has already been destroyed and cannot be used.'})},destroy:function(){if(!this.isDestroyed){var a=f.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.isDestroyed=!0,this.triggerMethod.apply(this,["destroy"].concat(a)),this.unbindUIElements(),this.remove(),c.invoke(this._behaviors,"destroy",a),this}},bindUIElements:function(){this._bindUIElements(),c.invoke(this._behaviors,this._bindUIElements)},_bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var a=c.result(this,"_uiBindings");this.ui={},c.each(c.keys(a),function(b){var c=a[b];this.ui[b]=this.$(c)},this)}},unbindUIElements:function(){this._unbindUIElements(),c.invoke(this._behaviors,this._unbindUIElements)},_unbindUIElements:function(){this.ui&&this._uiBindings&&(c.each(this.ui,function(a,b){delete this.ui[b]},this),this.ui=this._uiBindings,delete this._uiBindings)},_buildViewTrigger:function(a){var b=c.isObject(a),d=c.defaults({},b?a:{},{preventDefault:!0,stopPropagation:!0}),e=b?d.event:a;return function(a){a&&(a.preventDefault&&d.preventDefault&&a.preventDefault(),a.stopPropagation&&d.stopPropagation&&a.stopPropagation());var b={view:this,model:this.model,collection:this.collection};this.triggerMethod(e,b)}},setElement:function(){var a=b.View.prototype.setElement.apply(this,arguments);return c.invoke(this._behaviors,"proxyViewProperties",this),a},triggerMethod:function(){var a=arguments,b=e.triggerMethod,d=b.apply(this,a);return c.each(this._behaviors,function(c){b.apply(c,a)}),d},normalizeMethods:e.normalizeMethods,getOption:e.proxyGetOption,bindEntityEvents:e.proxyBindEntityEvents,unbindEntityEvents:e.proxyUnbindEntityEvents}),e.ItemView=e.View.extend({constructor:function(){e.View.apply(this,arguments)},serializeData:function(){var a={};return this.model?a=c.partial(this.serializeModel,this.model).apply(this,arguments):this.collection&&(a={items:c.partial(this.serializeCollection,this.collection).apply(this,arguments)}),a},serializeCollection:function(a){return a.toJSON.apply(a,f.call(arguments,1))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.triggerMethod("render",this),this},_renderTemplate:function(){var a=this.getTemplate();if(a!==!1){if(!a)throw new e.Error({name:"UndefinedTemplateError",message:"Cannot render the template since it is null or undefined."});var b=this.serializeData();b=this.mixinTemplateHelpers(b);var c=e.Renderer.render(a,b,this);return this.attachElContent(c),this}},attachElContent:function(a){return this.$el.html(a),this},destroy:function(){return this.isDestroyed?void 0:e.View.prototype.destroy.apply(this,arguments)}}),e.CollectionView=e.View.extend({childViewEventPrefix:"childview",constructor:function(a){var d=a||{};if(this.sort=c.isUndefined(d.sort)?!0:d.sort,d.collection&&!(d.collection instanceof b.Collection))throw new e.Error("The Collection option passed to this view needs to be an instance of a Backbone.Collection");this.once("render",this._initialEvents),this._initChildViewStorage(),e.View.apply(this,arguments),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this._triggerBeforeShowBufferedChildren(),this.attachBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerBeforeShowBufferedChildren:function(){this._isShown&&c.each(this._bufferedChildren,c.partial(this._triggerMethodOnChild,"before:show"))},_triggerShowBufferedChildren:function(){this._isShown&&(c.each(this._bufferedChildren,c.partial(this._triggerMethodOnChild,"show")),this._bufferedChildren=[])},_triggerMethodOnChild:function(a,b){e.triggerMethodOn(b,a)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(a){this.destroyEmptyView();var b=this.getChildView(a),c=this.collection.indexOf(a);this.addChild(a,b,c)},_onCollectionRemove:function(a){var b=this.children.findByModel(a);this.removeChildView(b),this.checkEmpty()},onShowCalled:function(){this.children.each(c.partial(this._triggerMethodOnChild,"show"))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this.triggerMethod("render",this),this},resortView:function(){this.render()},_sortViews:function(){var a=this.collection.find(function(a,b){var c=this.children.findByModel(a);return!c||c._index!==b},this);a&&this.resortView()},_renderChildren:function(){this.destroyEmptyView(),this.destroyChildren(),this.isEmpty(this.collection)?this.showEmptyView():(this.triggerMethod("before:render:collection",this),this.startBuffering(),this.showCollection(),this.endBuffering(),this.triggerMethod("render:collection",this))},showCollection:function(){var a;this.collection.each(function(b,c){a=this.getChildView(b),this.addChild(b,a,c)},this)},showEmptyView:function(){var a=this.getEmptyView();if(a&&!this._showingEmptyView){this.triggerMethod("before:render:empty"),this._showingEmptyView=!0;var c=new b.Model;this.addEmptyView(c,a),this.triggerMethod("render:empty")}},destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty"),this.destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty"))},getEmptyView:function(){return this.getOption("emptyView")},addEmptyView:function(a,b){var d=this.getOption("emptyViewOptions")||this.getOption("childViewOptions");c.isFunction(d)&&(d=d.call(this));var f=this.buildChildView(a,b,d);this.proxyChildEvents(f),this._isShown&&e.triggerMethodOn(f,"before:show"),this.children.add(f),this.renderChildView(f,-1),this._isShown&&e.triggerMethodOn(f,"show")},getChildView:function(){var a=this.getOption("childView");if(!a)throw new e.Error({name:"NoChildViewError",message:'A "childView" must be specified'});return a},addChild:function(a,b,d){var e=this.getOption("childViewOptions");c.isFunction(e)&&(e=e.call(this,a,d));var f=this.buildChildView(a,b,e);return this._updateIndices(f,!0,d),this._addChildView(f,d),f},_updateIndices:function(a,b,c){this.sort&&(b?(a._index=c,this.children.each(function(b){b._index>=a._index&&b._index++})):this.children.each(function(b){b._index>=a._index&&b._index--}))},_addChildView:function(a,b){this.proxyChildEvents(a),this.triggerMethod("before:add:child",a),this.children.add(a),this.renderChildView(a,b),this._isShown&&!this.isBuffering&&e.triggerMethodOn(a,"show"),this.triggerMethod("add:child",a)},renderChildView:function(a,b){return a.render(),this.attachHtml(this,a,b),a},buildChildView:function(a,b,d){var e=c.extend({model:a},d);return new b(e)},removeChildView:function(a){return a&&(this.triggerMethod("before:remove:child",a),a.destroy?a.destroy():a.remove&&a.remove(),this.stopListening(a),this.children.remove(a),this.triggerMethod("remove:child",a),this._updateIndices(a,!1)),a},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},attachBuffer:function(a,b){a.$el.append(b)},attachHtml:function(a,b,c){a.isBuffering?(a.elBuffer.appendChild(b.el),a._bufferedChildren.push(b)):a._insertBefore(b,c)||a._insertAfter(b)},_insertBefore:function(a,b){var c,d=this.sort&&bfunction references/names to a hash of events=>function references @@ -1336,8 +1475,10 @@ } if (!template) { - throwError('Cannot render the template since it is null or undefined.', - 'UndefinedTemplateError'); + throw new Marionette.Error({ + name: 'UndefinedTemplateError', + message: 'Cannot render the template since it is null or undefined.' + }); } // Add in entity data and template helpers @@ -1352,7 +1493,7 @@ }, // Attaches the content of a given view. - // This method can be overriden to optimize rendering, + // This method can be overridden to optimize rendering, // or to render in a non standard way. // // For example, using `innerHTML` instead of `$el.html` @@ -1379,6 +1520,7 @@ }); /* jshint maxstatements: 14 */ + /* jshint maxlen: 200 */ // Collection View // --------------- @@ -1399,11 +1541,16 @@ var initOptions = options || {}; this.sort = _.isUndefined(initOptions.sort) ? true : initOptions.sort; + if (initOptions.collection && !(initOptions.collection instanceof Backbone.Collection)) { + throw new Marionette.Error('The Collection option passed to this view needs to be an instance of a Backbone.Collection'); + } + + this.once('render', this._initialEvents); + this._initChildViewStorage(); Marionette.View.apply(this, arguments); - this._initialEvents(); this.initRenderBuffer(); }, @@ -1430,23 +1577,24 @@ _triggerBeforeShowBufferedChildren: function() { if (this._isShown) { - _.invoke(this._bufferedChildren, 'triggerMethod', 'before:show'); + _.each(this._bufferedChildren, _.partial(this._triggerMethodOnChild, 'before:show')); } }, _triggerShowBufferedChildren: function() { if (this._isShown) { - _.each(this._bufferedChildren, function (child) { - if (_.isFunction(child.triggerMethod)) { - child.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(child, 'show'); - } - }); + _.each(this._bufferedChildren, _.partial(this._triggerMethodOnChild, 'show')); + this._bufferedChildren = []; } }, + // Internal method for _.each loops to call `Marionette.triggerMethodOn` on + // a child view + _triggerMethodOnChild: function(event, childView) { + Marionette.triggerMethodOn(childView, event); + }, + // Configured the initial events that the collection view // binds to. _initialEvents: function() { @@ -1477,14 +1625,8 @@ }, // Override from `Marionette.View` to trigger show on child views - onShowCalled: function(){ - this.children.each(function(child){ - if (_.isFunction(child.triggerMethod)) { - child.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(child, 'show'); - } - }); + onShowCalled: function() { + this.children.each(_.partial(this._triggerMethodOnChild, 'show')); }, // Render children views. Override this method to @@ -1568,8 +1710,12 @@ // rendered empty, and then a child is added to the collection. destroyEmptyView: function() { if (this._showingEmptyView) { + this.triggerMethod('before:remove:empty'); + this.destroyChildren(); delete this._showingEmptyView; + + this.triggerMethod('remove:empty'); } }, @@ -1581,7 +1727,7 @@ // Render and show the emptyView. Similar to addChild method // but "child:added" events are not fired, and the event from // emptyView are not forwarded - addEmptyView: function(child, EmptyView){ + addEmptyView: function(child, EmptyView) { // get the emptyViewOptions, falling back to childViewOptions var emptyViewOptions = this.getOption('emptyViewOptions') || @@ -1594,10 +1740,13 @@ // build the empty view var view = this.buildChildView(child, EmptyView, emptyViewOptions); + // Proxy emptyView events + this.proxyChildEvents(view); + // trigger the 'before:show' event on `view` if the collection view // has already been shown - if (this._isShown){ - this.triggerMethod.call(view, 'before:show'); + if (this._isShown) { + Marionette.triggerMethodOn(view, 'before:show'); } // Store the `emptyView` like a `childView` so we can properly @@ -1609,8 +1758,8 @@ // call the 'show' method if the collection view // has already been shown - if (this._isShown){ - this.triggerMethod.call(view, 'show'); + if (this._isShown) { + Marionette.triggerMethodOn(view, 'show'); } }, @@ -1624,7 +1773,10 @@ var childView = this.getOption('childView'); if (!childView) { - throwError('A "childView" must be specified', 'NoChildViewError'); + throw new Marionette.Error({ + name: 'NoChildViewError', + message: 'A "childView" must be specified' + }); } return childView; @@ -1692,12 +1844,8 @@ this.children.add(view); this.renderChildView(view, index); - if (this._isShown && !this.isBuffering){ - if (_.isFunction(view.triggerMethod)) { - view.triggerMethod('show'); - } else { - Marionette.triggerMethod.call(view, 'show'); - } + if (this._isShown && !this.isBuffering) { + Marionette.triggerMethodOn(view, 'show'); } this.triggerMethod('add:child', view); @@ -1740,7 +1888,7 @@ }, // check if the collection is empty - isEmpty: function(collection) { + isEmpty: function() { return !this.collection || this.collection.length === 0; }, @@ -1879,18 +2027,16 @@ // Bind only after composite view is rendered to avoid adding child views // to nonexistent childViewContainer - this.once('render', function() { - if (this.collection) { - this.listenTo(this.collection, 'add', this._onCollectionAdd); - this.listenTo(this.collection, 'remove', this._onCollectionRemove); - this.listenTo(this.collection, 'reset', this._renderChildren); - - if (this.sort) { - this.listenTo(this.collection, 'sort', this._sortViews); - } - } - }); + if (this.collection) { + this.listenTo(this.collection, 'add', this._onCollectionAdd); + this.listenTo(this.collection, 'remove', this._onCollectionRemove); + this.listenTo(this.collection, 'reset', this._renderChildren); + + if (this.sort) { + this.listenTo(this.collection, 'sort', this._sortViews); + } + } }, // Retrieve the `childView` to be used when rendering each of @@ -1901,7 +2047,10 @@ var childView = this.getOption('childView') || this.constructor; if (!childView) { - throwError('A "childView" must be specified', 'NoChildViewError'); + throw new Marionette.Error({ + name: 'NoChildViewError', + message: 'A "childView" must be specified' + }); } return childView; @@ -1964,7 +2113,7 @@ }, // Attaches the content of the root. - // This method can be overriden to optimize rendering, + // This method can be overridden to optimize rendering, // or to render in a non standard way. // // For example, using `innerHTML` instead of `$el.html` @@ -2015,8 +2164,10 @@ } if (container.length <= 0) { - throwError('The specified "childViewContainer" was not found: ' + - containerView.childViewContainer, 'ChildViewContainerMissingError'); + throw new Marionette.Error({ + name: 'ChildViewContainerMissingError', + message: 'The specified "childViewContainer" was not found: ' + containerView.childViewContainer + }); } } else { @@ -2153,6 +2304,10 @@ _.extend(regions, regionOptions); + // Normalize region selectors hash to allow + // a user to use the @ui. syntax. + regions = this.normalizeUIValues(regions); + this.addRegions(regions); }, @@ -2165,8 +2320,8 @@ }); }, - // Enable easy overiding of the default `RegionManager` - // for customized region interactions and buisness specific + // Enable easy overriding of the default `RegionManager` + // for customized region interactions and business specific // view logic for better control over single regions. getRegionManager: function() { return new Marionette.RegionManager(); @@ -2236,6 +2391,11 @@ this.stopListening(); }, + proxyViewProperties: function (view) { + this.$el = view.$el; + this.el = view.el; + }, + // import the `triggerMethod` to trigger events with corresponding // methods if the method exists triggerMethod: Marionette.triggerMethod, @@ -2252,19 +2412,19 @@ // Borrow Backbones extend implementation // this allows us to setup a proper - // inheritence pattern that follow in suite + // inheritance pattern that follows suit // with the rest of Marionette views. Behavior.extend = Marionette.extend; return Behavior; })(_, Backbone); - /* jshint maxlen: 143, nonew: false */ + /* jshint maxlen: 143 */ // Marionette.Behaviors // -------- // Behaviors is a utility class that takes care of - // glueing your behavior instances to their given View. + // gluing your behavior instances to their given View. // The most important part of this class is that you // **MUST** override the class level behaviorsLookup // method for things to work properly. @@ -2272,6 +2432,11 @@ Marionette.Behaviors = (function(Marionette, _) { function Behaviors(view, behaviors) { + + if (!_.isObject(view.behaviors)) { + return {}; + } + // Behaviors defined on a view can be a flat object literal // or it can be a function that returns an object. behaviors = Behaviors.parseBehaviors(view, behaviors || _.result(view, 'behaviors')); @@ -2280,76 +2445,13 @@ // calling the methods first on each behavior // and then eventually calling the method on the view. Behaviors.wrap(view, behaviors, _.keys(methods)); + return behaviors; } var methods = { - setElement: function(setElement, behaviors) { - setElement.apply(this, _.tail(arguments, 2)); - - // proxy behavior $el to the view's $el. - // This is needed because a view's $el proxy - // is not set until after setElement is called. - _.each(behaviors, function(b) { - b.$el = this.$el; - b.el = this.el; - }, this); - - return this; - }, - - destroy: function(destroy, behaviors) { - var args = _.tail(arguments, 2); - destroy.apply(this, args); - - // Call destroy on each behavior after - // destroying the view. - // This unbinds event listeners - // that behaviors have registerd for. - _.invoke(behaviors, 'destroy', args); - return this; - }, - - bindUIElements: function(bindUIElements, behaviors) { - bindUIElements.apply(this); - _.invoke(behaviors, bindUIElements); - }, - - unbindUIElements: function(unbindUIElements, behaviors) { - unbindUIElements.apply(this); - _.invoke(behaviors, unbindUIElements); - }, - - triggerMethod: function(triggerMethod, behaviors) { - var args = _.tail(arguments, 2); - triggerMethod.apply(this, args); - - _.each(behaviors, function(b) { - triggerMethod.apply(b, args); - }); - }, - - delegateEvents: function(delegateEvents, behaviors) { - var args = _.tail(arguments, 2); - delegateEvents.apply(this, args); - - _.each(behaviors, function(b) { - Marionette.bindEntityEvents(b, this.model, Marionette.getOption(b, 'modelEvents')); - Marionette.bindEntityEvents(b, this.collection, Marionette.getOption(b, 'collectionEvents')); - }, this); - - return this; - }, - - undelegateEvents: function(undelegateEvents, behaviors) { - var args = _.tail(arguments, 2); - undelegateEvents.apply(this, args); - - _.each(behaviors, function(b) { - Marionette.unbindEntityEvents(b, this.model, Marionette.getOption(b, 'modelEvents')); - Marionette.unbindEntityEvents(b, this.collection, Marionette.getOption(b, 'collectionEvents')); - }, this); - - return this; + behaviorTriggers: function(behaviorTriggers, behaviors) { + var triggerBuilder = new BehaviorTriggersBuilder(this, behaviors); + return triggerBuilder.buildBehaviorTriggers(); }, behaviorEvents: function(behaviorEvents, behaviors) { @@ -2404,9 +2506,10 @@ // } // ``` behaviorsLookup: function() { - throw new Error('You must define where your behaviors are stored.' + - 'See https://github.com/marionettejs/backbone.marionette' + - '/blob/master/docs/marionette.behaviors.md#behaviorslookup'); + throw new Marionette.Error({ + message: 'You must define where your behaviors are stored.', + url: 'marionette.behaviors.html#behaviorslookup' + }); }, // Takes care of getting the behavior class @@ -2448,6 +2551,44 @@ } }); + // Class to build handlers for `triggers` on behaviors + // for views + function BehaviorTriggersBuilder(view, behaviors) { + this._view = view; + this._viewUI = _.result(view, 'ui'); + this._behaviors = behaviors; + this._triggers = {}; + } + + _.extend(BehaviorTriggersBuilder.prototype, { + // Main method to build the triggers hash with event keys and handlers + buildBehaviorTriggers: function() { + _.each(this._behaviors, this._buildTriggerHandlersForBehavior, this); + return this._triggers; + }, + + // Internal method to build all trigger handlers for a given behavior + _buildTriggerHandlersForBehavior: function(behavior, i) { + var ui = _.extend({}, this._viewUI, _.result(behavior, 'ui')); + var triggersHash = _.clone(_.result(behavior, 'triggers')) || {}; + + triggersHash = Marionette.normalizeUIKeys(triggersHash, ui); + + _.each(triggersHash, _.partial(this._setHandlerForBehavior, behavior, i), this); + }, + + // Internal method to create and assign the trigger handler for a given + // behavior + _setHandlerForBehavior: function(behavior, i, eventName, trigger) { + // Unique identifier for the `this._triggers` hash + var triggerKey = trigger.replace(/^\S+/, function(triggerName) { + return triggerName + '.' + 'behaviortriggers' + i; + }); + + this._triggers[triggerKey] = this._view._buildViewTrigger(eventName); + } + }); + return Behaviors; })(Marionette, _); @@ -2524,7 +2665,7 @@ var method = controller[methodName]; if (!method) { - throwError('Method "' + methodName + '" was not found on the controller'); + throw new Marionette.Error('Method "' + methodName + '" was not found on the controller'); } this.route(route, methodName, _.bind(method, controller)); @@ -2541,14 +2682,20 @@ // Stores and starts up `Region` objects, includes an // event aggregator as `app.vent` Marionette.Application = function(options) { + this.options = options; this._initializeRegions(options); this._initCallbacks = new Marionette.Callbacks(); this.submodules = {}; _.extend(this, options); this._initChannel(); + this.initialize.apply(this, arguments); }; _.extend(Marionette.Application.prototype, Backbone.Events, { + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function() {}, + // Command execution, facilitated by Backbone.Wreqr.Commands execute: function() { this.commands.execute.apply(this.commands, arguments); @@ -2718,9 +2865,6 @@ // within a module. this.app = app; - // By default modules start with their parents. - this.startWithParent = true; - if (_.isFunction(this.initialize)) { this.initialize(moduleName, app, this.options); } @@ -2732,6 +2876,9 @@ // can be used as an event aggregator or pub/sub. _.extend(Marionette.Module.prototype, Backbone.Events, { + // By default modules start with their parents. + startWithParent: true, + // Initialize is an empty function by default. Override it with your own // initialization logic when extending Marionette.Module. initialize: function() {}, diff --git a/lib/core/backbone.marionette.map b/lib/core/backbone.marionette.map index 239879697b..8871e09e5d 100644 --- a/lib/core/backbone.marionette.map +++ b/lib/core/backbone.marionette.map @@ -1 +1 @@ -{"version":3,"file":"lib/core/backbone.marionette.min.js","sources":["core/backbone.marionette.js"],"names":["root","factory","define","amd","Backbone","_","Marionette","exports","require","module","this","throwError","message","name","error","Error","previousMarionette","VERSION","noConflict","Deferred","$","slice","Array","prototype","extend","Model","getOption","target","optionName","value","options","undefined","proxyGetOption","normalizeMethods","hash","normalizedHash","each","method","isFunction","normalizeUIKeys","ui","keys","v","pattern","match","replace","r","actAsCollection","object","listProperty","methods","list","values","result","args","concat","toArray","arguments","apply","triggerMethod","getEventName","prefix","eventName","toUpperCase","splitter","event","methodName","tail","trigger","MonitorDOMRefresh","documentElement","handleShow","view","_isShown","triggerDOMRefresh","handleRender","_isRendered","isInDOM","contains","el","listenTo","document","bindFromStrings","entity","evt","methodNames","split","bindToFunction","unbindFromStrings","stopListening","unbindToFunction","iterateEvents","bindings","functionCallback","stringCallback","call","bindEntityEvents","unbindEntityEvents","proxyBindEntityEvents","proxyUnbindEntityEvents","Callbacks","_deferred","_callbacks","add","callback","contextOverride","promise","push","cb","ctx","then","context","run","resolve","reset","callbacks","Controller","initialize","Events","destroy","off","Object","Region","$el","getEl","buildRegion","regionConfig","DefaultRegionClass","isString","_buildRegionFromSelector","selector","regionClass","_buildRegionFromObject","_buildRegionFromRegionClass","RegionClass","omit","region","parentEl","isObject","find","show","_ensureElement","showOptions","isDifferentView","currentView","preventDestroy","forceShow","isChangingView","_shouldDestroyView","empty","_shouldShowView","once","bind","render","attachHtml","length","innerHTML","appendChild","_destroyView","isDestroyed","remove","attachView","hasView","RegionManager","constructor","_regions","addRegions","regionDefinitions","defaults","regions","definition","addRegion","hasSelector","_store","get","getRegions","clone","removeRegion","_remove","removeRegions","emptyRegions","_setLength","size","TemplateCache","templateId","templateCaches","cachedTemplate","load","clear","i","compiledTemplate","template","loadTemplate","compileTemplate","html","rawTemplate","Renderer","data","templateFunc","View","bindAll","events","behaviors","Behaviors","onShowCalled","getTemplate","serializeModel","model","toJSON","mixinTemplateHelpers","templateHelpers","uiBindings","configureTriggers","triggers","triggerEvents","key","hasOptions","e","prevent","preventDefault","stop","stopPropagation","shouldPrevent","shouldStop","collection","delegateEvents","_delegateDOMEvents","combinedEvents","behaviorEvents","undelegateEvents","_ensureViewIsIntact","err","unbindUIElements","bindUIElements","_uiBindings","ItemView","serializeData","partial","items","serializeCollection","_renderTemplate","attachElContent","CollectionView","childViewEventPrefix","initOptions","sort","isUndefined","_initChildViewStorage","_initialEvents","initRenderBuffer","elBuffer","createDocumentFragment","_bufferedChildren","startBuffering","isBuffering","endBuffering","_triggerBeforeShowBufferedChildren","attachBuffer","_triggerShowBufferedChildren","invoke","child","_onCollectionAdd","_onCollectionRemove","_sortViews","destroyEmptyView","ChildView","getChildView","index","indexOf","addChild","children","findByModel","removeChildView","checkEmpty","_renderChildren","resortView","orderChanged","item","_index","destroyChildren","isEmpty","showEmptyView","showCollection","EmptyView","getEmptyView","_showingEmptyView","addEmptyView","emptyViewOptions","buildChildView","renderChildView","childView","childViewOptions","_updateIndices","_addChildView","increment","laterView","proxyChildEvents","ChildViewClass","collectionView","buffer","append","_insertBefore","_insertAfter","findPosition","before","ChildViewContainer","childViews","map","identity","rootEvent","childEvents","splice","CompositeView","isRendered","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","LayoutView","_firstRender","_initializeRegions","_reInitializeRegions","regionManager","_buildRegions","getRegion","that","_initRegionManager","regionOptions","getRegionManager","Behavior","parseBehaviors","wrap","setElement","b","_behaviorsEvents","viewUI","_events","behaviorUI","whitespace","join","eventKey","handler","behaviorsLookup","getBehaviorClass","behaviorClass","chain","BehaviorClass","behavior","nestedBehaviors","flatten","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","on","_processOnRoute","appRoute","route","_addAppRoute","routeName","routeArgs","routePath","invert","onRoute","routeNames","reverse","Application","_initCallbacks","submodules","_initChannel","execute","commands","request","reqres","addInitializer","initializer","start","_regionManager","moduleNames","moduleDefinition","ModuleClass","Module","getClass","unshift","create","optionRegions","channelName","channel","Wreqr","radio","vent","moduleName","app","_setupInitializersAndFinalizers","startWithParent","_initializerCallbacks","addFinalizer","_finalizerCallbacks","_isInitialized","mod","addDefinition","customArgs","_runModuleDefinition","moduleDefinitions","parentModule","_getModule","_addModuleDefinition","def","moduleClass","fn","_getDefine","_getStartWithParent","_addStartWithParent","swp","startWithParentIsConfigured"],"mappings":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ASA,EAAIxY,oBAAqBjB,GAAW+X,QAC5DgC,EAAM5Z,EAAO2J,YAAY7I,UAAU2X,gBAC5B7Y,EAAEiP,YAAY+K,IAAO,EAAOA,GAGjCha,EAAEqI,SAASqR,IACbM,EAAMN,EAAIb,gBACH7Y,EAAEiP,YAAY+K,IAAO,EAAOA,IAG9B,GAGTH,WAAY,SAASH,GACnB,OAAI1Z,EAAEiC,WAAWyX,IAAUA,EAAIxY,oBAAqBjB,GAAW+X,OAI3DhY,EAAEqI,SAASqR,GACNA,EAAI7Z,OAGN,KAPE6Z,GAUXK,oBAAqB,SAASR,EAAcnZ,EAAQyY,GAClDzY,EAAOyY,gBAAkBzY,EAAOyY,iBAAmBA,EAE9CzY,EAAOyY,kBAAqBzY,EAAO6Z,8BAIxC7Z,EAAO6Z,6BAA8B,EAErCV,EAAa9B,eAAe,SAAShW,GAC/BrB,EAAOyY,iBACTzY,EAAOuX,MAAMlW,SAOdxB"} \ No newline at end of file +{"version":3,"file":"lib/core/backbone.marionette.min.js","sources":["core/backbone.marionette.js"],"names":["root","factory","define","amd","Backbone","_","Marionette","exports","require","module","this","previousMarionette","VERSION","noConflict","Deferred","$","slice","Array","prototype","extend","Model","getOption","target","optionName","value","options","undefined","proxyGetOption","normalizeMethods","hash","normalizedHash","each","method","name","isFunction","normalizeUIString","uiString","ui","replace","r","normalizeUIKeys","clone","keys","key","normalizedKey","normalizeUIValues","val","isString","actAsCollection","object","listProperty","methods","list","values","result","args","concat","toArray","arguments","apply","triggerMethod","event","getEventName","match","prefix","eventName","toUpperCase","splitter","methodName","tail","trigger","triggerMethodOn","context","fnc","MonitorDOMRefresh","documentElement","handleShow","view","_isShown","triggerDOMRefresh","handleRender","_isRendered","isInDOM","contains","el","listenTo","document","bindFromStrings","entity","evt","methodNames","split","Error","bindToFunction","unbindFromStrings","stopListening","unbindToFunction","iterateEvents","bindings","functionCallback","stringCallback","isObject","message","url","call","bindEntityEvents","unbindEntityEvents","proxyBindEntityEvents","proxyUnbindEntityEvents","errorProps","urlRoot","constructor","error","pick","captureStackTrace","toString","Callbacks","_deferred","_callbacks","add","callback","contextOverride","promise","push","cb","ctx","then","run","resolve","reset","callbacks","Controller","initialize","Events","destroy","off","Object","Region","$el","getEl","buildRegion","regionConfig","DefaultRegionClass","_buildRegionFromSelector","selector","regionClass","_buildRegionFromObject","_buildRegionFromRegionClass","RegionClass","omit","region","parentEl","find","show","_ensureElement","showOptions","isDifferentView","currentView","preventDestroy","forceShow","isChangingView","_shouldDestroyView","_shouldShowView","empty","once","bind","render","attachHtml","length","innerHTML","appendChild","_destroyView","isDestroyed","remove","attachView","hasView","RegionManager","_regions","addRegions","regionDefinitions","defaults","regions","definition","addRegion","_store","get","getRegions","removeRegion","_remove","removeRegions","emptyRegions","_setLength","size","TemplateCache","templateId","templateCaches","cachedTemplate","load","clear","i","compiledTemplate","template","loadTemplate","compileTemplate","html","rawTemplate","Renderer","data","templateFunc","View","bindAll","_behaviors","Behaviors","onShowCalled","getTemplate","serializeModel","model","toJSON","mixinTemplateHelpers","templateHelpers","uiBindings","configureTriggers","triggers","triggerEvents","_buildViewTrigger","delegateEvents","events","_delegateDOMEvents","collection","behavior","eventsArg","isUndefined","combinedEvents","behaviorEvents","behaviorTriggers","undelegateEvents","_ensureViewIsIntact","cid","unbindUIElements","invoke","bindUIElements","_bindUIElements","_uiBindings","_unbindUIElements","triggerDef","hasOptions","preventDefault","stopPropagation","e","setElement","ret","b","ItemView","serializeData","partial","items","serializeCollection","_renderTemplate","attachElContent","CollectionView","childViewEventPrefix","initOptions","sort","Collection","_initialEvents","_initChildViewStorage","initRenderBuffer","elBuffer","createDocumentFragment","_bufferedChildren","startBuffering","isBuffering","endBuffering","_triggerBeforeShowBufferedChildren","attachBuffer","_triggerShowBufferedChildren","_triggerMethodOnChild","childView","_onCollectionAdd","_onCollectionRemove","_sortViews","child","destroyEmptyView","ChildView","getChildView","index","indexOf","addChild","children","findByModel","removeChildView","checkEmpty","_renderChildren","resortView","orderChanged","item","_index","destroyChildren","isEmpty","showEmptyView","showCollection","EmptyView","getEmptyView","_showingEmptyView","addEmptyView","emptyViewOptions","buildChildView","proxyChildEvents","renderChildView","childViewOptions","_updateIndices","_addChildView","increment","laterView","ChildViewClass","collectionView","buffer","append","_insertBefore","_insertAfter","findPosition","before","ChildViewContainer","childViews","map","identity","rootEvent","childEvents","splice","CompositeView","isRendered","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","LayoutView","_firstRender","_initializeRegions","_reInitializeRegions","regionManager","_buildRegions","getRegion","that","_initRegionManager","regionOptions","getRegionManager","Behavior","proxyViewProperties","behaviors","parseBehaviors","wrap","BehaviorTriggersBuilder","_view","_viewUI","_triggers","triggerBuilder","buildBehaviorTriggers","_behaviorsEvents","viewUI","_events","behaviorUI","whitespace","join","eventKey","handler","behaviorsLookup","getBehaviorClass","behaviorClass","chain","BehaviorClass","nestedBehaviors","flatten","_buildTriggerHandlersForBehavior","triggersHash","_setHandlerForBehavior","triggerKey","triggerName","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","on","_processOnRoute","appRoute","route","_addAppRoute","routeName","routeArgs","routePath","invert","onRoute","routeNames","reverse","Application","_initCallbacks","submodules","_initChannel","execute","commands","request","reqres","addInitializer","initializer","start","_regionManager","moduleNames","moduleDefinition","ModuleClass","Module","getClass","unshift","create","optionRegions","channelName","channel","Wreqr","radio","vent","moduleName","app","_setupInitializersAndFinalizers","startWithParent","_initializerCallbacks","addFinalizer","_finalizerCallbacks","_isInitialized","mod","stop","addDefinition","customArgs","_runModuleDefinition","moduleDefinitions","parentModule","_getModule","_addModuleDefinition","def","moduleClass","fn","_getDefine","_getStartWithParent","_addStartWithParent","swp","startWithParentIsConfigured"],"mappings":"CASC,SAASA,EAAMC,GAEd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,aAAc,iBAAkB,uBAAwB,SAASE,EAAUC,GAC7F,MAAQL,GAAKM,WAA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KAPEyb,GAUXK,oBAAqB,SAASR,EAAc/a,EAAQoa,GAClDpa,EAAOoa,gBAAkBpa,EAAOoa,iBAAmBA,EAE9Cpa,EAAOoa,kBAAqBpa,EAAOyb,8BAIxCzb,EAAOyb,6BAA8B,EAErCV,EAAa/B,eAAe,SAAShY,GAC/BhB,EAAOoa,iBACTpa,EAAOkZ,MAAMlY,SAOdnB"} \ No newline at end of file diff --git a/lib/core/backbone.marionette.min.js b/lib/core/backbone.marionette.min.js index 44b8cc6f8d..30a16500f9 100644 --- a/lib/core/backbone.marionette.min.js +++ b/lib/core/backbone.marionette.min.js @@ -1,2 +1,3 @@ -!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore","backbone.wreqr","backbone.babysitter"],function(c,d){return a.Marionette=b(a,c,d)});else if("undefined"!=typeof exports){{var c=require("backbone"),d=require("underscore");require("backbone.wreqr"),require("backbone.babysitter")}module.exports=b(a,c,d)}else a.Marionette=b(a,a.Backbone,a._)}(this,function(a,b,c){"use strict";function d(a,b){var c=new Error(a);throw c.name=b||"Error",c}var e=a.Marionette,f=b.Marionette={};f.VERSION="2.1.0",f.noConflict=function(){return a.Marionette=e,this},f.Deferred=b.$.Deferred;var g=Array.prototype.slice;return f.extend=b.Model.extend,f.getOption=function(a,b){if(a&&b){var c;return c=a.options&&void 0!==a.options[b]?a.options[b]:a[b]}},f.proxyGetOption=function(a){return f.getOption(this,a)},f.normalizeMethods=function(a){var b={};return c.each(a,function(a,d){c.isFunction(a)||(a=this[a]),a&&(b[d]=a)},this),b},f.normalizeUIKeys=function(a,b){return"undefined"!=typeof a?(c.each(c.keys(a),function(c){var d=/@ui\.[a-zA-Z_$0-9]*/g;c.match(d)&&(a[c.replace(d,function(a){return b[a.slice(4)]})]=a[c],delete a[c])}),a):void 0},f.actAsCollection=function(a,b){var d=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];c.each(d,function(d){a[d]=function(){var a=c.values(c.result(this,b)),e=[a].concat(c.toArray(arguments));return c[d].apply(c,e)}})},f.triggerMethod=function(){function a(a,b,c){return c.toUpperCase()}var b=/(^|:)(\w)/gi,d=function(d){var e,f="on"+d.replace(b,a),g=this[f];return c.isFunction(g)&&(e=g.apply(this,c.tail(arguments))),c.isFunction(this.trigger)&&this.trigger.apply(this,arguments),e};return d}(),f.MonitorDOMRefresh=function(a){function d(a){a._isShown=!0,f(a)}function e(a){a._isRendered=!0,f(a)}function f(a){a._isShown&&a._isRendered&&g(a)&&c.isFunction(a.triggerMethod)&&a.triggerMethod("dom:refresh")}function g(c){return b.$.contains(a,c.el)}return function(a){a.listenTo(a,"show",function(){d(a)}),a.listenTo(a,"render",function(){e(a)})}}(document.documentElement),function(a){function b(a,b,e,f){var g=f.split(/\s+/);c.each(g,function(c){var f=a[c];f||d('Method "'+c+'" was configured as an event handler, but does not exist.'),a.listenTo(b,e,f)})}function e(a,b,c,d){a.listenTo(b,c,d)}function f(a,b,d,e){var f=e.split(/\s+/);c.each(f,function(c){var e=a[c];a.stopListening(b,d,e)})}function g(a,b,c,d){a.stopListening(b,c,d)}function h(a,b,d,e,f){b&&d&&(c.isFunction(d)&&(d=d.call(a)),c.each(d,function(d,g){c.isFunction(d)?e(a,b,g,d):f(a,b,g,d)}))}a.bindEntityEvents=function(a,c,d){h(a,c,d,e,b)},a.unbindEntityEvents=function(a,b,c){h(a,b,c,g,f)},a.proxyBindEntityEvents=function(b,c){return a.bindEntityEvents(this,b,c)},a.proxyUnbindEntityEvents=function(b,c){return a.unbindEntityEvents(this,b,c)}}(f),f.Callbacks=function(){this._deferred=f.Deferred(),this._callbacks=[]},c.extend(f.Callbacks.prototype,{add:function(a,b){var d=c.result(this._deferred,"promise");this._callbacks.push({cb:a,ctx:b}),d.then(function(c){b&&(c.context=b),a.call(c.context,c.options)})},run:function(a,b){this._deferred.resolve({options:a,context:b})},reset:function(){var a=this._callbacks;this._deferred=f.Deferred(),this._callbacks=[],c.each(a,function(a){this.add(a.cb,a.ctx)},this)}}),f.Controller=function(a){this.options=a||{},c.isFunction(this.initialize)&&this.initialize(this.options)},f.Controller.extend=f.extend,c.extend(f.Controller.prototype,b.Events,{destroy:function(){var a=g.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.triggerMethod.apply(this,["destroy"].concat(a)),this.stopListening(),this.off(),this},triggerMethod:f.triggerMethod,getOption:f.proxyGetOption}),f.Object=function(a){this.options=c.extend({},c.result(this,"options"),a),this.initialize(this.options)},f.Object.extend=f.extend,c.extend(f.Object.prototype,{initialize:function(){},destroy:function(){this.triggerMethod("before:destroy"),this.triggerMethod("destroy"),this.stopListening()},triggerMethod:f.triggerMethod,getOption:f.proxyGetOption,bindEntityEvents:f.proxyBindEntityEvents,unbindEntityEvents:f.proxyUnbindEntityEvents}),c.extend(f.Object.prototype,b.Events),f.Region=function(a){if(this.options=a||{},this.el=this.getOption("el"),this.el=this.el instanceof b.$?this.el[0]:this.el,this.el||d('An "el" must be specified for a region.',"NoElError"),this.$el=this.getEl(this.el),this.initialize){var c=g.apply(arguments);this.initialize.apply(this,c)}},c.extend(f.Region,{buildRegion:function(a,b){return c.isString(a)?this._buildRegionFromSelector(a,b):a.selector||a.el||a.regionClass?this._buildRegionFromObject(a,b):c.isFunction(a)?this._buildRegionFromRegionClass(a):void d("Improper region configuration type. Please refer to http://marionettejs.com/docs/marionette.region.html#region-configuration-types")},_buildRegionFromSelector:function(a,b){return new b({el:a})},_buildRegionFromObject:function(a,d){var e=a.regionClass||d,f=c.omit(a,"selector","regionClass");a.selector&&!f.el&&(f.el=a.selector);var g=new e(f);return a.parentEl&&(g.getEl=function(d){if(c.isObject(d))return b.$(d);var e=a.parentEl;return c.isFunction(e)&&(e=e()),e.find(d)}),g},_buildRegionFromRegionClass:function(a){return new a}}),c.extend(f.Region.prototype,b.Events,{show:function(a,b){this._ensureElement();var d=b||{},e=a!==this.currentView,f=!!d.preventDestroy,g=!!d.forceShow,h=!!this.currentView,i=!f&&e;i&&this.empty();var j=e||g;return j?(a.once("destroy",c.bind(this.empty,this)),a.render(),h&&this.triggerMethod("before:swap",a),this.triggerMethod("before:show",a),c.isFunction(a.triggerMethod)?a.triggerMethod("before:show"):this.triggerMethod.call(a,"before:show"),this.attachHtml(a),this.currentView=a,h&&this.triggerMethod("swap",a),this.triggerMethod("show",a),c.isFunction(a.triggerMethod)?a.triggerMethod("show"):this.triggerMethod.call(a,"show"),this):this},_ensureElement:function(){c.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),this.$el&&0!==this.$el.length||d('An "el" '+this.$el.selector+" must exist in DOM")},getEl:function(a){return b.$(a)},attachHtml:function(a){this.el.innerHTML="",this.el.appendChild(a.el)},empty:function(){var a=this.currentView;if(a)return this.triggerMethod("before:empty",a),this._destroyView(),this.triggerMethod("empty",a),delete this.currentView,this},_destroyView:function(){var a=this.currentView;a.destroy&&!a.isDestroyed?a.destroy():a.remove&&a.remove()},attachView:function(a){return this.currentView=a,this},hasView:function(){return!!this.currentView},reset:function(){return this.empty(),this.$el&&(this.el=this.$el.selector),delete this.$el,this},getOption:f.proxyGetOption,triggerMethod:f.triggerMethod}),f.Region.extend=f.extend,f.RegionManager=function(a){var b=a.Controller.extend({constructor:function(b){this._regions={},a.Controller.call(this,b)},addRegions:function(a,b){c.isFunction(a)&&(a=a.apply(this,arguments));var d={};return c.each(a,function(a,e){c.isString(a)&&(a={selector:a}),a.selector&&(a=c.defaults({},a,b));var f=this.addRegion(e,a);d[e]=f},this),d},addRegion:function(b,d){var e,f=c.isObject(d),g=c.isString(d),h=!!d.selector;return e=g||f&&h?a.Region.buildRegion(d,a.Region):c.isFunction(d)?a.Region.buildRegion(d,a.Region):d,this.triggerMethod("before:add:region",b,e),this._store(b,e),this.triggerMethod("add:region",b,e),e},get:function(a){return this._regions[a]},getRegions:function(){return c.clone(this._regions)},removeRegion:function(a){var b=this._regions[a];return this._remove(a,b),b},removeRegions:function(){var a=this.getRegions();return c.each(this._regions,function(a,b){this._remove(b,a)},this),a},emptyRegions:function(){var a=this.getRegions();return c.each(a,function(a){a.empty()},this),a},destroy:function(){return this.removeRegions(),a.Controller.prototype.destroy.apply(this,arguments)},_store:function(a,b){this._regions[a]=b,this._setLength()},_remove:function(a,b){this.triggerMethod("before:remove:region",a,b),b.empty(),b.stopListening(),delete this._regions[a],this._setLength(),this.triggerMethod("remove:region",a,b)},_setLength:function(){this.length=c.size(this._regions)}});return a.actAsCollection(b.prototype,"_regions"),b}(f),f.TemplateCache=function(a){this.templateId=a},c.extend(f.TemplateCache,{templateCaches:{},get:function(a){var b=this.templateCaches[a];return b||(b=new f.TemplateCache(a),this.templateCaches[a]=b),b.load()},clear:function(){var a,b=g.call(arguments),c=b.length;if(c>0)for(a=0;c>a;a++)delete this.templateCaches[b[a]];else this.templateCaches={}}}),c.extend(f.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var a=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(a),this.compiledTemplate},loadTemplate:function(a){var c=b.$(a).html();return c&&0!==c.length||d('Could not find template: "'+a+'"',"NoTemplateError"),c},compileTemplate:function(a){return c.template(a)}}),f.Renderer={render:function(a,b){a||d("Cannot render the template since its false, null or undefined.","TemplateNotFoundError");var c;return(c="function"==typeof a?a:f.TemplateCache.get(a))(b)}},f.View=b.View.extend({constructor:function(a){c.bindAll(this,"render"),this.options=c.extend({},c.result(this,"options"),c.isFunction(a)?a.call(this):a),this.events=this.normalizeUIKeys(c.result(this,"events")),c.isObject(this.behaviors)&&new f.Behaviors(this),b.View.apply(this,arguments),f.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled)},getTemplate:function(){return this.getOption("template")},serializeModel:function(a){return a.toJSON.apply(a,g.call(arguments,1))},mixinTemplateHelpers:function(a){a=a||{};var b=this.getOption("templateHelpers");return c.isFunction(b)&&(b=b.call(this)),c.extend(a,b)},normalizeUIKeys:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return f.normalizeUIKeys(a,d||b)},configureTriggers:function(){if(this.triggers){var a={},b=this.normalizeUIKeys(c.result(this,"triggers"));return c.each(b,function(b,d){var e=c.isObject(b),f=e?b.event:b;a[d]=function(a){if(a){var c=a.preventDefault,d=a.stopPropagation,g=e?b.preventDefault:c,h=e?b.stopPropagation:d;g&&c&&c.apply(a),h&&d&&d.apply(a)}var i={view:this,model:this.model,collection:this.collection};this.triggerMethod(f,i)}},this),a}},delegateEvents:function(a){return this._delegateDOMEvents(a),this.bindEntityEvents(this.model,this.getOption("modelEvents")),this.bindEntityEvents(this.collection,this.getOption("collectionEvents")),this},_delegateDOMEvents:function(a){a=a||this.events,c.isFunction(a)&&(a=a.call(this)),a=this.normalizeUIKeys(a);var d={},e=c.result(this,"behaviorEvents")||{},f=this.configureTriggers();c.extend(d,e,a,f),b.View.prototype.delegateEvents.call(this,d)},undelegateEvents:function(){var a=g.call(arguments);return b.View.prototype.undelegateEvents.apply(this,a),this.unbindEntityEvents(this.model,this.getOption("modelEvents")),this.unbindEntityEvents(this.collection,this.getOption("collectionEvents")),this},onShowCalled:function(){},_ensureViewIsIntact:function(){if(this.isDestroyed){var a=new Error("Cannot use a view thats already been destroyed.");throw a.name="ViewDestroyedError",a}},destroy:function(){if(!this.isDestroyed){var a=g.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.isDestroyed=!0,this.triggerMethod.apply(this,["destroy"].concat(a)),this.unbindUIElements(),this.remove(),this}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var a=c.result(this,"_uiBindings");this.ui={},c.each(c.keys(a),function(b){var c=a[b];this.ui[b]=this.$(c)},this)}},unbindUIElements:function(){this.ui&&this._uiBindings&&(c.each(this.ui,function(a,b){delete this.ui[b]},this),this.ui=this._uiBindings,delete this._uiBindings)},triggerMethod:f.triggerMethod,normalizeMethods:f.normalizeMethods,getOption:f.proxyGetOption,bindEntityEvents:f.proxyBindEntityEvents,unbindEntityEvents:f.proxyUnbindEntityEvents}),f.ItemView=f.View.extend({constructor:function(){f.View.apply(this,arguments)},serializeData:function(){var a={};return this.model?a=c.partial(this.serializeModel,this.model).apply(this,arguments):this.collection&&(a={items:c.partial(this.serializeCollection,this.collection).apply(this,arguments)}),a},serializeCollection:function(a){return a.toJSON.apply(a,g.call(arguments,1))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.triggerMethod("render",this),this},_renderTemplate:function(){var a=this.getTemplate();if(a!==!1){a||d("Cannot render the template since it is null or undefined.","UndefinedTemplateError");var b=this.serializeData();b=this.mixinTemplateHelpers(b);var c=f.Renderer.render(a,b,this);return this.attachElContent(c),this}},attachElContent:function(a){return this.$el.html(a),this},destroy:function(){return this.isDestroyed?void 0:f.View.prototype.destroy.apply(this,arguments)}}),f.CollectionView=f.View.extend({childViewEventPrefix:"childview",constructor:function(a){var b=a||{};this.sort=c.isUndefined(b.sort)?!0:b.sort,this._initChildViewStorage(),f.View.apply(this,arguments),this._initialEvents(),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this._triggerBeforeShowBufferedChildren(),this.attachBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerBeforeShowBufferedChildren:function(){this._isShown&&c.invoke(this._bufferedChildren,"triggerMethod","before:show")},_triggerShowBufferedChildren:function(){this._isShown&&(c.each(this._bufferedChildren,function(a){c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")}),this._bufferedChildren=[])},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(a){this.destroyEmptyView();var b=this.getChildView(a),c=this.collection.indexOf(a);this.addChild(a,b,c)},_onCollectionRemove:function(a){var b=this.children.findByModel(a);this.removeChildView(b),this.checkEmpty()},onShowCalled:function(){this.children.each(function(a){c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")})},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this.triggerMethod("render",this),this},resortView:function(){this.render()},_sortViews:function(){var a=this.collection.find(function(a,b){var c=this.children.findByModel(a);return!c||c._index!==b},this);a&&this.resortView()},_renderChildren:function(){this.destroyEmptyView(),this.destroyChildren(),this.isEmpty(this.collection)?this.showEmptyView():(this.triggerMethod("before:render:collection",this),this.startBuffering(),this.showCollection(),this.endBuffering(),this.triggerMethod("render:collection",this))},showCollection:function(){var a;this.collection.each(function(b,c){a=this.getChildView(b),this.addChild(b,a,c)},this)},showEmptyView:function(){var a=this.getEmptyView();if(a&&!this._showingEmptyView){this.triggerMethod("before:render:empty"),this._showingEmptyView=!0;var c=new b.Model;this.addEmptyView(c,a),this.triggerMethod("render:empty")}},destroyEmptyView:function(){this._showingEmptyView&&(this.destroyChildren(),delete this._showingEmptyView)},getEmptyView:function(){return this.getOption("emptyView")},addEmptyView:function(a,b){var d=this.getOption("emptyViewOptions")||this.getOption("childViewOptions");c.isFunction(d)&&(d=d.call(this));var e=this.buildChildView(a,b,d);this._isShown&&this.triggerMethod.call(e,"before:show"),this.children.add(e),this.renderChildView(e,-1),this._isShown&&this.triggerMethod.call(e,"show")},getChildView:function(){var a=this.getOption("childView");return a||d('A "childView" must be specified',"NoChildViewError"),a},addChild:function(a,b,d){var e=this.getOption("childViewOptions");c.isFunction(e)&&(e=e.call(this,a,d));var f=this.buildChildView(a,b,e);return this._updateIndices(f,!0,d),this._addChildView(f,d),f},_updateIndices:function(a,b,c){this.sort&&(b?(a._index=c,this.children.each(function(b){b._index>=a._index&&b._index++})):this.children.each(function(b){b._index>=a._index&&b._index--}))},_addChildView:function(a,b){this.proxyChildEvents(a),this.triggerMethod("before:add:child",a),this.children.add(a),this.renderChildView(a,b),this._isShown&&!this.isBuffering&&(c.isFunction(a.triggerMethod)?a.triggerMethod("show"):f.triggerMethod.call(a,"show")),this.triggerMethod("add:child",a)},renderChildView:function(a,b){return a.render(),this.attachHtml(this,a,b),a},buildChildView:function(a,b,d){var e=c.extend({model:a},d);return new b(e)},removeChildView:function(a){return a&&(this.triggerMethod("before:remove:child",a),a.destroy?a.destroy():a.remove&&a.remove(),this.stopListening(a),this.children.remove(a),this.triggerMethod("remove:child",a),this._updateIndices(a,!1)),a},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},attachBuffer:function(a,b){a.$el.append(b)},attachHtml:function(a,b,c){a.isBuffering?(a.elBuffer.appendChild(b.el),a._bufferedChildren.push(b)):a._insertBefore(b,c)||a._insertAfter(b)},_insertBefore:function(a,b){var c,d=this.sort&&b0)for(a=0;c>a;a++)delete this.templateCaches[b[a]];else this.templateCaches={}}}),c.extend(e.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var a=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(a),this.compiledTemplate},loadTemplate:function(a){var c=b.$(a).html();if(!c||0===c.length)throw new e.Error({name:"NoTemplateError",message:'Could not find template: "'+a+'"'});return c},compileTemplate:function(a){return c.template(a)}}),e.Renderer={render:function(a,b){if(!a)throw new e.Error({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var c;return(c="function"==typeof a?a:e.TemplateCache.get(a))(b)}},e.View=b.View.extend({constructor:function(a){c.bindAll(this,"render"),this.options=c.extend({},c.result(this,"options"),c.isFunction(a)?a.call(this):a),this._behaviors=e.Behaviors(this),b.View.apply(this,arguments),e.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled)},getTemplate:function(){return this.getOption("template")},serializeModel:function(a){return a.toJSON.apply(a,f.call(arguments,1))},mixinTemplateHelpers:function(a){a=a||{};var b=this.getOption("templateHelpers");return c.isFunction(b)&&(b=b.call(this)),c.extend(a,b)},normalizeUIKeys:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return e.normalizeUIKeys(a,d||b)},normalizeUIValues:function(a){var b=c.result(this,"ui"),d=c.result(this,"_uiBindings");return e.normalizeUIValues(a,d||b)},configureTriggers:function(){if(this.triggers){var a={},b=this.normalizeUIKeys(c.result(this,"triggers"));return c.each(b,function(b,c){a[c]=this._buildViewTrigger(b)},this),a}},delegateEvents:function(a){return this._delegateDOMEvents(a),this.bindEntityEvents(this.model,this.getOption("modelEvents")),this.bindEntityEvents(this.collection,this.getOption("collectionEvents")),c.each(this._behaviors,function(a){a.bindEntityEvents(this.model,a.getOption("modelEvents")),a.bindEntityEvents(this.collection,a.getOption("collectionEvents"))},this),this},_delegateDOMEvents:function(a){var d=a||this.events;c.isFunction(d)&&(d=d.call(this)),d=this.normalizeUIKeys(d),c.isUndefined(a)&&(this.events=d);var e={},f=c.result(this,"behaviorEvents")||{},g=this.configureTriggers(),h=c.result(this,"behaviorTriggers")||{};c.extend(e,f,d,g,h),b.View.prototype.delegateEvents.call(this,e)},undelegateEvents:function(){var a=f.call(arguments);return b.View.prototype.undelegateEvents.apply(this,a),this.unbindEntityEvents(this.model,this.getOption("modelEvents")),this.unbindEntityEvents(this.collection,this.getOption("collectionEvents")),c.each(this._behaviors,function(a){a.unbindEntityEvents(this.model,a.getOption("modelEvents")),a.unbindEntityEvents(this.collection,a.getOption("collectionEvents"))},this),this},onShowCalled:function(){},_ensureViewIsIntact:function(){if(this.isDestroyed)throw new e.Error({name:"ViewDestroyedError",message:'View (cid: "'+this.cid+'") has already been destroyed and cannot be used.'})},destroy:function(){if(!this.isDestroyed){var a=f.call(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(a)),this.isDestroyed=!0,this.triggerMethod.apply(this,["destroy"].concat(a)),this.unbindUIElements(),this.remove(),c.invoke(this._behaviors,"destroy",a),this}},bindUIElements:function(){this._bindUIElements(),c.invoke(this._behaviors,this._bindUIElements)},_bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var a=c.result(this,"_uiBindings");this.ui={},c.each(c.keys(a),function(b){var c=a[b];this.ui[b]=this.$(c)},this)}},unbindUIElements:function(){this._unbindUIElements(),c.invoke(this._behaviors,this._unbindUIElements)},_unbindUIElements:function(){this.ui&&this._uiBindings&&(c.each(this.ui,function(a,b){delete this.ui[b]},this),this.ui=this._uiBindings,delete this._uiBindings)},_buildViewTrigger:function(a){var b=c.isObject(a),d=c.defaults({},b?a:{},{preventDefault:!0,stopPropagation:!0}),e=b?d.event:a;return function(a){a&&(a.preventDefault&&d.preventDefault&&a.preventDefault(),a.stopPropagation&&d.stopPropagation&&a.stopPropagation());var b={view:this,model:this.model,collection:this.collection};this.triggerMethod(e,b)}},setElement:function(){var a=b.View.prototype.setElement.apply(this,arguments);return c.invoke(this._behaviors,"proxyViewProperties",this),a},triggerMethod:function(){var a=arguments,b=e.triggerMethod,d=b.apply(this,a);return c.each(this._behaviors,function(c){b.apply(c,a)}),d},normalizeMethods:e.normalizeMethods,getOption:e.proxyGetOption,bindEntityEvents:e.proxyBindEntityEvents,unbindEntityEvents:e.proxyUnbindEntityEvents}),e.ItemView=e.View.extend({constructor:function(){e.View.apply(this,arguments)},serializeData:function(){var a={};return this.model?a=c.partial(this.serializeModel,this.model).apply(this,arguments):this.collection&&(a={items:c.partial(this.serializeCollection,this.collection).apply(this,arguments)}),a},serializeCollection:function(a){return a.toJSON.apply(a,f.call(arguments,1))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.triggerMethod("render",this),this},_renderTemplate:function(){var a=this.getTemplate();if(a!==!1){if(!a)throw new e.Error({name:"UndefinedTemplateError",message:"Cannot render the template since it is null or undefined."});var b=this.serializeData();b=this.mixinTemplateHelpers(b);var c=e.Renderer.render(a,b,this);return this.attachElContent(c),this}},attachElContent:function(a){return this.$el.html(a),this},destroy:function(){return this.isDestroyed?void 0:e.View.prototype.destroy.apply(this,arguments)}}),e.CollectionView=e.View.extend({childViewEventPrefix:"childview",constructor:function(a){var d=a||{};if(this.sort=c.isUndefined(d.sort)?!0:d.sort,d.collection&&!(d.collection instanceof b.Collection))throw new e.Error("The Collection option passed to this view needs to be an instance of a Backbone.Collection");this.once("render",this._initialEvents),this._initChildViewStorage(),e.View.apply(this,arguments),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this._triggerBeforeShowBufferedChildren(),this.attachBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerBeforeShowBufferedChildren:function(){this._isShown&&c.each(this._bufferedChildren,c.partial(this._triggerMethodOnChild,"before:show"))},_triggerShowBufferedChildren:function(){this._isShown&&(c.each(this._bufferedChildren,c.partial(this._triggerMethodOnChild,"show")),this._bufferedChildren=[])},_triggerMethodOnChild:function(a,b){e.triggerMethodOn(b,a)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(a){this.destroyEmptyView();var b=this.getChildView(a),c=this.collection.indexOf(a);this.addChild(a,b,c)},_onCollectionRemove:function(a){var b=this.children.findByModel(a);this.removeChildView(b),this.checkEmpty()},onShowCalled:function(){this.children.each(c.partial(this._triggerMethodOnChild,"show"))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this.triggerMethod("render",this),this},resortView:function(){this.render()},_sortViews:function(){var a=this.collection.find(function(a,b){var c=this.children.findByModel(a);return!c||c._index!==b},this);a&&this.resortView()},_renderChildren:function(){this.destroyEmptyView(),this.destroyChildren(),this.isEmpty(this.collection)?this.showEmptyView():(this.triggerMethod("before:render:collection",this),this.startBuffering(),this.showCollection(),this.endBuffering(),this.triggerMethod("render:collection",this))},showCollection:function(){var a;this.collection.each(function(b,c){a=this.getChildView(b),this.addChild(b,a,c)},this)},showEmptyView:function(){var a=this.getEmptyView();if(a&&!this._showingEmptyView){this.triggerMethod("before:render:empty"),this._showingEmptyView=!0;var c=new b.Model;this.addEmptyView(c,a),this.triggerMethod("render:empty")}},destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty"),this.destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty"))},getEmptyView:function(){return this.getOption("emptyView")},addEmptyView:function(a,b){var d=this.getOption("emptyViewOptions")||this.getOption("childViewOptions");c.isFunction(d)&&(d=d.call(this));var f=this.buildChildView(a,b,d);this.proxyChildEvents(f),this._isShown&&e.triggerMethodOn(f,"before:show"),this.children.add(f),this.renderChildView(f,-1),this._isShown&&e.triggerMethodOn(f,"show")},getChildView:function(){var a=this.getOption("childView");if(!a)throw new e.Error({name:"NoChildViewError",message:'A "childView" must be specified'});return a},addChild:function(a,b,d){var e=this.getOption("childViewOptions");c.isFunction(e)&&(e=e.call(this,a,d));var f=this.buildChildView(a,b,e);return this._updateIndices(f,!0,d),this._addChildView(f,d),f},_updateIndices:function(a,b,c){this.sort&&(b?(a._index=c,this.children.each(function(b){b._index>=a._index&&b._index++})):this.children.each(function(b){b._index>=a._index&&b._index--}))},_addChildView:function(a,b){this.proxyChildEvents(a),this.triggerMethod("before:add:child",a),this.children.add(a),this.renderChildView(a,b),this._isShown&&!this.isBuffering&&e.triggerMethodOn(a,"show"),this.triggerMethod("add:child",a)},renderChildView:function(a,b){return a.render(),this.attachHtml(this,a,b),a},buildChildView:function(a,b,d){var e=c.extend({model:a},d);return new b(e)},removeChildView:function(a){return a&&(this.triggerMethod("before:remove:child",a),a.destroy?a.destroy():a.remove&&a.remove(),this.stopListening(a),this.children.remove(a),this.triggerMethod("remove:child",a),this._updateIndices(a,!1)),a},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},attachBuffer:function(a,b){a.$el.append(b)},attachHtml:function(a,b,c){a.isBuffering?(a.elBuffer.appendChild(b.el),a._bufferedChildren.push(b)):a._insertBefore(b,c)||a._insertAfter(b)},_insertBefore:function(a,b){var c,d=this.sort&&b