ende 0.4.20 → 0.4.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/build/build.css +111 -0
  4. data/component.json +1 -0
  5. data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +4 -13
  6. data/lib/assets/javascripts/aura/extensions/platform.js.coffee +2 -8
  7. data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +21 -10
  8. data/lib/assets/javascripts/aura/extensions/states.js.coffee +25 -27
  9. data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +28 -23
  10. data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +21 -34
  11. data/lib/assets/javascripts/aura/extensions/widget/napable.js.coffee +17 -13
  12. data/lib/assets/javascripts/config/load_components.js.coffee +5 -7
  13. data/lib/assets/javascripts/widgets/dialog/main.js.coffee +1 -2
  14. data/lib/assets/javascripts/widgets/list/presenter.js.coffee +5 -4
  15. data/lib/assets/javascripts/widgets/support/adapters/olark.js +1 -1
  16. data/lib/assets/javascripts/widgets/tray/main.js.coffee +16 -22
  17. data/lib/assets/javascripts/widgets/viewer/main.js.coffee +39 -102
  18. data/lib/assets/javascripts/widgets/viewer/plugins/scopable.js.coffee +7 -1
  19. data/lib/ende/version.rb +1 -1
  20. data/vendor/assets/components/ende_build.js +5732 -1047
  21. data/vendor/components/indefinido-indemma/build/development.js +2 -2
  22. data/vendor/components/indefinido-indemma/build/release.js +9 -4
  23. data/vendor/components/indefinido-indemma/build/test.js +115 -21916
  24. data/vendor/components/indefinido-indemma/component.json +0 -1
  25. data/vendor/components/indefinido-indemma/lib/record/restfulable.js +7 -2
  26. data/vendor/components/indefinido-indemma/lib/record/validatable.js +2 -2
  27. data/vendor/components/indefinido-indemma/src/lib/record/persistable.coffee +2 -0
  28. data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +3 -2
  29. data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +16 -4
  30. data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +3 -3
  31. data/vendor/components/indefinido-observable/.gitignore +15 -0
  32. data/vendor/components/indefinido-observable/.ruby-gemset +1 -0
  33. data/vendor/components/indefinido-observable/.ruby-version +1 -0
  34. data/vendor/components/indefinido-observable/Gemfile +13 -0
  35. data/vendor/components/indefinido-observable/Guardfile +39 -0
  36. data/vendor/components/indefinido-observable/History.md +0 -0
  37. data/vendor/components/indefinido-observable/Readme.md +116 -0
  38. data/vendor/components/indefinido-observable/build/build.js +14798 -0
  39. data/vendor/components/indefinido-observable/build/development.js +339 -0
  40. data/vendor/components/indefinido-observable/build/release.js +14937 -0
  41. data/vendor/components/indefinido-observable/build/test.js +339 -0
  42. data/vendor/components/indefinido-observable/component.json +7 -3
  43. data/vendor/components/indefinido-observable/components/chaijs-chai/component.json +46 -0
  44. data/vendor/components/indefinido-observable/components/chaijs-chai/index.js +1 -0
  45. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/assertion.js +132 -0
  46. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
  47. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/error.js +60 -0
  48. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/assert.js +1060 -0
  49. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
  50. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/should.js +76 -0
  51. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
  52. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
  53. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
  54. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/eql.js +124 -0
  55. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
  56. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
  57. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
  58. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
  59. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
  60. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
  61. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
  62. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/index.js +108 -0
  63. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/inspect.js +316 -0
  64. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
  65. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
  66. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
  67. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/test.js +26 -0
  68. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
  69. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/type.js +45 -0
  70. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai.js +79 -0
  71. data/vendor/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
  72. data/vendor/components/indefinido-observable/components/component-jquery/component.json +14 -0
  73. data/vendor/components/indefinido-observable/components/component-jquery/index.js +9601 -0
  74. data/vendor/components/indefinido-observable/components/kapit-observe-shim/component.json +11 -0
  75. data/vendor/components/indefinido-observable/components/kapit-observe-utils/component.json +13 -0
  76. data/vendor/components/indefinido-observable/karma.conf.js +92 -0
  77. data/vendor/components/indefinido-observable/lib/observable.js +9 -19
  78. data/vendor/components/indefinido-observable/spec/legacy/observable_spec.js +126 -0
  79. data/vendor/components/indefinido-observable/spec/observable_spec.js +92 -0
  80. data/vendor/components/indefinido-observable/spec/spec_helper.js +8 -0
  81. data/vendor/components/indefinido-observable/spec/vendor/accessors_spec.js +63 -0
  82. data/vendor/components/indefinido-observable/src/lib/adapters/rivets.js.coffee +15 -0
  83. data/vendor/components/indefinido-observable/src/spec/legacy/observable_spec.coffee +132 -0
  84. data/vendor/components/indefinido-observable/src/spec/observable_spec.coffee +85 -0
  85. data/vendor/components/indefinido-observable/src/spec/spec_helper.coffee +5 -0
  86. data/vendor/components/indefinido-observable/src/spec/vendor/accessors_spec.coffee +59 -0
  87. data/vendor/components/indefinido-observable/vendor/spec/boot.js +104 -0
  88. data/vendor/components/indefinido-observable/vendor/spec/jasmine.js +2054 -0
  89. metadata +60 -8
  90. data/lib/assets/javascripts/aura/extensions/domain.js.coffee +0 -55
  91. data/lib/assets/javascripts/aura/extensions/stamps.js.coffee +0 -35
  92. data/lib/assets/javascripts/aura/extensions/widget/composable.js.coffee +0 -135
  93. data/lib/assets/javascripts/aura/extensions/widget/flowable.js.coffee +0 -65
  94. data/lib/assets/javascripts/widgets/attachable/main.js.coffee +0 -77
  95. /data/{lib/assets/javascripts/aura/extensions/stamps → vendor/assets/javascripts/stampit}/stampit.js +0 -0
