From c2acfacc260e8c10eeae40e236c5f4e8bffaa292 Mon Sep 17 00:00:00 2001 From: Torsten Date: Fri, 16 Dec 2022 10:58:26 +0200 Subject: [PATCH] starting on page styles aka types --- app/models/merged/page_style.rb | 8 ++++++++ app/views/merged/sections/_form.haml | 10 ---------- config/merged/page_styles.yml | 4 ++++ spec/models/merged/page_style_spec.rb | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 app/models/merged/page_style.rb delete mode 100644 app/views/merged/sections/_form.haml create mode 100644 config/merged/page_styles.yml create mode 100644 spec/models/merged/page_style_spec.rb diff --git a/app/models/merged/page_style.rb b/app/models/merged/page_style.rb new file mode 100644 index 0000000..afeb81a --- /dev/null +++ b/app/models/merged/page_style.rb @@ -0,0 +1,8 @@ +module Merged + class PageStyle < ActiveYaml::Base + set_root_path Engine.root + "config" + + fields :type , :description + + end +end diff --git a/app/views/merged/sections/_form.haml b/app/views/merged/sections/_form.haml deleted file mode 100644 index 7f8e880..0000000 --- a/app/views/merged/sections/_form.haml +++ /dev/null @@ -1,10 +0,0 @@ -= form_for @merged_section do |f| - - if @merged_section.errors.any? - #error_explanation - %h2= "#{pluralize(@merged_section.errors.count, "error")} prohibited this merged_section from being saved:" - %ul - - @merged_section.errors.full_messages.each do |message| - %li= message - - .actions - = f.submit 'Save' diff --git a/config/merged/page_styles.yml b/config/merged/page_styles.yml new file mode 100644 index 0000000..a71188e --- /dev/null +++ b/config/merged/page_styles.yml @@ -0,0 +1,4 @@ +--- +- type: page + description: A general page, may contain anykind of section. + No restrictions of any kind. No options either. diff --git a/spec/models/merged/page_style_spec.rb b/spec/models/merged/page_style_spec.rb new file mode 100644 index 0000000..703c865 --- /dev/null +++ b/spec/models/merged/page_style_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +module Merged + RSpec.describe PageStyle, type: :model do + let(:first) {PageStyle.all.first} + + it "finds stye" do + spacer = PageStyle.find_by_type("page") + expect(spacer).not_to be nil + end + + it "has Style.sections" do + expect(PageStyle.all.length).to be 1 + end + it "Spacer has no fields" do + expect(first.description).not_to be nil + end + end +end