app/components/planner_command_panel.rb
# Generates a Ruby Hash containing a configuration compatible with ExtJS Button-widget definition,
# to be used inside an items list of a panel container.
#
# Works similarly to ApplicationHelper::create_extjs_button_config, but instead of returning a parsable
# Javascript string, the result is a plain Ruby Hash.
#
# == Params:
#
# <tt>action_title_i19n_sym</tt> => Symbol for the I18n title for the button. The method assumes also that
#                                   a tooltip symbol is defined with a "_tooltip" appended on the title symbol
# <tt>action_title_i19n_scope_sym</tt> => Symbol for the I18n scope of the localization;
#                                         it can be nil for using the default global scope
# <tt>image_name</tt> => file name for the image to be used in the button, searched under "/images/icons"
#
Generates a Ruby Hash containing a configuration compatible with ExtJS Button-widget definition,
to be used inside an items list of a panel container.

Works similarly to ApplicationHelper::create_extjs_button_config, but instead of returning a parsable
Javascript string, the result is a plain Ruby Hash.



action_title_i19n_sym => Symbol for the I18n title for the button. The method assumes also that
a tooltip symbol is defined with a "_tooltip" appended on the title symbol
action_title_i19n_scope_sym => Symbol for the I18n scope of the localization;
it can be nil for using the default global scope
image_name => file name for the image to be used in the button, searched under "/images/icons"
Generates a Ruby Hash containing a configuration compatible with ExtJS Button - widget definition to be used inside an items list of a panel container . Works similarly to ApplicationHelper :: create_extjs_button_config but instead of returning a parsable Javascript string the result is a plain Ruby Hash . action_title_i19n_sym = > Symbol for the I18n title for the button . The method assumes also that a tooltip symbol is defined with a " _tooltip " appended on the title symbol action_title_i19n_scope_sym = > Symbol for the I18n scope of the localization ; it can be nil for using the default global scope image_name = > file name for the image to be used in the button searched under " / images / icons "
def create_button_config( action_title_i19n_sym, action_title_i19n_scope_sym, image_name = "cog.png" )
    action_text  = I18n.t( action_title_i19n_sym.to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
    tooltip_text = I18n.t( "#{action_title_i19n_sym}_tooltip".to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
    {
      :xtype => 'button',
      :id    => action_title_i19n_sym.to_s,
      :name  => action_title_i19n_sym.to_s,
      :icon  => "/images/icons/#{ image_name }",
      :text  => "#{ action_text }",
      :tooltip  => "#{ tooltip_text }",
      :margin  => '0 3 3 3'
    }
  end
def create_button_config ( action_title_i19n_sym , action_title_i19n_scope_sym , image_name = "cog.png" ) action_text = I18n . t ( action_title_i19n_sym . to_sym , { :scope => [ action_title_i19n_scope_sym ? action_title_i19n_scope_sym . to_sym : nil ] } ) tooltip_text = I18n . t ( "#{action_title_i19n_sym}_tooltip" . to_sym , { :scope => [ action_title_i19n_scope_sym ? action_title_i19n_scope_sym . to_sym : nil ] } ) { :xtype => 'button' , :id => action_title_i19n_sym . to_s , :name => action_title_i19n_sym . to_s , :icon => "/images/icons/#{ image_name }" , :text => "#{ action_text }" , :tooltip => "#{ tooltip_text }" , :margin => '0 3 3 3' } end
Generates a Ruby Hash containing a configuration compatible with ExtJS Button-widget definition,
to be used inside an items list of a panel container.
Generates a Ruby Hash containing a configuration compatible with ExtJS Button - widget definition to be used inside an items list of a panel container .
action_title_i19n_sym
action_title_i19n_scope_sym
image_name