Sha256: e2976b06319caebdd187ae7dcab6c35e18ec491aa5a925c6a5427016e26602f5
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
#= require tao/form/shared/fields/select/element/base class Tao.Form.Select.Element extends Tao.Form.Select.ElementBase _connected: -> @slideBox = @findComponent '.slide-box' super _bind: -> super @slideBox.on 'tao:hide', (e) => @active = false if @active null @on 'click', '.select-result-delegate', (e) => @_toggleActive() null @on 'click', '.header .link-close', (e) => @active = false null @on 'click', '.button-ok', (e) => @active = false null @on 'tao:change', => @_refreshListHeight() if @active @_refreshSelectedText() _bindListEvents: -> super @on 'tao:select', '.select-list', (e, option) => if @multiple @list.reset() else @active = false null _childComponentsReady: -> super @_refreshSelectedText() _refreshSelectedText: -> text = if @multiple && @selectedOption.length > 0 @selectedOption.map (opt) -> opt.text .join ', ' else if @selectedOption @selectedOption.text else '' @jq.find('.select-result-delegate .selected-text').text text _refreshListHeight: -> $listWrapper = @list.jq.find('.list-wrapper') winHeight = $(window).height() offsetTop = $listWrapper[0].getBoundingClientRect().top buttonsHeight = @slideBox.jq.find('.slide-box-content > .buttons').outerHeight() || 0 $listWrapper.css height: winHeight - offsetTop - buttonsHeight _activeChanged: -> @slideBox.active = @active if @active @_refreshListHeight() else @list.reset() TaoComponent.register Tao.Form.Select.Element
Version data entries
4 entries across 4 versions & 1 rubygems