Module: Engine2::ActionModifySupport

Includes:
ActionFormSupport
Included in:
ModifyAction
Defined in:
lib/engine2/action.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#menu, #menu?, #post_process

Methods included from ActionAngularSupport

#ng_call, #ng_execute, #ng_info!, #ng_record, #ng_record!

Methods included from ActionOnChangeSupport

#on_change

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_runObject



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_runObject



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.*.menu(: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