Module: Engine2::ActionModifySupport
Class Method Summary collapse
Instance Method Summary collapse
- #invoke(handler) ⇒ Object
- #modify_record(handler, record) ⇒ Object
- #post_run ⇒ Object
- #pre_run ⇒ Object
- #record(handler, record) ⇒ Object
Methods included from ActionFormSupport
#field_tabs, #field_template, #hr_after, #post_process, #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
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
1069 1070 1071 |
# File 'lib/engine2/action.rb', line 1069 def self.included action action.action_type :modify end |
Instance Method Details
#invoke(handler) ⇒ Object
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 |
# File 'lib/engine2/action.rb', line 1086 def invoke handler handler.permit id = handler.params[:id] record = find_record(handler, id) if record static.record(handler, record) {record: record} else handler.halt_not_found LOCS[:no_entry] end end |
#modify_record(handler, record) ⇒ Object
1083 1084 |
# File 'lib/engine2/action.rb', line 1083 def modify_record handler, record end |
#post_run ⇒ Object
1098 1099 1100 1101 1102 1103 |
# File 'lib/engine2/action.rb', line 1098 def post_run super assets[:model].primary_keys.each do |key| # pre_run ? fields! key, disabled: true end end |
#pre_run ⇒ Object
1073 1074 1075 1076 1077 |
# File 'lib/engine2/action.rb', line 1073 def pre_run super panel_title "#{LOCS[:modify_title]} - #{LOCS[assets[:model].table_name]}" node.parent.*.(:item_menu).option node.name, icon: "pencil", button_loc: false end |
#record(handler, record) ⇒ Object
1079 1080 1081 |
# File 'lib/engine2/action.rb', line 1079 def record handler, record modify_record(handler, record) end |