ende 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/component.json +4 -2
  3. data/ende.gemspec +1 -0
  4. data/lib/assets/javascripts/aura/extensions/devise.js.coffee +94 -15
  5. data/lib/assets/javascripts/aura/extensions/routes.js.coffee +21 -0
  6. data/lib/assets/javascripts/aura/extensions/states.js.coffee +3 -1
  7. data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +19 -21
  8. data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +17 -1
  9. data/lib/assets/javascripts/config/initializers/jquery.js.coffee +4 -3
  10. data/lib/assets/javascripts/config/initializers/load_components.js.coffee +19 -0
  11. data/lib/assets/javascripts/ende.js.coffee +3 -1
  12. data/lib/assets/javascripts/widgets/authenticator/main.js.coffee +3 -3
  13. data/lib/assets/javascripts/widgets/viewer/main.js.coffee +189 -120
  14. data/lib/ende/users_controller_extensions.rb +14 -0
  15. data/lib/ende/version.rb +1 -1
  16. data/lib/ende.rb +5 -0
  17. data/vendor/assets/components/KapIT-observe-utils/component.json +16 -0
  18. data/vendor/assets/components/KapIT-observe-utils/lib/observe-utils.js +780 -0
  19. data/vendor/assets/components/chaijs-assertion-error/component.json +18 -0
  20. data/vendor/assets/components/chaijs-assertion-error/index.js +110 -0
  21. data/vendor/assets/components/chaijs-chai/component.json +47 -0
  22. data/vendor/assets/components/chaijs-chai/index.js +1 -0
  23. data/vendor/assets/components/chaijs-chai/lib/chai/assertion.js +130 -0
  24. data/vendor/assets/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
  25. data/vendor/assets/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
  26. data/vendor/assets/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
  27. data/vendor/assets/components/chaijs-chai/lib/chai/interface/should.js +76 -0
  28. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
  29. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
  30. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
  31. data/vendor/assets/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
  32. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
  33. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
  34. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
  35. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
  36. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
  37. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
  38. data/vendor/assets/components/chaijs-chai/lib/chai/utils/index.js +108 -0
  39. data/vendor/assets/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
  40. data/vendor/assets/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
  41. data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
  42. data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
  43. data/vendor/assets/components/chaijs-chai/lib/chai/utils/test.js +26 -0
  44. data/vendor/assets/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
  45. data/vendor/assets/components/chaijs-chai/lib/chai/utils/type.js +45 -0
  46. data/vendor/assets/components/chaijs-chai/lib/chai.js +80 -0
  47. data/vendor/assets/components/chaijs-deep-eql/component.json +18 -0
  48. data/vendor/assets/components/chaijs-deep-eql/lib/eql.js +257 -0
  49. data/vendor/assets/components/chaijs-type-detect/component.json +16 -0
  50. data/vendor/assets/components/chaijs-type-detect/lib/type.js +142 -0
  51. data/vendor/assets/components/component-bind/component.json +14 -0
  52. data/vendor/assets/components/component-bind/index.js +24 -0
  53. data/vendor/assets/components/component-delegate/component.json +19 -0
  54. data/vendor/assets/components/component-delegate/index.js +42 -0
  55. data/vendor/assets/components/component-event/component.json +13 -0
  56. data/vendor/assets/components/component-event/index.js +40 -0
  57. data/vendor/assets/components/component-jquery/component.json +14 -0
  58. data/vendor/assets/components/component-jquery/index.js +9601 -0
  59. data/vendor/assets/components/component-link-delegate/component.json +23 -0
  60. data/vendor/assets/components/component-link-delegate/index.js +60 -0
  61. data/vendor/assets/components/component-matches-selector/component.json +20 -0
  62. data/vendor/assets/components/component-matches-selector/index.js +45 -0
  63. data/vendor/assets/components/component-query/component.json +21 -0
  64. data/vendor/assets/components/component-query/index.js +21 -0
  65. data/vendor/assets/components/component-type/component.json +18 -0
  66. data/vendor/assets/components/component-type/index.js +32 -0
  67. data/vendor/assets/components/component-url/component.json +17 -0
  68. data/vendor/assets/components/component-url/index.js +63 -0
  69. data/vendor/assets/components/discore-closest/component.json +14 -0
  70. data/vendor/assets/components/discore-closest/index.js +18 -0
  71. data/vendor/assets/components/indefinido-advisable/component.json +21 -0
  72. data/vendor/assets/components/indefinido-advisable/index.js +1 -0
  73. data/vendor/assets/components/indefinido-advisable/lib/advisable.js +60 -0
  74. data/vendor/assets/components/indefinido-indemma/component.json +40 -0
  75. data/vendor/assets/components/indefinido-indemma/index.js +1 -0
  76. data/vendor/assets/components/indefinido-indemma/lib/extensions/rivets.js +23 -0
  77. data/vendor/assets/components/indefinido-indemma/lib/record/associable.js +217 -0
  78. data/vendor/assets/components/indefinido-indemma/lib/record/maid.js +24 -0
  79. data/vendor/assets/components/indefinido-indemma/lib/record/resource.js +104 -0
  80. data/vendor/assets/components/indefinido-indemma/lib/record/rest.js +36 -0
  81. data/vendor/assets/components/indefinido-indemma/lib/record/restfulable.js +326 -0
  82. data/vendor/assets/components/indefinido-indemma/lib/record/scopable.js +279 -0
  83. data/vendor/assets/components/indefinido-indemma/lib/record/translationable.js +19 -0
  84. data/vendor/assets/components/indefinido-indemma/lib/record/validatable.js +216 -0
  85. data/vendor/assets/components/indefinido-indemma/lib/record/validations/associated.js +30 -0
  86. data/vendor/assets/components/indefinido-indemma/lib/record/validations/confirmation.js +19 -0
  87. data/vendor/assets/components/indefinido-indemma/lib/record/validations/cpf.js +60 -0
  88. data/vendor/assets/components/indefinido-indemma/lib/record/validations/presence.js +19 -0
  89. data/vendor/assets/components/indefinido-indemma/lib/record/validations/remote.js +71 -0
  90. data/vendor/assets/components/indefinido-indemma/lib/record.js +167 -0
  91. data/vendor/assets/components/indefinido-indemma/vendor/sinon.js +4290 -0
  92. data/vendor/assets/components/indefinido-indemma/vendor/stampit.js +392 -0
  93. data/vendor/assets/components/indefinido-observable/component.json +25 -0
  94. data/vendor/assets/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
  95. data/vendor/assets/components/indefinido-observable/index.js +1 -0
  96. data/vendor/assets/components/indefinido-observable/lib/adapters/rivets.js +26 -0
  97. data/vendor/assets/components/indefinido-observable/lib/observable.js +320 -0
  98. data/vendor/assets/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
  99. data/vendor/assets/components/indefinido-observable/vendor/shims/accessors.js +173 -0
  100. data/vendor/assets/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
  101. data/vendor/assets/components/indefinido-observable/vendor/shims/object.create.js +77 -0
  102. data/vendor/assets/components/mikeric-rivets/component.json +15 -0
  103. data/vendor/assets/components/mikeric-rivets/dist/rivets.js +1020 -0
  104. data/vendor/assets/components/paulmillr-es6-shim/component.json +17 -0
  105. data/vendor/assets/components/paulmillr-es6-shim/es6-shim.js +985 -0
  106. data/vendor/assets/components/pluma-assimilate/component.json +25 -0
  107. data/vendor/assets/components/pluma-assimilate/dist/assimilate.js +87 -0
  108. data/vendor/assets/components/segmentio-extend/component.json +13 -0
  109. data/vendor/assets/components/segmentio-extend/index.js +15 -0
  110. data/vendor/assets/javascripts/ende/build.js +30346 -0
  111. data/vendor/assets/javascripts/jquery/inview.js +125 -0
  112. data/vendor/assets/javascripts/lennon/lennon.js +184 -0
  113. metadata +114 -3
  114. data/lib/tasks/sprite.thor +0 -62
