Sha256: 30dd4d4e860462f6fb6884b475d8882466ab59bd64140818ef75cb85f05004a2
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
class @Mercury.Toolbar.ButtonGroup constructor: (@name, @options = {}) -> @build() @bindEvents() @regions = @options._regions return @element build: -> @element = $('<div>', {class: "mercury-button-group mercury-#{@name}-group"}) if @options._context || @options._regions @element.addClass('disabled') bindEvents: -> Mercury.bind 'region:update', (event, options) => context = Mercury.Toolbar.ButtonGroup.contexts[@name] if context if options.region && $.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.bind '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.bind '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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mercury-rails-0.1.1 | app/assets/javascripts/mercury/toolbar.button_group.js.coffee |
mercury-rails-0.1.0 | app/assets/javascripts/mercury/toolbar.button_group.js.coffee |