marionette-rails 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -30,4 +30,20 @@ Or, if you are using pure javascript, add this to `app/assets/javascripts/applic
30
30
 
31
31
  ## Versioning
32
32
 
33
- The gem will mirror the [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) versioning scheme. That is, version 0.8.2.* of `marionette-rails` would vendor [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) v0.8.2.
33
+ The gem will mirror the [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) versioning scheme. That is, version 0.8.2.* of `marionette-rails` would vendor [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) v0.8.2.
34
+
35
+ ## Contributing
36
+
37
+ For bugs in [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) itself, head over to their [issue tracker](https://github.com/derickbailey/backbone.marionette/issues). If you have a question, post it at [StackOverflow under the `backbone.marionette` tag](http://stackoverflow.com/questions/tagged/backbone.marionette).
38
+
39
+ For bugs in this gem distribution, use the [GitHub issue tracker](https://github.com/chancancode/marionette-rails/issues). If you could submit a pull request - that's even better!
40
+
41
+ ## Donations
42
+
43
+ If you're using Marionette and you're finding that it is saving you time and effort, then please consider donating to the upstream [Backbone.Marionette](https://github.com/derickbailey/backbone.marionette) project.
44
+
45
+ [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7SJHYWJ487SF4)
46
+
47
+ ## License
48
+
49
+ This library is distributed under the MIT license. Please see the LICENSE file.
@@ -1,4 +1,4 @@
1
- // Backbone.Marionette v0.8.2
1
+ // Backbone.Marionette v0.8.3
2
2
  //
3
3
  // Copyright (C)2012 Derick Bailey, Muted Solutions, LLC
4
4
  // Distributed Under MIT License
@@ -9,7 +9,7 @@
9
9
  Backbone.Marionette = (function(Backbone, _, $){
10
10
  var Marionette = {};
11
11
 
12
- Marionette.version = "0.8.2";
12
+ Marionette.version = "0.8.3";
13
13
 
14
14
  // Marionette.View
15
15
  // ---------------
@@ -696,55 +696,6 @@ Backbone.Marionette = (function(Backbone, _, $){
696
696
  this[region] = regionObj;
697
697
  }
698
698
  }
699
- },
700
-
701
- // Add modules to the application, providing direct
702
- // access to your applicaiton object, Backbone,
703
- // Marionette, jQuery and Underscore as parameters
704
- // to a callback function.
705
- module: function(moduleNames, moduleDefinition){
706
- var moduleName, module, moduleOverride;
707
- var parentModule = this;
708
- var moduleNames = moduleNames.split(".");
709
-
710
- // Loop through all the parts of the module definition
711
- var length = moduleNames.length;
712
- for(var i = 0; i < length; i++){
713
-
714
- // only run the module definition if this is the
715
- // last module in the chaing: "Foo.Bar.Baz" only
716
- // runs the module definition for the "Baz" module
717
- var defineModule = (i === length-1);
718
-
719
- // Get the module name, and check if it exists on
720
- // the current parent already
721
- moduleName = moduleNames[i];
722
- module = parentModule[moduleName];
723
-
724
- if (!module){
725
- // Create the module
726
- module = new Marionette.Application();
727
-
728
- // Build the module definition if this is the last
729
- // module specified in the . chain
730
- if (defineModule && moduleDefinition){
731
- moduleOverride = moduleDefinition(module, this, Backbone, Marionette, jQuery, _);
732
- // Override it if necessary
733
- if (moduleOverride){
734
- module = moduleOverride;
735
- }
736
- }
737
-
738
- // And attach it to the parent module
739
- parentModule[moduleName] = module;
740
- }
741
-
742
- // Reset the parent module so that the next child
743
- // in the list will be added to the correct parent
744
- parentModule = module;
745
- }
746
-
747
- return module;
748
699
  }
749
700
  });
750
701
 
@@ -966,6 +917,67 @@ Backbone.Marionette = (function(Backbone, _, $){
966
917
 
967
918
  };
968
919
 
920
+ // Modules
921
+ // -------
922
+
923
+ // The "Modules" object builds modules on an
924
+ // object that it is attached to. It should not be
925
+ // used on it's own, but should be attached to
926
+ // another object that will define modules.
927
+ Marionette.Modules = {
928
+
929
+ // Add modules to the application, providing direct
930
+ // access to your applicaiton object, Backbone,
931
+ // Marionette, jQuery and Underscore as parameters
932
+ // to a callback function.
933
+ module: function(moduleNames, moduleDefinition){
934
+ var moduleName, module, moduleOverride;
935
+ var parentModule = this;
936
+ var moduleNames = moduleNames.split(".");
937
+
938
+ // Loop through all the parts of the module definition
939
+ var length = moduleNames.length;
940
+ for(var i = 0; i < length; i++){
941
+ var isLastModuleInChain = (i === length-1);
942
+
943
+ // Get the module name, and check if it exists on
944
+ // the current parent already
945
+ moduleName = moduleNames[i];
946
+ module = parentModule[moduleName];
947
+
948
+ // Create a new module if we don't have one already
949
+ if (!module){
950
+ module = new Marionette.Application();
951
+ }
952
+
953
+ // Check to see if we need to run the definition
954
+ // for the module. Only run the definition if one
955
+ // is supplied, and if we're at the last segment
956
+ // of the "Module.Name" chain.
957
+ if (isLastModuleInChain && moduleDefinition){
958
+ moduleOverride = moduleDefinition(module, parentModule, Backbone, Marionette, jQuery, _);
959
+ // If we have a module override, use it instead.
960
+ if (moduleOverride){
961
+ module = moduleOverride;
962
+ }
963
+ }
964
+
965
+ // If the defined module is not what we are
966
+ // currently storing as the module, replace it
967
+ if (parentModule[moduleName] !== module){
968
+ parentModule[moduleName] = module;
969
+ }
970
+
971
+ // Reset the parent module so that the next child
972
+ // in the list will be added to the correct parent
973
+ parentModule = module;
974
+ }
975
+
976
+ // Return the last module in the definition chain
977
+ return module;
978
+ }
979
+ };
980
+
969
981
  // Helpers
970
982
  // -------
971
983
 
@@ -977,6 +989,9 @@ Backbone.Marionette = (function(Backbone, _, $){
977
989
  Marionette.Region.extend = extend;
978
990
  Marionette.Application.extend = extend;
979
991
 
992
+ // Copy the `modules` feature on to the `Application` object
993
+ Marionette.Application.prototype.module = Marionette.Modules.module;
994
+
980
995
  // Copy the features of `BindTo` on to these objects
981
996
  _.extend(Marionette.View.prototype, Marionette.BindTo);
982
997
  _.extend(Marionette.Application.prototype, Marionette.BindTo);
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.8.2
4
+ version: 0.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: