Class: Netzke::Communitypack::ModelExplorer
- Inherits:
-
Basepack::BorderLayoutPanel
- Object
- Basepack::BorderLayoutPanel
- Netzke::Communitypack::ModelExplorer
- Defined in:
- lib/netzke/communitypack/model_explorer.rb
Overview
2 regions - “grid” and “form”, form displaying the details of the record selected in the grid.
Accepts the following config options:
-
:model - name of the model, e.g. “User”
-
:grid_config (optional) - a config hash passed to the grid
-
:form_config (optional) - a config hash passed to the form
Instance Method Summary collapse
Instance Method Details
#configuration ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/netzke/communitypack/model_explorer.rb', line 18 def configuration super.tap do |c| # merge default container and collection config with the one provided by the user c[:grid_config] = { :region => :west, :class_name => "Netzke::Basepack::GridPanel", :model => c[:model], :item_id => 'grid' }.merge(c[:grid_config] || {}) c[:form_config] = { :class_name => "Netzke::Basepack::FormPanel", :model => c[:model], :region => :center, :item_id => 'form' }.merge(c[:form_config] || {}) # set default width/height for regions c[:grid_config][:width] ||= 300 if [:west, :east].include?(c[:grid_config][:region].to_sym) c[:grid_config][:height] ||= 150 if [:north, :south].include?(c[:grid_config][:region].to_sym) c[:items] = [c[:grid_config], c[:form_config]] end end |