marionette-rails 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
|
|
1
|
-
// Backbone.Marionette v0.9.
|
1
|
+
// Backbone.Marionette v0.9.2
|
2
2
|
//
|
3
3
|
// Copyright (C)2012 Derick Bailey, Muted Solutions, LLC
|
4
4
|
// Distributed Under MIT License
|
@@ -279,6 +279,7 @@ Marionette.CollectionView = Marionette.View.extend({
|
|
279
279
|
// and events
|
280
280
|
triggerBeforeRender: function(){
|
281
281
|
if (this.beforeRender) { this.beforeRender(); }
|
282
|
+
this.trigger("before:render", this);
|
282
283
|
this.trigger("collection:before:render", this);
|
283
284
|
},
|
284
285
|
|
@@ -286,6 +287,7 @@ Marionette.CollectionView = Marionette.View.extend({
|
|
286
287
|
// events
|
287
288
|
triggerRendered: function(){
|
288
289
|
if (this.onRender) { this.onRender(); }
|
290
|
+
this.trigger("render", this);
|
289
291
|
this.trigger("collection:rendered", this);
|
290
292
|
},
|
291
293
|
|
@@ -503,6 +505,8 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
|
|
503
505
|
render: function(){
|
504
506
|
var that = this;
|
505
507
|
|
508
|
+
this.resetItemViewContainer();
|
509
|
+
|
506
510
|
var html = this.renderModel();
|
507
511
|
this.$el.html(html);
|
508
512
|
this.trigger("composite:model:rendered");
|
@@ -527,6 +531,39 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
|
|
527
531
|
|
528
532
|
var template = this.getTemplate();
|
529
533
|
return Marionette.Renderer.render(template, data);
|
534
|
+
},
|
535
|
+
|
536
|
+
// Appends the `el` of itemView instances to the specified
|
537
|
+
// `itemViewContainer` (a jQuery selector). Override this method to
|
538
|
+
// provide custom logic of how the child item view instances have their
|
539
|
+
// HTML appended to the composite view instance.
|
540
|
+
appendHtml: function(cv, iv){
|
541
|
+
var $container = this.getItemViewContainer(cv, this.itemViewContainer);
|
542
|
+
$container.append(iv.el);
|
543
|
+
},
|
544
|
+
|
545
|
+
// Internal method to ensure an `$itemViewContainer` exists, for the
|
546
|
+
// `appendHtml` method to use.
|
547
|
+
getItemViewContainer: function(containerView, itemViewContainer){
|
548
|
+
var container;
|
549
|
+
if ("$itemViewContainer" in containerView){
|
550
|
+
container = containerView.$itemViewContainer;
|
551
|
+
} else {
|
552
|
+
if (containerView.itemViewContainer){
|
553
|
+
container = containerView.$(itemViewContainer);
|
554
|
+
} else {
|
555
|
+
container = containerView.$el;
|
556
|
+
}
|
557
|
+
containerView.$itemViewContainer = container;
|
558
|
+
}
|
559
|
+
return container;
|
560
|
+
},
|
561
|
+
|
562
|
+
// Internal method to reset the `$itemViewContainer` on render
|
563
|
+
resetItemViewContainer: function(){
|
564
|
+
if (this.$itemViewContainer){
|
565
|
+
delete this.$itemViewContainer;
|
566
|
+
}
|
530
567
|
}
|
531
568
|
});
|
532
569
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marionette-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|