Sha256: 54b26c36497257ecee0c8a9e60b3e9486d027e946a52d6fd1cb2497819971415
Contents?: true
Size: 1.63 KB
Versions: 3
Compression:
Stored size: 1.63 KB
Contents
Tao.Table.Expandable = -> @attribute 'expandable', type: 'boolean' _initExpandable: -> @on 'click', 'tbody > tr.expandable', (e) => return if !@expandable || $(e.target).is('a, input') $row = $ e.currentTarget if $row.hasClass 'expanded' @collapseRow $row @trigger 'tao:expandRow', $row else @expandRow $row @trigger 'tao:collapseRow', $row null expandRow: (row) -> $row = $ row return @ if $row.is('.disabled, .hidden, .expanded, .expanding') $panel = $row.next('.expandable-panel') return @ unless $panel.length > 0 $panelWrapper = $panel.find('> td > div:first') $panel.show() $panel[0].offsetHeight # force reflow $panelWrapper.one 'transitionend', (e) -> $row.removeClass 'expanding' $row.addClass 'expanded expanding' $panel.addClass 'expanded' $panelWrapper.css 'height', $panelWrapper[0].scrollHeight @_loadRemotePanel $panel @ collapseRow: (row) -> $row = $ row return @ if $row.is('.disabled, .hidden, :not(.expanded), .collapsing') $panel = $row.next('.expandable-panel') return @ unless $panel.length > 0 $panelWrapper = $panel.find('> td > div:first') $panelWrapper.one 'transitionend', (e) -> $row.removeClass 'collapsing' $panel.hide() $row.removeClass 'expanded' .addClass 'collapsing' $panel.removeClass 'expanded' $panelWrapper.css 'height', 0 @ _loadRemotePanel: ($panel) -> return unless $panel.is('[data-url]') $.ajax url: $panel.data('url') method: 'get' dataType: 'script' .done -> $panel.removeAttr 'data-url'
Version data entries
3 entries across 3 versions & 1 rubygems