This repository has been archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Needed support for version that was tested against this specific LoDash version
- Loading branch information
Showing
155 changed files
with
65,980 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "backtree", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/timc3/backtree", | ||
"authors": [ | ||
"Tim Child <[email protected]>" | ||
|
@@ -23,8 +23,8 @@ | |
], | ||
"dependencies": { | ||
"jquery": ">=1.7.2", | ||
"lodash": "1.0.0-rc.3", | ||
"backbone": ">=0.9.10", | ||
"backbone.babysitter": "0.0.4" | ||
"backbone.babysitter": "0.0.4", | ||
"lodash": "1.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "backbone.babysitter", | ||
"homepage": "https://github.com/marionettejs/backbone.babysitter", | ||
"version": "0.0.4", | ||
"_release": "0.0.4", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v0.0.4", | ||
"commit": "ce579d6758e4dd831391385e237f313d6b9f65bb" | ||
}, | ||
"_source": "git://github.com/marionettejs/backbone.babysitter.git", | ||
"_target": "0.0.4", | ||
"_originalSource": "backbone.babysitter" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.DS_Store | ||
*.swp | ||
*.swo | ||
node_modules | ||
_SpecRunner.html | ||
.idea | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Change log | ||
|
||
### v0.0.4 | ||
|
||
* Added a fix for IE < 9, when applying a function to the views | ||
* Added `.pluck` as a method, from Underscore.js | ||
* Can specify an array of views to the container constructor | ||
|
||
### v0.0.3 | ||
|
||
* Added iterators and other collection processing functions from Underscore.js | ||
|
||
### v0.0.2 | ||
|
||
* Added `.length` attribute | ||
* Added `.findByIndx` method | ||
|
||
### v0.0.1 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Backbone.BabySitter | ||
|
||
Copyright (C)2012 Derick Bailey, Muted Solutions, LLC | ||
|
||
Distributed Under [MIT License](http://mutedsolutions.mit-license.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/*global module:false*/ | ||
module.exports = function(grunt) { | ||
|
||
grunt.loadNpmTasks('grunt-rigger'); | ||
grunt.loadNpmTasks('grunt-jasmine-runner'); | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
meta: { | ||
version: '0.0.4', | ||
banner: '// Backbone.BabySitter, v<%= meta.version %>\n' + | ||
'// Copyright (c)<%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' + | ||
'// Distributed under MIT license\n' + | ||
'// http://github.com/marionettejs/backbone.babysitter' | ||
}, | ||
|
||
lint: { | ||
files: ['src/childviewcontainer.js'] | ||
}, | ||
|
||
rig: { | ||
build: { | ||
src: ['<banner:meta.banner>', 'src/childviewcontainer.js'], | ||
dest: 'lib/backbone.babysitter.js' | ||
}, | ||
amd: { | ||
src: ['<banner:meta.banner>', 'src/amd.js'], | ||
dest: 'lib/amd/backbone.babysitter.js' | ||
} | ||
}, | ||
|
||
min: { | ||
standard: { | ||
src: ['<banner:meta.banner>', '<config:rig.build.dest>'], | ||
dest: 'lib/backbone.babysitter.min.js' | ||
}, | ||
amd: { | ||
src: ['<banner:meta.banner>', '<config:rig.amd.dest>'], | ||
dest: 'lib/amd/backbone.babysitter.min.js' | ||
}, | ||
}, | ||
|
||
jasmine : { | ||
src : [ | ||
'public/javascripts/json2.js', | ||
'public/javascripts/jquery.js', | ||
'public/javascripts/underscore.js', | ||
'public/javascripts/backbone.js', | ||
'src/childviewcontainer.js', | ||
], | ||
helpers : 'spec/javascripts/helpers/*.js', | ||
specs : 'spec/javascripts/**/*.spec.js' | ||
}, | ||
|
||
'jasmine-server' : { | ||
browser : false | ||
}, | ||
|
||
jshint: { | ||
options: { | ||
curly: true, | ||
eqeqeq: true, | ||
immed: false, | ||
latedef: true, | ||
newcap: true, | ||
noarg: true, | ||
sub: true, | ||
undef: true, | ||
boss: true, | ||
eqnull: true, | ||
browser: true | ||
}, | ||
globals: { | ||
jQuery: true, | ||
Backbone: true, | ||
_: true, | ||
BabySitter: true, | ||
$: true | ||
} | ||
}, | ||
uglify: {} | ||
}); | ||
|
||
// Default task. | ||
grunt.registerTask('default', 'lint rig min'); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
// Backbone.BabySitter, v0.0.4 | ||
// Copyright (c)2012 Derick Bailey, Muted Solutions, LLC. | ||
// Distributed under MIT license | ||
// http://github.com/marionettejs/backbone.babysitter | ||
(function (root, factory) { | ||
if (typeof exports === 'object') { | ||
|
||
var underscore = require('underscore'); | ||
var backbone = require('backbone'); | ||
|
||
module.exports = factory(underscore, backbone); | ||
|
||
} else if (typeof define === 'function' && define.amd) { | ||
|
||
define(['underscore', 'backbone'], factory); | ||
|
||
} | ||
}(this, function (_, Backbone) { | ||
"option strict"; | ||
|
||
// Backbone.ChildViewContainer | ||
// --------------------------- | ||
// | ||
// Provide a container to store, retrieve and | ||
// shut down child views. | ||
|
||
Backbone.ChildViewContainer = (function(Backbone, _){ | ||
|
||
// Container Constructor | ||
// --------------------- | ||
|
||
var Container = function(initialViews){ | ||
this._views = {}; | ||
this._indexByModel = {}; | ||
this._indexByCollection = {}; | ||
this._indexByCustom = {}; | ||
this._updateLength(); | ||
|
||
this._addInitialViews(initialViews); | ||
}; | ||
|
||
// Container Methods | ||
// ----------------- | ||
|
||
_.extend(Container.prototype, { | ||
|
||
// 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 | ||
// a custom key to store an retrieve the view. | ||
add: function(view, customIndex){ | ||
var viewCid = view.cid; | ||
|
||
// store the view | ||
this._views[viewCid] = view; | ||
|
||
// index it by model | ||
if (view.model){ | ||
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; | ||
} | ||
|
||
this._updateLength(); | ||
}, | ||
|
||
// 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 | ||
findByModel: function(model){ | ||
var viewCid = this._indexByModel[model.cid]; | ||
return this.findByCid(viewCid); | ||
}, | ||
|
||
// 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]; | ||
return this.findByCid(viewCid); | ||
}, | ||
|
||
// Find a view by a custom indexer. | ||
findByCustom: function(index){ | ||
var viewCid = this._indexByCustom[index]; | ||
return this.findByCid(viewCid); | ||
}, | ||
|
||
// Find by index. This is not guaranteed to be a | ||
// stable index. | ||
findByIndex: function(index){ | ||
return _.values(this._views)[index]; | ||
}, | ||
|
||
// retrieve a view by it's `cid` directly | ||
findByCid: function(cid){ | ||
return this._views[cid]; | ||
}, | ||
|
||
// Remove a view | ||
remove: function(view){ | ||
var viewCid = view.cid; | ||
|
||
// delete model index | ||
if (view.model){ | ||
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; | ||
} | ||
} | ||
} | ||
|
||
if (cust){ | ||
delete this._indexByCustom[cust]; | ||
} | ||
|
||
// remove the view from the container | ||
delete this._views[viewCid]; | ||
|
||
// update the length | ||
this._updateLength(); | ||
}, | ||
|
||
// 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); | ||
}, | ||
|
||
// 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){ | ||
if (_.isFunction(view[method])){ | ||
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); | ||
} | ||
} | ||
}); | ||
|
||
// Borrowing this code from Backbone.Collection: | ||
// http://backbonejs.org/docs/backbone.html#section-106 | ||
// | ||
// Mix in methods from Underscore, for iteration, and other | ||
// collection related features. | ||
var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter', | ||
'select', 'reject', 'every', 'all', 'some', 'any', 'include', | ||
'contains', 'invoke', 'toArray', 'first', 'initial', 'rest', | ||
'last', 'without', 'isEmpty', 'pluck']; | ||
|
||
_.each(methods, function(method) { | ||
Container.prototype[method] = function() { | ||
var views = _.values(this._views); | ||
var args = [views].concat(_.toArray(arguments)); | ||
return _[method].apply(_, args); | ||
}; | ||
}); | ||
|
||
// return the public API | ||
return Container; | ||
})(Backbone, _); | ||
|
||
return Backbone.ChildViewContainer; | ||
|
||
})); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.