Sha256: 1a739c23c29322e2279042ee56fdeb98905710906f5ce588b5b8cd28847af4d6

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

class HelloWorldComponent < Netzke::Base
  # Ext.Panel's config option "title"
  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

4 entries across 4 versions & 1 rubygems

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