Class: Engine2::ModifyMeta

Inherits:
FormMeta show all
Defined in:
lib/engine2/meta/form_meta.rb

Instance Attribute Summary

Attributes inherited from Meta

#action, #assets, #invokable, #static

Instance Method Summary collapse

Methods inherited from FormMeta

#field_template, #hr_after, #post_process, #template

Methods included from MetaAPISupport

#config, #decorate, #field_filter, #hide_fields, #info, #info!, #render, #show_fields

Methods included from MetaModelSupport

#action_defined, #get_type_info, #hide_pk, #show_pk, #unsupported_association

Methods included from MetaQuerySupport

#get_query, #query, #select

Methods included from MetaTabSupport

#field_tabs, #lazy_tab, #select_tabs

Methods included from MetaPanelSupport

#glyphicon, #modal_action, #panel, #panel_class, #panel_panel_template, #panel_template, #panel_title

Methods included from MetaMenuSupport

#menu, #post_process

Methods included from MetaAngularSupport

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

Methods included from MetaOnChangeSupport

#on_change

Methods inherited from Meta

#action_defined, #check_static_meta, #dynamic?, #freeze_meta, #get, http_method, #http_method, inherited, #initialize, #invoke!, #lookup, #merge, #meta_type, meta_type, #post_process, #request, #request_meta_proc_params, #response, #split_keys

Constructor Details

This class inherits a constructor from Engine2::Meta

Instance Method Details

#invoke(handler) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/engine2/meta/form_meta.rb', line 124

def invoke handler
    handler.permit id = handler.params[:id]
    record = get_query[assets[:model].primary_keys_hash_qualified(split_keys(id))]

    if record
        static.record(handler, record)
        {record: record}
    else
        handler.halt_not_found LOCS[:no_entry]
    end
end

#modify_record(handler, record) ⇒ Object



121
122
# File 'lib/engine2/meta/form_meta.rb', line 121

def modify_record handler, record
end

#post_runObject



136
137
138
139
140
141
# File 'lib/engine2/meta/form_meta.rb', line 136

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

#pre_runObject



111
112
113
114
115
# File 'lib/engine2/meta/form_meta.rb', line 111

def pre_run
    super
    panel_title LOCS[:modify_title]
    action.parent.*.menu(:item_menu).option action.name, icon: "pencil", button_loc: false
end

#record(handler, record) ⇒ Object



117
118
119
# File 'lib/engine2/meta/form_meta.rb', line 117

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