ende 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +2 -1
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +2 -0
- data/lib/assets/javascripts/widgets/authenticator/main.js.coffee +7 -6
- data/lib/assets/javascripts/widgets/content/main.js.coffee +44 -0
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +7 -5
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +14 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 362630c766baff3cccabe5443ddb2be3d2b66050
|
4
|
+
data.tar.gz: 5afeec7b37e493bf49ed30bcbbcbc02981124b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479fccebac6fdcbed5fba140c3cca96691e9dd7a6d84cff785628ad83e9e24ac40e4cf9699fe2cb685abc22dfd1c9ced7f878e7646c4336851041fa3541cf9c7
|
7
|
+
data.tar.gz: 3a3beb85a7627e57a4f924a14a5ae077f7d6cd297f4174d493eb95db9d350418ccc4be3057deded4d7a5c85d2fc658947da6cbe8accae02900c9db1064ee0af4
|
@@ -11,6 +11,7 @@ define 'aura/extensions/devise', () ->
|
|
11
11
|
# TODO create an indemma session model, or use apps default session
|
12
12
|
# model, or the configured one
|
13
13
|
session =
|
14
|
+
# TODO add support for authentication keys
|
14
15
|
build: (user = {}) ->
|
15
16
|
|
16
17
|
if core.models.user
|
@@ -147,7 +148,7 @@ define 'aura/extensions/devise', () ->
|
|
147
148
|
mediator.emit 'password.created', @
|
148
149
|
mediator.emit 'user.password_created' , user
|
149
150
|
|
150
|
-
.fail ->
|
151
|
+
.fail (xhr) ->
|
151
152
|
# TODO improve event naming
|
152
153
|
# TODO treat other failure cases
|
153
154
|
# TODO auto publish events
|
@@ -45,6 +45,8 @@ define 'aura/extensions/models', <%= models_list.to_json %>, (models...) ->
|
|
45
45
|
sandbox = application.sandbox
|
46
46
|
core.util.inflector =
|
47
47
|
cssify: (sentence) -> sentence.replace /\//, '-'
|
48
|
+
pluralize: indemma.model.pluralize
|
49
|
+
singularize: indemma.model.singularize
|
48
50
|
|
49
51
|
# TODO rename core.models to core.domain, completely
|
50
52
|
core.domain = core.models = sandbox.models = indemma.model
|
@@ -5,12 +5,11 @@ define ['./states/index', './presenter'], (templates, presenter) ->
|
|
5
5
|
#
|
6
6
|
# type: 'Base'
|
7
7
|
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# options: {}
|
8
|
+
|
9
|
+
# TODO add support for authentication keys
|
10
|
+
# TODO get authentication keys from server side
|
11
|
+
# options:
|
12
|
+
# authentication_keys: ['email']
|
14
13
|
|
15
14
|
|
16
15
|
# Widget initialization method, will be called upon loading, options
|
@@ -88,4 +87,6 @@ define ['./states/index', './presenter'], (templates, presenter) ->
|
|
88
87
|
transition: (to) ->
|
89
88
|
@html templates[to]
|
90
89
|
@bind @presentation
|
90
|
+
|
91
|
+
@sandbox.emit 'authenticator.state_changed', target: @, to: to
|
91
92
|
@observed.state = to
|
@@ -0,0 +1,44 @@
|
|
1
|
+
define ->
|
2
|
+
|
3
|
+
defaults =
|
4
|
+
context: null
|
5
|
+
beforeSend: (xhr) ->
|
6
|
+
xhr.setRequestHeader 'X-XHR-Referer', document.location.href
|
7
|
+
|
8
|
+
type: 'Base'
|
9
|
+
version: '0.0.1'
|
10
|
+
options:
|
11
|
+
autoload: true
|
12
|
+
|
13
|
+
initialize: (options) ->
|
14
|
+
@sandbox.logger.log "initialized!"
|
15
|
+
|
16
|
+
throw new TypeError "content.initialize: No uri provided to load content" unless options.uri?
|
17
|
+
throw new TypeError "content.initialize: Multiple before sends are not supported yet" if options.beforeSend
|
18
|
+
|
19
|
+
defaults.context = @
|
20
|
+
|
21
|
+
options.url = options.uri
|
22
|
+
delete options.uri
|
23
|
+
|
24
|
+
if options.autoload
|
25
|
+
delete options.autoload
|
26
|
+
@load()
|
27
|
+
else
|
28
|
+
@sandbox.once "content.#{@identifier}.load", @, @load
|
29
|
+
|
30
|
+
load: ->
|
31
|
+
options = @sandbox.util._.omit @options, 'el', 'ref', '_ref', 'name', 'require', 'baseUrl'
|
32
|
+
options = $.extend {}, defaults, options
|
33
|
+
|
34
|
+
# TODO remove jQuery dependency
|
35
|
+
$.ajax(options).done(@loaded).fail(@failed)
|
36
|
+
|
37
|
+
loaded: (response) ->
|
38
|
+
|
39
|
+
# Will also initialize sandbox!
|
40
|
+
@html response
|
41
|
+
|
42
|
+
failed: ->
|
43
|
+
|
44
|
+
@html 'Failed to load content'
|
@@ -128,15 +128,17 @@ define ['./states/index', './presenters/default', '/assets/jquery/inview'], (tem
|
|
128
128
|
|
129
129
|
@load = @sandbox.ui.loader @results
|
130
130
|
|
131
|
+
if @options.records?
|
132
|
+
deferred = jQuery.Deferred()
|
133
|
+
deferred.resolveWith @scope, [@options.records]
|
134
|
+
else
|
135
|
+
deferred = @scope.all()
|
136
|
+
|
131
137
|
# Initialize dependencies
|
132
|
-
|
138
|
+
deferred.done (records) =>
|
133
139
|
|
134
140
|
@load.stop()
|
135
141
|
|
136
|
-
# TODO do not fetch for records instead of just rendering an
|
137
|
-
# empty viewer
|
138
|
-
records = @options.records if @options.records?
|
139
|
-
|
140
142
|
@presentation = @presenter records
|
141
143
|
|
142
144
|
@html templates[@options.resource]
|
data/lib/ende/version.rb
CHANGED
data/lib/ende.rb
CHANGED
@@ -2,6 +2,7 @@ require "ende/version"
|
|
2
2
|
|
3
3
|
module Ende
|
4
4
|
class Railtie < Rails::Railtie
|
5
|
+
|
5
6
|
config.to_prepare do
|
6
7
|
current_dir = Pathname.new(__FILE__).parent.parent
|
7
8
|
assets = Ende.assets
|
@@ -14,13 +15,24 @@ module Ende
|
|
14
15
|
|
15
16
|
# Check if devise exists and extend devise controllers to send
|
16
17
|
# authenticity (csrf) token
|
17
|
-
#
|
18
|
-
|
18
|
+
# initializer :user_controller_extensions do |config|
|
19
|
+
# UsersController.class_eval do
|
20
|
+
# include, UsersControllerExtensions if devise_controller?
|
21
|
+
# end
|
19
22
|
# end
|
20
23
|
end
|
21
24
|
|
25
|
+
def Ende.load_widget_extensions
|
26
|
+
current_dir = Pathname.new(__FILE__).parent.parent
|
27
|
+
Dir.glob(current_dir.join 'lib', 'assets', '**', '*.rb').each do |extension|
|
28
|
+
require extension
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def Ende.assets
|
23
33
|
assets = Railtie.config.assets rescue nil
|
24
34
|
assets or Rails.application.config.assets
|
25
35
|
end
|
26
36
|
end
|
37
|
+
|
38
|
+
Ende.load_widget_extensions
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ende
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/assets/javascripts/widgets/authenticator/states/default.html
|
90
90
|
- lib/assets/javascripts/widgets/authenticator/states/index.js.coffee
|
91
91
|
- lib/assets/javascripts/widgets/authenticator/states/passwords.html
|
92
|
+
- lib/assets/javascripts/widgets/content/main.js.coffee
|
92
93
|
- lib/assets/javascripts/widgets/form/default.html
|
93
94
|
- lib/assets/javascripts/widgets/form/main.js.coffee
|
94
95
|
- lib/assets/javascripts/widgets/form/presenter.js.coffee
|