ende 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d3e887331f74d6f58ae8e9b7473a1838d24afbb
4
- data.tar.gz: af61742f11d9872e8798ed14c0721fac12047c77
3
+ metadata.gz: c15447034d52dc8068994d183579def24eb1bf8c
4
+ data.tar.gz: cd61b314b42387239996caa53425988ca0319781
5
5
  SHA512:
6
- metadata.gz: 76a1c2de29d53dc9fd330eca47cbd28499ed70cc7fd1f1205a2f827ecc90efea1cc1604ea43088802b7ad4e125c76f5bca482436b723d613951389dfc8025148
7
- data.tar.gz: b4224e35da26b7ec86338dfe6d9d8f6201a329fe7481b299c635f6c0373b648e9f720e3a7940aa4ea70bd9ea1c29de9aa79480ac8649e499862251dee7036da0
6
+ metadata.gz: 3917492bbffd9e1501097cd1a7034d8f519192e2fa7a7452fd727a0634da8ae658be8eb2da9388607b401575cce8984e9a6049e0e524ec7ea50dfcc82e1df2d3
7
+ data.tar.gz: e18c60a2973c4c58c7ac97d1f4f8bd25f320a00189dc2f07c9bba3300a26f5897ceb0393eb0dc3671b7256653377d951b6f3a3760bc42f2506c609260f41fd5a
data/component.json CHANGED
@@ -22,14 +22,11 @@
22
22
  "scripts": [
23
23
  "vendor/assets/javascripts/lennon/lennon.js",
24
24
  "vendor/assets/javascripts/stampit/stampit.js",
25
-
26
25
  "vendor/assets/javascripts/spin/spin.js",
27
-
28
26
  "vendor/assets/javascripts/jquery/inview.js",
29
27
  "vendor/assets/javascripts/jquery/inputmask.js",
30
28
  "vendor/assets/javascripts/jquery/inputmask.extensions.js",
31
29
  "vendor/assets/javascripts/jquery/inputmask.numeric.extensions.js",
32
-
33
30
  "vendor/assets/javascripts/polyfills/es5-shim.js",
34
31
  "vendor/assets/javascripts/polyfills/es6-map-shim.js"
35
32
  ],
@@ -40,4 +37,4 @@
40
37
  "vendor/assets/javascripts"
41
38
  ],
42
39
  "license": "MIT"
