Skip to content
Snippets Groups Projects
Commit 7bcfbff0 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix

parent 2418401f
No related branches found
No related tags found
No related merge requests found
...@@ -6,17 +6,17 @@ module WithBlocks ...@@ -6,17 +6,17 @@ module WithBlocks
has_many :headings, as: :about, class_name: 'Communication::Block::Heading', dependent: :destroy has_many :headings, as: :about, class_name: 'Communication::Block::Heading', dependent: :destroy
end end
def content def contents
unless @content unless @contents
@content = [] @contents = []
blocks.without_heading.published.ordered.each do |block| blocks.without_heading.published.ordered.each do |block|
@content << block @contents << block
end end
headings.ordered.each do |heading| headings.ordered.each do |heading|
@content << heading @contents << heading
end end
end end
@content @contents
end end
# Basic rule is: TOC if 2 titles or more # Basic rule is: TOC if 2 titles or more
......
json.contents about.content do |block_or_heading| json.contents about.contents do |block_or_heading|
if block_or_heading.is_a? Communication::Block if block_or_heading.is_a? Communication::Block
json.partial! 'admin/communication/blocks/static', block: block_or_heading json.partial! 'admin/communication/blocks/static', block: block_or_heading
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment