updated jslibraries

This commit is contained in:
Keivan Beigi 2013-07-24 17:41:19 -07:00
parent 478caf15f8
commit df705b79cf
3 changed files with 55 additions and 106 deletions

View File

@ -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;
}

View File

@ -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<length; i++){
view = views[i];
this.add(view);
}
}
});
@ -1418,7 +1377,13 @@ Marionette.View = Backbone.View.extend({
// A single item view implementation that contains code for rendering
// with underscore.js templates, serializing the view's model or collection,
// and calling several methods on extended views, such as `onRender`.
Marionette.ItemView = Marionette.View.extend({
Marionette.ItemView = Marionette.View.extend({
// Setting up the inheritance chain which allows changes to
// Marionette.View.prototype.constructor which allows overriding
constructor: function(){
Marionette.View.prototype.constructor.apply(this, slice(arguments));
},
// Serialize the model or collection for the view. If a model is
// found, `.toJSON()` is called. If a collection is found, `.toJSON()`
@ -1749,6 +1714,12 @@ Marionette.CollectionView = Marionette.View.extend({
// Extends directly from CollectionView and also renders an
// an item view as `modelView`, for the top leaf
Marionette.CompositeView = Marionette.CollectionView.extend({
// Setting up the inheritance chain which allows changes to
// Marionette.CollectionView.prototype.constructor which allows overriding
constructor: function(){
Marionette.CollectionView.prototype.constructor.apply(this, slice(arguments));
},
// Configured the initial events that the composite view
// binds to. Override this method to prevent the initial
@ -1893,7 +1864,7 @@ Marionette.Layout = Marionette.ItemView.extend({
this._firstRender = true;
this._initializeRegions(options);
Marionette.ItemView.call(this, options);
Marionette.ItemView.prototype.constructor.call(this, options);
},
// Layout's render will use the existing region objects the

View File

@ -1,5 +1,5 @@
/*
backbone-pageable 1.3.1
backbone-pageable 1.3.2
http://github.com/wyuenho/backbone-pageable
Copyright (c) 2013 Jimmy Yuen Ho Wong
@ -19,7 +19,7 @@
// Browser
else if (typeof _ !== "undefined" && typeof Backbone !== "undefined") {
var oldPageableCollection = Backbone.PageableCollection;
var PageableCollection = Backbone.PageableCollection = factory(_, Backbone);
var PageableCollection = factory(_, Backbone);
/**
__BROWSER ONLY__
@ -102,7 +102,7 @@
@class Backbone.PageableCollection
@extends Backbone.Collection
*/
var PageableCollection = Backbone.Collection.extend({
var PageableCollection = Backbone.PageableCollection = Backbone.Collection.extend({
/**
The container object to store all pagination states.
@ -615,12 +615,14 @@
var state = this.state;
var totalPages = ceil(state.totalRecords / pageSize);
var currentPage = max(state.firstPage,
floor(totalPages *
(state.firstPage ?
state.currentPage :
state.currentPage + 1) /
state.totalPages));
var currentPage = totalPages ?
max(state.firstPage,
floor(totalPages *
(state.firstPage ?
state.currentPage :
state.currentPage + 1) /
state.totalPages)) :
state.firstPage;
state = this.state = this._checkState(_extend({}, state, {
pageSize: pageSize,
@ -803,8 +805,8 @@
can be forced in client mode before resetting the current page. Under
infinite mode, if the index is less than the current page, a reset is
done as in client mode. If the index is greater than the current page
number, a fetch is made with the results **appended** to
#fullCollection. The current page will then be reset after fetching.
number, a fetch is made with the results **appended** to #fullCollection.
The current page will then be reset after fetching.
@param {number|string} index The page index to go to, or the page name to
look up from #links in infinite mode.
@ -926,9 +928,9 @@
is assumed to be the `first` URL. If `prev` or `next` is missing, it is
assumed to be `null`. An empty object hash must be returned if there are
no links found. If either the response or the header contains information
pertaining to the total number of records on the server,
#state.totalRecords must be set to that number. The default
implementation uses the `last` link from the header to calculate it.
pertaining to the total number of records on the server, #state.totalRecords
must be set to that number. The default implementation uses the `last`
link from the header to calculate it.
@param {*} resp The deserialized response body.
@param {Object} [options]
@ -1175,11 +1177,8 @@
if (v != null) data[kvp[0]] = v;
}
var fullCol = this.fullCollection, links = this.links;
if (mode != "server") {
var self = this;
var self = this, fullCol = this.fullCollection;
var success = options.success;
options.success = function (col, resp, opts) {
@ -1189,28 +1188,7 @@
else opts.silent = options.silent;
var models = col.models;
var currentPage = state.currentPage;
if (mode == "client") fullCol.reset(models, opts);
else if (links[currentPage]) { // refetching a page
var pageSize = state.pageSize;
var pageStart = (state.firstPage === 0 ?
currentPage :
currentPage - 1) * pageSize;
var fullModels = fullCol.models;
var head = fullModels.slice(0, pageStart);
var tail = fullModels.slice(pageStart + pageSize);
fullModels = head.concat(models).concat(tail);
var updateFunc = fullCol.set || fullCol.update;
// Must silent update and trigger reset later because the event
// sychronization handler is temporarily taken out during either add
// or remove, which Collection#set does, so the pageable collection
// will be out of sync if not silenced because adding will trigger
// the sychonization event handler
updateFunc.call(fullCol, fullModels, _extend({silent: true}, opts));
fullCol.trigger("reset", fullCol, opts);
}
// fetching new page
else fullCol.add(models, _extend({at: fullCol.length}, opts));
if (success) success(col, resp, opts);