Sha256: 42ea2a7469961c0cc12dea1aff92d522ed09a7279b6b7827191c8a6939a3cc92

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

class ComponentWithPersistence < Netzke::Base
  config :initial, :persistence => true, :title => "Default title"
  
  action :change_title
  action :set_original_title
  
  js_property :bbar, [:change_title.action, :set_original_title.action]

  js_method :on_change_title, <<-JS
    function(){
      this.setNewTitle();
    }
  JS
  
  js_method :on_set_original_title, <<-JS
    function(){
      this.setOriginalTitle();
    }
  JS
  
  endpoint :set_new_title do |params|
    update_persistent_options(:title => "New title")
    {}
  end
  
  endpoint :set_original_title do |params|
    update_persistent_options(:title => nil)
    Rails.logger.debug "!!! persistent_options: #{persistent_options.inspect}\n"
    {}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netzke-persistence-0.1.0 test/rails_app/app/components/component_with_persistence.rb