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
1132
1133
1134
|
# File 'lib/engine2/action.rb', line 1132
def self.included action
action.action_type :view
end
|
Instance Method Details
#field_tabs(hash) ⇒ Object
1146
1147
1148
1149
|
# File 'lib/engine2/action.rb', line 1146
def field_tabs hash
super
panel_template 'scaffold/view_tabs'
end
|
#invoke(handler) ⇒ Object
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
|
# File 'lib/engine2/action.rb', line 1154
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
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
|
# File 'lib/engine2/action.rb', line 1165
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
|
1136
1137
1138
1139
1140
1141
1142
1143
1144
|
# File 'lib/engine2/action.rb', line 1136
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
1151
1152
|
# File 'lib/engine2/action.rb', line 1151
def record handler, record
end
|