43
- }
40
+ }
@@ -13,8 +13,8 @@ define 'aura/extensions/rivets', ['aura/extensions/rivets/formatters'], (formatt
13
13
  with_component = 'indefinido-observable/lib/adapters/rivets'
14
14
  observable_configuration = require with_component
15
15
 
16
- with_component = 'segmentio-extend'
17
- extend = require with_component
16
+ with_component = 'segmentio-extend'
17
+ extend = require with_component
18
18
 
19
19
  extend rivets.formatters, formatters
20
20
 
@@ -29,6 +29,7 @@ define 'aura/extensions/states', ['application/states'], (states) ->
29
29
  dom.find('html').addClass state.current
30
30
 
31
31
  # Application flow control
32
+ # TODO think of a more specific name, like a machine!
32
33
  flow =
33
34
 
34
35
  changed: (transition) ->
@@ -73,7 +74,7 @@ define 'aura/extensions/states', ['application/states'], (states) ->
73
74
  logger.error "states.flow.failed: Failed autostarting widget! \n Message: #{exception.message}", exception
74
75
 
75
76
 
76
- version: '0.2.3'
77
+ version: '0.2.4'
77
78
 
78
79
  initialize: (application) ->
79
80
  mediator.on 'state.change' , state.change
@@ -124,4 +125,13 @@ define 'aura/extensions/states', ['application/states'], (states) ->
124
125
 
125
126
  get: -> state.current
126
127
 
127
- afterAppStart: (application) -> application.state = "default"
128
+ afterAppStart: (application) ->
129
+ # TODO Change the application to default state in flows extension
130
+ if (application.startOptions.widgets)
131
+ application.state = "default"
132
+ else
133
+ current_start = application.core.start
134
+ application.core.start = ->
135
+ application.state = "default"
136
+ application.core.start = current_start
137
+ current_start.apply @, arguments
@@ -1,17 +1,11 @@
1
1
  root = exports ? this
2
2
 
3
- # Prevent aura from defining jquery erroniously
4
- define 'jquery' , ['config/load_components'], -> require 'component-jquery'
5
- define 'modernizr' , ['config/load_components'], -> require 'modernizr'
6
- # TODO define 'underscore', ['config/load_components'], -> require 'lodash'
7
-
8
- # TODO figure out how to use rjs optmizer to include component builds
9
- # Use call method to avoid optmization at all
10
- define 'ende_components', ['ende_build'], {}
11
- define 'application_components', ['ende_components', 'build'], {}
12
-
13
3
  requirejs.config
14
4
  shim:
5
+ 'jquery.ujs':
6
+ deps: ['jquery', 'config/load_components']
7
+ exports: 'jQuery.rails'
8
+
15
9
  build:
16
10
  # FIXME check that the build was loaded in a more elegant way
17
11
  # probably create a undefined plug-in for component builder
@@ -20,6 +14,21 @@ requirejs.config
20
14
  ende_build:
21
15
  exports: 'require.register'
22
16
 
17
+ paths:
18
+ 'jquery.ujs': 'jquery_ujs'
19
+
20
+ # Prevent aura from defining jquery erroniously
21
+ define 'jquery' , ['config/load_components'], ->
22
+ window.jQuery = window.$ = require 'component-jquery'
23
+
24
+ define 'modernizr' , ['config/load_components'], -> require 'modernizr'
25
+ # TODO define 'underscore', ['config/load_components'], -> require 'lodash'
26
+
27
+ # TODO figure out how to use rjs optmizer to include component builds
28
+ # Use call method to avoid optmization at all
29
+ define 'ende_components', ['ende_build'], {}
30
+ define 'application_components', ['ende_components', 'build'], {}
31
+
23
32
  # In order to start, application and ende components must be loaded
24
33
  define 'config/load_components', ['application_components'], ->
25
34
 
@@ -1,7 +1,7 @@
1
1
  # TODO think if require jquery and jquery inview in this place is actualy a good idead
2
2
 
3
3
  # TODO use requirejs alias / packing modules definition for this
4
- define 'ende', ['config/load_components', 'config/initializers'], ->
4
+ define 'ende', ['config/load_components', 'config/initializers', 'jquery.ujs'], ->
5
5
 
6
6
  # Override defaults components definition
7
7
  # TODO better way to forward component modules to application
data/lib/ende/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ende
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -20246,230 +20246,218 @@ module.exports = composed;
20246
20246
 
20247
20247
  });
