Sha256: eed9e0273ce0203926825e1c96deb0441a85e9aa2799592c7627f475502e3675

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

class ComponentWithSessionPersistence < Netzke::Base
  title "Default Title"

  js_property :bbar, [:bug_server.action]

  action :bug_server, :text => "Tell server to store new title"

  def default_config
    super.merge(:session_persistence => true)
  end

  def configuration
    super.merge(:html => component_session[:html_content] || "Default HTML")
  end

  js_method :bug_server, <<-JS
    function(){
      this.whatsUp();
    }
  JS

  js_method :on_bug_server, <<-JS
    function(){
      this.bugServer();
    }
  JS


  endpoint :whats_up do |params|
    update_session_options(:title => "Title From Session") # setting a value in session_options, which will get auto-merged into +config+
    component_session[:html_content] = "HTML from session" # setting some custom session key/value, which we use manually in +configuration+
    {}
  end

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_session_persistence.rb
netzke-core-0.7.6 test/core_test_app/app/components/component_with_session_persistence.rb
netzke-core-0.7.5 test/core_test_app/app/components/component_with_session_persistence.rb
netzke-core-0.7.4 test/core_test_app/app/components/component_with_session_persistence.rb