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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d9cffdff63f333c6f998182588b91493382b9bc
4
- data.tar.gz: e262aa1a947ebf2ac0e6abd335447160c548f157
3
+ metadata.gz: 67175a38bbf95b8a59dec5180128fd9abb123ee5
4
+ data.tar.gz: 7efc8d8c9dcf9e72a2d490c13791c9638ed468d1
5
5
  SHA512:
6
- metadata.gz: 9496216b99e6ad4dd307373dc70a6739e7c6f17c238fd02bfa21c0098813f438105c74ab58ce5b35e55938abed97ba08250bb4e070ea553ab7d0ef86933224f4
7
- data.tar.gz: a705a310d3f42b14f2ed2e6fec1787e41a7bf176f969ba0b77646facf5d23268ab32a93a77b9de7b3954acf579e5bf6d307d01c177931e315e1e26b37e2916b9
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/stampit/stampit.js"
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
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "thor"
23
24
  end
@@ -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
- setTimeout (( ) -> session.create()), 3000
48
- # session.create()
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
- .fail ->
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
- mediator.emit 'user.unauthorized', @ unless session.restoring
66
- sandbox.signed_in ||= false
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 /users/password/edit(.:format) devise/passwords#edit
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.0'
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: 'default'
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 application.core.Widgets.Base.prototype,
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
- parent = application.core.Widgets.Base
49
-
50
- # TODO pass this extensions to the identifiable extension
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
- # window.$ require 'jquery'
2
- #
3
- # window.$.ajaxSetup
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: ->
@@ -1 +1,3 @@
1
- #= require_tree ./config/initializers
1
+ #= require ende/build
2
+ #= require_tree ./config/initializers
3
+ # TODO think if require jquery and jquery inview in this place is actualy a good idead
@@ -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' , authenticator.authenticated
70
- sandbox.on 'user.unauthorized' , authenticator.unauthorized
71
- sandbox.on 'user.password_recovered' , recoverer.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!