ende 0.5.9 → 0.5.10

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: dae52e696f3671e586020dbaa2eb76995b7d2ff5
4
- data.tar.gz: ae527f3c6d02a6a220827c38270be8d8a60cbe6b
3
+ metadata.gz: 7ef17acb592f82967df3a8ac261e041cfc75e89d
4
+ data.tar.gz: 763d3c38a214e34619757c030b7231201ff84ae3
5
5
  SHA512:
6
- metadata.gz: a828c279160ad67eeff93fa0722b9b1c1f3d520b4020b3eab72bd4daae18c5f230b3048e859c65f513195bbf25a526bb15dd8759f0257c32b1af6b12ac6c7e0d
7
- data.tar.gz: 6484be1734abb16edf37a524bfbee2b3764cb04f3843a2fa01db2f0a8d9423dd1c5cc401c023fdc8d9a8f4fcb2d3aabf02ccf51cc269a501d6562bdadcaaeb99
6
+ metadata.gz: c6fd008aa547188f0475a326e43b893f036cd362a24d2ed14a8669a6a7ee2dbae82c7dc0d4e3eedd146377c9dbdfbfef0c799019096e7791839721e1eb853785
7
+ data.tar.gz: bb733db893fe3c8a198380616b45d088e8af96513ceba71836ba899f8129b6bf410dad1d1f80091220226a518e7a52c6f2b0b460147fb0d7e658c8e9b5623a34
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "matches-selector",
3
3
  "description": "Check if an element matches a given selector",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "keywords": [
6
6
  "match",
7
7
  "element",
@@ -36,6 +36,7 @@ module.exports = match;
36
36
  */
37
37
 
38
38
  function match(el, selector) {
39
+ if (!el || el.nodeType !== 1) return false;
39
40
  if (vendor) return vendor.call(el, selector);
40
41
  var nodes = query.all(selector, el.parentNode);
41
42
  for (var i = 0; i < nodes.length; ++i) {
@@ -2,7 +2,7 @@
2
2
  "name": "indemma",
3
3
  "repository": "indefinido/indemma",
4
4
  "description": "Indemma (mind picture = memory), client side ES5 observable REST model",
5
- "version": "0.2.4",
5
+ "version": "0.2.7",
6
6
  "keywords": [],
7
7
  "dependencies": {
8
8
  "pluma/assimilate": "0.4.0",
@@ -95,18 +95,31 @@ descriptors = {
95
95
  return this.owner.observed[this.resource + '_id'];
96
96
  },
97
97
  setter: function(resource_id) {
98
- var association_name, current_resource_id, _ref;
98
+ var association_name, change, current_resource_id, _ref, _ref1;
99
99
 
100
100
  association_name = this.resource.toString();
101
- if (!resource_id) {
101
+ if (resource_id == null) {
102
102
  this.dirty = true;
103
- this.owner[association_name] = resource_id;
103
+ this.owner[association_name] = null;
104
104
  return resource_id;
105
105
  }
106
106
  current_resource_id = (_ref = this.owner.observed[association_name]) != null ? _ref._id : void 0;
107
107
  if (resource_id !== current_resource_id) {
108
108
  this.owner.observed[association_name + '_id'] = resource_id;
109
109
  this.owner.observed[association_name] = null;
110
+ if (!Object.observe) {
111
+ if ((_ref1 = this.owner.observation.observers[association_name + '_id']) != null) {
112
+ _ref1.check_();
113
+ }
114
+ } else {
115
+ change = {
116
+ oldValue: current_resource_id,
117
+ type: 'update',
118
+ name: association_name + '_id',
119
+ object: this.owner
120
+ };
121
+ Object.getNotifier(this.owner).notify(change);
122
+ }
110
123
  }
111
124
  return resource_id;
112
125
  }
@@ -119,7 +132,7 @@ descriptors = {
119
132
  associated = this.owner.observed[association_name];
120
133
  associated_id = this.owner.observed[association_name + '_id'];
121
134
  if (!(((associated != null ? associated._id : void 0) != null) || associated_id)) {
122
- return associated;
135
+ return associated || null;
123
136
  }
124
137
  if (associated != null ? associated.sustained : void 0) {
125
138
  return associated;
@@ -140,8 +153,29 @@ descriptors = {
140
153
  return this.owner.observed[association_name] = associated;
141
154
  },
142
155
  setter: function(associated) {
143
- this.owner.observed[this.resource.toString()] = associated;
144
- return this.owner.observed[this.resource.toString() + '_id'] = associated ? associated._id : null;
156
+ var association_name, change, current_value, _ref;
157
+
158
+ association_name = this.resource.toString();
159
+ current_value = this.owner.observed[association_name];
160
+ if (current_value === associated) {
161
+ return;
162
+ }
163
+ this.owner.observed[association_name] = associated;
164
+ this.owner.observed[association_name + '_id'] = associated ? associated._id : null;
165
+ if (!Object.observe) {
166
+ if ((_ref = this.owner.observation.observers[association_name]) != null) {
167
+ _ref.check_();
168
+ }
169
+ } else {
170
+ change = {
171
+ oldValue: current_value,
172
+ type: 'update',
173
+ name: association_name,
174
+ object: this.owner
175
+ };
176
+ Object.getNotifier(this.owner).notify(change);
177
+ }
178
+ return associated;
145
179
  }
146
180
  }
147
181
  }
@@ -167,10 +201,9 @@ callbacks = {
167
201
  }
168
202
  association.resource = model.singularize(association.resource);
169
203
  association.add.apply(association, associations_attributes);
170
- _results.push(association.resource = model.pluralize(association.resource));
171
- } else {
172
- _results.push(void 0);
204
+ association.resource = model.pluralize(association.resource);
173
205
  }
206
+ _results.push(delete this["" + association_name + "_attributes"]);
174
207
  }
175
208
  return _results;
176
209
  }
@@ -284,6 +317,7 @@ associable = {
284
317
  association_proxy[this.resource.toString()] = this;
285
318
  this["build_" + resource] = $.proxy(singular.build, association_proxy);
286
319
  this["create_" + resource] = $.proxy(singular.create, association_proxy);
320
+ this["" + association_name + "_attributes"] = $.extend(this[association_name], this["" + association_name + "_attributes"]);
287
321
  }
288
322
  callbacks.has_one.nest_attributes.call(this);
289
323
  }
@@ -329,13 +363,15 @@ associable = {
329
363
  parent_resource: this.resource,
330
364
  owner: record
331
365
  };
332
- old_resource = this[resource];
366
+ old_resource = record[resource];
333
367
  Object.defineProperty(record, resource.toString(), {
334
368
  get: $.proxy(descriptors.belongs_to.resource.getter, association_proxy),
335
369
  set: $.proxy(descriptors.belongs_to.resource.setter, association_proxy),
336
370
  configurable: true
337
371
  });
338
- _results.push(this[resource] = old_resource);
372
+ _results.push(record.after_initialize.push((function() {
373
+ return this[resource] = old_resource;
374
+ })));
339
375
  }
