lib/netzke/grid/configuration.rb in netzke-basepack-1.0.0.1 vs lib/netzke/grid/configuration.rb in netzke-basepack-1.0.1.0
- old
+ new
@@ -18,17 +18,11 @@
def bbar
config.has_key?(:bbar) ? config[:bbar] : default_bbar
end
def default_bbar
- [].tap do |bbar|
- bbar << :add if has_add_action?
- bbar << :edit if has_edit_action?
- bbar << :apply if has_apply_action?
- bbar << :delete if has_delete_action?
- bbar << :search if has_search_action?
- end
+ [:add, :add_in_form, :edit, :edit_in_form, :apply, :delete, :search]
end
def context_menu
config.has_key?(:context_menu) ? config.context_menu : default_context_menu
end
@@ -59,13 +53,27 @@
end
end
def validate_config(c)
raise ArgumentError, "Grid requires a model" if model.nil?
- c.paging = true if c.edit_inline
+
+ c.editing = :in_form if c.editing.nil?
+
+ c.edits_in_form = [:both, :in_form].include?(c.editing)
+ c.edits_inline = [:both, :inline].include?(c.editing)
+
+ if c.paging.nil?
+ c.paging = c.edits_inline ? :pagination : :buffered
+ end
+
+ if c.paging == :buffered && c.edits_inline
+ raise ArgumentError, "Buffered grid cannot have inline editing"
+ end
+
c.tools = tools
c.bbar = bbar
c.context_menu = context_menu
+
super
end
end
end
end