marionette-rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,7 +17,7 @@ Add it to your Gemfile:
17
17
 
18
18
  group :assets do
19
19
  # Your other asset gems (sass-rails, coffee-rails, etc)
20
-
20
+
21
21
  gem 'marionette-rails'
22
22
  end
23
23
 
@@ -34,6 +34,13 @@ Or, if you are using pure javascript, add this to `app/assets/javascripts/applic
34
34
 
35
35
  The gem will mirror the [Backbone.Marionette](https://github.com/marionettejs/backbone.marionette) versioning scheme. That is, version 0.8.2.* of `marionette-rails` would vendor [Backbone.Marionette](https://github.com/marionettejs/backbone.marionette) v0.8.2.
36
36
 
37
+ ### Updating Backbone.Marionette
38
+
39
+ There are two rake tasks that aid with this process:
40
+
41
+ rake marionette:latest # => will fetch the latest Backbone.Marionette tag/SHA and print them
42
+ rake marionette:update # => will update the gem to the latest Backbone.Marionette js and update the gem version
43
+
37
44
  ## Contributing
38
45
 
39
46
  For bugs in [Backbone.Marionette](https://github.com/marionettejs/backbone.marionette) itself, head over to their [issue tracker](https://github.com/marionettejs/backbone.marionette/issues). If you have a question, post it at [StackOverflow under the `backbone.marionette` tag](http://stackoverflow.com/questions/tagged/backbone.marionette).
@@ -0,0 +1,5 @@
1
+ module Marionette
2
+ module Rails
3
+ VERSION = '1.0.1'
4
+ end
5
+ end
@@ -1,6 +1,6 @@
1
1
  // MarionetteJS (Backbone.Marionette)
2
2
  // ----------------------------------
3
- // v1.0.0
3
+ // v1.0.1
4
4
  //
5
5
  // Copyright (c)2013 Derick Bailey, Muted Solutions, LLC.
6
6
  // Distributed under MIT license
@@ -28,7 +28,7 @@
28
28
  // shut down child views.
29
29
 
30
30
  Backbone.ChildViewContainer = (function(Backbone, _){
31
-
31
+
32
32
  // Container Constructor
33
33
  // ---------------------
34
34
 
@@ -194,9 +194,9 @@ Backbone.ChildViewContainer = (function(Backbone, _){
194
194
  //
195
195
  // Mix in methods from Underscore, for iteration, and other
196
196
  // collection related features.
197
- var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
198
- 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
199
- 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
197
+ var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
198
+ 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
199
+ 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
200
200
  'last', 'without', 'isEmpty', 'pluck'];
201
201
 
202
202
  _.each(methods, function(method) {
@@ -231,14 +231,14 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){
231
231
 
232
232
  Wreqr.Handlers = (function(Backbone, _){
233
233
  "use strict";
234
-
234
+
235
235
  // Constructor
236
236
  // -----------
237
237
 
238
238
  var Handlers = function(options){
239
239
  this.options = options;
240
240
  this._wreqrHandlers = {};
241
-
241
+
242
242
  if (_.isFunction(this.initialize)){
243
243
  this.initialize(options);
244
244
  }
@@ -344,7 +344,7 @@ Wreqr.CommandStorage = (function(){
344
344
 
345
345
  // build the configuration
346
346
  commands = {
347
- command: commandName,
347
+ command: commandName,
348
348
  instances: []
349
349
  };
350
350
 
@@ -530,18 +530,18 @@ Marionette.getOption = function(target, optionName){
530
530
  // Trigger an event and a corresponding method name. Examples:
531
531
  //
532
532
  // `this.triggerMethod("foo")` will trigger the "foo" event and
533
- // call the "onFoo" method.
533
+ // call the "onFoo" method.
534
534
  //
535
535
  // `this.triggerMethod("foo:bar") will trigger the "foo:bar" event and
536
536
  // call the "onFooBar" method.
