diff --git a/app/models/merged/card_style.rb b/app/models/merged/card_style.rb index 1bc2dcf..5203e73 100644 --- a/app/models/merged/card_style.rb +++ b/app/models/merged/card_style.rb @@ -1,22 +1,11 @@ module Merged - class CardStyle < ActiveYaml::Base - set_root_path Engine.root + "config" - + class CardStyle < Style + fields :template , :text , :header, :fields def card_preview "merged/card_preview/" + template end - def options_definitions - option_defs = [] - options.each do |name| - option = OptionDefinition.find_by_name(name) - raise "no option for #{name}:#{name.class}" if option.blank? - option_defs << option - end if options - option_defs - end - end end diff --git a/app/models/merged/page_style.rb b/app/models/merged/page_style.rb index afeb81a..847d66b 100644 --- a/app/models/merged/page_style.rb +++ b/app/models/merged/page_style.rb @@ -1,7 +1,5 @@ module Merged - class PageStyle < ActiveYaml::Base - set_root_path Engine.root + "config" - + class PageStyle < Style fields :type , :description end diff --git a/app/models/merged/section_style.rb b/app/models/merged/section_style.rb index 8054853..d96e2f8 100644 --- a/app/models/merged/section_style.rb +++ b/app/models/merged/section_style.rb @@ -1,7 +1,6 @@ module Merged - class SectionStyle < ActiveYaml::Base - set_root_path Engine.root + "config" - + class SectionStyle < Style + fields :template , :text , :header, :fields , :cards def has_cards? @@ -12,15 +11,5 @@ module Merged "merged/section_preview/" + template end - def options_definitions - option_defs = [] - options.each do |name| - option = OptionDefinition.find_by_name(name) - raise "no option for #{name}:#{name.class}" if option.blank? - option_defs << option - end if options - option_defs - end - end end diff --git a/app/models/merged/style.rb b/app/models/merged/style.rb new file mode 100644 index 0000000..d89016a --- /dev/null +++ b/app/models/merged/style.rb @@ -0,0 +1,19 @@ +module Merged + class Style < ActiveYaml::Base + + set_root_path Engine.root + "config" + + fields :options + + def options_definitions + option_defs = [] + options.each do |name| + option = OptionDefinition.find_by_name(name) + raise "no option for #{name}:#{name.class}" if option.blank? + option_defs << option + end if options + option_defs + end + + end +end