Sha256: 866e0dd51e4b3b649609cfada358ba51046b28aea79e614d82c04b045b812b01
Contents?: true
Size: 1.31 KB
Versions: 26
Compression:
Stored size: 1.31 KB
Contents
class @Mercury.Toolbar.ButtonGroup constructor: (@name, @options = {}) -> @build() @bindEvents() @regions = @options._regions return @element build: -> @element = jQuery('<div>', {class: "mercury-button-group mercury-#{@name}-group"}) if @options._context || @options._regions @element.addClass('disabled') bindEvents: -> Mercury.on 'region:update', (event, options) => context = Mercury.Toolbar.ButtonGroup.contexts[@name] if context if options.region && jQuery.type(options.region.currentElement) == 'function' element = options.region.currentElement() if element.length && context.call(@, element, options.region.element) @element.removeClass('disabled') else @element.addClass('disabled') Mercury.on 'region:focused', (event, options) => if @regions && options.region && options.region.type if @regions.indexOf(options.region.type) > -1 @element.removeClass('disabled') unless @options._context else @element.addClass('disabled') Mercury.on 'region:blurred', (event, options) => @element.addClass('disabled') if @options.regions # ButtonGroup contexts @Mercury.Toolbar.ButtonGroup.contexts = table: (node, region) -> !!node.closest('table', region).length
Version data entries
26 entries across 26 versions & 3 rubygems