Module: Engine2::ActionViewSupport
Class Method Summary
collapse
Instance Method Summary
collapse
#hide_pk, #node_defined, #show_pk, #unsupported_association
#config, #decorate, #field_filter, #fields, #fields!, #hide_fields, #loc!, #render, #show_fields
#select_tabs, #tab
#modal_action, #panel, #panel_class, #panel_footer, #panel_header, #panel_panel_template, #panel_template, #panel_title, #post_run
#menu, #menu?
Class Method Details
.included(action) ⇒ Object
1109
1110
1111
|
# File 'lib/engine2/action.rb', line 1109
def self.included action
action.action_type :view
end
|
Instance Method Details
#field_tabs(hash) ⇒ Object
1123
1124
1125
1126
|
# File 'lib/engine2/action.rb', line 1123
def field_tabs hash
super
panel_template 'scaffold/view_tabs'
end
|
#invoke(handler) ⇒ Object
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
|
# File 'lib/engine2/action.rb', line 1131
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_process ⇒ Object
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
|
# File 'lib/engine2/action.rb', line 1142
def post_process
if fields = @meta[:field_list]
model = assets[:model]
fields = fields - static.meta[:field_list] if dynamic?
decorate(fields)
fields.each do |name|
type_info = model.find_type_info(name)
proc = ListRendererPostProcessors[type_info[:type]]
proc.(self, name, type_info) if proc
end
end
super
end
|
1113
1114
1115
1116
1117
1118
1119
1120
1121
|
# File 'lib/engine2/action.rb', line 1113
def pre_run
super
panel_template 'scaffold/view'
panel_title "#{LOCS[:view_title]} - #{LOCS[assets[:model].table_name]}"
panel[:backdrop] = true
(:panel_menu).option :close, icon: "remove"
node.parent.*.(:item_menu).option node.name, icon: "file", button_loc: false
end
|
#record(handler, record) ⇒ Object
1128
1129
|
# File 'lib/engine2/action.rb', line 1128
def record handler, record
end
|