Class: MegaBar::LayablesController
Instance Method Summary
collapse
#add_form_path_to_mega_displays, #collect_filters, #column_sorting, #conditions, #constant_from_controller, #create, #destroy, #edit, #form_path, #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
#display_layout ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/mega_bar/layables_controller.rb', line 16
def display_layout
m_layout = MegaBar::MasterLayoutsController.new
m_layout.request = request
m_layout.response = response
final_layout_sections = {}
@layout.template.template_sections.each do |section|
@layable = @layables.find_by(template_section_id: section.id)
final_layout_sections[section.code_name] = []
final_layout_sections[section.code_name][0] = generate_section(section)
end
m_layout.instance_variable_set('@mega_layout_sections', final_layout_sections)
m_layout.instance_variable_set('@mega_layout', @layout)
m_layout.render_layout_with_sections
end
|
#generate_section(template_section) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/mega_bar/layables_controller.rb', line 33
def generate_section(template_section)
m_layout_section = MegaBar::MasterLayoutSectionsController.new
m_layout_section.request = request
m_layout_section.response = response
m_layout_section.instance_variable_set('@layable', @layable)
html = m_layout_section.render_layout_section_admin
html[0]
end
|
#index ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'app/controllers/mega_bar/layables_controller.rb', line 5
def index
if @layout
@layables = Layable.where(layout_id: @layout.id)
@bob = display_layout
render
else
super
end
end
|