micro-rails 0.1.0.pre.alpha3 → 0.1.0.pre.alpha4
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.
- checksums.yaml +4 -4
- data/lib/micro/rails/version.rb +2 -2
- data/vendor/assets/javascripts/micro.js +35 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7568da37f76d162e043f25911d1eb83fbd36de3
|
4
|
+
data.tar.gz: 20e616e3455ee92e51d5eee8270d01a53aa3e6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f376271722ec63e6f7e6182d0e2f9bc0e4a13d4e392bd6e16c2fc3ae7a32674cbf8d872f5a2f65b1453c4d05c8edf7e16834313df3fbeca04452d7161442c8
|
7
|
+
data.tar.gz: 1341431fdf733c867051c4053417f35a47bee10feb9b2eb57649750206a5fd99e0774ca61d57229622a49747252a9d08cee8be133b9d5971f6674eda6d20bc44
|
data/lib/micro/rails/version.rb
CHANGED
@@ -59,7 +59,7 @@
|
|
59
59
|
Component = _this.component(name);
|
60
60
|
selector || (selector = Component.config.defaultSelector);
|
61
61
|
if (!selector) {
|
62
|
-
throw new Error('you must provide a selector or define defaultSelector in the component configuration');
|
62
|
+
throw new Error('you must provide a selector or define' + ' defaultSelector in the component configuration');
|
63
63
|
}
|
64
64
|
_this._initialize.push(function() {
|
65
65
|
Component.initialize(this.filter(selector), config);
|
@@ -231,7 +231,7 @@
|
|
231
231
|
} else if (prototype instanceof Module) {
|
232
232
|
return this._addModule(Unit);
|
233
233
|
} else {
|
234
|
-
throw new Error(
|
234
|
+
throw new Error('the unit must be a module or a component');
|
235
235
|
}
|
236
236
|
};
|
237
237
|
|
@@ -265,10 +265,10 @@
|
|
265
265
|
Unit.extend = function(options) {
|
266
266
|
var Child, Parent;
|
267
267
|
if (!options.namespace) {
|
268
|
-
throw new Error(
|
268
|
+
throw new Error('you must provide a namespace when creating a component');
|
269
269
|
}
|
270
270
|
if (!options.label) {
|
271
|
-
throw new Error(
|
271
|
+
throw new Error('you must provide a name when creating a component');
|
272
272
|
}
|
273
273
|
if (!options.label.match(this.labelFormat)) {
|
274
274
|
throw new Error(options.label + " is not a valid component name");
|
@@ -446,7 +446,7 @@
|
|
446
446
|
if (this._modules[Module.fullName()]) {
|
447
447
|
throw new Error("module " + Module.namespace + "." + Module.label + " is already included");
|
448
448
|
}
|
449
|
-
this._modules[Module.
|
449
|
+
this._modules[Module.fullName()] = Module;
|
450
450
|
return Module.included(this);
|
451
451
|
};
|
452
452
|
|
@@ -525,7 +525,7 @@
|
|
525
525
|
};
|
526
526
|
|
527
527
|
function Component(_at_$el, config) {
|
528
|
-
var Module, components, factory,
|
528
|
+
var Module, components, factory, moduleName, name, _ref;
|
529
529
|
this.$el = _at_$el;
|
530
530
|
factory = this.constructor.namespace.factory;
|
531
531
|
components = factory.data(this.$el, 'components') || {};
|
@@ -540,27 +540,27 @@
|
|
540
540
|
this._dataFull = $();
|
541
541
|
this._dataNames = [];
|
542
542
|
Component.__super__.constructor.call(this, config);
|
543
|
-
this._moduleInstances =
|
543
|
+
this._moduleInstances = {};
|
544
544
|
_ref = this.constructor._modules;
|
545
|
-
for (
|
546
|
-
Module = _ref[
|
547
|
-
this._moduleInstances
|
545
|
+
for (moduleName in _ref) {
|
546
|
+
Module = _ref[moduleName];
|
547
|
+
this._moduleInstances[moduleName] = new Module(this, this.config);
|
548
548
|
}
|
549
549
|
}
|
550
550
|
|
551
551
|
Component.prototype.destroy = function() {
|
552
|
-
var components, dataName, factory, moduleInstance,
|
552
|
+
var components, dataName, factory, moduleInstance, moduleName, _i, _len, _ref, _ref1;
|
553
553
|
Component.__super__.destroy.apply(this, arguments);
|
554
554
|
_ref = this._moduleInstances;
|
555
|
-
for (
|
556
|
-
moduleInstance = _ref[
|
555
|
+
for (moduleName in _ref) {
|
556
|
+
moduleInstance = _ref[moduleName];
|
557
557
|
moduleInstance.destroy();
|
558
558
|
}
|
559
559
|
factory = this.constructor.namespace.factory;
|
560
560
|
this._listeners.off("." + this._uniqueId);
|
561
561
|
_ref1 = this._dataNames;
|
562
|
-
for (
|
563
|
-
dataName = _ref1[
|
562
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
563
|
+
dataName = _ref1[_i];
|
564
564
|
factory.removeData(this._dataFull, dataName);
|
565
565
|
}
|
566
566
|
components = factory.data(this.$el, 'components');
|
@@ -622,9 +622,11 @@
|
|
622
622
|
};
|
623
623
|
|
624
624
|
Component.prototype.trigger = function() {
|
625
|
-
var eventType, namespace, params, _ref;
|
625
|
+
var componentLabel, eventType, namespace, namespaceLabel, params, _ref;
|
626
626
|
eventType = arguments[0], params = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
627
|
-
|
627
|
+
namespaceLabel = this.constructor.namespace.label.toLowerCase();
|
628
|
+
componentLabel = this.constructor.label.toLowerCase();
|
629
|
+
namespace = namespaceLabel + ":" + componentLabel;
|
628
630
|
return (_ref = this.$el).trigger.apply(_ref, [namespace + ":" + eventType].concat(__slice.call(params)));
|
629
631
|
};
|
630
632
|
|
@@ -725,7 +727,22 @@
|
|
725
727
|
};
|
726
728
|
|
727
729
|
Module.included = function(Component) {
|
728
|
-
|
730
|
+
var extension, fullName, name, _ref, _results;
|
731
|
+
fullName = this.fullName();
|
732
|
+
_ref = this._extensions;
|
733
|
+
_results = [];
|
734
|
+
for (name in _ref) {
|
735
|
+
extension = _ref[name];
|
736
|
+
_results.push((function(extension) {
|
737
|
+
return Component.prototype[name] = function() {
|
738
|
+
var args, instance;
|
739
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
740
|
+
instance = this._moduleInstances[fullName];
|
741
|
+
return extension.apply(instance, args);
|
742
|
+
};
|
743
|
+
})(extension));
|
744
|
+
}
|
745
|
+
return _results;
|
729
746
|
};
|
730
747
|
|
731
748
|
function Module(_at_component, config) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.alpha4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérôme Guyon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|