tao_ui 0.3.4 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tao_ui/components/tree/item_component.rb +20 -12
  3. data/lib/tao_ui/components/tree_component.rb +1 -1
  4. data/lib/tao_ui/engine.rb +0 -1
  5. data/lib/tao_ui/version.rb +1 -1
  6. data/lib/views/components/tao_ui/components/_dialog.html.erb +2 -2
  7. data/lib/views/components/tao_ui/components/_slide_box.html.erb +1 -1
  8. metadata +7 -157
  9. data/config/autoprefixer.yml +0 -7
  10. data/lib/assets/icons/Loading.svg +0 -19
  11. data/lib/assets/icons/close.svg +0 -12
  12. data/lib/assets/javascripts/tao/ui/dialog/confirm.coffee +0 -13
  13. data/lib/assets/javascripts/tao/ui/dialog/element.coffee +0 -115
  14. data/lib/assets/javascripts/tao/ui/dialog/index.coffee +0 -16
  15. data/lib/assets/javascripts/tao/ui/dialog/message.coffee +0 -13
  16. data/lib/assets/javascripts/tao/ui/icons/base.coffee +0 -5
  17. data/lib/assets/javascripts/tao/ui/icons/index.coffee +0 -20
  18. data/lib/assets/javascripts/tao/ui/index.coffee +0 -12
  19. data/lib/assets/javascripts/tao/ui/mobile/index.coffee +0 -6
  20. data/lib/assets/javascripts/tao/ui/mobile/slide_box/element.coffee +0 -7
  21. data/lib/assets/javascripts/tao/ui/mobile/slide_box/index.coffee +0 -2
  22. data/lib/assets/javascripts/tao/ui/popover/confirm.coffee +0 -23
  23. data/lib/assets/javascripts/tao/ui/popover/create.coffee +0 -18
  24. data/lib/assets/javascripts/tao/ui/popover/direction.coffee +0 -76
  25. data/lib/assets/javascripts/tao/ui/popover/element.coffee +0 -198
  26. data/lib/assets/javascripts/tao/ui/popover/index.coffee +0 -16
  27. data/lib/assets/javascripts/tao/ui/popover/position.coffee +0 -80
  28. data/lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee +0 -118
  29. data/lib/assets/javascripts/tao/ui/shared/slide_box/export.coffee +0 -11
  30. data/lib/assets/javascripts/tao/ui/shared/ujs.coffee +0 -51
  31. data/lib/assets/javascripts/tao/ui/slide_box/element.coffee +0 -9
  32. data/lib/assets/javascripts/tao/ui/slide_box/index.coffee +0 -2
  33. data/lib/assets/javascripts/tao/ui/sortable.coffee +0 -147
  34. data/lib/assets/javascripts/tao/ui/table/element.coffee +0 -13
  35. data/lib/assets/javascripts/tao/ui/table/expandable.coffee +0 -62
  36. data/lib/assets/javascripts/tao/ui/table/index.coffee +0 -6
  37. data/lib/assets/javascripts/tao/ui/table/selectable.coffee +0 -52
  38. data/lib/assets/javascripts/tao/ui/tooltip.coffee +0 -5
  39. data/lib/assets/javascripts/tao/ui/tree/element.coffee +0 -58
  40. data/lib/assets/javascripts/tao/ui/tree/index.coffee +0 -5
  41. data/lib/assets/javascripts/tao/ui/tree/item.coffee +0 -93
  42. data/lib/assets/stylesheets/tao/ui/_custom.scss +0 -1
  43. data/lib/assets/stylesheets/tao/ui/_globals.scss +0 -3
  44. data/lib/assets/stylesheets/tao/ui/_mixins.scss +0 -2
  45. data/lib/assets/stylesheets/tao/ui/_variables.scss +0 -4
  46. data/lib/assets/stylesheets/tao/ui/basic.scss +0 -30
  47. data/lib/assets/stylesheets/tao/ui/buttons.scss +0 -8
  48. data/lib/assets/stylesheets/tao/ui/code.scss +0 -2
  49. data/lib/assets/stylesheets/tao/ui/dialog.scss +0 -117
  50. data/lib/assets/stylesheets/tao/ui/icons.scss +0 -2
  51. data/lib/assets/stylesheets/tao/ui/index.scss +0 -13
  52. data/lib/assets/stylesheets/tao/ui/mobile/_custom.scss +0 -1
  53. data/lib/assets/stylesheets/tao/ui/mobile/_globals.scss +0 -3
  54. data/lib/assets/stylesheets/tao/ui/mobile/_mixins.scss +0 -2
  55. data/lib/assets/stylesheets/tao/ui/mobile/_variables.scss +0 -3
  56. data/lib/assets/stylesheets/tao/ui/mobile/basic.scss +0 -24
  57. data/lib/assets/stylesheets/tao/ui/mobile/buttons.scss +0 -8
  58. data/lib/assets/stylesheets/tao/ui/mobile/code.scss +0 -2
  59. data/lib/assets/stylesheets/tao/ui/mobile/icons.scss +0 -2
  60. data/lib/assets/stylesheets/tao/ui/mobile/index.scss +0 -7
  61. data/lib/assets/stylesheets/tao/ui/mobile/slide_box.scss +0 -56
  62. data/lib/assets/stylesheets/tao/ui/mobile/tables.scss +0 -2
  63. data/lib/assets/stylesheets/tao/ui/mobile/variables/_base.scss +0 -10
  64. data/lib/assets/stylesheets/tao/ui/mobile/variables/_buttons.scss +0 -7
  65. data/lib/assets/stylesheets/tao/ui/popover.scss +0 -206
  66. data/lib/assets/stylesheets/tao/ui/shared/_basic.scss +0 -127
  67. data/lib/assets/stylesheets/tao/ui/shared/_buttons.scss +0 -65
  68. data/lib/assets/stylesheets/tao/ui/shared/_code.scss +0 -54
  69. data/lib/assets/stylesheets/tao/ui/shared/_icons.scss +0 -16
  70. data/lib/assets/stylesheets/tao/ui/shared/_slide_box.scss +0 -83
  71. data/lib/assets/stylesheets/tao/ui/shared/_tables.scss +0 -38
  72. data/lib/assets/stylesheets/tao/ui/shared/mixins/_base.scss +0 -6
  73. data/lib/assets/stylesheets/tao/ui/shared/mixins/_buttons.scss +0 -40
  74. data/lib/assets/stylesheets/tao/ui/shared/variables/_base.scss +0 -49
  75. data/lib/assets/stylesheets/tao/ui/shared/variables/_buttons.scss +0 -99
  76. data/lib/assets/stylesheets/tao/ui/shared/variables/_tables.scss +0 -4
  77. data/lib/assets/stylesheets/tao/ui/slide_box.scss +0 -39
  78. data/lib/assets/stylesheets/tao/ui/sortable.scss +0 -16
  79. data/lib/assets/stylesheets/tao/ui/tables.scss +0 -89
  80. data/lib/assets/stylesheets/tao/ui/tabs.scss +0 -23
  81. data/lib/assets/stylesheets/tao/ui/tooltip.scss +0 -147
  82. data/lib/assets/stylesheets/tao/ui/tree.scss +0 -128
  83. data/lib/assets/stylesheets/tao/ui/variables/_base.scss +0 -10
  84. data/lib/assets/stylesheets/tao/ui/variables/_tree.scss +0 -2
  85. data/lib/generators/tao/icons/USAGE +0 -8
  86. data/lib/generators/tao/icons/icons_generator.rb +0 -56
  87. data/lib/generators/tao/icons/templates/icons.coffee.erb +0 -3
  88. data/vendor/assets/stylesheets/normalize.css +0 -427
