Skip to content

Commit

Permalink
build v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Bailey committed Jul 10, 2013
1 parent 7a39a40 commit d03946f
Show file tree
Hide file tree
Showing 31 changed files with 73 additions and 118 deletions.
81 changes: 20 additions & 61 deletions lib/backbone.marionette.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

// Backbone.BabySitter
// -------------------
// v0.0.5
// v0.0.6
//
// Copyright (c)2013 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
},

Expand Down Expand Up @@ -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];
Expand All @@ -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);
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion lib/backbone.marionette.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions lib/backbone.marionette.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/amd/backbone.marionette.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/backbone.marionette.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions lib/core/backbone.marionette.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reports/coverage.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions reports/coverage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<h1>Code coverage report for <span class="entity">All files</span></h1>
<h2>

Statements: <span class="metric">98.28% <small>(628 / 639)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Statements: <span class="metric">98.28% <small>(630 / 641)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Branches: <span class="metric">93.94% <small>(217 / 231)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -192,7 +192,7 @@ <h2>
Functions: <span class="metric">98.8% <small>(164 / 166)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Lines: <span class="metric">98.87% <small>(610 / 617)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">98.87% <small>(612 / 619)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;

</h2>
<div class="path"></div>
Expand Down Expand Up @@ -231,34 +231,34 @@ <h2>
<td class="file high" data-value="src/"><a href="src/index.html">src/</a></td>
<td data-value="98.26" class="pic high"><span class="cover-fill" style="width: 98px;"></span><span class="cover-empty" style="width:2px;"></span></td>
<td data-value="98.26" class="pct high">98.26%</td>
<td data-value="633" class="abs high">(622&nbsp;/&nbsp;633)</td>
<td data-value="634" class="abs high">(623&nbsp;/&nbsp;634)</td>
<td data-value="93.94" class="pct high">93.94%</td>
<td data-value="231" class="abs high">(217&nbsp;/&nbsp;231)</td>
<td data-value="98.79" class="pct high">98.79%</td>
<td data-value="165" class="abs high">(163&nbsp;/&nbsp;165)</td>
<td data-value="98.85" class="pct high">98.85%</td>
<td data-value="611" class="abs high">(604&nbsp;/&nbsp;611)</td>
<td data-value="98.86" class="pct high">98.86%</td>
<td data-value="612" class="abs high">(605&nbsp;/&nbsp;612)</td>
</tr>

<tr>
<td class="file high" data-value="src/build/"><a href="src/build/index.html">src/build/</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">(5&nbsp;/&nbsp;5)</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">(5&nbsp;/&nbsp;5)</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
</tr>

</tbody>
</table>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion reports/coverage/spec/javascripts/support/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ <h2>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h2>

</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../../../prettify.js"></script>
Expand Down
10 changes: 5 additions & 5 deletions reports/coverage/src/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<h1>Code coverage report for <span class="entity">src/build/</span></h1>
<h2>

Statements: <span class="metric">100% <small>(5 / 5)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Statements: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -192,7 +192,7 @@ <h2>
Functions: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Lines: <span class="metric">100% <small>(5 / 5)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;

</h2>
<div class="path"><a href="../../index.html">All files</a> &#187; src/build/</div>
Expand All @@ -218,21 +218,21 @@ <h2>
<td class="file high" data-value="marionette.core.js"><a href="marionette.core.js.html">marionette.core.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">(5&nbsp;/&nbsp;5)</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">(5&nbsp;/&nbsp;5)</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
</tr>

</tbody>
</table>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../../prettify.js"></script>
Expand Down
8 changes: 4 additions & 4 deletions reports/coverage/src/build/marionette.core.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<h1>Code coverage report for <span class="entity">src/build/marionette.core.js</span></h1>
<h2>

Statements: <span class="metric">100% <small>(5 / 5)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Statements: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -192,7 +192,7 @@ <h2>
Functions: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Lines: <span class="metric">100% <small>(5 / 5)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;

</h2>
<div class="path"><a href="../../index.html">All files</a> &#187; <a href="index.html">src/build/</a> &#187; marionette.core.js</div>
Expand Down Expand Up @@ -236,7 +236,7 @@ <h2>
35
36
37</td><td class="line-coverage"><span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
Expand Down Expand Up @@ -312,7 +312,7 @@ <h2>

</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../../prettify.js"></script>
Expand Down
10 changes: 5 additions & 5 deletions reports/coverage/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<h1>Code coverage report for <span class="entity">src/</span></h1>
<h2>

Statements: <span class="metric">98.26% <small>(622 / 633)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Statements: <span class="metric">98.26% <small>(623 / 634)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Branches: <span class="metric">93.94% <small>(217 / 231)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -192,7 +192,7 @@ <h2>
Functions: <span class="metric">98.79% <small>(163 / 165)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;


Lines: <span class="metric">98.85% <small>(604 / 611)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">98.86% <small>(605 / 612)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;

</h2>
<div class="path"><a href="../index.html">All files</a> &#187; src/</div>
Expand Down Expand Up @@ -244,13 +244,13 @@ <h2>
<td class="file high" data-value="marionette.bindEntityEvents.js"><a href="marionette.bindEntityEvents.js.html">marionette.bindEntityEvents.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="30" class="abs high">(30&nbsp;/&nbsp;30)</td>
<td data-value="31" class="abs high">(31&nbsp;/&nbsp;31)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="10" class="abs high">(10&nbsp;/&nbsp;10)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="11" class="abs high">(11&nbsp;/&nbsp;11)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="29" class="abs high">(29&nbsp;/&nbsp;29)</td>
<td data-value="30" class="abs high">(30&nbsp;/&nbsp;30)</td>
</tr>

<tr>
Expand Down Expand Up @@ -453,7 +453,7 @@ <h2>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion reports/coverage/src/marionette.application.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ <h2>

</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion reports/coverage/src/marionette.approuter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ <h2>

</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jun 30 2013 00:32:56 GMT-0400 (EDT)</div>
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jul 10 2013 10:32:43 GMT-0500 (CDT)</div>
</div>

<script src="../prettify.js"></script>
Expand Down
Loading

0 comments on commit d03946f

Please sign in to comment.