lib/assets/javascripts/tao/ui/popover/element.coffee in tao_ui-0.2.2 vs lib/assets/javascripts/tao/ui/popover/element.coffee in tao_ui-0.2.3
- old
+ new
@@ -51,14 +51,14 @@
_activeChanged: ->
if @active
@refresh()
@_enableAutoHide() if @autoHide
- @trigger 'show'
+ @trigger 'tao:show'
else
@_disableAutoHide() if @autoHide
- @trigger 'hide'
+ @trigger 'tao:hide'
@jq.remove() if @autoDestroy
_enableAutoHide: ->
$(document).on "mousedown.tao-popover-#{@taoId}", (e) =>
return unless @active
@@ -89,9 +89,20 @@
top: @position.top
left: @position.left
toggleActive: ->
@active = !@active
+
+ beforeCache: ->
+ if @autoDestroy
+ @remove()
+ else
+ @active = false
+
+ remove: ->
+ @trigger 'tao:beforeRemove'
+ @jq.remove()
+ @trigger 'tao:remove'
_disconnected: ->
@triggerEl.off '.tao-popover'
$(document).off ".tao-popover-#{@taoId}"