Sha256: 0ff2791914e8f0cdf8b14d6d0e9510959fcab7d2cfd00ae6210faff0d5b0fc2a
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# Shows how component session and state can be used for persistence class Persistence < Netzke::Base action :set_state action :reset_state action :set_session_variable action :retrieve_session_variable def configure(c) super c.bbar = [:set_state, :reset_state, :set_session_variable, :retrieve_session_variable] # title will be gotten from component's state c.title = state[:title] || "Default title" end js_configure do |c| c.on_set_state = <<-JS function(){ this.serverSetState(); } JS c.on_reset_state = <<-JS function(){ this.serverResetState(); } JS c.on_set_session_variable = <<-JS function(){ this.serverSetSessionVariable(); } JS c.on_retrieve_session_variable = <<-JS function(){ this.serverRetrieveSessionVariable(null, function(result){ this.setTitle("Session variable: " + result); }) } JS end endpoint :server_set_state do |params, this| state[:title] = "Title from state" end endpoint :server_reset_state do |params,this| state.clear end endpoint :server_set_session_variable do |params,this| component_session[:some_variable] = "set" end endpoint :server_retrieve_session_variable do |params,this| this.netzke_set_result(component_session[:some_variable] || "not set") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
netzke-core-0.8.4 | test/core_test_app/app/components/persistence.rb |