From df705b79cf94291f3d67a5727e188d3100534d6e Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Wed, 24 Jul 2013 17:41:19 -0700 Subject: [PATCH] updated jslibraries --- UI/Content/prefixer.less | 6 +- UI/JsLibraries/backbone.marionette.js | 99 ++++++++++----------------- UI/JsLibraries/backbone.pageable.js | 56 +++++---------- 3 files changed, 55 insertions(+), 106 deletions(-) diff --git a/UI/Content/prefixer.less b/UI/Content/prefixer.less index 04559cf3e..c9040baa1 100644 --- a/UI/Content/prefixer.less +++ b/UI/Content/prefixer.less @@ -198,9 +198,9 @@ column-width: @width; } .column-rule(@args){ - -webkit-column-rule: @rule; - -moz-column-rule: @rule; - column-rule: @rule; + -webkit-column-rule: @args; + -moz-column-rule: @args; + column-rule: @args; } diff --git a/UI/JsLibraries/backbone.marionette.js b/UI/JsLibraries/backbone.marionette.js index 47054e1c3..35d5f761e 100644 --- a/UI/JsLibraries/backbone.marionette.js +++ b/UI/JsLibraries/backbone.marionette.js @@ -1,6 +1,6 @@ // MarionetteJS (Backbone.Marionette) // ---------------------------------- -// v1.0.3 +// v1.0.4 // // Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license @@ -19,7 +19,7 @@ // Backbone.BabySitter // ------------------- -// v0.0.5 +// v0.0.6 // // Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license @@ -37,14 +37,13 @@ Backbone.ChildViewContainer = (function(Backbone, _){ // Container Constructor // --------------------- - var Container = function(initialViews){ + var Container = function(views){ this._views = {}; this._indexByModel = {}; - this._indexByCollection = {}; this._indexByCustom = {}; this._updateLength(); - this._addInitialViews(initialViews); + _.each(views, this.add, this); }; // Container Methods @@ -54,7 +53,7 @@ Backbone.ChildViewContainer = (function(Backbone, _){ // Add a view to this container. Stores the view // by `cid` and makes it searchable by the model - // and/or collection of the view. Optionally specify + // cid (and model itself). Optionally specify // a custom key to store an retrieve the view. add: function(view, customIndex){ var viewCid = view.cid; @@ -67,11 +66,6 @@ Backbone.ChildViewContainer = (function(Backbone, _){ this._indexByModel[view.model.cid] = viewCid; } - // index it by collection - if (view.collection){ - this._indexByCollection[view.collection.cid] = viewCid; - } - // index by custom if (customIndex){ this._indexByCustom[customIndex] = viewCid; @@ -81,18 +75,16 @@ Backbone.ChildViewContainer = (function(Backbone, _){ }, // Find a view by the model that was attached to - // it. Uses the model's `cid` to find it, and - // retrieves the view by it's `cid` from the result + // it. Uses the model's `cid` to find it. findByModel: function(model){ - var viewCid = this._indexByModel[model.cid]; - return this.findByCid(viewCid); + return this.findByModelCid(model.cid); }, - // Find a view by the collection that was attached to - // it. Uses the collection's `cid` to find it, and - // retrieves the view by it's `cid` from the result - findByCollection: function(col){ - var viewCid = this._indexByCollection[col.cid]; + // Find a view by the `cid` of the model that was attached to + // it. Uses the model's `cid` to find the view `cid` and + // retrieve the view using it. + findByModelCid: function(modelCid){ + var viewCid = this._indexByModel[modelCid]; return this.findByCid(viewCid); }, @@ -122,26 +114,13 @@ Backbone.ChildViewContainer = (function(Backbone, _){ delete this._indexByModel[view.model.cid]; } - // delete collection index - if (view.collection){ - delete this._indexByCollection[view.collection.cid]; - } - // delete custom index - var cust; - - for (var key in this._indexByCustom){ - if (this._indexByCustom.hasOwnProperty(key)){ - if (this._indexByCustom[key] === viewCid){ - cust = key; - break; - } + _.any(this._indexByCustom, function(cid, key) { + if (cid === viewCid) { + delete this._indexByCustom[key]; + return true; } - } - - if (cust){ - delete this._indexByCustom[cust]; - } + }, this); // remove the view from the container delete this._views[viewCid]; @@ -153,44 +132,24 @@ Backbone.ChildViewContainer = (function(Backbone, _){ // Call a method on every view in the container, // passing parameters to the call method one at a // time, like `function.call`. - call: function(method, args){ - args = Array.prototype.slice.call(arguments, 1); - this.apply(method, args); + call: function(method){ + this.apply(method, _.tail(arguments)); }, // Apply a method on every view in the container, // passing parameters to the call method one at a // time, like `function.apply`. apply: function(method, args){ - var view; - - // fix for IE < 9 - args = args || []; - - _.each(this._views, function(view, key){ + _.each(this._views, function(view){ if (_.isFunction(view[method])){ - view[method].apply(view, args); + view[method].apply(view, args || []); } }); - }, // Update the `.length` attribute on this container _updateLength: function(){ this.length = _.size(this._views); - }, - - // set up an initial list of views - _addInitialViews: function(views){ - if (!views){ return; } - - var view, i, - length = views.length; - - for (i=0; i