Sha256: f12335d23b041cd251e04fdedb6982c3f393b990f70ddc84acbe6ab85a592409
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
module Netzke # GUI for Preference class class PreferenceGrid < PropertyGrid def initialize(*args) super config[:default_properties] ||= [] NetzkePreference.widget_name = config[:host_widget_name] # Create default properties config[:default_properties].each do |p| NetzkePreference[p[:name]] = p[:value] if NetzkePreference[p[:name]].nil? end end def load_source(params = {}) # config[:data_class_name] = 'NetzkePreference' config[:conditions] ||= {} data_class = NetzkePreference records = data_class.find(:all, :conditions => {:widget_name => config[:host_widget_name]}) NetzkePreference.widget_name = config[:host_widget_name] source = {} records.each do |r| source.merge!(r.name => NetzkePreference[r.name]) end {:source => source} end def submit_source(params = {}) data = JSON.parse(params[:data]) NetzkePreference.widget_name = config[:host_widget_name] data.each_pair do |k,v| NetzkePreference[k.underscore] = v end {:success => true, :flash => @flash} end end end
Version data entries
9 entries across 9 versions & 1 rubygems