Class: BlueberryCMS::PageBlocks::Shared
Constant Summary
BlueberryCMS::PageBlock::MARGINS
Class Method Summary
collapse
Instance Method Summary
collapse
#to_partial_path, types, #used_for_sharing?
Class Method Details
.avaible_shared_blocks_for_select ⇒ Object
6
7
8
9
10
11
12
|
# File 'app/models/blueberry_cms/page_blocks/shared.rb', line 6
def self.avaible_shared_blocks_for_select
blocks = BlueberryCMS::Page.all.map(&:blocks).flatten.select(&:shared)
blocks.map do |block|
[[block.page.name, block.decorate.label].join(' | '), block.id]
end
end
|
Instance Method Details
#block ⇒ Object
19
20
21
22
|
# File 'app/models/blueberry_cms/page_blocks/shared.rb', line 19
def block
return nil unless page_by_block
page_by_block&.blocks&.find(block_id)
end
|
#page_by_block ⇒ Object
14
15
16
17
|
# File 'app/models/blueberry_cms/page_blocks/shared.rb', line 14
def page_by_block
return nil unless block_id?
BlueberryCMS::Page.find_by('blocks._id' => block_id)
end
|