Class: MegaBar::BlocksController
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, #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
23
24
25
26
27
28
29
|
# File 'app/controllers/mega_bar/blocks_controller.rb', line 11
def edit
@mega_instance = Block.find(params["id"])
@mega_displays[0][:displayable_fields].reject! do | df |
case df[:field].field
when 'index_model_display'
true if @mega_instance.model_displays.pluck(:action).include?'index'
when 'show_model_display'
true if @mega_instance.model_displays.pluck(:action).include?'show'
when 'edit_model_display'
true if @mega_instance.model_displays.pluck(:action).include?'edit'
when 'new_model_display'
true if @mega_instance.model_displays.pluck(:action).include?'new'
else
false
end
end
super
end
|
#get_options ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/mega_bar/blocks_controller.rb', line 32
def get_options
models = Model.all.pluck("name, id")
@options[:mega_bar_blocks] = {
model_id: models,
nest_level_1: models,
nest_level_2: models,
nest_level_3: models,
nest_level_4: models,
nest_level_5: models,
nest_level_6: models,
theme_ids: Theme.all.pluck("name, id"),
site_ids: Site.all.pluck("name, id"),
layout_section_id: LayoutSection.all.pluck("code_name, id")
}
end
|
#new ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/mega_bar/blocks_controller.rb', line 5
def new
@layout_id = params["layout_id"] if params["layout_id"]
@layout_section_id = params["layout_section_id"] if params["layout_section_id"]
super
end
|