20248
20248
  require.register("indefinido-indemma/lib/record/validatable.js", function(exports, require, module){
20249
- var errorsable, extensions, initializers, manager, messages, observable, root, stampit, type;
20249
+ (function() {
20250
+ var errorsable, extensions, initializers, manager, messages, observable, root, stampit, type;
20250
20251
 
20251
- require('./translationable');
20252
+ require('./translationable');
20252
20253
 
20253
- root = typeof exports !== "undefined" && exports !== null ? exports : this;
20254
+ root = typeof exports !== "undefined" && exports !== null ? exports : this;
20254
20255
 
20255
- stampit = require('../../vendor/stampit');
20256
+ stampit = require('../../vendor/stampit');
20256
20257
 
20257
- observable = require('observable').mixin;
20258
+ observable = require('observable').mixin;
20258
20259
 
20259
- type = require('type');
20260
-
20261
- messages = {
20262
- blank: function(attribute_name) {
20263
- attribute_name = this.human_attribute_name(attribute_name);
20264
- return "O campo " + attribute_name + " não pode ficar em branco.";
20265
- },
20266
- cpf: function(attribute_name) {
20267
- attribute_name = this.human_attribute_name(attribute_name);
20268
- return "O campo " + attribute_name + " não está válido.";
20269
- },
20270
- confirmation: function(attribute_name) {
20271
- var confirmation_attribute_name;
20260
+ type = require('type');
20272
20261
 
20273
- confirmation_attribute_name = this.human_attribute_name(attribute_name);
20274
- attribute_name = this.human_attribute_name(attribute_name.replace('_confirmation', ''));
20275
- return "O campo " + attribute_name + " não está de acordo com o campo " + confirmation_attribute_name + ".";
20276
- },
20277
- associated: function(attribute_name) {
20278
- attribute_name = this.human_attribute_name(attribute_name);
20279
- return "O registro associado " + attribute_name + " não é válido.";
20280
- },
20281
- server: function(attribute_name, options) {
20282
- if (attribute_name === 'base') {
20283
- return options.server_message;
20284
- } else {
20262
+ messages = {
20263
+ blank: function(attribute_name) {
20285
20264
  attribute_name = this.human_attribute_name(attribute_name);
20286
- return "" + attribute_name + " " + options.server_message + ".";
20287
- }
20288
- },
20289
- type: function(attribute_name, options) {
20290
- attribute_name = this.human_attribute_name(attribute_name);
20291
- return "O campo " + attribute_name + " não está válido.";
20292
- }
20293
- };
20294
-
20295
- errorsable = stampit({
20296
- add: function(attribute_name, message_key, options) {
20297
- var translator;
20298
-
20299
- this.push([attribute_name, message_key, options]);
20300
- this.messages[attribute_name] = '';
20301
- translator = messages[message_key];
20302
- if (translator != null) {
20303
- return this.messages[attribute_name] += translator.call(this.model, attribute_name, options);
20304
- } else {
20305
- return this.messages[attribute_name] += message_key;
20306
- }
20307
- },
20308
- clear: function() {
20309
- var attribute_name, _results;
20310
-
20311
- if (this.length) {
20312
- this.length = 0;
20313
- _results = [];
20314
- for (attribute_name in this.messages) {
20315
- _results.push(this.messages[attribute_name] = null);
20265
+ return "O campo " + attribute_name + " não pode ficar em branco.";
20266
+ },
20267
+ cpf: function(attribute_name) {
20268
+ attribute_name = this.human_attribute_name(attribute_name);
20269
+ return "O campo " + attribute_name + " não está válido.";
20270
+ },
20271
+ confirmation: function(attribute_name) {
20272
+ var confirmation_attribute_name;
20273
+ confirmation_attribute_name = this.human_attribute_name(attribute_name);
20274
+ attribute_name = this.human_attribute_name(attribute_name.replace('_confirmation', ''));
20275
+ return "O campo " + attribute_name + " não está de acordo com o campo " + confirmation_attribute_name + ".";
20276
+ },
20277
+ associated: function(attribute_name) {
20278
+ attribute_name = this.human_attribute_name(attribute_name);
20279
+ return "O registro associado " + attribute_name + " não é válido.";
20280
+ },
20281
+ server: function(attribute_name, options) {
20282
+ if (attribute_name === 'base') {
20283
+ return options.server_message;
20284
+ } else {
20285
+ attribute_name = this.human_attribute_name(attribute_name);
20286
+ return "" + attribute_name + " " + options.server_message + ".";
20316
20287
  }
20317
- return _results;
20288
+ },
20289
+ type: function(attribute_name, options) {
20290
+ attribute_name = this.human_attribute_name(attribute_name);
20291
+ return "O campo " + attribute_name + " não está válido.";
20318
20292
  }
20319
- },
20320
- push: Array.prototype.push,
20321
- splice: Array.prototype.splice,
20322
- indexOf: Array.prototype.indexOf
20323
- }, {
20324
- model: null,
20325
- messages: null,
20326
- length: 0
20327
- }, function() {
20328
- this.messages = {};
20329
- return this;
20330
- });
20293
+ };
20331
20294
 
20332
- initializers = {
20333
- define_triggers: function() {
20334
- this.errors = errorsable({
20335
- model: model[this.resource]
20336
- });
20337
- this.before('save', function() {
20338
- if (this.save) {
20339
- return this.validate();
20295
+ errorsable = stampit({
20296
+ add: function(attribute_name, message_key, options) {
20297
+ var translator;
20298
+ this.push([attribute_name, message_key, options]);
20299
+ this.messages[attribute_name] = '';
20300
+ translator = messages[message_key];
20301
+ if (translator != null) {
20302
+ return this.messages[attribute_name] += translator.call(this.model, attribute_name, options);
20303
+ } else {
20304
+ return this.messages[attribute_name] += message_key;
20340
20305
  }
20341
- });
20342
- this.validated = false;
20343
- this.subscribe('dirty', function(value) {
20344
- return value && (this.validated = false);
20345
- });
20346
- return Object.defineProperty(this, 'valid', {
20347
- get: function() {
20348
- this.validate();
20349
- if (this.validation.state() === 'resolved') {
20350
- return !this.errors.length;
20351
- } else {
20352
- return null;
20306
+ },
20307
+ clear: function() {
20308
+ var attribute_name, _results;
20309
+ if (this.length) {
20310
+ this.length = 0;
20311
+ _results = [];
20312
+ for (attribute_name in this.messages) {
20313
+ _results.push(this.messages[attribute_name] = null);
20353
20314
  }
20354
- },
20355
- set: function() {
20356
- throw new TypeError("You can't set the value for the valid property.");
20357
- },
20358
- enumerable: false
20359
- });
20360
- },
20361
- create_validators: function(definitions) {
20362
- var definition, name, validator, validator_options, _ref, _results;
20315
+ return _results;
20316
+ }
20317
+ },
20318
+ push: Array.prototype.push,
20319
+ splice: Array.prototype.splice,
20320
+ indexOf: Array.prototype.indexOf
20321
+ }, {
20322
+ model: null,
20323
+ messages: null,
20324
+ length: 0
20325
+ }, function() {
20326
+ this.messages = {};
20327
+ return this;
20328
+ });
20363
20329
 
20364
- this.validators = [];
20365
- _ref = manager.validators;
20366
- _results = [];
20367
- for (name in _ref) {
20368
- validator = _ref[name];
20369
- definition = definitions[validator.definition_key];
20370
- if (definition) {
20371
- if (type(definition) !== 'array') {
20372
- definition = [definition];
20373
- }
20374
- _results.push((function() {
20375
- var _i, _len, _results1;
20376
-
20377
- _results1 = [];
20378
- for (_i = 0, _len = definition.length; _i < _len; _i++) {
20379
- validator_options = definition[_i];
20380
- if (type(validator_options) !== 'object') {
20381
- validator_options = {
20382
- attribute_name: validator_options
20383
- };
20384
- }
20385
- validator_options.model = this;
20386
- this.validators.push(validator(validator_options));
20387
- _results1.push(delete definitions[validator.definition_key]);
20330
+ initializers = {
20331
+ define_triggers: function() {
20332
+ this.errors = errorsable({
20333
+ model: model[this.resource]
20334
+ });
20335
+ this.before('save', function() {
20336
+ if (this.save) return this.validate();
20337
+ });
20338
+ this.validated = false;
20339
+ this.subscribe('dirty', function(value) {
20340
+ return value && (this.validated = false);
20341
+ });
20342
+ return Object.defineProperty(this, 'valid', {
20343
+ get: function() {
20344
+ this.validate();
20345
+ if (this.validation.state() === 'resolved') {
20346
+ return !this.errors.length;
20347
+ } else {
20348
+ return null;
20388
20349
  }
20389
- return _results1;
20390
- }).call(this));
20391
- } else {
20392
- _results.push(void 0);
20350
+ },
20351
+ set: function() {
20352
+ throw new TypeError("You can't set the value for the valid property.");
20353
+ },
20354
+ enumerable: false
20355
+ });
20356
+ },
20357
+ create_validators: function(definitions) {
20358
+ var definition, name, validator, validator_options, _ref, _results;
20359
+ this.validators = [];
20360
+ _ref = manager.validators;
20361
+ _results = [];
20362
+ for (name in _ref) {
20363
+ validator = _ref[name];
20364
+ definition = definitions[validator.definition_key];
20365
+ if (definition) {
20366
+ if (type(definition) !== 'array') definition = [definition];
20367
+ _results.push((function() {
20368
+ var _i, _len, _results2;
20369
+ _results2 = [];
20370
+ for (_i = 0, _len = definition.length; _i < _len; _i++) {
20371
+ validator_options = definition[_i];
20372
+ if (type(validator_options) !== 'object') {
20373
+ validator_options = {
20374
+ attribute_name: validator_options
20375
+ };
20376
+ }
20377
+ validator_options.model = this;
20378
+ this.validators.push(validator(validator_options));
20379
+ _results2.push(delete definitions[validator.definition_key]);
20380
+ }
20381
+ return _results2;
20382
+ }).call(this));
20383
+ } else {
20384
+ _results.push(void 0);
20385
+ }
20393
20386
  }
20387
+ return _results;
20394
20388
  }
20395
- return _results;
20396
- }
20397
- };
20398
-
20399
- extensions = {
20400
- model: {
20401
- validators: null
20402
- },
20403
- record: {
20404
- validate_attribute: function(attribute, doned, failed) {
20405
- var results, validation, validator, _i, _len, _ref;
20389
+ };
20406
20390
 
20407
- this.errors.messages[attribute] = null;
20408
- results = [this, attribute];
20409
- _ref = model[this.resource.toString()].validators;
20410
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
20411
- validator = _ref[_i];
20412
- if (validator.attribute_name === attribute) {
20391
+ extensions = {
20392
+ model: {
20393
+ validators: null
20394
+ },
20395
+ record: {
20396
+ validate_attribute: function(attribute, doned, failed) {
20397
+ var results, validation, validator, _i, _len, _ref;
20398
+ this.errors.messages[attribute] = null;
20399
+ results = [this, attribute];
20400
+ _ref = model[this.resource.toString()].validators;
20401
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
20402
+ validator = _ref[_i];
20403
+ if (validator.attribute_name === attribute) {
20404
+ results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
20405
+ }
20406
+ }
20407
+ validation = jQuery.when.apply(jQuery, results);
20408
+ validation.done(doned);
20409
+ validation.fail(failed);
20410
+ return validation;
20411
+ },
20412
+ validate: function(doned, failed) {
20413
+ var results, validator, _i, _len, _ref;
20414
+ if (this.validated && !this.dirty) return this.validation;
20415
+ this.errors.clear();
20416
+ results = [this];
20417
+ _ref = model[this.resource.toString()].validators;
20418
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
20419
+ validator = _ref[_i];
20413
20420
  results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
20414
20421
  }
20422
+ this.validation = jQuery.when.apply(jQuery, results);
20423
+ this.validation.done(doned);
20424
+ this.validation.fail(failed);
20425
+ return this.validation.then(function(record) {
20426
+ var old_dirty;
20427
+ old_dirty = record.dirty;
20428
+ record.dirty = null;
20429
+ record.validated || (record.validated = true);
20430
+ return record.dirty = old_dirty;
20431
+ });
20415
20432
  }
20416
- validation = jQuery.when.apply(jQuery, results);
20417
- validation.done(doned);
20418
- validation.fail(failed);
20419
- return validation;
20420
- },
20421
- validate: function(doned, failed) {
20422
- var results, validator, _i, _len, _ref;
20423
-
20424
- if (this.validated && !this.dirty) {
20425
- return this.validation;
20426
- }
20427
- this.errors.clear();
20428
- results = [this];
20429
- _ref = model[this.resource.toString()].validators;
20430
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
20431
- validator = _ref[_i];
20432
- results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
20433
- }
20434
- this.validation = jQuery.when.apply(jQuery, results);
20435
- this.validation.done(doned);
20436
- this.validation.fail(failed);
20437
- this.validation.then(function(record) {
20438
- var old_dirty;
20439
-
20440
- old_dirty = record.dirty;
20441
- record.dirty = null;
20442
- record.validated || (record.validated = true);
20443
- return record.dirty = old_dirty;
20444
- });
20445
- return this.validation;
20446
20433
  }
20447
- }
20448
- };
20434
+ };
20449
20435
 
20450
- manager = {
20451
- validators: {}
20452
- };
20436
+ manager = {
20437
+ validators: {}
20438
+ };
20453
20439
 
20454
- model.mix(function(modelable) {
20455
- jQuery.extend(modelable, extensions.model);
20456
- jQuery.extend(modelable.record, extensions.record);
20457
- modelable.after_mix.unshift(initializers.create_validators);
20458
- modelable.record.after_initialize.push(initializers.define_triggers);
20459
- return model.validators = manager.validators;
20460
- });
20440
+ model.mix(function(modelable) {
20441
+ jQuery.extend(modelable, extensions.model);
20442
+ jQuery.extend(modelable.record, extensions.record);
20443
+ modelable.after_mix.unshift(initializers.create_validators);
20444
+ modelable.record.after_initialize.push(initializers.define_triggers);
20445
+ return model.validators = manager.validators;
20446
+ });
20447
+
20448
+ manager.validators.confirmation = require('./validations/confirmation');
20461
20449
 
20462
- manager.validators.confirmation = require('./validations/confirmation');
20450
+ manager.validators.associated = require('./validations/associated');
20463
20451
 
20464
- manager.validators.associated = require('./validations/associated');
20452
+ manager.validators.presence = require('./validations/presence');
20465
20453
 
20466
- manager.validators.presence = require('./validations/presence');
20454
+ manager.validators.remote = require('./validations/remote');
20467
20455
 
20468
- manager.validators.remote = require('./validations/remote');
20456
+ manager.validators.type = require('./validations/type');
20469
20457
 
20470
- manager.validators.type = require('./validations/type');
20458
+ manager.validators.cpf = require('./validations/cpf');
20471
20459
 
20472
- manager.validators.cpf = require('./validations/cpf');
20460
+ }).call(this);
20473
20461
 
20474
20462
  });
20475
20463
  require.register("indefinido-indemma/lib/extensions/rivets.js", function(exports, require, module){
@@ -24797,6 +24785,7 @@ module.exports = require('./lib/observable');
24797
24785
  });
24798
24786
  require.register("indefinido-observable/lib/observable.js", function(exports, require, module){
24799
24787
  // TODO Better keypath support
24788
+ // TODO Convert to coffeescript
24800
24789
 
24801
24790
  // Shim older browsers
24802
24791
  if (!Object.create ) require('../vendor/shims/object.create');
@@ -24981,8 +24970,8 @@ observable.unobserve = function (object) {
24981
24970
  check = function (keypath, value) {
24982
24971
  this.observed[keypath] = value;
24983
24972
 
24984
- // TODO implement subscription
24985
- (this.dirty === false) && (this.dirty = true);
24973
+ // TODO implement subscription to any change, using Object.observe
24974
+ (this.dirty === false && keypath != 'dirty') && (this.dirty = true);
24986
24975
  return true;
24987
24976
  };
24988
24977