Class: MegaBar::ModelDisplaysController
Instance Method Summary
collapse
#add_form_path_to_mega_displays, #collect_filters, #column_sorting, #conditions, #constant_from_controller, #create, #destroy, #form_path, #index, #is_displayable?, #might_filter?, #might_paginate?, #move, #new, #num_per_page, #process_filters, #redo_setup, #set_vars_for_all, #set_vars_for_displays, #show, #sort_column, #sort_direction, #test_create, #unpack_nested_classes, #update
#_params
Instance Method Details
#edit ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/mega_bar/model_displays_controller.rb', line 11
def edit
@mega_instance = ModelDisplay.find(params["id"])
@mega_displays[0][:displayable_fields].reject! do | df |
case df[:field].field
when 'index_field_display', 'show_field_display', 'edit_field_display', 'new_field_display'
true if isnt_current_action(df[:field].field) || @mega_instance.field_displays.present?
else
false
end
end
super
end
|
#get_options ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/mega_bar/model_displays_controller.rb', line 5
def get_options
@options[:mega_bar_model_displays] = {
model_id: Model.all.pluck("name, id")
}
end
|
#isnt_current_action(field) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/mega_bar/model_displays_controller.rb', line 24
def isnt_current_action(field)
case @mega_instance.action
when 'show'
true if field == 'show_field_display'
when 'index'
true if field == 'index_field_display'
when 'new'
true if field == 'new_field_display'
when 'edit'
true if field == 'edit_field_display'
else
false
end
end
|