Sha256: cc2c431d0599c230ab77ef9f2191fa669c6d3a8cec7239245c24763cf5bbb3d1

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

class ComponentWithActions < Netzke::Base
  # 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 :title, "Panel that has actions"

  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

9 entries across 9 versions & 1 rubygems

Version Path
netzke-core-0.7.3 test/core_test_app/app/components/component_with_actions.rb
netzke-core-0.7.2 test/core_test_app/app/components/component_with_actions.rb
netzke-core-0.7.1 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.6.7 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.7.0 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.6.6 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.6.5 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.6.4 test/rails_app/app/components/component_with_actions.rb
netzke-core-0.6.3 test/rails_app/app/components/component_with_actions.rb