vendor/assets/javascripts/mercury/toolbar.js.coffee in mercury-rails-0.2.3 vs vendor/assets/javascripts/mercury/toolbar.js.coffee in mercury-rails-0.3.1
- old
+ new
@@ -24,11 +24,11 @@
if container.css('white-space') == 'nowrap'
expander = new Mercury.Toolbar.Expander(toolbarName, {appendTo: toolbar, for: container})
expander.appendTo(@element)
- toolbar.addClass('disabled') unless toolbarName == 'primary'
+ toolbar.addClass('disabled') if Mercury.config.toolbars['primary'] && toolbarName != 'primary'
@element.css({width: '100%'})
buildButton: (name, options) ->
@@ -46,28 +46,30 @@
group
when 'string' # separator
jQuery('<hr>', {class: "mercury-#{if options == '-' then 'line-separator' else 'separator'}"})
- else throw "Unknown button structure -- please provide an array, object, or string for #{name}."
+ else throw Mercury.I18n('Unknown button structure -- please provide an array, object, or string for "%s".', name)
bindEvents: ->
- Mercury.bind 'region:focused', (event, options) =>
+ Mercury.on 'region:focused', (event, options) =>
for toolbar in @element.find(".mercury-toolbar")
toolbar = jQuery(toolbar)
if regions = toolbar.data('regions')
toolbar.removeClass('disabled') if regions.split(',').indexOf(options.region.type) > -1
- Mercury.bind 'region:blurred', (event, options) =>
+ Mercury.on 'region:blurred', (event, options) =>
for toolbar in @element.find(".mercury-toolbar")
toolbar = jQuery(toolbar)
if regions = toolbar.data('regions')
toolbar.addClass('disabled') if regions.split(',').indexOf(options.region.type) > -1
+ @element.on 'click', ->
+ Mercury.trigger('hide:dialogs')
- @element.click -> Mercury.trigger('hide:dialogs')
- @element.mousedown (event) -> event.preventDefault()
+ @element.on 'mousedown', (event) ->
+ event.preventDefault()
height: ->
if @visible then @element.outerHeight() else 0