340
376
  return _results;
341
377
  }
@@ -22,10 +22,13 @@ util = {
22
22
  map: function(records) {
23
23
  var index, record, _i, _len, _results;
24
24
 
25
+ if (this.build) {
26
+ return record;
27
+ }
25
28
  _results = [];
26
29
  for (index = _i = 0, _len = records.length; _i < _len; index = ++_i) {
27
30
  record = records[index];
28
- _results.push((this.build || this).call(this, record));
31
+ _results.push(this.call(this, record));
29
32
  }
30
33
  return _results;
31
34
  }
@@ -87,6 +87,8 @@ initializers = {
87
87
  return this.ignores.indexOf(name) === -1;
88
88
  },
89
89
  define_triggers: function() {
90
+ var original_validate;
91
+
90
92
  this.errors = errorsable({
91
93
  model: model[this.resource]
92
94
  });
@@ -103,8 +105,18 @@ initializers = {
103
105
  modified = !!Object.keys($.extend(added, removed, changed)).filter(initializers.reserved_filter, initializers).length;
104
106
  return modified && (this.validated = false);
105
107
  });
106
- return Object.defineProperty(this, 'valid', {
108
+ Object.defineProperty(this, 'valid', {
107
109
  get: function() {
110
+ var _ref;
111
+
112
+ if (((_ref = this.validation) != null ? _ref.state() : void 0) === 'pending') {
113
+ this.validation.done(function() {
114
+ if (this.dirty || !this.validated) {
115
+ return this.valid;
116
+ }
117
+ });
118
+ return null;
119
+ }
108
120
  this.validate();
109
121
  if (this.validation.state() === 'resolved') {
110
122
  return !this.errors.length;
@@ -117,6 +129,12 @@ initializers = {
117
129
  },
118
130
  enumerable: false
119
131
  });
132
+ original_validate = this.validate;
133
+ this.validate = function() {};
134
+ this.validation = $.Deferred();
135
+ this.observation.deliver(true);
136
+ this.validation = null;
137
+ return this.validate = original_validate;
120
138
  },
121
139
  create_validators: function(definitions) {
122
140
  var definition, name, validator, validator_options, _ref, _results;
@@ -66,6 +66,13 @@ define 'aura/extensions/devise', ->
66
66
  sandbox.signed_in = false
67
67
  mediator.emit 'session.restoration_failed'
68
68
 
69
+ # TODO change when restoring the session through GET #show
70
+ # Ignore session restoration errors, for now
71
+ @errors.clear()
72
+
73
+ # TODO implement #show on devise/sessions_controller, and
74
+ # try to restore session not by creating a new one, but
75
+ # trying to retrieve the current one
69
76
  attempt.rejectWith @, arguments
70
77
 
71
78
  restoration.always ->
@@ -20,7 +20,6 @@ end
20
20
 
21
21
  %>
22
22
 
23
-
24
23
  'use strict'
25
24
 
26
25
  define 'aura/extensions/resources', <%= models_list.to_json %>, (resources...) ->
data/lib/ende/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ende
2
- VERSION = "0.5.9"
2
+ VERSION = "0.5.10"
3
3
  end