inlined sectionoverview templates

This commit is contained in:
2022-12-01 15:35:52 +02:00
parent 204ab1abcc
commit e29f2b79e8
13 changed files with 54 additions and 57 deletions

View File

@ -9,6 +9,7 @@ module Merged
attr_reader :name , :content , :page , :index , :cards
def initialize(page , index , section_data)
@page = page
raise "No number #{index}" unless index.is_a?(Integer)
@ -24,6 +25,15 @@ module Merged
end
end
[:template , :card_template , :id , :text , :header, :image].each do |meth|
define_method(meth) do
@content[meth.to_s]
end
end
def cards?
@content["cards"] == true
end
def update(key , value)
return if key == "id" #not updating that
@ -35,17 +45,6 @@ module Merged
@content[key] = value
end
def template
@content["template"]
end
def card_template
@content["card_template"]
end
def id
@content["id"]
end
def save
page.save
end

View File

@ -20,7 +20,7 @@ module Merged
def text
@content["text"]
end
def cards
def cards?
@content["cards"] == true
end
def section_preview