Class: Engine2::DecodeEntryMeta
- Inherits:
-
DecodeMeta
- Object
- Meta
- DecodeMeta
- Engine2::DecodeEntryMeta
- Defined in:
- lib/engine2/meta/decode_meta.rb
Instance Attribute Summary
Attributes inherited from Meta
#action, #assets, #invokable, #static
Instance Method Summary collapse
Methods inherited from DecodeMeta
#decode, #post_process, #pre_run, #separator, #show_max_selected
Methods included from MetaAPISupport
#config, #decorate, #field_filter, #hide_fields, #info, #info!, #loc!, #reload_routes!, #render, #show_fields
Methods included from MetaModelSupport
#action_defined, #get_type_info, #hide_pk, #pre_run, #show_pk, #unsupported_association
Methods included from MetaQuerySupport
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, #pre_run, #request, #request_meta_proc_params, #response, #split_keys
Constructor Details
This class inherits a constructor from Engine2::Meta
Instance Method Details
#invoke(handler) ⇒ Object
89 90 91 |
# File 'lib/engine2/meta/decode_meta.rb', line 89 def invoke handler {entries: invoke_decode(handler, handler.param_to_json(:ids))} end |
#invoke_decode(handler, ids) ⇒ Object
93 94 95 96 97 |
# File 'lib/engine2/meta/decode_meta.rb', line 93 def invoke_decode handler, ids records = get_query.where(ids.map{|keys| Hash[assets[:model].primary_keys.zip(keys)]}.inject{|q, c| q | c}).all # handler.halt_not_found(LOCS[:no_entry]) if records.empty? records end |
#post_run ⇒ Object
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/engine2/meta/decode_meta.rb', line 99 def post_run super if assoc = assets[:assoc] decode = assoc[:model].type_info[assoc[:keys].first][:decode] if decode[:search][:multiple] && action.parent.parent.*.is_a?(ListMeta) action.list.*.(:panel_menu).option_at 0, :choose, icon: :ok # , disabled: "action.selected_size() == 0" end end end |