@@ -0,0 +1,71 @@
1
+ var composed, remoteable, rest, root, stampit, validations;
2
+
3
+ root = typeof exports !== "undefined" && exports !== null ? exports : window;
4
+
5
+ validations = require('../validatable');
6
+
7
+ rest = require('../rest');
8
+
9
+ stampit = require('../../../vendor/stampit');
10
+
11
+ remoteable = stampit({
12
+ validate_each: function(record, attribute, value) {
13
+ var data,
14
+ _this = this;
15
+
16
+ data = this.json(record);
17
+ return this.post(data).done(function(json) {
18
+ return _this.succeeded(json, record);
19
+ });
20
+ },
21
+ json: function(record) {
22
+ var data, _base;
23
+
24
+ data = {};
25
+ data[this.resource] = record.json();
26
+ (_base = data[this.resource]).id || (_base.id = data[this.resource]._id);
27
+ delete data[this.resource]._id;
28
+ return data;
29
+ },
30
+ post: function(data) {
31
+ return jQuery.ajax({
32
+ url: this.route,
33
+ data: data,
34
+ type: 'post',
35
+ dataType: 'json',
36
+ context: this
37
+ });
38
+ },
39
+ succeeded: function(json, record) {
40
+ var error_message, error_messages, _i, _len, _results;
41
+
42
+ error_messages = json[this.attribute_name];
43
+ if (!error_messages) {
44
+ return;
45
+ }
46
+ _results = [];
47
+ for (_i = 0, _len = error_messages.length; _i < _len; _i++) {
48
+ error_message = error_messages[_i];
49
+ _results.push(record.errors.add(this.attribute_name, 'server', {
50
+ server_message: error_message
51
+ }));
52
+ }
53
+ return _results;
54
+ }
55
+ }, {
56
+ message: "Remote validation failed",
57
+ route: null
58
+ }, function() {
59
+ var pluralized_resource;
60
+
61
+ pluralized_resource = model.pluralize(this.model.resource);
62
+ this.resource = this.model.resource;
63
+ this.route || (this.route = "/" + pluralized_resource + "/validate");
64
+ return this;
65
+ });
66
+
67
+ composed = stampit.compose(validations.validatable, remoteable);
68
+
69
+ composed.definition_key = 'validates_remotely';
70
+
71
+ validations.manager.validators.remote = composed;
@@ -0,0 +1,167 @@
1
+ var $, advisable, bind, extend, merge, observable, type,
2
+ __slice = [].slice;
3
+
4
+ $ = require('jquery');
5
+
6
+ type = require('type');
7
+
8
+ bind = require('bind');
9
+
10
+ observable = require('observable').mixin;
11
+
12
+ advisable = require('advisable').mixin;
13
+
14
+ extend = require('assimilate');
15
+
16
+ merge = require('assimilate').withStrategy('deep');
17
+
18
+ this.model = (function() {
19
+ var initialize_record, mixer, modelable;
20
+
21
+ modelable = {
22
+ after_mix: [],
23
+ record: {
24
+ after_initialize: []
25
+ },
26
+ all: function() {
27
+ return this.cache;
28
+ },
29
+ create: function() {
30
+ var params;
31
+
32
+ params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
33
+ throw 'model.create not implemented yet, try using the restful.model.create method';
34
+ },
35
+ find: function(id) {
36
+ return this.where({
37
+ id: id
38
+ }, true);
39
+ },
40
+ where: function(conditions, first) {
41
+ var record, results, _i, _len, _ref;
42
+
43
+ if (first == null) {
44
+ first = false;
45
+ }
46
+ results = [];
47
+ if (type(conditions.id) !== 'array') {
48
+ conditions.id = [conditions.id];
49
+ }
50
+ _ref = this.cache;
51
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
52
+ record = _ref[_i];
53
+ if (conditions.id.indexOf(record._id) !== -1) {
54
+ if (first) {
55
+ return record;
56
+ } else {
57
+ results.push(record);
58
+ }
59
+ }
60
+ }
61
+ if (first) {
62
+ return null;
63
+ } else {
64
+ return results;
65
+ }
66
+ }
67
+ };
68
+ initialize_record = function(data) {
69
+ var after_initialize, callback, instance, _i, _len, _ref;
70
+
71
+ if (data == null) {
72
+ data = {
73
+ resource: this.resource,
74
+ parent_resource: this.parent_resource
75
+ };
76
+ }
77
+ data.resource || (data.resource = this.resource);
78
+ data.parent_resource || (data.parent_resource = this.resource.parent || this.parent_resource);
79
+ data.route || (data.route = this.route);
80
+ data.nested_attributes = this.nested_attributes || [];
81
+ after_initialize = (data.after_initialize || []).concat(this.record.after_initialize);
82
+ instance = record.call(extend(Object.create(data), this.record, {
83
+ after_initialize: after_initialize
84
+ }));
85
+ _ref = instance.after_initialize;
86
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
87
+ callback = _ref[_i];
88
+ callback.call(instance, instance);
89
+ }
90
+ delete instance.after_initialize;
91
+ return instance;
92
+ };
93
+ mixer = function(options) {
94
+ var after_initialize, callback, instance, _i, _len, _ref;
95
+
96
+ if (this === window) {
97
+ throw 'Model mixin called incorrectly call with model.call {} instead of model({})';
98
+ }
99
+ if (!mixer.stale) {
100
+ mixer.stale = true;
101
+ }
102
+ if (this.record && this.record.after_initialize) {
103
+ after_initialize = this.record.after_initialize.splice(0);
104
+ } else {
105
+ after_initialize = [];
106
+ }
107
+ instance = bind(this, initialize_record);
108
+ extend(instance, merge(this, modelable));
109
+ this.record = instance.record = merge({}, instance.record, modelable.record);
110
+ this.record.after_initialize = instance.record.after_initialize = instance.record.after_initialize.concat(after_initialize);
111
+ _ref = modelable.after_mix;
112
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
113
+ callback = _ref[_i];
114
+ callback.call(instance, instance);
115
+ }
116
+ return mixer[this.resource.name || this.resource.toString()] = instance;
117
+ };
118
+ mixer.mix = function(blender) {
119
+ if (this.stale) {
120
+ throw "Trying to change model mixin with " + object + " but model already used.\nCheck your configuration order";
121
+ }
122
+ return blender(modelable);
123
+ };
124
+ return mixer;
125
+ })();
126
+
127
+ this.record = (function() {
128
+ var callbacks, recordable, that;
129
+
130
+ callbacks = {
131
+ dirtify: function() {
132
+ return this.subscribe(function(prop, value, old) {
133
+ if (prop !== 'dirty' && !this.dirty && value !== old) {
134
+ console.groupCollapsed("◉ Property '" + prop + "' dirtied a " + this.resource);
135
+ console.log(old, "→", value);
136
+ console.log(this);
137
+ console.groupEnd();
138
+ return this.dirty = true;
139
+ }
140
+ });
141
+ }
142
+ };
143
+ recordable = {
144
+ dirty: false,
145
+ after_initialize: [callbacks.dirtify]
146
+ };
147
+ that = function(data) {
148
+ var after_initialize;
149
+
150
+ if (this === window) {
151
+ throw "Mixin called incorrectly, call mixin with call method: record.call(object, data)";
152
+ }
153
+ data || (data = {});
154
+ after_initialize = (this.after_initialize || []).concat(data.after_initialize || []).concat(recordable.after_initialize);
155
+ return advisable(observable(extend(this, recordable, data, {
156
+ after_initialize: after_initialize
157
+ })));
158
+ };
159
+ that.mix = function(blender) {
160
+ return blender(recordable);
161
+ };
162
+ return that;
163
+ })();
164
+
165
+ exports.record = this.record;
166
+
167
+ exports.model = this.model;