module Engine2::ActionFormSupport
Public Instance Methods
create?()
click to toggle source
# File lib/engine2/action.rb, line 1044 def create? @action_type == :create end
field_tabs(hash)
click to toggle source
Calls superclass method
# File lib/engine2/action.rb, line 988 def field_tabs hash super panel_template 'scaffold/form_tabs' end
field_template(template)
click to toggle source
# File lib/engine2/action.rb, line 971 def field_template template panel[:field_template] = template end
hr_after(field, message = '-')
click to toggle source
# File lib/engine2/action.rb, line 1040 def hr_after field, message = '-' fields! field, hr: message end
modify?()
click to toggle source
# File lib/engine2/action.rb, line 1048 def modify? @action_type == :modify end
post_process()
click to toggle source
Calls superclass method
# File lib/engine2/action.rb, line 996 def post_process if fields = @meta[:field_list] model = assets[:model] fields = fields - static.meta[:field_list] if dynamic? decorate(fields) fields.each do |name| type_info = model.find_type_info(name) fields(name)[:render] ||= begin renderer = DefaultFormRenderers[type_info[:type]] # .merge(default: true) raise E2Error.new("No form renderer found for field '#{type_info[:name]}' of type '#{type_info[:type]}'") unless renderer renderer.(self, type_info) end proc = FormRendererPostProcessors[type_info[:type]] proc.(self, name, type_info) if proc end assoc = assets[:assoc] if assoc && assoc[:type] == :one_to_many # fields.select{|f| assoc[:keys].include? f}.each do |key| # # hide_fields(key) if self[:fields, key, :hidden] == nil # fields! key, disabled: true # end assoc[:keys].each do |key| fields! key, disabled: true if fields.include? key end end end super end
post_run()
click to toggle source
Calls superclass method
# File lib/engine2/action.rb, line 1031 def post_run super @meta[:primary_fields] = assets[:model].primary_keys end
pre_run()
click to toggle source
Calls superclass method
# File lib/engine2/action.rb, line 975 def pre_run super panel_template 'scaffold/form' field_template 'scaffold/fields' panel_class 'modal-large' top = node.parent.parent == nil menu :panel_menu do option :approve, icon: "ok", disabled: "action.action_pending()" # text: true, option :cancel, icon: "remove" unless top # text: true, end # modal_action false end
record(handler, record)
click to toggle source
# File lib/engine2/action.rb, line 993 def record handler, record end
template()
click to toggle source
# File lib/engine2/action.rb, line 1036 def template Templates end