Sha256: 9c8d032ffb6fbb482560a818179ca956d25405bbe349a1e4df7972345973e7ad

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

class KindaComplexComponent < Netzke::Base
  # Note the use of ActiveSupport::Concern module
  module BasicStuff
    extend ActiveSupport::Concern
    
    included do
      action :some_action
      action :another_action
      
      # Calling main class' methods is simple
      js_method :on_some_action, <<-JS
        function(){ this.items.last().setTitle("Action triggered"); }
      JS
      
      # Another way of defining a JS method
      js_method :on_another_action do
        <<-JS
          function(){ this.items.first().setTitle("Another action triggered"); }
        JS
      end
  
      js_properties(
        :active_tab => 0, :bbar => [:some_action.action, :another_action.action]
      )
      
      # Instance method, overridden in the ExtraStuff module
      # config 
    end
    
    def final_config
      super.merge(:items => [{:title => "Panel One"}, {:title => "Panel Two"}])
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netzke-core-0.6.2 test/rails_app/app/components/kinda_complex_component/basic_stuff.rb
netzke-core-0.6.1 test/rails_app/app/components/kinda_complex_component/basic_stuff.rb
netzke-core-0.6.0 test/rails_app/app/components/kinda_complex_component/basic_stuff.rb