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
1016 1017 1018 |
# File 'lib/engine2/action.rb', line 1016 def self.included action action.action_type :create end |
Instance Method Details
#create_record(handler, record) ⇒ Object
1032 1033 |
# File 'lib/engine2/action.rb', line 1032 def create_record handler, record end |
#invoke(handler) ⇒ Object
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 |
# File 'lib/engine2/action.rb', line 1035 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
1020 1021 1022 1023 1024 1025 1026 |
# File 'lib/engine2/action.rb', line 1020 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
1028 1029 1030 |
# File 'lib/engine2/action.rb', line 1028 def record handler, record create_record(handler, record) end |