start on section edit (without edit)

This commit is contained in:
2022-11-26 19:07:20 +02:00
parent 29183a3394
commit 1823f5cb3e
23 changed files with 70 additions and 5 deletions

View File

@ -21,12 +21,25 @@ module Cms
@content.collect{|section_data| Section.new(self , section_data)}
end
def template
def find_section(section_id)
content = @content.find{|section| section["id"] == section_id }
Section.new(self , content)
end
def first_template
@content[0]["template"]
end
def new_section
section = Hash.new
section['id'] = SecureRandom.hex(10)
@content << section
Section.new(self , section)
end
def save
false
file_name = Rails.root.join("cms" , name + ".yaml")
File.write( file_name , @content.to_yaml)
end
def self.all

View File

@ -20,6 +20,10 @@ module Cms
@content["template"]
end
def id
@content["id"]
end
def save
false
end