ende 0.2.19 → 0.2.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20f58c97d11116adab7967ea27b5c43b3b349dc7
4
- data.tar.gz: 9a1ea51e6742658e1d987785f2ecc7c2dc8f1bba
3
+ metadata.gz: 046a0ed43eae2200826c55b0c423d9e45b1656dc
4
+ data.tar.gz: 96018aaf998f600f8a7e434429d84ee6f2daa40d
5
5
  SHA512:
6
- metadata.gz: 5866c1117c421e09c41b3606ad801784e7b20bf3488e572ad4e6fd9d4ba95ec7f1758650137828fd89389e581c5444ad4e53aaeec6c1dc661bdf1f031d0c9ba0
7
- data.tar.gz: c5ea7be1ad9dac6c401fd9fe01039ee8dc37809d42d3829ddbb189ead8f0e526f1903708a255e8d81bebdeb073939b3aea22b2be4919d2cc9c3d8f46c65ead49
6
+ metadata.gz: a315647d6135e2830247174ad17294ead57b36cb9b1432dc78643325accc154afe520163d008734c103ac7eeae3ae13be4f1b69770911af0ec6364907f181dd2
7
+ data.tar.gz: 7aba13a1af67e58d416a8d10a787f3e978ca8325d60a1c18e8fbf1d84844a2b63696ba51ee7872d78b6a62c5c9371b1bfda67171ae3b85549775037096aeb1fe
data/README.md CHANGED
@@ -59,6 +59,7 @@ Extensions List
59
59
  - Devise
60
60
  - Rivets
61
61
  - Widget
62
+ - Napable
62
63
  - Lifecycleable
63
64
  - Eventable
64
65
  - Models
@@ -20,7 +20,6 @@ end
20
20
 
21
21
  %>
22
22
 
23
-
24
23
  'use strict'
25
24
 
26
25
  root = exports ? this
@@ -102,25 +102,34 @@ define 'aura/extensions/widget/lifecycleable', ->
102
102
  lifecycleable.capitalize = core.util.capitalize
103
103
 
104
104
  # Add injection function for widgets
105
- core.inject = (name, options) ->
105
+ # TODO create a paremeter parser method
106
+ core.inject = (name, options, parent = core) ->
106
107
 
107
108
  switch arguments.length
108
109
  when 1
109
110
  if jQuery.isArray name
110
111
  widgets = name
111
112
  injections = core.util._.map widgets, lifecycleable.injection, lifecycleable
112
- return core.start injections
113
+ return parent.start injections
113
114
  else
114
115
  options = name
115
- core.start [lifecycleable.injection name: options.name, options: options]
116
+ parent.start [lifecycleable.injection name: options.name, options: options]
116
117
 
117
118
  when 2
118
119
  options.name ||= name
119
- core.start [lifecycleable.injection name: options.name, options: options]
120
+ parent.start [lifecycleable.injection name: options.name, options: options]
121
+ when 3
122
+ if options?
123
+ options.name ||= name
124
+ else
125
+ options = name
126
+
127
+ parent.start [lifecycleable.injection name: options.name, options: options]
120
128
 
121
129
  # TODO instead of using inject function, overwrite start function
122
130
  application.sandbox.inject = (params...) ->
123
131
  console.warn 'sandbox.inject will be deprecated, then you will use sandbox.start with object parameters'
132
+ params[2] = @ if params.length < 3
124
133
  core.inject params...
125
134
 
126
135
  # Add support for element removal after stoping widget
@@ -0,0 +1,33 @@
1
+ define 'aura/extensions/widget/napable', ->
2
+
3
+ 'use strict'
4
+
5
+ napable =
6
+ bind: ->
7
+ @sandbox.on "#{@name}.#{@identifier}.sleep", napable.sleep, @
8
+ @sandbox.on "#{@name}.#{@identifier}.wake" , napable.wake , @
9
+ sleep: ->
10
+ @$el.addClass 'asleep'
11
+ @$el.removeClass 'awake'
12
+ wake: ->
13
+ @$el.addClass 'awake'
14
+ @$el.removeClass 'asleep'
15
+
16
+ extensions =
17
+ constructor: ->
18
+ extensions["super"].constructor.apply @, arguments
19
+ napable.bind.call @
20
+
21
+ # The purpose of this extension is allow parent widget to save
22
+ # memory by sending a sleep command to the child widgets
23
+ (application) ->
24
+
25
+ version: '0.1.0'
26
+
27
+ initialize: (application) ->
28
+ {core} = application
29
+
30
+ # Add support for element removal after stoping widget
31
+ # TODO replace Base.extend inheritance to stampit composition
32
+ core.Widgets.Base = core.Widgets.Base.extend extensions
33
+ extensions.super = core.Widgets.Base.__super__
@@ -10,7 +10,8 @@ define ->
10
10
 
11
11
  @sandbox.on "content.#{@identifier}.load", @load, @
