ende 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +4 -2
- data/ende.gemspec +1 -0
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +94 -15
- data/lib/assets/javascripts/aura/extensions/routes.js.coffee +21 -0
- data/lib/assets/javascripts/aura/extensions/states.js.coffee +3 -1
- data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +19 -21
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +17 -1
- data/lib/assets/javascripts/config/initializers/jquery.js.coffee +4 -3
- data/lib/assets/javascripts/config/initializers/load_components.js.coffee +19 -0
- data/lib/assets/javascripts/ende.js.coffee +3 -1
- data/lib/assets/javascripts/widgets/authenticator/main.js.coffee +3 -3
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +189 -120
- data/lib/ende/users_controller_extensions.rb +14 -0
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +5 -0
- data/vendor/assets/components/KapIT-observe-utils/component.json +16 -0
- data/vendor/assets/components/KapIT-observe-utils/lib/observe-utils.js +780 -0
- data/vendor/assets/components/chaijs-assertion-error/component.json +18 -0
- data/vendor/assets/components/chaijs-assertion-error/index.js +110 -0
- data/vendor/assets/components/chaijs-chai/component.json +47 -0
- data/vendor/assets/components/chaijs-chai/index.js +1 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/assertion.js +130 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/should.js +76 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/index.js +108 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/test.js +26 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/type.js +45 -0
- data/vendor/assets/components/chaijs-chai/lib/chai.js +80 -0
- data/vendor/assets/components/chaijs-deep-eql/component.json +18 -0
- data/vendor/assets/components/chaijs-deep-eql/lib/eql.js +257 -0
- data/vendor/assets/components/chaijs-type-detect/component.json +16 -0
- data/vendor/assets/components/chaijs-type-detect/lib/type.js +142 -0
- data/vendor/assets/components/component-bind/component.json +14 -0
- data/vendor/assets/components/component-bind/index.js +24 -0
- data/vendor/assets/components/component-delegate/component.json +19 -0
- data/vendor/assets/components/component-delegate/index.js +42 -0
- data/vendor/assets/components/component-event/component.json +13 -0
- data/vendor/assets/components/component-event/index.js +40 -0
- data/vendor/assets/components/component-jquery/component.json +14 -0
- data/vendor/assets/components/component-jquery/index.js +9601 -0
- data/vendor/assets/components/component-link-delegate/component.json +23 -0
- data/vendor/assets/components/component-link-delegate/index.js +60 -0
- data/vendor/assets/components/component-matches-selector/component.json +20 -0
- data/vendor/assets/components/component-matches-selector/index.js +45 -0
- data/vendor/assets/components/component-query/component.json +21 -0
- data/vendor/assets/components/component-query/index.js +21 -0
- data/vendor/assets/components/component-type/component.json +18 -0
- data/vendor/assets/components/component-type/index.js +32 -0
- data/vendor/assets/components/component-url/component.json +17 -0
- data/vendor/assets/components/component-url/index.js +63 -0
- data/vendor/assets/components/discore-closest/component.json +14 -0
- data/vendor/assets/components/discore-closest/index.js +18 -0
- data/vendor/assets/components/indefinido-advisable/component.json +21 -0
- data/vendor/assets/components/indefinido-advisable/index.js +1 -0
- data/vendor/assets/components/indefinido-advisable/lib/advisable.js +60 -0
- data/vendor/assets/components/indefinido-indemma/component.json +40 -0
- data/vendor/assets/components/indefinido-indemma/index.js +1 -0
- data/vendor/assets/components/indefinido-indemma/lib/extensions/rivets.js +23 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/associable.js +217 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/maid.js +24 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/resource.js +104 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/rest.js +36 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/restfulable.js +326 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/scopable.js +279 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/translationable.js +19 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validatable.js +216 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/associated.js +30 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/confirmation.js +19 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/cpf.js +60 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/presence.js +19 -0
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/remote.js +71 -0
- data/vendor/assets/components/indefinido-indemma/lib/record.js +167 -0
- data/vendor/assets/components/indefinido-indemma/vendor/sinon.js +4290 -0
- data/vendor/assets/components/indefinido-indemma/vendor/stampit.js +392 -0
- data/vendor/assets/components/indefinido-observable/component.json +25 -0
- data/vendor/assets/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
- data/vendor/assets/components/indefinido-observable/index.js +1 -0
- data/vendor/assets/components/indefinido-observable/lib/adapters/rivets.js +26 -0
- data/vendor/assets/components/indefinido-observable/lib/observable.js +320 -0
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors.js +173 -0
- data/vendor/assets/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
- data/vendor/assets/components/indefinido-observable/vendor/shims/object.create.js +77 -0
- data/vendor/assets/components/mikeric-rivets/component.json +15 -0
- data/vendor/assets/components/mikeric-rivets/dist/rivets.js +1020 -0
- data/vendor/assets/components/paulmillr-es6-shim/component.json +17 -0
- data/vendor/assets/components/paulmillr-es6-shim/es6-shim.js +985 -0
- data/vendor/assets/components/pluma-assimilate/component.json +25 -0
- data/vendor/assets/components/pluma-assimilate/dist/assimilate.js +87 -0
- data/vendor/assets/components/segmentio-extend/component.json +13 -0
- data/vendor/assets/components/segmentio-extend/index.js +15 -0
- data/vendor/assets/javascripts/ende/build.js +30346 -0
- data/vendor/assets/javascripts/jquery/inview.js +125 -0
- data/vendor/assets/javascripts/lennon/lennon.js +184 -0
- metadata +114 -3
- data/lib/tasks/sprite.thor +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67175a38bbf95b8a59dec5180128fd9abb123ee5
|
4
|
+
data.tar.gz: 7efc8d8c9dcf9e72a2d490c13791c9638ed468d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d217f7da63f480a04dbc5715df12e6844fe04e32997715a119668ef589a44267fe93254f05b369a0edc91d09e07f02e6e0e157c93503fe76e5f5457bba06974
|
7
|
+
data.tar.gz: 3f14d88edd2f7b41f4e8d403b32e05c74a525b9dbbed5a4624f642b5331c0ce1162f10d0609f89ad96079abc750bb500707df45a4c0febe6c031a322d8fcd620
|
data/component.json
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
"keywords": [],
|
7
7
|
"dependencies": {
|
8
8
|
"mikeric/rivets": "*",
|
9
|
-
"bestiejs/lodash": "*",
|
10
9
|
"KapIT/observe-utils": "*",
|
11
10
|
"segmentio/extend": "*",
|
12
11
|
"pluma/assimilate": "*",
|
@@ -14,12 +13,15 @@
|
|
14
13
|
"component/type": "*",
|
15
14
|
"component/bind": "*",
|
16
15
|
"component/jquery": "*",
|
16
|
+
"component/link-delegate": "*",
|
17
17
|
"indefinido/indemma": "*",
|
18
18
|
"indefinido/observable": "*",
|
19
19
|
"indefinido/advisable": "*"
|
20
20
|
},
|
21
21
|
"scripts": [
|
22
|
-
"vendor/assets/javascripts/
|
22
|
+
"vendor/assets/javascripts/lennon/lennon.js",
|
23
|
+
"vendor/assets/javascripts/stampit/stampit.js",
|
24
|
+
"vendor/assets/javascripts/jquery/inview.js"
|
23
25
|
],
|
24
26
|
"development": {},
|
25
27
|
"paths": [
|
data/ende.gemspec
CHANGED
@@ -34,18 +34,40 @@ define 'aura/extensions/devise', () ->
|
|
34
34
|
user_session
|
35
35
|
|
36
36
|
# TODO better and more formal way to restore
|
37
|
+
# Devise::SessionsController#show would be a great solution!
|
37
38
|
restore: ->
|
38
39
|
# We make a dummy request to the new session path and if user is
|
39
40
|
# logged in, devise redirects us to the users/show.json path for
|
40
41
|
# the current loged in user
|
41
|
-
|
42
|
-
|
43
|
-
session.restoring = true
|
42
|
+
attempt = core.data.deferred()
|
44
43
|
|
45
44
|
# Also find a better way to publish events after all widgets are
|
46
45
|
# loaded
|
47
|
-
|
48
|
-
|
46
|
+
session.restoring = true # TODO implement #show on devise/sessions_controller
|
47
|
+
|
48
|
+
setTimeout ( () ->
|
49
|
+
restoration = session.create()
|
50
|
+
restoration.done -> attempt.resolveWith @, arguments
|
51
|
+
restoration.progress -> attempt.notifyWith @, arguments
|
52
|
+
restoration.fail ->
|
53
|
+
# TODO think what this method should do with other response codes
|
54
|
+
sandbox.signed_in = false
|
55
|
+
mediator.emit 'session.restoration_failed'
|
56
|
+
|
57
|
+
attempt.rejectWith @, arguments
|
58
|
+
|
59
|
+
restoration.always ->
|
60
|
+
# TODO implement #show on devise/sessions_controller, and
|
61
|
+
# try to restore session not by creating a new one, but
|
62
|
+
# trying to retrieve the current one
|
63
|
+
setTimeout ->
|
64
|
+
session.restoring = false
|
65
|
+
, 100
|
66
|
+
mediator.emit 'session.restoration_tried'
|
67
|
+
|
68
|
+
), 3000
|
69
|
+
|
70
|
+
attempt
|
49
71
|
|
50
72
|
create: (user) ->
|
51
73
|
|
@@ -55,23 +77,42 @@ define 'aura/extensions/devise', () ->
|
|
55
77
|
user_session.dirty = true
|
56
78
|
|
57
79
|
user_session
|
58
|
-
.save ->
|
80
|
+
.save (response, status, xhr) ->
|
59
81
|
sandbox.current_user = @
|
60
82
|
sandbox.signed_in = true
|
83
|
+
mediator.emit 'session.created', @
|
61
84
|
mediator.emit 'user.signed_in', @
|
62
85
|
|
63
|
-
|
86
|
+
# When the user logs in, the csrf token changes, so we need
|
87
|
+
# to update it too! The ende gem extends the controller when
|
88
|
+
# devise is included to send it to us
|
89
|
+
# TODO implement as a indemma extension
|
90
|
+
token = xhr.getResponseHeader 'X-CSRF-Token'
|
91
|
+
console.warn "Server did not send the new csrf token.\n User may not be logged in!" unless token
|
92
|
+
$('meta[name="csrf-token"]').attr 'content', token
|
93
|
+
|
94
|
+
.fail (xhr) ->
|
95
|
+
switch xhr.status
|
96
|
+
when 401
|
97
|
+
mediator.emit 'session.creation_unauthorized', @ unless session.restoring # TODO implement #show on devise/sessions_controller
|
98
|
+
else
|
99
|
+
# TODO move session.restoring check outside this method
|
100
|
+
mediator.emit 'session.creation_failed', @
|
101
|
+
|
102
|
+
destroy: ->
|
103
|
+
# TODO update the csrf token with the new one!
|
104
|
+
session.instance.destroy()
|
105
|
+
.done ->
|
64
106
|
sandbox.current_user = null
|
65
|
-
|
66
|
-
|
107
|
+
sandbox.signed_in = false
|
108
|
+
mediator.emit 'user.signed_out', @
|
109
|
+
.fail (xhr) ->
|
110
|
+
mediator.emit 'session.destruction_failed', @
|
67
111
|
|
68
|
-
.always ->
|
69
|
-
mediator.emit 'session.restore.tried', @ if session.restoring
|
70
|
-
session.restoring = false
|
71
112
|
|
72
113
|
# user_password POST /users/password(.:format) devise/passwords#create
|
73
114
|
# new_user_password GET /users/password/new(.:format) devise/passwords#new
|
74
|
-
# edit_user_password GET /
|
115
|
+
# edit_user_password GET /userss/password/edit(.:format) devise/passwords#edit
|
75
116
|
# PATCH /users/password(.:format) devise/passwords#update
|
76
117
|
# PUT /users/password(.:format) devise/passwords#updaet
|
77
118
|
password =
|
@@ -92,13 +133,36 @@ define 'aura/extensions/devise', () ->
|
|
92
133
|
.save ->
|
93
134
|
mediator.emit 'user.password_recovered', @
|
94
135
|
.fail ->
|
136
|
+
# TODO improve event naming
|
95
137
|
mediator.emit 'user.unauthorized', @
|
96
138
|
|
139
|
+
domain =
|
140
|
+
action_unauthorized: ->
|
141
|
+
# Try to restore session in case of forbindness
|
142
|
+
#
|
143
|
+
# TODO Think if its really necessary to try to restore now its
|
144
|
+
# used only to get initial user
|
145
|
+
#
|
146
|
+
# TODO remove the session.restoring check and implement devise/sessions_controller#show
|
147
|
+
if not session.restoring and (sandbox.signed_in or sandbox.current_user)
|
148
|
+
mediator.off 'action.unauthorized', domain.action_unauthorized
|
149
|
+
session.restore()
|
150
|
+
.done ->
|
151
|
+
mediator.on 'action.unauthorized', domain.action_unauthorized
|
152
|
+
|
153
|
+
.fail (xhr) ->
|
154
|
+
# When the restoration was forbidden by the server, order to
|
155
|
+
# destroy current user session, because if there is one, it
|
156
|
+
# is probably invalid
|
157
|
+
session.destroy() if xhr.status == 401
|
158
|
+
|
159
|
+
|
160
|
+
|
97
161
|
|
98
162
|
|
99
163
|
# Extension definition
|
100
164
|
name: 'devise'
|
101
|
-
version: '0.1
|
165
|
+
version: '0.2.1'
|
102
166
|
initialize: (application) ->
|
103
167
|
|
104
168
|
core = application.core
|
@@ -108,9 +172,18 @@ define 'aura/extensions/devise', () ->
|
|
108
172
|
# Define callbacks
|
109
173
|
# TODO get json with features info from devise
|
110
174
|
# gem and only use apropriated listeners
|
111
|
-
mediator.on 'user.sign_in', session.create
|
175
|
+
mediator.on 'user.sign_in' , session.create
|
176
|
+
mediator.on 'user.sign_out', session.destroy
|
112
177
|
mediator.on 'user.recover_password', password.create
|
113
178
|
|
179
|
+
|
180
|
+
mediator.on 'action.unauthorized', domain.action_unauthorized
|
181
|
+
|
182
|
+
# TODO add ajax control into an extension and stop using jquery directly
|
183
|
+
jQuery(document).ajaxError (event, xhr) ->
|
184
|
+
if xhr.status == 401
|
185
|
+
mediator.emit 'action.unauthorized', sandbox.current_user unless session.restoring
|
186
|
+
|
114
187
|
# Define api
|
115
188
|
Object.defineProperty sandbox, 'current_user',
|
116
189
|
set: (user) -> session.current_user = user
|
@@ -118,6 +191,9 @@ define 'aura/extensions/devise', () ->
|
|
118
191
|
|
119
192
|
sandbox.session = session
|
120
193
|
|
194
|
+
define_routes: (router) ->
|
195
|
+
router.route '/users/sessions', 'session.new'
|
196
|
+
|
121
197
|
define_resources: (model) ->
|
122
198
|
|
123
199
|
# TODO define user session as a record too!
|
@@ -139,6 +215,9 @@ define 'aura/extensions/devise', () ->
|
|
139
215
|
afterAppStart: (application) ->
|
140
216
|
@define_resources application.core.models
|
141
217
|
|
218
|
+
# TODO move to an external module
|
219
|
+
@define_routes application if application.router?
|
220
|
+
|
142
221
|
# Restore session if not already
|
143
222
|
# TODO Restore only when application is ready
|
144
223
|
session.restore()
|
@@ -0,0 +1,21 @@
|
|
1
|
+
define 'aura/extensions/routes', ['application/routes'], (routes) ->
|
2
|
+
|
3
|
+
'use strict'
|
4
|
+
|
5
|
+
router = new require('lennon')()
|
6
|
+
|
7
|
+
(application) ->
|
8
|
+
core = application.core
|
9
|
+
logger = application.logger
|
10
|
+
mediator = core.mediator
|
11
|
+
_ = core.util._
|
12
|
+
|
13
|
+
application.router = router
|
14
|
+
application.route = (params) -> router.apply router, params
|
15
|
+
|
16
|
+
version: '0.1.0'
|
17
|
+
|
18
|
+
initialize: (application) ->
|
19
|
+
|
20
|
+
|
21
|
+
afterAppStart: (application) ->
|
@@ -9,7 +9,7 @@ define 'aura/extensions/states', ['application/states'], (states) ->
|
|
9
9
|
_ = core.util._
|
10
10
|
|
11
11
|
state =
|
12
|
-
current: '
|
12
|
+
current: 'initializing'
|
13
13
|
list: []
|
14
14
|
previous: null
|
15
15
|
change: (transition) ->
|
@@ -73,3 +73,5 @@ define 'aura/extensions/states', ['application/states'], (states) ->
|
|
73
73
|
Object.defineProperty application, 'state',
|
74
74
|
set: (to) -> state.change to: to
|
75
75
|
get: -> state.current
|
76
|
+
|
77
|
+
afterAppStart: (application) -> application.state = "default"
|
@@ -19,19 +19,33 @@ define 'aura/extensions/widget/eventable', ->
|
|
19
19
|
translations.set 'animation.start',
|
20
20
|
'webkitAnimationStart oanimationstart oAnimationStart msAnimationStart animationstart'
|
21
21
|
|
22
|
-
|
23
22
|
create_handler = (widget, event_name) ->
|
24
23
|
(event) ->
|
25
24
|
widget.sandbox.emit "#{widget.name}.#{widget.identifier}.#{event_name}ed", @
|
26
25
|
event.preventDefault()
|
27
26
|
false
|
28
27
|
|
28
|
+
eventable =
|
29
|
+
# TODO pass this extensions to the identifiable extension
|
30
|
+
# TODO use widget.extend with the constructor property
|
31
|
+
constructor: (options) ->
|
32
|
+
matches = extractor.exec options._ref
|
33
|
+
@name = matches[1]
|
34
|
+
@identifier = options.resource ? matches[2]
|
35
|
+
|
36
|
+
eventable.super.constructor.call @, options
|
37
|
+
|
38
|
+
@sandbox.identifier = @identifier
|
39
|
+
|
40
|
+
@
|
41
|
+
|
29
42
|
|
30
43
|
(application) ->
|
31
44
|
|
32
45
|
initialize: (application) ->
|
46
|
+
Widgets = application.core.Widgets
|
33
47
|
|
34
|
-
extend
|
48
|
+
extend Widgets.Base.prototype,
|
35
49
|
# TODO implement rivets compatibility, instead of generic binding events, alter html
|
36
50
|
handles: (event_name, widget_event_name = event_name, selector = @$el) ->
|
37
51
|
unless @name
|
@@ -45,22 +59,6 @@ define 'aura/extensions/widget/eventable', ->
|
|
45
59
|
|
46
60
|
@sandbox.dom.find(selector, context).on event_name, create_handler(@, widget_event_name || event_name)
|
47
61
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
eventableize = (options) ->
|
52
|
-
matches = extractor.exec options._ref
|
53
|
-
@name = matches[1]
|
54
|
-
@identifier = options.resource ? matches[2]
|
55
|
-
|
56
|
-
parent.call @, options
|
57
|
-
|
58
|
-
@sandbox.identifier = @identifier
|
59
|
-
|
60
|
-
@
|
61
|
-
|
62
|
-
eventableize.prototype = new parent _ref: ''
|
63
|
-
extend eventableize, parent
|
64
|
-
application.core.Widgets.Base = eventableize
|
65
|
-
|
66
|
-
|
62
|
+
# TODO replace Base.extend inheritance to stampit composition
|
63
|
+
Widgets.Base = Widgets.Base.extend eventable
|
64
|
+
eventable.super = Widgets.Base.__super__
|
@@ -52,6 +52,17 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
52
52
|
|
53
53
|
definition
|
54
54
|
|
55
|
+
recyclable =
|
56
|
+
constructor: (options) ->
|
57
|
+
recyclable.super.constructor.call @, options
|
58
|
+
|
59
|
+
# TODO only listen to this specific sandbox stop
|
60
|
+
@sandbox.on 'aura.sandbox.stop', (sandbox) =>
|
61
|
+
@stopped() if @sandbox.ref == sandbox.ref
|
62
|
+
|
63
|
+
stopped: ->
|
64
|
+
@$el.remove()
|
65
|
+
|
55
66
|
(application) ->
|
56
67
|
|
57
68
|
initialize: (application) ->
|
@@ -79,4 +90,9 @@ define 'aura/extensions/widget/lifecycleable', ->
|
|
79
90
|
else if not name
|
80
91
|
throw new TypeError "app.core.inject: No widget name provided" unless name?
|
81
92
|
|
82
|
-
core.start = lifecycleable.injection options
|
93
|
+
core.start = lifecycleable.injection options
|
94
|
+
|
95
|
+
# Add support for element removal after stoping widget
|
96
|
+
# TODO replace Base.extend inheritance to stampit composition
|
97
|
+
core.Widgets.Base = core.Widgets.Base.extend recyclable
|
98
|
+
recyclable.super = core.Widgets.Base.__super__
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
1
|
+
root = exports ? @
|
2
|
+
|
3
|
+
# TODO figure out a better place to put the crsft token initialization
|
4
|
+
# root.$.ajaxSetup
|
4
5
|
# beforeSend: (xhr) ->
|
5
6
|
# token = $('meta[name="csrf-token"]').attr('content')
|
6
7
|
# xhr.setRequestHeader 'X-CSRF-Token', token
|
@@ -1,8 +1,27 @@
|
|
1
1
|
#= require require/require
|
2
2
|
#= require build
|
3
|
+
#= require ./jquery
|
4
|
+
# TODO Move this file outside the initializers folder
|
3
5
|
|
4
6
|
root = exports ? this
|
5
7
|
|
8
|
+
# if jQuery is already included in the default build, we need to load
|
9
|
+
# it and globalize it, because aurajs does not know we are using
|
10
|
+
# component.io loader and thinks jquery must be shipped within it
|
11
|
+
# TODO think in away to not use a global jquery
|
12
|
+
try
|
13
|
+
root.jQuery = root.$ = require 'component-jquery'
|
14
|
+
catch e
|
15
|
+
# jQuery was not included in the component build, soo the application will fallback to the
|
16
|
+
# jquery builded in aurajs
|
17
|
+
|
18
|
+
# This may be included in build, and loaded before aurajs requires for them
|
19
|
+
# TODO also preload underscorejs
|
20
|
+
# TODO also preload eventemitter2
|
21
|
+
# TODO also preload require-jstext
|
22
|
+
|
23
|
+
# TODO!! Try to improve requirejs and components require integrationod
|
24
|
+
|
6
25
|
# Little object class to merge component require and requirejs require
|
7
26
|
loader =
|
8
27
|
shim: ->
|
@@ -66,9 +66,9 @@ define ['./states/index', './presenter'], (templates, presenter) ->
|
|
66
66
|
|
67
67
|
|
68
68
|
# Bind and unbind events depending on state
|
69
|
-
sandbox.on 'user.signed_in'
|
70
|
-
sandbox.on '
|
71
|
-
sandbox.on 'user.password_recovered'
|
69
|
+
sandbox.on 'user.signed_in' , authenticator.authenticated
|
70
|
+
sandbox.on 'session.creation_unauthorized' , authenticator.unauthorized
|
71
|
+
sandbox.on 'user.password_recovered' , recoverer.recovered
|
72
72
|
|
73
73
|
|
74
74
|
# Will also initialize sandbox!
|