Module: Engine2::ActionCreateSupport
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
#field_tabs, #field_template, #hr_after, #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
1033 1034 1035 |
# File 'lib/engine2/action.rb', line 1033 def self.included action action.action_type :create end |
Instance Method Details
#create_record(handler, record) ⇒ Object
1049 1050 |
# File 'lib/engine2/action.rb', line 1049 def create_record handler, record end |
#invoke(handler) ⇒ Object
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File 'lib/engine2/action.rb', line 1052 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
1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/engine2/action.rb', line 1037 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?(ListAction) hide_pk unless assets[:model].natural_key end |
#record(handler, record) ⇒ Object
1045 1046 1047 |
# File 'lib/engine2/action.rb', line 1045 def record handler, record create_record(handler, record) end |