537
537
  Marionette.triggerMethod = (function(){
538
-
538
+
539
539
  // split the event name on the :
540
540
  var splitter = /(^|:)(\w)/gi;
541
541
 
542
542
  // take the event section ("section1:section2:section3")
543
543
  // and turn it in to uppercase name
544
- function getEventName(match, prefix, eventName) {
544
+ function getEventName(match, prefix, eventName) {
545
545
  return eventName.toUpperCase();
546
546
  }
547
547
 
@@ -610,8 +610,8 @@ Marionette.MonitorDOMRefresh = (function(){
610
610
  // Marionette.bindEntityEvents & unbindEntityEvents
611
611
  // ---------------------------
612
612
  //
613
- // These methods are used to bind/unbind a backbone "entity" (collection/model)
614
- // to methods on a target object.
613
+ // These methods are used to bind/unbind a backbone "entity" (collection/model)
614
+ // to methods on a target object.
615
615
  //
616
616
  // The first parameter, `target`, must have a `listenTo` method from the
617
617
  // EventBinder object.
@@ -621,7 +621,7 @@ Marionette.MonitorDOMRefresh = (function(){
621
621
  //
622
622
  // The third parameter is a hash of { "event:name": "eventHandler" }
623
623
  // configuration. Multiple handlers can be separated by a space. A
624
- // function can be supplied instead of a string handler name.
624
+ // function can be supplied instead of a string handler name.
625
625
 
626
626
  (function(Marionette){
627
627
  "use strict";
@@ -663,7 +663,7 @@ Marionette.MonitorDOMRefresh = (function(){
663
663
  target.stopListening(entity, evt, method, target);
664
664
  }
665
665
 
666
-
666
+
667
667
  // generic looping function
668
668
  function iterateEvents(target, entity, bindings, functionCallback, stringCallback){
669
669
  if (!entity || !bindings) { return; }
@@ -676,7 +676,7 @@ Marionette.MonitorDOMRefresh = (function(){
676
676
  // iterate the bindings and bind them
677
677
  _.each(bindings, function(methods, evt){
678
678
 
679
- // allow for a function as the handler,
679
+ // allow for a function as the handler,
680
680
  // or a list of event names as a string
681
681
  if (_.isFunction(methods)){
682
682
  functionCallback(target, entity, evt, methods);
@@ -686,7 +686,7 @@ Marionette.MonitorDOMRefresh = (function(){
686
686
 
687
687
  });
688
688
  }
689
-
689
+
690
690
  // Export Public API
691
691
  Marionette.bindEntityEvents = function(target, entity, bindings){
692
692
  iterateEvents(target, entity, bindings, bindToFunction, bindFromStrings);
@@ -713,7 +713,7 @@ Marionette.Callbacks = function(){
713
713
  _.extend(Marionette.Callbacks.prototype, {
714
714
 
715
715
  // Add a callback to be executed. Callbacks added here are
716
- // guaranteed to execute, even if they are added after the
716
+ // guaranteed to execute, even if they are added after the
717
717
  // `run` method is called.
718
718
  add: function(callback, contextOverride){
719
719
  this._callbacks.push({cb: callback, ctx: contextOverride});
@@ -724,8 +724,8 @@ _.extend(Marionette.Callbacks.prototype, {
724
724
  });
725
725
  },
726
726
 
727
- // Run all registered callbacks with the context specified.
728
- // Additional callbacks can be added after this has been run
727
+ // Run all registered callbacks with the context specified.
728
+ // Additional callbacks can be added after this has been run
729
729
  // and they will still be executed.
730
730
  run: function(options, context){
731
731
  this._deferred.resolve(context, options);
@@ -737,7 +737,7 @@ _.extend(Marionette.Callbacks.prototype, {
737
737
  var callbacks = this._callbacks;
738
738
  this._deferred = Marionette.$.Deferred();
739
739
  this._callbacks = [];
740
-
740
+
741
741
  _.each(callbacks, function(cb){
742
742
  this.add(cb.cb, cb.ctx);
743
743
  }, this);
@@ -774,7 +774,7 @@ _.extend(Marionette.Controller.prototype, Backbone.Events, {
774
774
  }
775
775
  });
776
776
 
777
- // Region
777
+ // Region
778
778
  // ------
779
779
  //
780
780
  // Manage the visual regions of your composite application. See
@@ -828,19 +828,19 @@ _.extend(Marionette.Region, {
828
828
  }
829
829
 
830
830
  var selector, RegionType;
831
-
831
+
832
832
  // get the selector for the region
833
-
833
+
834
834
  if (regionIsString) {
835
835
  selector = regionConfig;
836
- }
836
+ }
837
837
 
838
838
  if (regionConfig.selector) {
839
839
  selector = regionConfig.selector;
840
840
  }
841
841
 
842
842
  // get the type for the region
843
-
843
+
844
844
  if (regionIsType){
845
845
  RegionType = regionConfig;
846
846
  }
@@ -852,7 +852,7 @@ _.extend(Marionette.Region, {
852
852
  if (regionConfig.regionType) {
853
853
  RegionType = regionConfig.regionType;
854
854
  }
855
-
855
+
856
856
  // build the region instance
857
857
  var region = new RegionType({
858
858
  el: selector
@@ -941,8 +941,8 @@ _.extend(Marionette.Region.prototype, Backbone.Events, {
941
941
  delete this.currentView;
942
942
  },
943
943
 
944
- // Attach an existing view to the region. This
945
- // will not call `render` or `onShow` for the new view,
944
+ // Attach an existing view to the region. This
945
+ // will not call `render` or `onShow` for the new view,
946
946
  // and will not replace the current HTML for the `el`
947
947
  // of the region.
948
948
  attachView: function(view){
@@ -1007,6 +1007,8 @@ Marionette.RegionManager = (function(Marionette){
1007
1007
 
1008
1008
  if (isString || (isObject && hasSelector)){
1009
1009
  region = Marionette.Region.buildRegion(definition, Marionette.Region);
1010
+ } else if (_.isFunction(definition)){
1011
+ region = Marionette.Region.buildRegion(definition, Marionette.Region);
1010
1012
  } else {
1011
1013
  region = definition;
1012
1014
  }
@@ -1071,9 +1073,9 @@ Marionette.RegionManager = (function(Marionette){
1071
1073
  //
1072
1074
  // Mix in methods from Underscore, for iteration, and other
1073
1075
  // collection related features.
1074
- var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
1075
- 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
1076
- 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
1076
+ var methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',
1077
+ 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
1078
+ 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',
1077
1079
  'last', 'without', 'isEmpty', 'pluck'];
1078
1080
 
1079
1081
  _.each(methods, function(method) {
@@ -1098,7 +1100,7 @@ Marionette.TemplateCache = function(templateId){
1098
1100
  };
1099
1101
 
1100
1102
  // TemplateCache object-level methods. Manage the template
1101
- // caches from these method calls instead of creating
1103
+ // caches from these method calls instead of creating
1102
1104
  // your own TemplateCache instances
1103
1105
  _.extend(Marionette.TemplateCache, {
1104
1106
  templateCaches: {},
@@ -1121,7 +1123,7 @@ _.extend(Marionette.TemplateCache, {
1121
1123
  // are specified, clears all templates:
1122
1124
  // `clear()`
1123
1125
  //
1124
- // If arguments are specified, clears each of the
1126
+ // If arguments are specified, clears each of the
1125
1127
  // specified templates from the cache:
1126
1128
  // `clear("#t1", "#t2", "...")`
1127
1129
  clear: function(){
@@ -1161,7 +1163,7 @@ _.extend(Marionette.TemplateCache.prototype, {
1161
1163
  // Load a template from the DOM, by default. Override
1162
1164
  // this method to provide your own template retrieval
1163
1165
  // For asynchronous loading with AMD/RequireJS, consider
1164
- // using a template-loader plugin as described here:
1166
+ // using a template-loader plugin as described here:
1165
1167
  // https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs
1166
1168
  loadTemplate: function(templateId){
1167
1169
  var template = Marionette.$(templateId).html();
@@ -1219,7 +1221,7 @@ Marionette.View = Backbone.View.extend({
1219
1221
  },
1220
1222
 
1221
1223
  // import the "triggerMethod" to trigger events with corresponding
1222
- // methods if the method exists
1224
+ // methods if the method exists
1223
1225
  triggerMethod: Marionette.triggerMethod,
1224
1226
 
1225
1227
  // Get the template for this view
@@ -1281,7 +1283,7 @@ Marionette.View = Backbone.View.extend({
1281
1283
  return triggerEvents;
1282
1284
  },
1283
1285
 
1284
- // Overriding Backbone.View's delegateEvents to handle
1286
+ // Overriding Backbone.View's delegateEvents to handle
1285
1287
  // the `triggers`, `modelEvents`, and `collectionEvents` configuration
1286
1288
  delegateEvents: function(events){
1287
1289
  this._delegateDOMEvents(events);
@@ -1587,9 +1589,9 @@ Marionette.CollectionView = Marionette.View.extend({
1587
1589
  itemViewOptions = itemViewOptions.call(this, item, index);
1588
1590
  }
1589
1591
 
1590
- // build the view
1592
+ // build the view
1591
1593
  var view = this.buildItemView(item, ItemView, itemViewOptions);
1592
-
1594
+
1593
1595
  // set up the child view event forwarding
1594
1596
  this.addChildViewEventForwarding(view);
1595
1597
 
@@ -1749,7 +1751,7 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
1749
1751
  return itemView;
1750
1752
  },
1751
1753
 
1752
- // Serialize the collection for the view.
1754
+ // Serialize the collection for the view.
1753
1755
  // You can override the `serializeData` method in your own view
1754
1756
  // definition, to provide custom serialization for your view's data.
1755
1757
  serializeData: function(){
@@ -1773,7 +1775,7 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
1773
1775
  this.triggerBeforeRender();
1774
1776
  var html = this.renderModel();
1775
1777
  this.$el.html(html);
1776
- // the ui bindings is done here and not at the end of render since they
1778
+ // the ui bindings is done here and not at the end of render since they
1777
1779
  // will not be available until after the model is rendered, but should be
1778
1780
  // available before the collection is rendered.
1779
1781
  this.bindUIElements();
@@ -1858,7 +1860,7 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
1858
1860
  // Used for composite view management and sub-application areas.
1859
1861
  Marionette.Layout = Marionette.ItemView.extend({
1860
1862
  regionType: Marionette.Region,
1861
-
1863
+
1862
1864
  // Ensure the regions are available when the `initialize` method
1863
1865
  // is called.
1864
1866
  constructor: function (options) {
@@ -1866,7 +1868,7 @@ Marionette.Layout = Marionette.ItemView.extend({
1866
1868
 
1867
1869
  this._firstRender = true;
1868
1870
  this._initializeRegions(options);
1869
-
1871
+
1870
1872
  Marionette.ItemView.call(this, options);
1871
1873
  },
1872
1874
 
@@ -1881,11 +1883,11 @@ Marionette.Layout = Marionette.ItemView.extend({
1881
1883
  // reset the regions
1882
1884
  this._firstRender = false;
1883
1885
  } else if (this.isClosed){
1884
- // a previously closed layout means we need to
1886
+ // a previously closed layout means we need to
1885
1887
  // completely re-initialize the regions
1886
1888
  this._initializeRegions();
1887
1889
  } else {
1888
- // If this is not the first render call, then we need to
1890
+ // If this is not the first render call, then we need to
1889
1891
  // re-initializing the `el` for each region
1890
1892
  this._reInitializeRegions();
1891
1893
  }
@@ -1934,7 +1936,7 @@ Marionette.Layout = Marionette.ItemView.extend({
1934
1936
  },
1935
1937
 
1936
1938
  // Internal method to initialize the regions that have been defined in a
1937
- // `regions` attribute on this layout.
1939
+ // `regions` attribute on this layout.
1938
1940
  _initializeRegions: function (options) {
1939
1941
  var regions;
1940
1942
  this._initRegionManager();
@@ -1985,7 +1987,7 @@ Marionette.Layout = Marionette.ItemView.extend({
1985
1987
  //
1986
1988
  // Configure an AppRouter with `appRoutes`.
1987
1989
  //
1988
- // App routers can only take one `controller` object.
1990
+ // App routers can only take one `controller` object.
1989
1991
  // It is recommended that you divide your controller
1990
1992
  // objects in to smaller pieces of related functionality
1991
1993
  // and have multiple routers / controllers, instead of
@@ -2073,7 +2075,7 @@ _.extend(Marionette.Application.prototype, Backbone.Events, {
2073
2075
  this.triggerMethod("start", options);
2074
2076
  },
2075
2077
 
2076
- // Add regions to your app.
2078
+ // Add regions to your app.
2077
2079
  // Accepts a hash of named strings or Region objects
2078
2080
  // addRegions({something: "#someRegion"})
2079
2081
  // addRegions({something: Region.extend({el: "#someRegion"}) });
@@ -2278,7 +2280,7 @@ _.extend(Marionette.Module, {
2278
2280
  },
2279
2281
 
2280
2282
  _addModuleDefinition: function(parentModule, module, def, args){
2281
- var fn;
2283
+ var fn;
2282
2284
  var startWithParent;
2283
2285
 
2284
2286
  if (_.isFunction(def)){
@@ -2290,7 +2292,7 @@ _.extend(Marionette.Module, {
2290
2292
  // if an object is supplied
2291
2293
  fn = def.define;
2292
2294
  startWithParent = def.startWithParent;
2293
-
2295
+
2294
2296
  } else {
2295
2297
  // if nothing is supplied
2296
2298
  startWithParent = true;
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marionette-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Godfrey Chan
9
+ - Stafford Brunk
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -27,13 +28,15 @@ dependencies:
27
28
  - - ! '>='
28
29
  - !ruby/object:Gem::Version
29
30
  version: 3.1.0
30
- description: Vendors Backbone.Marionette for use with asset pipeline.
31
+ description: Vendors Backbone.Marionette for use with the asset pipeline.
31
32
  email:
32
33
  - godfreykfc@gmail.com
34
+ - stafford.brunk@gmail.com
33
35
  executables: []
34
36
  extensions: []
35
37
  extra_rdoc_files: []
36
38
  files:
39
+ - lib/marionette-rails/version.rb
37
40
  - lib/marionette-rails.rb
38
41
  - vendor/assets/javascripts/backbone.marionette.js
39
42
  - LICENSE