Module: Engine2::ActionCreateSupport
- Includes:
- ActionFormSupport
- Included in:
- ArrayCreateAction, CreateAction
- Defined in:
- lib/engine2/action.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_record(handler, record) ⇒ Object
- #invoke(handler) ⇒ Object
- #pre_run ⇒ Object
- #record(handler, record) ⇒ Object
Methods included from ActionFormSupport
#create?, #field_tabs, #field_template, #hr_after, #modify?, #post_process, #post_run, #template
Methods included from ActionModelSupport
#hide_pk, #node_defined, #show_pk, #unsupported_association
Methods included from ActionAPISupport
#config, #decorate, #field_filter, #fields, #fields!, #hide_fields, #loc!, #render, #show_fields
Methods included from ActionTabSupport
#field_tabs, #select_tabs, #tab
Methods included from ActionPanelSupport
#modal_action, #panel, #panel_class, #panel_footer, #panel_header, #panel_panel_template, #panel_template, #panel_title, #post_run
Methods included from ActionMenuSupport
Methods included from ActionAngularSupport
#ng_call, #ng_execute, #ng_info!, #ng_record, #ng_record!
Methods included from ActionOnChangeSupport
Class Method Details
.included(action) ⇒ Object
1056 1057 1058 |
# File 'lib/engine2/action.rb', line 1056 def self.included action action.action_type :create end |
Instance Method Details
#create_record(handler, record) ⇒ Object
1072 1073 |
# File 'lib/engine2/action.rb', line 1072 def create_record handler, record end |
#invoke(handler) ⇒ Object
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 |
# File 'lib/engine2/action.rb', line 1075 def invoke handler record = {} # if assoc = assets[:assoc] # case assoc[:type] # when :one_to_many # parent = handler.params[:parent_id] # assoc[:keys].zip(split_keys(parent)).each{|key, val| record[key] = val} if parent # end # end static.record(handler, record) {record: record, new: true} end |
#pre_run ⇒ Object
1060 1061 1062 1063 1064 1065 1066 |
# File 'lib/engine2/action.rb', line 1060 def pre_run super panel_title "#{LOCS[:create_title]} - #{LOCS[assets[:model].table_name]}" node.parent.*.(:menu).option_at 0, node.name, icon: "plus-sign", button_loc: false if node.parent.*.is_a?(ActionListSupport) hide_pk unless assets[:model].natural_key end |
#record(handler, record) ⇒ Object
1068 1069 1070 |
# File 'lib/engine2/action.rb', line 1068 def record handler, record create_record(handler, record) end |