base class for styles
This commit is contained in:
parent
22f21225a1
commit
46987dac70
@ -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
|
||||
|
@ -1,7 +1,5 @@
|
||||
module Merged
|
||||
class PageStyle < ActiveYaml::Base
|
||||
set_root_path Engine.root + "config"
|
||||
|
||||
class PageStyle < Style
|
||||
fields :type , :description
|
||||
|
||||
end
|
||||
|
@ -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
|
||||
|
19
app/models/merged/style.rb
Normal file
19
app/models/merged/style.rb
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user