lib/netzke/basepack/search_panel.rb in netzke-basepack-0.7.4 vs lib/netzke/basepack/search_panel.rb in netzke-basepack-0.7.5
- old
+ new
@@ -2,10 +2,12 @@
module Basepack
# == Configuration
# +load_last_preset+ - on load, tries to load the latest saved preset
class SearchPanel < Base
+ include Netzke::Basepack::DataAccessor
+
js_base_class "Ext.form.FormPanel"
js_properties(
:padding => 5,
:auto_scroll => true
@@ -54,17 +56,18 @@
end
def js_config
super.merge(
:attrs => attributes,
- :attrs_hash => data_class.column_names.inject({}){ |hsh,c| hsh.merge(c => data_class.columns_hash[c].type) },
+ :attrs_hash => data_class.column_names.inject({}){ |hsh,c|
+ hsh.merge(c => data_adapter.get_property_type(data_class.columns_hash[c])) },
:preset_query => (config[:load_last_preset] ? last_preset.try(:fetch, "query") : config[:query]) || []
)
end
def attributes
- data_class.column_names.map do |name|
- [name, data_class.human_attribute_name(name)]
+ config[:fields].map do |field|
+ [field[:name], field[:field_label]]
end
end
def last_preset
(state[:presets] || []).last