12
12
 
13
- if options.autoload
13
+ # TODO convert options to respective types and remove != 'false' comparison
14
+ if options.autoload and options.autoload != 'false'
14
15
  delete options.autoload
15
16
  @sandbox.emit "content.#{@identifier}.load"
16
17
 
@@ -37,6 +38,8 @@ define ->
37
38
 
38
39
  # TODO move to handlers
39
40
  load: (options) ->
41
+ _.invoke @sandbox._children, 'stop' if @sandbox._children?.length
42
+
40
43
  # TODO move to anoter method
41
44
  if @loads > 0
42
45
  @html ''
@@ -50,6 +53,7 @@ define ->
50
53
  @spinner = @sandbox.ui.loader @$el
51
54
  @$el.addClass "loading"
52
55
  @$el.removeClass "idle"
56
+
53
57
 
54
58
  # TODO remove jQuery dependency
55
59
  @loading = $.ajax(@request_options options).done(@loaded).fail(@failed).always(@ended)
@@ -32,9 +32,12 @@ define ->
32
32
  render: (options) ->
33
33
  {widget, content: child} = options
34
34
  {sandbox, $el: el} = widget
35
+ identifier = child.identifier || child.resource || 'default'
36
+
35
37
  @el = el
36
38
 
37
39
  el.addClass 'hide' unless options.autoshow
40
+ el.addClass 'injecting'
38
41
 
39
42
  sandbox.inject options.content
40
43
 
@@ -45,11 +48,17 @@ define ->
45
48
  @hide()
46
49
  false
47
50
 
48
- sandbox.once "#{child.name}.#{child.identifier || 'default'}.started", (widget) =>
51
+ # Positionate modal after widget insertions, when widget starts
52
+ # visible
53
+ @positionate() if options.autoshow
54
+
55
+ # TODO get identifier through sandbox method instead of generating here
56
+ sandbox.once "#{child.name}.#{identifier}.started", (widget) =>
57
+ el.removeClass 'injecting'
49
58
  @positionate()
50
59
 
51
60
  # TODO better close html creation and handling
52
- el.prepend @close_template
61
+ el.prepend @close_template if options.closable
53
62
 
54
63
 
55
64
  remove: ->
@@ -62,7 +71,7 @@ define ->
62
71
 
63
72
  dialog: null
64
73
 
65
- version: '0.1.0'
74
+ version: '0.1.1'
66
75
 
67
76
  options:
68
77
 
@@ -80,7 +89,14 @@ define ->
80
89
  overlay = require 'component-overlay'
81
90
  @sandbox.util.extend dialog.prototype, dialog_extensions
82
91
 
92
+ # Initialize fundamental style
93
+ @$el.attr 'id', 'dialog'
94
+ options.size && @$el.addClass options.size
95
+ options.theme && @$el.addClass options.theme
96
+
97
+
83
98
  widget_options = @extract_options()
99
+
84
100
  @dialog = new dialog
85
101
  widget: @, # TODO forward only element of the widget
86
102
  autoshow: options.autoshow
@@ -94,11 +110,11 @@ define ->
94
110
  # TODO better dialog implementation
95
111
  options.closable && @dialog.closable()
96
112
 
97
- @identifier = widget_options.name if @identifier == 'default' or @identifier == @name
98
- @$el.attr 'id', 'dialog'
99
- options.size && @$el.addClass options.size
100
- options.theme && @$el.addClass options.theme
101
-
113
+ if @identifier == 'default' or @identifier == @name
114
+ @identifier = widget_options.name
115
+ # TODO implement postaljs and filter children widgets by event
116
+ # emitter instead of widget resources
117
+ @identifier += '!' + widget_options.resource if widget_options.resource?
102
118
 
103
119
  # TODO update dialog and remove this code when issue
104
120
  # https://github.com/component/dialog/issues/9 is fixed
@@ -112,7 +128,6 @@ define ->
112
128
 
113
129
  @_overlay = o
114
130
 
115
-
116
131
  # TODO add deprecation warning messages to modal commands
117
132
  @sandbox.on "modal.#{@identifier}.show" , @dialog.show , @dialog
118
133
  @sandbox.on "modal.#{@identifier}.hide" , @dialog.hide , @dialog
data/lib/ende/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ende
2
- VERSION = "0.2.19"
2
+ VERSION = "0.2.20"
3
3
  end
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.2.19
4
+ version: 0.2.20
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-12-31 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,6 +79,7 @@ files:
79
79
  - lib/assets/javascripts/aura/extensions/states.js.coffee
80
80
  - lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee
81
81
  - lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee
82
+ - lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
82
83
  - lib/assets/javascripts/aura/extensions/widget/presentable.js.coffee
83
84
  - lib/assets/javascripts/aura/presentable.js.coffee
84
85
  - lib/assets/javascripts/config/initializers/jquery.js.coffee