lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee in tao_ui-0.2.3 vs lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee in tao_ui-0.2.4
- old
+ new
@@ -2,11 +2,11 @@
@tag 'tao-slide-box'
@attribute 'active', type: 'boolean', observe: true
- @attribute 'withCloseButton', 'autoHide', 'autoDestroy', type: 'boolean'
+ @attribute 'autoHide', 'autoDestroy', 'modal', 'withoutPadding', type: 'boolean'
@attribute 'triggerSelector', 'triggerTraversal'
@attribute 'direction', default: 'btt'
@@ -27,17 +27,21 @@
@off()
$(document).off ".tao-select-#{@taoId}"
_initSize: ->
sizeProperty = if @direction in ['btt', 'ttb'] then 'height' else 'width'
- @jq[sizeProperty] if (size = parseFloat(@size)) < 0
- $(window)[sizeProperty]() + size
+ size = if (size = parseFloat(@size)) < 0
+ "#{$(window)[sizeProperty]() + size}px"
else
@size
+ @jq.find('.slide-box-wrapper').css sizeProperty, size
_bind: ->
- @on 'click', '> .link-close', =>
+ @on 'click', (e) =>
+ @active = false if e.target == @
+
+ @on 'click', '.slide-box-wrapper > .link-close', =>
@active = false
if @triggerEl && @triggerEl.length > 0
@triggerEl.on "click.tao-slide-box-#{@taoId}", (e) =>
@active = true
@@ -78,9 +82,10 @@
remove: ->
@trigger 'tao:beforeRemove'
@jq.remove()
@trigger 'tao:remove'
+ @
beforeCache: ->
if @autoDestroy
@remove()
else