ende 0.3.13 → 0.4.0
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/component.json +7 -0
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +2 -2
- data/lib/assets/javascripts/aura/extensions/loader.js.coffee +13 -11
- data/lib/assets/javascripts/aura/extensions/mask.js.coffee +54 -40
- data/lib/assets/javascripts/aura/extensions/mediator.js +5 -3
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +2 -2
- data/lib/assets/javascripts/aura/extensions/rivets/accounting.js.coffee +7 -1
- data/lib/assets/javascripts/aura/extensions/rivets/formatters.js.coffee +5 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +47 -29
- data/lib/assets/javascripts/aura/extensions/routes.js.coffee +10 -5
- data/lib/assets/javascripts/aura/extensions/states.js.coffee +2 -2
- data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +18 -19
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +15 -10
- data/lib/assets/javascripts/config/initializers/jquery.js.coffee +2 -1
- data/lib/assets/javascripts/config/initializers/requirejs.js.coffee +3 -4
- data/lib/assets/javascripts/config/initializers.js.coffee +3 -0
- data/lib/assets/javascripts/config/load_components.js.coffee +106 -83
- data/lib/assets/javascripts/ende.js.coffee +13 -4
- data/lib/assets/javascripts/widgets/authenticator/presenter.js.coffee +3 -2
- data/lib/assets/javascripts/widgets/dialog/main.js.coffee +7 -3
- data/lib/assets/javascripts/widgets/support/main.js.coffee +3 -4
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +35 -103
- data/lib/assets/javascripts/widgets/viewer/presenters/default.js.coffee +2 -4
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/build.js +30877 -0
- data/vendor/assets/components/ende_build.js +2487 -148
- data/vendor/assets/components/indemma_with_none.js +30553 -0
- data/vendor/assets/javascripts/spin/spin.js +349 -0
- data/vendor/components/indefinido-indemma/.gitignore +3 -0
- data/vendor/components/indefinido-indemma/.ruby-gemset +1 -1
- data/vendor/components/indefinido-indemma/.ruby-version +1 -1
- data/vendor/components/indefinido-indemma/build/development.js +17 -14
- data/vendor/components/indefinido-indemma/build/release.js +213 -148
- data/vendor/components/indefinido-indemma/build/test.js +213 -148
- data/vendor/components/indefinido-indemma/component.json +3 -1
- data/vendor/components/indefinido-indemma/karma.conf.js +50 -60
- data/vendor/components/indefinido-indemma/lib/record/associable.js +17 -17
- data/vendor/components/indefinido-indemma/lib/record/persistable.js +8 -1
- data/vendor/components/indefinido-indemma/lib/record/queryable.js +3 -0
- data/vendor/components/indefinido-indemma/lib/record/resource.js +25 -45
- data/vendor/components/indefinido-indemma/lib/record/restfulable.js +82 -28
- data/vendor/components/indefinido-indemma/lib/record/scopable.js +28 -2
- data/vendor/components/indefinido-indemma/lib/record/storable.js +1 -1
- data/vendor/components/indefinido-indemma/lib/record/validatable.js +15 -23
- data/vendor/components/indefinido-indemma/lib/record/validations/associated.js +3 -5
- data/vendor/components/indefinido-indemma/lib/record/validations/confirmation.js +3 -5
- data/vendor/components/indefinido-indemma/lib/record/validations/cpf.js +5 -7
- data/vendor/components/indefinido-indemma/lib/record/validations/presence.js +3 -5
- data/vendor/components/indefinido-indemma/lib/record/validations/remote.js +3 -7
- data/vendor/components/indefinido-indemma/lib/record/validations/type.js +2 -2
- data/vendor/components/indefinido-indemma/lib/record/validations/validatorable.js +12 -0
- data/vendor/components/indefinido-indemma/package.json +9 -0
- data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +12 -0
- data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +4 -4
- data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +2 -2
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +44 -20
- data/vendor/components/indefinido-indemma/src/lib/record/persistable.coffee +7 -2
- data/vendor/components/indefinido-indemma/src/lib/record/queryable.coffee +1 -0
- data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +32 -32
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +79 -22
- data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +27 -8
- data/vendor/components/indefinido-indemma/src/lib/record/storable.coffee +1 -1
- data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +20 -19
- data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +3 -5
- data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +2 -4
- data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +4 -5
- data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +2 -5
- data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +3 -7
- data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +2 -3
- data/vendor/components/indefinido-indemma/src/lib/record/validations/validatorable.coffee +5 -0
- data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +8 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +4 -4
- data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +2 -2
- metadata +9 -3
- data/lib/assets/javascripts/aura/extensions/rivets/formatters.js.coffee~ +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42feeb9bdfbce1fa04abe5a344b44da80456e256
|
4
|
+
data.tar.gz: f120b379354f93cab969053a7a3f519ffa7bc4b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b4e7ed00e3a274d3c69a4f6db887cef9f3a9eabded894be35c376dcc18f66bed17258c3f51a3457ed441b2fed4e1b93293da956c76897cb594aef978ecb0f76
|
7
|
+
data.tar.gz: cbc980da7c285c17b53d5c74552c4c568013b93fbbd9d27e2f2953c80d423468cd89dbe6cda628644f217e0317a802d55633a2c9e1a26fd507860c59e1fda29b
|
data/component.json
CHANGED
@@ -22,7 +22,14 @@
|
|
22
22
|
"scripts": [
|
23
23
|
"vendor/assets/javascripts/lennon/lennon.js",
|
24
24
|
"vendor/assets/javascripts/stampit/stampit.js",
|
25
|
+
|
26
|
+
"vendor/assets/javascripts/spin/spin.js",
|
27
|
+
|
25
28
|
"vendor/assets/javascripts/jquery/inview.js",
|
29
|
+
"vendor/assets/javascripts/jquery/inputmask.js",
|
30
|
+
"vendor/assets/javascripts/jquery/inputmask.extensions.js",
|
31
|
+
"vendor/assets/javascripts/jquery/inputmask.numeric.extensions.js",
|
32
|
+
|
26
33
|
"vendor/assets/javascripts/shims/es6-map-shim.js"
|
27
34
|
],
|
28
35
|
"development": {},
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
1
|
+
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
define 'aura/extensions/loader', ->
|
4
4
|
|
5
5
|
Spinner = null
|
6
6
|
|
7
|
+
# TODO return plain object instead of function
|
7
8
|
(application) ->
|
8
9
|
{core} = application
|
9
10
|
|
@@ -36,16 +37,17 @@ define 'aura/extensions/loader', ->
|
|
36
37
|
new Spinner(core.util.extend {}, @options, options).spin target[0]
|
37
38
|
|
38
39
|
name: 'loader'
|
39
|
-
|
40
|
+
|
41
|
+
version: '0.1.1'
|
42
|
+
|
43
|
+
require:
|
44
|
+
paths:
|
45
|
+
spinner: 'spin/spin'
|
46
|
+
|
40
47
|
initialize: (application) ->
|
41
|
-
{sandbox}
|
42
|
-
|
43
|
-
|
44
|
-
# paths
|
45
|
-
try
|
46
|
-
Spinner = require 'seminovos/vendor/assets/javascripts/spin/spin'
|
47
|
-
catch e
|
48
|
-
Spinner = require 'modacad/vendor/assets/javascripts/spin/spin'
|
48
|
+
{sandbox} = application
|
49
|
+
with_aura = 'spinner'
|
50
|
+
Spinner = require with_aura
|
49
51
|
|
50
52
|
# Extend application
|
51
53
|
sandbox.ui = core.util.extend sandbox.ui, loader: -> loader.create arguments...
|
@@ -1,61 +1,75 @@
|
|
1
|
-
|
2
|
-
#= require 'jquery/inputmask.extensions'
|
3
|
-
#= require 'jquery/inputmask.numeric.extensions'
|
1
|
+
'use strict'
|
4
2
|
|
5
|
-
|
6
|
-
groupSeparator : '.'
|
7
|
-
autoGroup : true
|
8
|
-
autoUnmask : true
|
3
|
+
define 'aura/extensions/mask',
|
9
4
|
|
10
|
-
|
11
|
-
groupSeparator : '.'
|
12
|
-
radixPoint : ','
|
13
|
-
autoGroup : true
|
14
|
-
autoUnmask : true
|
5
|
+
version: '0.1.1'
|
15
6
|
|
7
|
+
require:
|
8
|
+
paths:
|
9
|
+
jquery: true
|
10
|
+
'jquery.mask': true
|
11
|
+
'jquery.mask_extensions': true
|
12
|
+
'jquery.mask_numeric_extensions': true
|
13
|
+
shim:
|
14
|
+
# TODO implement exports option to check for properties
|
15
|
+
'jquery.mask_extensions': ['jquery.mask']
|
16
|
+
'jquery.mask_numeric_extensions': ['jquery.mask', 'jquery.mask_extensions']
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
alias : 'decimal'
|
20
|
-
digits : 2
|
21
|
-
allowMinus : false
|
22
|
-
allowPlus : false
|
18
|
+
initialize: (application) ->
|
19
|
+
{core, sandbox} = application
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
with_aura = 'jquery.mask'
|
22
|
+
require with_aura
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
allowMinus : false
|
30
|
-
allowPlus : false
|
31
|
-
integerDigits : 6
|
24
|
+
with_aura = 'jquery.mask_extensions'
|
25
|
+
require with_aura
|
32
26
|
|
33
|
-
|
34
|
-
|
27
|
+
with_aura = 'jquery.mask_numeric_extensions'
|
28
|
+
require with_aura
|
35
29
|
|
36
|
-
cnpj:
|
37
|
-
mask : '99.999.999/9999-99'
|
38
30
|
|
39
|
-
|
40
|
-
mask : '(99) 9999[9]-9999'
|
31
|
+
mask = (selector, mask, options) -> $(selector).inputmask mask, options
|
41
32
|
|
33
|
+
sandbox.ui = sandbox.util.extend sandbox.ui, mask: mask
|
42
34
|
|
35
|
+
extend: ->
|
43
36
|
|
44
|
-
|
37
|
+
# TODO conditionally extend and require this masks
|
45
38
|
|
46
|
-
|
39
|
+
$.extend $.inputmask.defaults.aliases.integer,
|
40
|
+
groupSeparator : '.'
|
41
|
+
autoGroup : true
|
42
|
+
autoUnmask : true
|
47
43
|
|
44
|
+
$.extend $.inputmask.defaults.aliases.decimal,
|
45
|
+
groupSeparator : '.'
|
46
|
+
radixPoint : ','
|
47
|
+
autoGroup : true
|
48
|
+
autoUnmask : true
|
48
49
|
|
49
|
-
|
50
|
+
$.extend $.inputmask.defaults.aliases,
|
51
|
+
price:
|
52
|
+
alias : 'decimal'
|
53
|
+
digits : 2
|
54
|
+
allowMinus : false
|
55
|
+
allowPlus : false
|
50
56
|
|
57
|
+
plate:
|
58
|
+
mask : 'AAA-9999'
|
51
59
|
|
52
|
-
|
53
|
-
|
60
|
+
meters:
|
61
|
+
alias : 'integer'
|
62
|
+
allowMinus : false
|
63
|
+
allowPlus : false
|
64
|
+
integerDigits : 6
|
54
65
|
|
66
|
+
cpf:
|
67
|
+
mask : '999.999.999-99'
|
55
68
|
|
56
|
-
|
69
|
+
cnpj:
|
70
|
+
mask : '99.999.999/9999-99'
|
71
|
+
|
72
|
+
phone:
|
73
|
+
mask : '(99) 9999[9]-9999'
|
57
74
|
|
58
|
-
initialize: (application) ->
|
59
|
-
{core, sandbox} = application
|
60
75
|
|
61
|
-
sandbox.ui = sandbox.util.extend sandbox.ui, mask: mask
|
@@ -7,7 +7,7 @@ define('aura/extensions/mediator', function () {
|
|
7
7
|
require: {
|
8
8
|
paths: {
|
9
9
|
eventemitter: 'components/eventemitter2/lib/eventemitter2',
|
10
|
-
|
10
|
+
underscore: 'components/underscore/underscore'
|
11
11
|
},
|
12
12
|
shim: {
|
13
13
|
underscore: {
|
@@ -17,8 +17,10 @@ define('aura/extensions/mediator', function () {
|
|
17
17
|
},
|
18
18
|
|
19
19
|
initialize: function (app) {
|
20
|
-
var
|
21
|
-
var
|
20
|
+
var with_aura = 'eventemitter';
|
21
|
+
var EventEmitter = require(with_aura);
|
22
|
+
var with_aura = 'underscore'
|
23
|
+
var _ = require(with_aura);
|
22
24
|
|
23
25
|
app.config.mediator = _.defaults(app.config.mediator || {}, {
|
24
26
|
wildcard: true,
|
@@ -22,7 +22,6 @@ end
|
|
22
22
|
|
23
23
|
'use strict'
|
24
24
|
|
25
|
-
|
26
25
|
root = exports ? this
|
27
26
|
|
28
27
|
define 'aura/extensions/models', <%= models_list.to_json %>, (models...) ->
|
@@ -57,9 +56,10 @@ define 'aura/extensions/models', <%= models_list.to_json %>, (models...) ->
|
|
57
56
|
# inflector outside it
|
58
57
|
define: owl.pluralize.define
|
59
58
|
|
60
|
-
# TODO rename core.models and core.
|
59
|
+
# TODO rename core.models, core.domain and core.resources to core.resourceable completely
|
61
60
|
core.resourceable = core.resources = core.domain = core.models = sandbox.models = indemma.model
|
62
61
|
|
62
|
+
|
63
63
|
core.resource = core.model = sandbox.resource = sandbox.model = (name) ->
|
64
64
|
# TODO use a Map internally in indemma
|
65
65
|
model = indemma.model[name]
|
@@ -1,6 +1,12 @@
|
|
1
1
|
#= require accounting/accounting
|
2
2
|
|
3
|
-
|
3
|
+
# TODO remove require from sprockets from this file
|
4
|
+
# TODO manage dependencies through aura, remove dependencies from this define call
|
5
|
+
|
6
|
+
'use strict'
|
7
|
+
|
8
|
+
# TODO unifiy extension plug-in api
|
9
|
+
define 'aura/extensions/rivets/accounting', ['aura/extensions/rivets', 'vendor/accounting'], (parent, accounting) ->
|
4
10
|
|
5
11
|
rivets = require 'mikeric-rivets/dist/rivets'
|
6
12
|
|
@@ -1,16 +1,20 @@
|
|
1
|
-
|
1
|
+
'use strict';
|
2
2
|
|
3
|
-
define 'aura/extensions/rivets', ['extensions/rivets/formatters'], (formatters)->
|
4
3
|
|
5
|
-
|
4
|
+
# TODO require formatters through aura instead of directly loding a module
|
5
|
+
define 'aura/extensions/rivets', ['aura/extensions/rivets/formatters'], (formatters) ->
|
6
6
|
|
7
|
-
extend
|
7
|
+
extend = null
|
8
8
|
|
9
|
-
|
9
|
+
with_component = 'mikeric-rivets/dist/rivets'
|
10
|
+
rivets = require with_component
|
11
|
+
Rivets = rivets._
|
10
12
|
|
11
|
-
|
13
|
+
with_component = 'indefinido-observable/lib/adapters/rivets'
|
14
|
+
observable_configuration = require with_component
|
12
15
|
|
13
|
-
|
16
|
+
with_component = 'segmentio-extend'
|
17
|
+
extend = require with_component
|
14
18
|
|
15
19
|
extend rivets.formatters, formatters
|
16
20
|
|
@@ -217,34 +221,48 @@ define 'aura/extensions/rivets', ['extensions/rivets/formatters'], (formatters)-
|
|
217
221
|
el.value = if value? then value else ''
|
218
222
|
|
219
223
|
|
220
|
-
|
221
|
-
|
224
|
+
require:
|
225
|
+
paths:
|
226
|
+
# TODO optimize formatters with r.js
|
227
|
+
# formatters: 'aura/extensions/rivets/formatters'
|
228
|
+
observable: true
|
222
229
|
|
223
|
-
|
224
|
-
observable = require('observable').mixin
|
230
|
+
version: '0.1.1'
|
225
231
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
console.warn "Model object not specified for key #{name}"
|
232
|
-
model = {}
|
232
|
+
initialize: (application) ->
|
233
|
+
# TODO optimize formatters with r.js, and put module names under
|
234
|
+
# rivets namespace
|
235
|
+
# with_aura = 'formatters'
|
236
|
+
# formatters = require with_aura
|
233
237
|
|
234
|
-
|
238
|
+
# TODO check if it is needed to do earliear formatters loading
|
239
|
+
# extend rivets.formatters, formatters
|
235
240
|
|
236
|
-
|
241
|
+
# TODO implement compatibility between observable and aura loader
|
242
|
+
observable = requirejs 'observable'
|
237
243
|
|
238
|
-
|
239
|
-
|
244
|
+
# TODO implement small view interface
|
245
|
+
original_bind = rivets.bind
|
246
|
+
rivets.bind = (selector, presentation) ->
|
247
|
+
for name, model of presentation
|
248
|
+
unless model?
|
249
|
+
console.warn "Model object not specified for key #{name}"
|
250
|
+
model = {}
|
240
251
|
|
241
|
-
|
242
|
-
bind: (presentation, options) ->
|
243
|
-
if presentation.presented
|
244
|
-
presented = presentation.presented
|
245
|
-
delete presentation.presented
|
252
|
+
presentation[name] = observable model unless model.observed?
|
246
253
|
|
247
|
-
|
254
|
+
original_bind.apply rivets, arguments
|
248
255
|
|
249
|
-
|
256
|
+
extend application.sandbox,
|
257
|
+
view: rivets
|
258
|
+
|
259
|
+
extend application.core.Widgets.Base.prototype,
|
260
|
+
bind: (presentation, options) ->
|
261
|
+
if presentation.presented
|
262
|
+
presented = presentation.presented
|
263
|
+
delete presentation.presented
|
264
|
+
|
265
|
+
@sandbox._view = @view = rivets.bind @$el, presentation, options
|
266
|
+
|
267
|
+
presented(@view) if presented?
|
250
268
|
|
@@ -1,12 +1,17 @@
|
|
1
|
-
|
1
|
+
'use strict'
|
2
2
|
|
3
|
-
|
3
|
+
define 'aura/extensions/routes', (routes) ->
|
4
4
|
|
5
5
|
# TODO Remove .call null
|
6
|
-
# TODO Remove
|
6
|
+
# TODO Remove modernizr global variable dependency from this extension
|
7
7
|
loader.require.call null, 'modernizr'
|
8
8
|
# TODO rename from ened to ende
|
9
|
+
# TODO Remove jquery global variable dependency from this extension
|
10
|
+
with_component = 'jquery'
|
11
|
+
window.jQuery = window.$ = require with_component
|
12
|
+
# TODO Remove .call null
|
9
13
|
loader.require.call null, 'ened/vendor/assets/javascripts/lennon/lennon.js'
|
14
|
+
|
10
15
|
query = loader.require.call null, 'querystring'
|
11
16
|
router = null
|
12
17
|
|
@@ -91,7 +96,7 @@ define 'aura/extensions/routes', (routes) ->
|
|
91
96
|
|
92
97
|
|
93
98
|
#-- No route has been found, hence, nothing dispatched
|
94
|
-
application.logger.warn
|
99
|
+
application.logger.warn 'No route dispatched'
|
95
100
|
|
96
101
|
location: (href, process = true) ->
|
97
102
|
# TODO load router depending of history api
|
@@ -129,4 +134,4 @@ define 'aura/extensions/routes', (routes) ->
|
|
129
134
|
|
130
135
|
initialize: (application) ->
|
131
136
|
{logger} = application
|
132
|
-
application.sandbox.location = location
|
137
|
+
application.sandbox.location = location
|
@@ -2,8 +2,6 @@ define 'aura/extensions/widget/eventable', ->
|
|
2
2
|
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
extend = require 'segmentio-extend'
|
6
|
-
|
7
5
|
extractor = /.*?\$(.*?)@(.*?)\+(.*?)/
|
8
6
|
|
9
7
|
translations = new Map()
|
@@ -41,26 +39,27 @@ define 'aura/extensions/widget/eventable', ->
|
|
41
39
|
@
|
42
40
|
|
43
41
|
|
44
|
-
(application) ->
|
42
|
+
initialize: (application) ->
|
43
|
+
with_component = 'segmentio-extend'
|
44
|
+
extend = require with_component
|
45
45
|
|
46
|
-
|
47
|
-
Widgets = application.core.Widgets
|
46
|
+
Widgets = application.core.Widgets
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
extend Widgets.Base.prototype,
|
49
|
+
# TODO implement rivets compatibility, instead of generic
|
50
|
+
# binding events, alter html
|
51
|
+
handles: (event_name, widget_event_name = event_name, selector = @$el) ->
|
52
|
+
unless @name
|
53
|
+
message = "Widget name must be provided in order to use handlers, but this.name is '#{@name}' \n"
|
54
|
+
message = "Also you may have forgotten to set the type of your widget to 'Base'"
|
55
|
+
throw message
|
57
56
|
|
58
|
-
|
57
|
+
context = @$el unless selector == @$el
|
59
58
|
|
60
|
-
|
59
|
+
event_name = translations.get(event_name) ? event_name
|
61
60
|
|
62
|
-
|
61
|
+
@sandbox.dom.find(selector, context).on event_name, create_handler(@, widget_event_name || event_name)
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
# TODO replace Base.extend inheritance to stampit composition
|
64
|
+
Widgets.Base = Widgets.Base.extend eventable
|
65
|
+
eventable.super = Widgets.Base.__super__
|
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
'use strict'
|
2
2
|
|
3
|
-
|
3
|
+
define 'aura/extensions/widget/lifecycleable', ->
|
4
4
|
|
5
5
|
# TODO Remove jquery and use core dependencies
|
6
|
-
|
7
|
-
|
6
|
+
with_component = 'jquery'
|
7
|
+
jQuery = require with_component
|
8
|
+
|
9
|
+
core = null
|
8
10
|
|
9
11
|
lifecycleable =
|
10
12
|
injection: (definition) ->
|
@@ -74,9 +76,6 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
74
76
|
core.inject name, options
|
75
77
|
|
76
78
|
initialized: ->
|
77
|
-
# TODO think how to access parent widget in children ones
|
78
|
-
@sandbox._widget ||= @
|
79
|
-
|
80
79
|
@sandbox.emit "#{@name}.#{@identifier}.initialized", @
|
81
80
|
|
82
81
|
started: ->
|
@@ -86,7 +85,6 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
86
85
|
stopped: ->
|
87
86
|
@$el.remove()
|
88
87
|
|
89
|
-
|
90
88
|
(application) ->
|
91
89
|
|
92
90
|
version: '0.2.0'
|
@@ -101,7 +99,14 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
101
99
|
# Cache usefull methods
|
102
100
|
lifecycleable.sources = application.config.widgets.sources
|
103
101
|
lifecycleable.find = core.dom.find
|
104
|
-
|
102
|
+
|
103
|
+
# TODO Keep searching for root until found, and only throw
|
104
|
+
# exception if someone tries to initialize widgets in root
|
105
|
+
# without a valid root selector
|
106
|
+
lifecycleable.root = core.dom.find app.startOptions.widgets || 'body'
|
107
|
+
|
108
|
+
throw new TypeError "No root node found for selector '#{app.startOptions.widgets}'." unless lifecycleable.root.length != 0
|
109
|
+
|
105
110
|
lifecycleable.decamelize = core.util.decamelize
|
106
111
|
lifecycleable.capitalize = core.util.capitalize
|
107
112
|
|
@@ -139,4 +144,4 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
139
144
|
# Add support for element removal after stoping widget
|
140
145
|
# TODO replace Base.extend inheritance to stampit composition
|
141
146
|
core.Widgets.Base = core.Widgets.Base.extend recyclable
|
142
|
-
recyclable.super = core.Widgets.Base.__super__
|
147
|
+
recyclable.super = core.Widgets.Base.__super__
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
lazy_require = 'jquery'
|
2
|
+
define 'config/initializers/jquery', [lazy_require], ($) ->
|
2
3
|
# TODO use prefilter instead of beforeSend
|
3
4
|
# $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
|
4
5
|
$.ajaxSetup
|
@@ -1,4 +1,3 @@
|
|
1
|
-
requirejs
|
2
|
-
|
3
|
-
|
4
|
-
});
|
1
|
+
define 'config/initializers/requirejs', ->
|
2
|
+
requirejs.config
|
3
|
+
waitSeconds: 15
|