Sha256: f4554246183859e82fcedb1e874ac236ced4c93e5ab9679fdbd65032d95fe221

Contents?: true

Size: 1015 Bytes

Versions: 7

Compression:

Stored size: 1015 Bytes

Contents

class HelloWorldComponent < Netzke::Base
  # Ext.Panel's config option "title"
  js_property :title, "My Hello World Component"

  # Bottom bar with an automatically created action
  js_property :bbar, [:bug_server.action]

  # Action to be placed on the bottom bar
  action :bug_server, :text => 'Greet the World', :icon => :accept

  # Method in the JS class that (by default) processes the action's "click" event
  js_method :on_bug_server, <<-JS
    function(){
      // Remotely calling the server's method greet_the_world (defined below)
      this.greetTheWorld();
    }
  JS

  # Server's method that gets called from the JS
  endpoint :greet_the_world do |params|
    # Tell the client side to call its method showGreeting with "Hello World!" as parameter
    {:show_greeting => "Hello World!"}
  end

  # Another method in the JS class that gets remotely called by the server side
  js_method :show_greeting, <<-JS
    function(greeting){
      this.body.update("Server says: " + greeting);
    }
  JS
end

Version data entries

7 entries across 7 versions & 1 rubygems

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