@@ -1,23 +0,0 @@
1
- class Tao.Popover.Confirm extends Tao.Popover.Element
2
-
3
- @tag 'tao-confirm-popover'
4
-
5
- _connected: ->
6
- super
7
-
8
- @on 'click', '.button-confirm', (e) =>
9
- @namespacedTrigger 'confirm'
10
- @active = false
11
- null
12
-
13
- @on 'click', '.button-cancel', (e) =>
14
- @namespacedTrigger 'cancel'
15
- @active = false
16
- null
17
-
18
- setContent: (content) ->
19
- @jq.find('.tao-popover-content .message').empty()
20
- .append content
21
- @
22
-
23
- TaoComponent.register Tao.Popover.Confirm
@@ -1,18 +0,0 @@
1
- # Avoid using this method to create popover
2
- # Use `tao_popover` view helper method instead
3
-
4
- Tao.Popover.create = (attributes, content) ->
5
- $popover = $('''
6
- <tao-popover class="tao-popover">
7
- <div class="tao-popover-content">
8
- </div>
9
- <div class="tao-popover-arrow">
10
- <i class="arrow arrow-shadow"></i>
11
- <i class="arrow arrow-border"></i>
12
- <i class="arrow arrow-basic"></i>
13
- </div>
14
- </tao-popover>
15
- ''').attr attributes
16
-
17
- $popover.find('.tao-popover-content').append content
18
- $popover.get(0)
@@ -1,76 +0,0 @@
1
-
2
- class Tao.Popover.Direction extends TaoModule
3
-
4
- @option 'popover', 'target', 'boundarySelector'
5
-
6
- _init: ->
7
- @boundary = if @boundarySelector
8
- @target.closest(@boundarySelector)
9
- else
10
- $(window)
11
-
12
- @_calculate()
13
-
14
- _calculate: ->
15
- coefficient = @_beyondCoefficient()
16
-
17
- vertical = if (coefficient.bottom > 0 && coefficient.top > 0) || coefficient.bottom == coefficient.top == 0
18
- 'middle'
19
- else if coefficient.bottom > 0
20
- 'top'
21
- else
22
- 'bottom'
23
-
24
- horizental = if (coefficient.left > 0 && coefficient.right > 0) || coefficient.left == coefficient.right == 0
25
- if vertical == 'middle' then 'right' else 'center'
26
- else if coefficient.right > 0
27
- 'left'
28
- else
29
- 'right'
30
-
31
- @directions = if vertical == 'middle'
32
- [horizental, vertical]
33
- else if horizental == 'center'
34
- [vertical, horizental]
35
- else if coefficient[vertical] > coefficient[horizental]
36
- [horizental, vertical]
37
- else
38
- [vertical, horizental]
39
-
40
- _beyondCoefficient: ->
41
- targetDimensions = @_getDimensions @target
42
- boundaryDimensions = @_getDimensions @boundary
43
- popoverWidth = @popover.outerWidth()
44
- popoverHeight = @popover.outerHeight()
45
- boundaryWidth = @boundary.width()
46
- boundaryHeight = @boundary.height()
47
-
48
- beyondOffset = ['left', 'right', 'top', 'bottom'].reduce (offset, name) ->
49
- offset[name] = targetDimensions[name] - boundaryDimensions[name]
50
- offset
51
- , {}
52
-
53
- {
54
- left: Math.max(popoverWidth - beyondOffset.left, 0) * popoverHeight + Math.max(popoverHeight - boundaryHeight, 0) * popoverWidth
55
- right: Math.max(popoverWidth - beyondOffset.right, 0) * popoverHeight + Math.max(popoverHeight - boundaryHeight, 0) * popoverWidth
56
- top: Math.max(popoverHeight - beyondOffset.top, 0) * popoverWidth + Math.max(popoverWidth - boundaryWidth, 0) * popoverHeight
57
- bottom: Math.max(popoverHeight - beyondOffset.bottom, 0) * popoverWidth + Math.max(popoverWidth - boundaryWidth, 0) * popoverHeight
58
- }
59
-
60
- _getDimensions: ($el) ->
61
- return {
62
- left: 0, right: 0, top: 0, bottom: 0
63
- } if $el[0] is window
64
-
65
- $window = $ window
66
- offset = $el.offset()
67
-
68
- {
69
- left: offset.left - $window.scrollLeft()
70
- right: $window.scrollLeft() + $window.width() - offset.left - $el.outerWidth()
71
- top: offset.top - $window.scrollTop()
72
- bottom: $window.scrollTop() + $window.height() - offset.top - $el.outerHeight()
73
- }
74
-
75
- toString: ->
76
- @directions.join('-')
@@ -1,198 +0,0 @@
1
- #= require ./direction
2
- #= require ./position
3
-
4
- {Direction, Position} = Tao.Popover
5
-
6
- class Tao.Popover.Element extends TaoComponent
7
-
8
- @tag 'tao-popover'
9
-
10
- @attribute 'active', 'disabled', type: 'boolean', observe: true
11
-
12
- @attribute 'targetSelector', 'targetTraversal'
13
-
14
- @attribute 'triggerSelector', 'triggerTraversal'
15
-
16
- @attribute 'triggerAction', default: 'click'
17
-
18
- @attribute 'boundarySelector', 'direction', 'size'
19
-
20
- @attribute 'offset', type: 'number', default: 5
21
-
22
- @attribute 'autoHide', 'autoDestroy', 'withArrow', 'autoActivate', type: 'boolean'
23
-
24
- _connected: ->
25
- @_initTarget()
26
- @_initTrigger()
27
- @_initSize()
28
-
29
- @on 'transitionend', @_afterTransition.bind(@)
30
-
31
- if @autoActivate
32
- @reflow()
33
- @active = true
34
- else if @active
35
- @_activeChanged()
36
-
37
- _initTarget: ->
38
- @target = if @targetTraversal && @targetSelector
39
- @jq[@targetTraversal]?(@targetSelector)
40
- else if @targetSelector
41
- $ @targetSelector
42
-
43
- _initTrigger: ->
44
- @triggerEl = if @triggerTraversal && @triggerSelector
45
- @jq[@triggerTraversal]?(@triggerSelector)
46
- else if @triggerSelector
47
- $ @triggerSelector
48
- else
49
- @target
50
-
51
- return unless @triggerEl && @triggerEl.length > 0
52
-
53
- if @triggerAction == 'click'
54
- @triggerEl.on 'click.tao-popover', (e) =>
55
- @toggleActive()
56
- null
57
- else if @triggerAction == 'hover'
58
- @triggerEl.on 'mouseenter.tao-popover', (e) =>
59
- @active = true
60
- null
61
- .on 'mouseleave.tao-popover', (e) =>
62
- return if @jq.is(e.relatedTarget) || @jq.has(e.relatedTarget).length
63
- @active = false
64
- null
65
-
66
- @jq.on 'mouseleave', (e) =>
67
- return if @triggerEl.is(e.relatedTarget) || @triggerEl.has(e.relatedTarget).length
68
- @active = false
69
- null
70
-
71
- _initSize: ->
72
- @jq.width(@size) if @size
73
-
74
- _beforeActiveChanged: (active) ->
75
- return false if @disabled
76
-
77
- if active
78
- @_prepareShowTransition()
79
- else
80
- @_prepareHideTransition()
81
-
82
- null
83
-
84
- _prepareShowTransition: ->
85
- @namespacedTrigger 'beforeShow'
86
- @jq.show()
87
- @refresh()
88
- @reflow()
89
- @_duringTransition = 'show'
90
-
91
- _prepareHideTransition: ->
92
- @namespacedTrigger 'beforeHide'
93
- if @jq.is(':visible') && @jq.css('opacity') * 1 > 0
94
- @_duringTransition = 'hide'
95
- else
96
- @reset()
97
-
98
- _afterTransition: (e) ->
99
- return unless $(e.target).is(@) && e.originalEvent.propertyName == 'opacity'
100
- if @_duringTransition == 'show'
101
- @namespacedTrigger 'afterShow'
102
- else if @_duringTransition == 'hide'
103
- @reset()
104
- @namespacedTrigger 'afterHide'
105
- @_duringTransition = false
106
- null
107
-
108
- _activeChanged: ->
109
- if @active
110
- @target.addClass "#{@constructor._tag}-active"
111
- @_enableAutoHide() if @autoHide
112
- @namespacedTrigger 'show'
113
- else
114
- @target.removeClass "#{@constructor._tag}-active"
115
- @_disableAutoHide() if @autoHide
116
- @namespacedTrigger 'hide'
117
-
118
- _beforeDisabledChanged: (disabled) ->
119
- @active = false if disabled && @active
120
- null
121
-
122
- _enableAutoHide: ->
123
- $(document).on "mousedown.tao-popover-#{@taoId}", (e) =>
124
- return unless @active
125
- target = e.target
126
- inTarget = @target.is(target) || @target.has(target).length
127
- inTrigger = @triggerEl && (@triggerEl.is(target) || @triggerEl.has(target).length)
128
- inPopover = @jq.is(target) || @jq.has(target).length
129
-
130
- return if inTarget || inTrigger || inPopover
131
- @active = false
132
- null
133
-
134
- _disableAutoHide: ->
135
- $(document).off "mousedown.tao-popover-#{@taoId}"
136
-
137
- refresh: ->
138
- unless @direction
139
- direction = new Direction
140
- popover: @jq
141
- target: @target
142
- boundarySelector: @boundarySelector
143
- @direction = direction.toString()
144
-
145
- @position = new Position
146
- popover: @jq
147
- target: @target
148
- direction: @direction.split('-')
149
- withArrow: @withArrow
150
- offset: @offset
151
-
152
- @jq.css
153
- top: @position.top
154
- left: @position.left
155
- @
156
-
157
- resetAttributes: ->
158
- @active = false if @active
159
- @triggerEl?.off '.tao-popover'
160
- @target = null
161
- @triggerEl = null
162
-
163
- for attr in _.toArray(@attributes)
164
- unless attr.name in ['class', 'tao-id']
165
- @jq.removeAttr attr.name
166
-
167
- setContent: (content) ->
168
- @jq.find('.tao-popover-content').empty()
169
- .append content
170
- @
171
-
172
- toggleActive: ->
173
- @active = !@active
174
- @
175
-
176
- beforeCache: ->
177
- @reset()
178
- @active = false
179
-
180
- remove: ->
181
- @namespacedTrigger 'beforeRemove'
182
- @target.removeClass 'tao-popover-active'
183
- @jq.remove()
184
- @namespacedTrigger 'remove'
185
- @
186
-
187
- reset: ->
188
- if @autoDestroy
189
- @remove()
190
- else
191
- @jq.hide()
192
- @
193
-
194
- _disconnected: ->
195
- @triggerEl?.off '.tao-popover'
196
- $(document).off ".tao-popover-#{@taoId}"
197
-
198
- TaoComponent.register Tao.Popover.Element
@@ -1,16 +0,0 @@
1
- #= require_self
2
- #= require ./element
3
- #= require ./confirm
4
- #= require ./create
5
-
6
- window.TaoPopover = Tao.Popover =
7
-
8
- closeAll: ->
9
- $('.tao-popover').each (i, dialog) ->
10
- dialog.active = false
11
- null
12
-
13
- removeAll: ->
14
- $('.tao-popover').each (i, dialog) ->
15
- dialog.remove()
16
- null
@@ -1,80 +0,0 @@
1
-
2
- class Tao.Popover.Position extends TaoModule
3
-
4
- @option 'direction', 'popover', 'target'
5
-
6
- @option 'withArrow', default: false
7
-
8
- @option 'offset', type: 'number', default: 0
9
-
10
- _init: ->
11
- @top = 0
12
- @left = 0
13
-
14
- @_setPosition()
15
- @_setOffset()
16
-
17
- _setPosition: ->
18
- targetOffset = @target.offset()
19
- targetWidth = @target.outerWidth()
20
- targetHeight = @target.outerHeight()
21
- popoverWidth = @popover.outerWidth()
22
- popoverHeight = @popover.outerHeight()
23
- parentOffset = @popover.offsetParent().offset()
24
-
25
- if @withArrow
26
- $arrow = @popover.find('.tao-popover-arrow')
27
- arrowWidth = $arrow.outerWidth()
28
- arrowHeight = $arrow.outerHeight()
29
- else
30
- arrowWidth = 8
31
- arrowHeight = 8
32
-
33
- switch @direction[0]
34
- when 'left'
35
- @left = targetOffset.left - popoverWidth - arrowWidth - parentOffset.left
36
- when 'right'
37
- @left = targetOffset.left + targetWidth + arrowWidth - parentOffset.left
38
- when 'top'
39
- @top = targetOffset.top - popoverHeight - arrowHeight - parentOffset.top
40
- when 'bottom'
41
- @top = targetOffset.top + targetHeight + arrowHeight - parentOffset.top
42
-
43
- switch @direction[1]
44
- when 'top'
45
- if @withArrow
46
- @top = targetOffset.top - popoverHeight + targetHeight / 2 + arrowHeight * 1.5 - parentOffset.top
47
- else
48
- @top = targetOffset.top - popoverHeight + targetHeight - parentOffset.top
49
- when 'bottom'
50
- if @withArrow
51
- @top = targetOffset.top + targetHeight / 2 - arrowHeight * 1.5 - parentOffset.top
52
- else
53
- @top = targetOffset.top - parentOffset.top
54
- when 'left'
55
- if @withArrow
56
- @left = targetOffset.left - popoverWidth + targetWidth / 2 + arrowWidth * 1.5 - parentOffset.left
57
- else
58
- @left = targetOffset.left - popoverWidth + targetWidth - parentOffset.left
59
- when 'right'
60
- if @withArrow
61
- @left = targetOffset.left + targetWidth / 2 - arrowWidth * 1.5 - parentOffset.left
62
- else
63
- @left = targetOffset.left - parentOffset.left
64
- when 'center'
65
- @left = targetOffset.left + targetWidth / 2 - popoverWidth / 2 - parentOffset.left
66
- when 'middle'
67
- @top = targetOffset.top + targetHeight / 2 - popoverHeight / 2 - parentOffset.top
68
-
69
- _setOffset: ->
70
- return unless @offset
71
-
72
- switch @direction[0]
73
- when 'top'
74
- @top -= @offset
75
- when 'bottom'
76
- @top += @offset
77
- when 'left'
78
- @left -= @offset
79
- when 'right'
80
- @left += @offset
@@ -1,118 +0,0 @@
1
- class Tao.SlideBox.ElementBase extends TaoComponent
2
-
3
- @tag 'tao-slide-box'
4
-
5
- @attribute 'active', type: 'boolean', observe: true
6
-
7
- @attribute 'autoHide', 'autoDestroy', 'modal', 'withoutPadding', type: 'boolean'
8
-
9
- @attribute 'triggerSelector', 'triggerTraversal'
10
-
11
- @attribute 'direction', default: 'btt'
12
-
13
- @attribute 'size'
14
-
15
- _connected: ->
16
- @wrapper = @jq.find('.slide-box-wrapper')
17
- @triggerEl = if @triggerTraversal && @triggerSelector
18
- @jq[@triggerTraversal]?(@triggerSelector)
19
- else if @triggerSelector
20
- $ @triggerSelector
21
-
22
- @_initSize()
23
- @_bind()
24
- @_activeChanged() if @active
25
-
26
- _disconnected: ->
27
- @triggerEl?.off ".tao-slide-box-#{@taoId}"
28
- @off()
29
- $(document).off ".tao-select-#{@taoId}"
30
-
31
- _initSize: ->
32
- sizeProperty = if @direction in ['btt', 'ttb'] then 'height' else 'width'
33
- size = if (size = parseFloat(@size)) < 0
34
- "#{$(window)[sizeProperty]() + size}px"
35
- else
36
- @size
37
- @wrapper.css sizeProperty, size
38
-
39
- _bind: ->
40
- @on 'click', (e) =>
41
- @active = false if e.target == @
42
-
43
- @on 'click', '.slide-box-wrapper > .link-close', =>
44
- @active = false
45
-
46
- @on 'transitionend', @_afterTransition.bind(@)
47
-
48
- if @triggerEl && @triggerEl.length > 0
49
- @triggerEl.on "click.tao-slide-box-#{@taoId}", (e) =>
50
- @active = true
51
-
52
- _beforeActiveChanged: (active) ->
53
- if active
54
- @_prepareShowTransition()
55
- else
56
- @_prepareHideTransition()
57
- null
58
-
59
- _prepareShowTransition: ->
60
- @namespacedTrigger 'beforeShow'
61
- @jq.show()
62
- @reflow()
63
- @_duringTransition = 'show'
64
-
65
- _prepareHideTransition: ->
66
- @namespacedTrigger 'beforeHide'
67
- if @jq.is(':visible') && @wrapper.css('opacity') * 1 > 0
68
- @_duringTransition = 'hide'
69
- else
70
- @reset()
71
-
72
- _afterTransition: (e) ->
73
- return unless $(e.target).is(@wrapper) && e.originalEvent.propertyName == 'opacity'
74
- if @_duringTransition == 'show'
75
- @namespacedTrigger 'afterShow'
76
- else if @_duringTransition == 'hide'
77
- @reset()
78
- @namespacedTrigger 'afterHide'
79
- @_duringTransition = false
80
- null
81
-
82
- _activeChanged: ->
83
- @_unbindAutoHideEvent() if @autoHide
84
- if @active
85
- @_bindAutoHideEvent() if @autoHide
86
- $('body').addClass('slide-box-active')
87
- @namespacedTrigger 'show'
88
- else
89
- $('body').removeClass('slide-box-active')
90
- @namespacedTrigger 'hide'
91
-
92
- _autoHideEvent: ''
93
-
94
- _unbindAutoHideEvent: ->
95
- $(document).off "#{@_autoHideEvent}.tao-slide-box-#{@taoId}"
96
-
97
- _bindAutoHideEvent: ->
98
- $(document).on "#{@_autoHideEvent}.tao-slide-box-#{@taoId}", (e) =>
99
- return if e.target == @ || $.contains(@, e.target) || @triggerEl?.is(e.target)
100
- @active = false
101
- @_unbindAutoHideEvent()
102
-
103
- remove: ->
104
- @namespacedTrigger 'beforeRemove'
105
- @jq.remove()
106
- @namespacedTrigger 'remove'
107
- @
108
-
109
- beforeCache: ->
110
- @reset()
111
- active = false
112
-
113
- reset: ->
114
- if @autoDestroy
115
- @remove()
116
- else
117
- @jq.hide()
118
- @
@@ -1,11 +0,0 @@
1
- Tao.SlideBox =
2
-
3
- closeAll: ->
4
- $('.tao-slide-box').each (i, dialog) ->
5
- dialog.active = false
6
- null
7
-
8
- removeAll: ->
9
- $('.tao-slide-box').each (i, dialog) ->
10
- dialog.remove()
11
- null
@@ -1,51 +0,0 @@
1
- # hack ujs for adding loading icon on disabled buttons/links
2
-
3
- prependLoadingIcon = (element) ->
4
- $element = $ element
5
- if $element.is('button') && $element.data('loading')
6
- $element.addClass('text-with-icon')
7
- .prepend Tao.iconTag('loading', class: 'spin')
8
-
9
- # jquery-ujs
10
- if $.rails?
11
- originDisableElement = $.rails.disableElement
12
- $.rails.disableElement = (element) ->
13
- originDisableElement element
14
- prependLoadingIcon element
15
-
16
- originDisableFormElement = $.rails.disableFormElement
17
- $.rails.disableFormElement = (element) ->
18
- originDisableFormElement element
19
- prependLoadingIcon element
20
-
21
- originEnableElement = $.rails.enableElement
22
- $.rails.enableElement = (element) ->
23
- originEnableElement element
24
- $(element).removeClass 'text-with-icon'
25
-
26
- originEnableFormElement = $.rails.enableFormElement
27
- $.rails.enableFormElement = (element) ->
28
- originEnableFormElement element
29
- $(element).removeClass 'text-with-icon'
30
-
31
- # rails-ujs
32
- else if Rails?
33
- originDisableElement = Rails.disableElement
34
- Rails.disableElement = (e) ->
35
- originDisableElement e
36
- element = if e instanceof Event then e.target else e
37
- if Rails.matches(element, Rails.formSubmitSelector)
38
- Rails.formElements(element, Rails.formDisableSelector).forEach (el) ->
39
- prependLoadingIcon el
40
- else
41
- prependLoadingIcon element
42
-
43
- originEnableElement = Rails.enableElement
44
- Rails.enableElement = (e) ->
45
- originEnableElement e
46
- element = if e instanceof Event then e.target else e
47
- if Rails.matches(element, Rails.formSubmitSelector)
48
- Rails.formElements(element, Rails.formDisableSelector).forEach (el) ->
49
- $(el).removeClass 'text-with-icon'
50
- else
51
- $(el).removeClass 'text-with-icon'
@@ -1,9 +0,0 @@
1
- #= require tao/ui/shared/slide_box/element/base
2
-
3
- class Tao.SlideBox.Element extends Tao.SlideBox.ElementBase
4
-
5
- @attribute 'withCloseButton', type: 'boolean'
6
-
7
- _autoHideEvent: 'mousedown'
8
-
9
- TaoComponent.register Tao.SlideBox.Element
@@ -1,2 +0,0 @@
1
- #= require tao/ui/shared/slide_box/export
2
- #= require ./element