@@ -10,7 +10,6 @@
10
10
  "component/bind": "*",
11
11
  "component/jquery": "*",
12
12
  "indefinido/observable": "*",
13
-
14
13
  "indefinido/advisable": "*"
15
14
  },
16
15
  "development": {},
@@ -85,7 +85,11 @@ restful = {
85
85
  data = {};
86
86
  }
87
87
  old_route = this.route;
88
- default_route = "/" + (model.pluralize(this.resource.name));
88
+ default_route = '/';
89
+ if (this.resource.scope != null) {
90
+ default_route += this.resource.scope + '/';
91
+ }
92
+ default_route += this.resource.singular ? this.resource.name : model.pluralize(this.resource.name);
89
93
  if (default_route !== this.route) {
90
94
  this.route = default_route;
91
95
  }
@@ -146,8 +150,9 @@ restful = {
146
150
  _ref = model[this.resource.toString()].has_many;
147
151
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
148
152
  association_name = _ref[_i];
149
- associations_attributes = attributes[association_name];
153
+ associations_attributes = attributes[association_name + "_attributes"] || attributes[association_name];
150
154
  delete attributes[association_name];
155
+ delete attributes[association_name + '_attributes'];
151
156
  association = this[association_name];
152
157
  if (association == null) {
153
158
  message = "Association '" + association_name + "' not found. \n";
@@ -173,7 +173,7 @@ extensions = {
173
173
  validate: function(doned, failed) {
174
174
  var results, validator, _i, _len, _ref;
175
175
 
176
- if (this.validated && !this.dirty) {
176
+ if (this.validated) {
177
177
  return this.validation;
178
178
  }
179
179
  this.errors.clear();
@@ -192,7 +192,7 @@ extensions = {
192
192
  old_dirty = record.dirty;
193
193
  record.dirty = null;
194
194
  record.validated || (record.validated = true);
195
- record.dirty = old_dirty;
195
+ record.observed.dirty = old_dirty;
196
196
  return record;
197
197
  });
198
198
  }
@@ -12,6 +12,8 @@ handlers =
12
12
 
13
13
  persistable =
14
14
  record:
15
+ # TODO better caching check after resource initialization
16
+ # TODO think how to retrieve already stored resources
15
17
  after_initialize: ->
16
18
  if @_id
17
19
  # TODO remove global model usage
@@ -25,6 +25,7 @@ resource = stampit
25
25
  @
26
26
 
27
27
  # TODO Think of a better name, and move to a composable stampit item
28
+ # TODO Externalize route generatio so we can reuse in other files
28
29
  descriptors =
29
30
  route:
30
31
  get: ->
@@ -33,9 +34,9 @@ descriptors =
33
34
 
34
35
  route = '/'
35
36
  route += "#{@parent.route}/#{@parent._id}/" if @parent?
36
- route += @resource.scope + '/' if @resource.scope?
37
+ route += @resource.scope + '/' if @resource.scope?
37
38
 
38
- route += if @resource.singular then @resource.name else model.pluralize @resource.name
39
+ route += if @resource.singular then @resource.name else model.pluralize @resource.name
39
40
 
40
41
  @route = route
41
42
 
@@ -63,7 +63,13 @@ restful =
63
63
  get: (action, data = {}) ->
64
64
  # TODO better way to override route
65
65
  old_route = @route
66
- default_route = "/#{model.pluralize @resource.name}"
66
+
67
+ # TODO extract route generation concern
68
+ default_route = '/'
69
+ default_route += @resource.scope + '/' if @resource.scope?
70
+ default_route += if @resource.singular then @resource.name else model.pluralize @resource.name
71
+
72
+ # TODO think why this code is here
67
73
  @route = default_route unless default_route == @route
68
74
 
69
75
  if action
@@ -116,16 +122,22 @@ restful =
116
122
 
117
123
  promise
118
124
 
125
+
126
+ # TODO sufix association attributes with '_attributes' and remove
127
+ # double checking in this method
119
128
  assign_attributes: (attributes) ->
120
129
 
121
130
  # TODO only set associations on nested attributes!
122
131
  # First assign has_many associations
123
132
  # TODO implement setter on has_many association and move this code there
124
133
  for association_name in model[@resource.toString()].has_many
125
- associations_attributes = attributes[association_name]
134
+ associations_attributes = attributes[association_name + "_attributes"] or attributes[association_name]
126
135
 
127
136
  # TODO copy attributes object and don't change it inside the assignment method
137
+ # TODO sufix association attributes with '_attributes' and remove
138
+ # double checking in this method
128
139
  delete attributes[association_name] # Remove loaded json data
140
+ delete attributes[association_name + '_attributes'] # Remove loaded json data
129
141
 
130
142
  # Clear current stored cache on this association
131
143
  # TODO implement setter on this association and let user to set
@@ -152,7 +164,7 @@ restful =
152
164
  for association_attributes in associations_attributes
153
165
 
154
166
  # TODO only nest specified nested attributes on model definition
155
- # TODO create special deserialization method no plural association
167
+ # TODO create special deserialization method on plural association
156
168
  # TODO check if we need to nest attributes in other association types
157
169
  for association_name in model[singular_resource].has_many
158
170
  association_attributes["#{association_name}_attributes"] = association_attributes[association_name]
@@ -464,4 +476,4 @@ model.associable && model.associable.mix (singular_association, plural_associat
464
476
 
465
477
  plural_association.post = ->
466
478
  @route ||= "#{@parent.route}/#{@parent._id}/#{model.pluralize @resource.name}" if @parent?
467
- rest.post.apply @, arguments
479
+ rest.post.apply @, arguments
@@ -158,7 +158,7 @@ extensions =
158
158
  validation
159
159
 
160
160
  validate: (doned, failed) ->
161
- return @validation if @validated and not @dirty
161
+ return @validation if @validated
162
162
 
163
163
  @errors.clear()
164
164
  results = [@]
@@ -181,8 +181,8 @@ extensions =
181
181
 
182
182
  record.validated ||= true
183
183
 
184
- # Restore dirty state
185
- record.dirty = old_dirty
184
+ # Restore dirty state, without publishing changes
185
+ record.observed.dirty = old_dirty
186
186
 
187
187
  record
188
188
 
@@ -0,0 +1,15 @@
1
+ # Coverage reports
2
+
3
+ # Emacs Temporary Files
4
+ *~
5
+ *#
6
+ .*#
7
+ #*
8
+
9
+ # Eclipse
10
+ .directory
11
+ .project
12
+ .loadpath
13
+
14
+ # Mac OS X Files
15
+ .DS_*
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p195
@@ -0,0 +1,13 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+
5
+ group :development do
6
+ # gem 'libv8'
7
+ gem 'guard'
8
+ gem 'guard-coffeescript'
9
+ gem 'guard-shell'
10
+ gem "guard-bundler"
11
+ gem "rb-fsevent", :require => false
12
+ gem "growl", "~> 1.0"
13
+ end
@@ -0,0 +1,39 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'bundler' do
5
+ watch('Gemfile')
6
+ # Uncomment next line if Gemfile contain `gemspec' command
7
+ # watch(/^.+\.gemspec/)
8
+ end
9
+
10
+ guard 'coffeescript', :input => 'src', :output => '.', :bare => true
11
+ # Add files and commands to this file, like the example:
12
+ # watch(%r{file/path}) { `command(s)` }
13
+ #
14
+ guard 'shell' do
15
+ watch(/(.*).coffee/) { |m|
16
+ puts ' Building release component'
17
+ puts `component-build --verbose --name release`
18
+
19
+ puts ' Building development component'
20
+ puts `component-build --verbose --name development --dev`
21
+
22
+ puts ' Building tests component'
23
+ puts `component-build --verbose --name test --dev`
24
+ }
25
+
26
+ watch(/component.json|lib\/observable/) { |m|
27
+ puts ' Installing possible new components'
28
+ puts `component install`
29
+
30
+ puts ' Building release component'
31
+ puts `component-build --verbose --name release`
32
+
33
+ puts ' Building development component'
34
+ puts `component-build --verbose --name development --dev`
35
+
36
+ puts ' Building tests component'
37
+ puts `component-build --verbose --name test --dev`
38
+ }
39
+ end
@@ -0,0 +1,116 @@
1
+
2
+ # observable
3
+
4
+ Observable, observer capabilities built upon the observable shim
5
+
6
+ ## Summary
7
+
8
+ - We need a pretty sintax to listen to single properties
9
+ - Requirements
10
+ - ES5 Getters and Setters (Shim ships with component, IE 10+)
11
+ - ES7 Observer (Shim ships with component, IE ?+)
12
+
13
+ ## Installation
14
+
15
+ $ component install indefinido/observable
16
+
17
+ ## API
18
+
19
+ ### Functionality (Single Property, All Properties)
20
+
21
+ Just implements a nicer interface:
22
+
23
+ ```javascript
24
+
25
+ require('observable');
26
+
27
+ arthur = observable.call({
28
+ name : function () { return this.firstname + " " + this.surname; },
29
+ firstname: "Arthur Philip",
30
+ surname : "Dent",
31
+ species : "Humam"
32
+ });
33
+
34
+ // Subscribe to all changes
35
+ arthur.subscribe(function (updates) {
36
+ var i = updates.length, update;
37
+ while (i--) {
38
+ update = updates[i];
39
+ console.log(update.name, update.type, update.oldValue, '→', update.object[update.name]); // also this[update.name]
40
+ }
41
+ });
42
+
43
+ // Subscribe to single property change
44
+ arthur.subscribe('firstname', function ( update) {
45
+ console.log( update.name, update.type, update.oldValue, '→', update.object[ update.name]); // also this[ update.name]
46
+ });
47
+
48
+ ```
49
+
50
+ ! Warning all properties and configuration is stored in a per object
51
+ basis on the observed property:
52
+
53
+ ```javascript
54
+ require('observable');
55
+
56
+ arthur = observable.call({
57
+ name : function () { return this.firstname + " " + this.surname; },
58
+ firstname: "Arthur Philip",
59
+ surname : "Dent",
60
+ species : "Humam"
61
+ });
62
+
63
+ // Don't mess with this properties
64
+ // they change between browsers!
65
+ arthur.observed.name; // "Arthur Philip"
66
+
67
+ // Also in some browsers it is not possible to create unreadable
68
+ // properties, the it will apear on for in loops!
69
+ for (attribute in arthur) {
70
+ if (attribute == "observed") alert("Im not hidden!");
71
+ }
72
+
73
+ ```
74
+
75
+ ### Adapters
76
+
77
+ #### Rivets
78
+
79
+ ```javascript
80
+ require('observable/adapters/rivets');
81
+
82
+ arthur = observable.call({
83
+ name : function () { return this.firstname + " " + this.surname; },
84
+ firstname: "Arthur Philip",
85
+ surname : "Dent",
86
+ species : "Humam"
87
+ }),
88
+
89
+ template = '<div class="person">' +
90
+ ' <span data-html="person.name"></span> ' +
91
+ ' <span data-html="person.species"></span> ' +
92
+ '</div>';
93
+
94
+ document.body.innerHTML = template;
95
+ element = document.body.children[0];
96
+
97
+ rivets.bind(element, {person: arthur});
98
+
99
+ arthur.species = "Homo Sapiens";
100
+
101
+ ```
102
+
103
+ ## TODO
104
+
105
+ ## TESTS!
106
+
107
+ A tiny part of tests has been written, but more on the go!
108
+
109
+ ## License
110
+
111
+ WTFPL
112
+
113
+ ## Credits
114
+
115
+ Built upon the lovely coffeescript language
116
+ Uses heavily https://github.com/KapIT/observe-shim and https://github.com/KapIT/observe-utils