ende 0.1.12 → 0.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c265e340f519fb57b7a5884fe4a8f0b27f2ea45
4
- data.tar.gz: 1893946a96f8999fe5447620ab9834145542992f
3
+ metadata.gz: 362630c766baff3cccabe5443ddb2be3d2b66050
4
+ data.tar.gz: 5afeec7b37e493bf49ed30bcbbcbc02981124b47
5
5
  SHA512:
6
- metadata.gz: 3b3f2b584afc45b31c50cc771cfdcb5b7bd2381ddc3c7038fe8e9fd20522a71fda0607f8b7cd8b82122049d60c93ae48893c743fbd44c0960871d46dcc928de7
7
- data.tar.gz: 58074b994df5664e0c19939a1166eb35fcc36682e8031d187c5b8375642c3168c3240af17256f1c45b12443b6a569839c46fca4ce18e431ae0ac146540909a54
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
- # Default values for the options passed to this widget
9
- #
10
- # Note: the options are passed thorught the html element data
11
- # attributes for this widget: <div data-aura-amount="3"></div>
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
- @scope.all (records) =>
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
@@ -1,3 +1,3 @@
1
1
  module Ende
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
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
- # config.initializer :blah do
18
- # UsersController.send :include, UsersControllerExtensions if devise
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.12
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-07 00:00:00.000000000 Z
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