ende 0.5.8 → 0.5.9
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/lib/assets/javascripts/aura/extensions/{models.js.coffee.erb → resources.js.coffee.erb} +7 -8
- data/lib/assets/javascripts/aura/extensions/states.js.coffee +1 -1
- data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +3 -0
- data/lib/assets/javascripts/widgets/contact/main.js.coffee +87 -0
- data/lib/assets/javascripts/widgets/contact/presenter.js.coffee +10 -0
- data/lib/assets/javascripts/widgets/contact/states/default.html.haml +39 -0
- data/lib/assets/javascripts/widgets/contact/states/index.js.coffee +2 -0
- data/lib/ende/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dae52e696f3671e586020dbaa2eb76995b7d2ff5
|
4
|
+
data.tar.gz: ae527f3c6d02a6a220827c38270be8d8a60cbe6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a828c279160ad67eeff93fa0722b9b1c1f3d520b4020b3eab72bd4daae18c5f230b3048e859c65f513195bbf25a526bb15dd8759f0257c32b1af6b12ac6c7e0d
|
7
|
+
data.tar.gz: 6484be1734abb16edf37a524bfbee2b3764cb04f3843a2fa01db2f0a8d9423dd1c5cc401c023fdc8d9a8f4fcb2d3aabf02ccf51cc269a501d6562bdadcaaeb99
|
data/lib/assets/javascripts/aura/extensions/{models.js.coffee.erb → resources.js.coffee.erb}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
<% # TODO mover para helper
|
2
|
-
base_path = Rails.root.join('app', 'assets', 'javascripts', '
|
2
|
+
base_path = Rails.root.join('app', 'assets', 'javascripts', 'resources')
|
3
3
|
models_list = Dir.glob(Rails.root.join(base_path, '**', '*.js*'))
|
4
4
|
models_list.map! do |file|
|
5
5
|
file.sub! base_path.to_s + '/', ''
|
@@ -8,7 +8,7 @@ models_list.map! do |file|
|
|
8
8
|
next nil if file =~ /~/
|
9
9
|
|
10
10
|
entries = file.split /\// || []
|
11
|
-
entries.unshift '
|
11
|
+
entries.unshift 'resources'
|
12
12
|
entries.push File.basename entries.pop, '.js.coffee'
|
13
13
|
File.join *entries
|
14
14
|
|
@@ -20,12 +20,10 @@ end
|
|
20
20
|
|
21
21
|
%>
|
22
22
|
|
23
|
-
'use strict'
|
24
|
-
|
25
23
|
|
26
|
-
|
24
|
+
'use strict'
|
27
25
|
|
28
|
-
define 'aura/extensions/
|
26
|
+
define 'aura/extensions/resources', <%= models_list.to_json %>, (resources...) ->
|
29
27
|
|
30
28
|
# TODO better require api for indemma
|
31
29
|
indemma = require 'indefinido~indemma@master'
|
@@ -47,7 +45,7 @@ define 'aura/extensions/models', <%= models_list.to_json %>, (resources...) ->
|
|
47
45
|
|
48
46
|
name: 'resources'
|
49
47
|
|
50
|
-
version: '0.
|
48
|
+
version: '0.2.0'
|
51
49
|
|
52
50
|
# Extension definition
|
53
51
|
initialize: (application) ->
|
@@ -68,7 +66,7 @@ define 'aura/extensions/models', <%= models_list.to_json %>, (resources...) ->
|
|
68
66
|
core.resource = core.model = sandbox.resource = sandbox.model = (name) ->
|
69
67
|
# TODO use a Map internally in indemma
|
70
68
|
model = indemma.model[name]
|
71
|
-
throw new TypeError unless model?
|
69
|
+
throw new TypeError "Resource not found with name: #{name}\nCheck for the definition on assets/javascripts/resources/#{name}.js.coffee" unless model?
|
72
70
|
model
|
73
71
|
|
74
72
|
# TODO rename core.models and core.domain, to core.resources, completely
|
@@ -85,3 +83,4 @@ define 'aura/extensions/models', <%= models_list.to_json %>, (resources...) ->
|
|
85
83
|
core.util._.map resources, (definition) ->
|
86
84
|
resource = indemma.model.call definition
|
87
85
|
indemma.model.every.push resource
|
86
|
+
|
@@ -137,7 +137,7 @@ define 'aura/extensions/states', ['states'], (states) ->
|
|
137
137
|
get: -> state.current
|
138
138
|
|
139
139
|
# TODO clearer startup sequence
|
140
|
-
application.core.metabolize = (root) ->
|
140
|
+
application.core.metabolize = (root = 'body') ->
|
141
141
|
# If any initialized flow changed the application state
|
142
142
|
# before the widgets initialization, store its state pass
|
143
143
|
# through the default state and go back to the old state
|
@@ -45,6 +45,9 @@ define 'aura/extensions/widget/eventable', ['stampit', 'es6-map-shim'], (stampit
|
|
45
45
|
@identifier = @options.identifier or @options.resource or matches[2]
|
46
46
|
@sandbox.identifier = @identifier
|
47
47
|
|
48
|
+
on: (event_name, handler, context) -> @sandbox.on "#{@name}.#{@identifier}.#{event_name}", handler, context || @
|
49
|
+
emit: (event_name, data...) -> @sandbox.emit "#{@name}.#{@identifier}.#{event_name}", data...
|
50
|
+
|
48
51
|
version: '0.1.0'
|
49
52
|
|
50
53
|
initialize: (application) ->
|
@@ -0,0 +1,87 @@
|
|
1
|
+
define ['./states/index', './presenter'], (templates, presenter) ->
|
2
|
+
|
3
|
+
# If some extension provides you can use the type defined in there
|
4
|
+
# to extend your widget. Defaults to Base constructor.
|
5
|
+
#
|
6
|
+
type: 'Base'
|
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-widget="contact" data-aura-amount="3"></div>
|
12
|
+
#
|
13
|
+
# options: {}
|
14
|
+
|
15
|
+
|
16
|
+
# Widget initialization method, will be called upon loading, options
|
17
|
+
# are already filled with defaults
|
18
|
+
initialize: (options) ->
|
19
|
+
widget = @
|
20
|
+
sandbox = @sandbox
|
21
|
+
sandbox.logger.log "initialized!"
|
22
|
+
|
23
|
+
# Will also initialize sandbox!
|
24
|
+
@html templates.default
|
25
|
+
|
26
|
+
# Forward the models to the presenter
|
27
|
+
message = sandbox.resource('message')()
|
28
|
+
|
29
|
+
sender =
|
30
|
+
button_label: 'Enviar mensagem'
|
31
|
+
|
32
|
+
status: 'idle'
|
33
|
+
classes: ->
|
34
|
+
"widget #{sender.status} contact"
|
35
|
+
|
36
|
+
send: (event) =>
|
37
|
+
sender.status = "loading blocked" # replace all status
|
38
|
+
sender.button_label = 'Enviando sua mensagem...'
|
39
|
+
if message.valid
|
40
|
+
message.save().done ->
|
41
|
+
widget.emit 'sent'
|
42
|
+
.fail (event) ->
|
43
|
+
if event.status == 422
|
44
|
+
widget.emit 'send_errored'
|
45
|
+
else
|
46
|
+
widget.emit 'send_failed'
|
47
|
+
else
|
48
|
+
widget.emit 'send_errored'
|
49
|
+
event.preventDefault()
|
50
|
+
|
51
|
+
sent: ->
|
52
|
+
sender.status = 'success blocked'
|
53
|
+
sender.button_label = 'Sua mensagem foi enviada com sucesso! Vamos responder logo.'
|
54
|
+
message.reset() # TODO reset only the presenter?
|
55
|
+
setTimeout ->
|
56
|
+
sender.status = 'idle'
|
57
|
+
sender.button_label = 'Enviar outra mensagem'
|
58
|
+
, 5000
|
59
|
+
|
60
|
+
send_errored: ->
|
61
|
+
sender.status = 'error blocked'
|
62
|
+
sender.button_label = 'Ops... confira os dados acima e tente novamente.'
|
63
|
+
setTimeout ->
|
64
|
+
sender.status = 'error'
|
65
|
+
sender.button_label = 'Enviar mensagem'
|
66
|
+
, 4000
|
67
|
+
|
68
|
+
send_failed: ->
|
69
|
+
sender.status = 'error blocked'
|
70
|
+
sender.button_label = 'Ops... ocorreu um erro no servidor e já fomos avisados. Que tal tentar novamente mais tarde?.'
|
71
|
+
setTimeout ->
|
72
|
+
sender.status = 'error'
|
73
|
+
sender.button_label = 'Tentar novamente'
|
74
|
+
, 7000
|
75
|
+
|
76
|
+
|
77
|
+
@$el.attr 'data-class', 'sender.classes < sender.status'
|
78
|
+
|
79
|
+
# Bind presenter to template
|
80
|
+
presentation = presenter message, sender
|
81
|
+
@$el.addClass 'contact'
|
82
|
+
@bind presentation
|
83
|
+
|
84
|
+
# TODO implement widget.on
|
85
|
+
@on 'sent' , sender.sent
|
86
|
+
@on 'send_failed' , sender.send_failed
|
87
|
+
@on 'send_errored', sender.send_errored
|
@@ -0,0 +1,39 @@
|
|
1
|
+
%h2 Fale com a gente
|
2
|
+
|
3
|
+
%form.form
|
4
|
+
.form-group{data: {class: {invalid: 'message.errors.name' }}}
|
5
|
+
%span.required-mark{ title: "obrigatório" } *
|
6
|
+
%input.form-control{ placeholder: "Nome", required: true, autofocus: true, data: { value: "message.name" } }
|
7
|
+
%i.validation ×
|
8
|
+
.tooltip.right
|
9
|
+
.tooltip-inner {{message.errors.name}}
|
10
|
+
.tooltip-arrow
|
11
|
+
|
12
|
+
.form-group{data: {class: {invalid: 'message.errors.email' }}}
|
13
|
+
%span.required-mark{ title: "obrigatório" } *
|
14
|
+
%input.form-control{ type: 'email', placeholder: "E-mail", required: :required, data: { value: "message.email" } }
|
15
|
+
%i.validation ×
|
16
|
+
.tooltip.right
|
17
|
+
.tooltip-inner {{message.errors.email}}
|
18
|
+
.tooltip-arrow
|
19
|
+
|
20
|
+
.form-group{data: {class: {invalid: 'message.errors.subject' }}}
|
21
|
+
%span.required-mark{ title: "obrigatório" } *
|
22
|
+
%input.form-control{ placeholder: "Assunto", data: { value: "message.subject" } }
|
23
|
+
%i.validation ×
|
24
|
+
.tooltip.right
|
25
|
+
.tooltip-inner {{message.errors.subject}}
|
26
|
+
.tooltip-arrow
|
27
|
+
|
28
|
+
.form-group{data: {class: {invalid: 'message.errors.body' }}}
|
29
|
+
%span.required-mark{ title: "obrigatório" } *
|
30
|
+
%textarea.form-control{ placeholder: "Mensagem", required: :required, data: { value: "message.body" }, rows: 6 }
|
31
|
+
%i.validation ×
|
32
|
+
.tooltip.right
|
33
|
+
.tooltip-inner {{message.errors.body}}
|
34
|
+
.tooltip-arrow
|
35
|
+
|
36
|
+
%button.btn.btn-success.btn-block{data: {html: 'sender.button_label', on: {click: 'sender.send'}}} Enviar mensagem
|
37
|
+
|
38
|
+
%br
|
39
|
+
%br
|
data/lib/ende/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -177,8 +177,8 @@ files:
|
|
177
177
|
- lib/assets/javascripts/aura/extensions/loader.js.coffee
|
178
178
|
- lib/assets/javascripts/aura/extensions/mask.js.coffee
|
179
179
|
- lib/assets/javascripts/aura/extensions/mediator.js
|
180
|
-
- lib/assets/javascripts/aura/extensions/models.js.coffee.erb
|
181
180
|
- lib/assets/javascripts/aura/extensions/platform.js.coffee
|
181
|
+
- lib/assets/javascripts/aura/extensions/resources.js.coffee.erb
|
182
182
|
- lib/assets/javascripts/aura/extensions/rivets.js.coffee
|
183
183
|
- lib/assets/javascripts/aura/extensions/rivets/accounting.js.coffee
|
184
184
|
- lib/assets/javascripts/aura/extensions/rivets/formatters.js.coffee
|
@@ -207,6 +207,10 @@ files:
|
|
207
207
|
- lib/assets/javascripts/widgets/authenticator/states/default.html
|
208
208
|
- lib/assets/javascripts/widgets/authenticator/states/index.js.coffee
|
209
209
|
- lib/assets/javascripts/widgets/authenticator/states/passwords.html
|
210
|
+
- lib/assets/javascripts/widgets/contact/main.js.coffee
|
211
|
+
- lib/assets/javascripts/widgets/contact/presenter.js.coffee
|
212
|
+
- lib/assets/javascripts/widgets/contact/states/default.html.haml
|
213
|
+
- lib/assets/javascripts/widgets/contact/states/index.js.coffee
|
210
214
|
- lib/assets/javascripts/widgets/content/main.js.coffee
|
211
215
|
- lib/assets/javascripts/widgets/dialog/main.js.coffee
|
212
216
|
- lib/assets/javascripts/widgets/dialog/presenter.js.coffee
|