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



1052
1053
1054
# File 'lib/engine2/action.rb', line 1052

def self.included action
    action.action_type :modify
end

Instance Method Details

#invoke(handler) ⇒ Object



1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/engine2/action.rb', line 1069

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



1066
1067
# File 'lib/engine2/action.rb', line 1066

def modify_record handler, record
end

#post_runObject



1081
1082
1083
1084
1085
1086
# File 'lib/engine2/action.rb', line 1081

def post_run
    super
    assets[:model].primary_keys.each do |key| # pre_run ?
        fields! key, disabled: true
    end
end

#pre_runObject



1056
1057
1058
1059
1060
# File 'lib/engine2/action.rb', line 1056

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



1062
1063
1064
# File 'lib/engine2/action.rb', line 1062

def record handler, record
    modify_record(handler, record)
end