Sha256: 8d5352322099011501be48e54c11fdc666ecc9aa548166a112e0f124078ad320

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

class ComponentWithActions < Netzke::Base
  title "Panel that has actions"

  # Define actions as a hash
  action :another_action, :disabled => true, :text => "Disabled action", :icon => :accept

  # ... or as a block returning hash
  action :some_action do
    {:text => "Some Cool Action", :icon => Netzke::Core.icons_uri + "/delete.png"}
  end

  # ... or directly as a method
  def _my_action_action
    {:text => "Not used"}
  end


  js_property :bbar, [:some_action.action, :another_action.action]

  js_property :tbar, [{
    :xtype =>  'buttongroup',
    :columns => 3,
    :title => 'A group',
    :items => [{
        :text => 'Paste',
        :scale => 'large',
        :rowspan => 3, :iconCls => 'add',
        :iconAlign => 'top',
        :cls => 'x-btn-as-arrow'
    },{
        :xtype => 'splitbutton',
        :text => 'Menu Button',
        :scale => 'large',
        :rowspan => 3,
        :iconCls => 'add',
        :iconAlign => 'top',
        :arrowAlign => 'bottom',
        :menu => [:some_action.action]
    },{
        :xtype => 'splitbutton', :text => 'Cut', :menu => [:another_action.action]
    }, :another_action.action,
    {
        :menu => [:some_action.action], :text => 'Format'
    }]
  }]

  js_method :on_some_action, <<-JS
    function(){
      this.update("Some action was triggered");
    }
  JS

  js_method :on_another_action, <<-JS
    function(){
      this.update("Another action was triggered");
    }
  JS

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
netzke-core-0.7.7 test/core_test_app/app/components/component_with_actions.rb
netzke-core-0.7.6 test/core_test_app/app/components/component_with_actions.rb
netzke-core-0.7.5 test/core_test_app/app/components/component_with_actions.rb
netzke-core-0.7.4 test/core_test_app/app/components/component_with_actions.rb