Sha256: 0ac88f4f56d6cde40147f966755723e59cec24e4f285843552d84ec2706875fc

Contents?: true

Size: 875 Bytes

Versions: 4

Compression:

Stored size: 875 Bytes

Contents

class ComponentWithSessionPersistence < Netzke::Base
  js_property :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.3 test/core_test_app/app/components/component_with_session_persistence.rb
netzke-core-0.7.2 test/core_test_app/app/components/component_with_session_persistence.rb
netzke-core-0.7.1 test/rails_app/app/components/component_with_session_persistence.rb
netzke-core-0.7.0 test/rails_app/app/components/component_with_session_persistence.rb