Class: MegaBar::LayoutSection

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/mega_bar/layout_section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_nameObject

Returns the value of attribute base_name.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def base_name
  @base_name
end

#block_textObject

Returns the value of attribute block_text.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def block_text
  @block_text
end

#edit_model_displayObject

Returns the value of attribute edit_model_display.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def edit_model_display
  @edit_model_display
end

#index_model_displayObject

Returns the value of attribute index_model_display.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def index_model_display
  @index_model_display
end

#model_idObject

Returns the value of attribute model_id.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def model_id
  @model_id
end

#new_model_displayObject

Returns the value of attribute new_model_display.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def new_model_display
  @new_model_display
end

#show_model_displayObject

Returns the value of attribute show_model_display.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def show_model_display
  @show_model_display
end

#template_section_idObject

Returns the value of attribute template_section_id.



3
4
5
# File 'app/models/mega_bar/layout_section.rb', line 3

def template_section_id
  @template_section_id
end

Instance Method Details

#create_block_for_sectionObject



13
14
15
16
17
18
# File 'app/models/mega_bar/layout_section.rb', line 13

def create_block_for_section
  # path_base:  MegaBar::Page.find(self.page_id).path, # could be added in below. but doesnt look necessary.
  block_hash = {layout_section_id: self.id, name: self.code_name.humanize + ' Block', actions: 'current', model_id: self.model_id, new_model_display: 'y', edit_model_display: 'y', index_model_display: 'y', show_model_display: 'y'}
  block_hash = block_hash.merge(html: self.block_text) if self.block_text
  Block.create(block_hash)
end