Module: Engine2::MetaViewSupport

Includes:
MetaAPISupport, MetaMenuSupport, MetaModelSupport, MetaPanelSupport, MetaTabSupport
Included in:
ViewMeta
Defined in:
lib/engine2/meta.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MetaModelSupport

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

Methods included from MetaAPISupport

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

Methods included from MetaTabSupport

#field_tabs, #lazy_tab, #select_tabs

Methods included from MetaPanelSupport

#modal_action, #panel, #panel_class, #panel_footer, #panel_panel_template, #panel_template, #panel_title, #post_run

Methods included from MetaMenuSupport

#menu, #menu?

Class Method Details

.included(meta) ⇒ Object



904
905
906
# File 'lib/engine2/meta.rb', line 904

def self.included meta
    meta.meta_type :view
end

Instance Method Details

#invoke(handler) ⇒ Object



920
921
922
923
924
925
926
927
928
929
# File 'lib/engine2/meta.rb', line 920

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

#post_processObject



931
932
933
934
935
936
937
938
939
940
941
942
943
944
# File 'lib/engine2/meta.rb', line 931

def post_process
    if fields = @meta[:fields]
        fields = fields - static.get[:fields] if dynamic?

        decorate(fields)
        fields.each do |name|
            type_info = get_type_info(name)
            proc = ListRendererPostProcessors[type_info[:type]]
            proc.(self, name, type_info) if proc
        end
    end

    super
end

#pre_runObject



908
909
910
911
912
913
914
915
# File 'lib/engine2/meta.rb', line 908

def pre_run
    super
    panel_template 'scaffold/view'
    panel_title LOCS[:view_title]

    menu(:panel_menu).option :cancel, icon: "remove"
    action.parent.*.menu(:item_menu).option action.name, icon: "file", button_loc: false
end

#record(handler, record) ⇒ Object



917
918
# File 'lib/engine2/meta.rb', line 917

def record handler, record
end