base class for styles
This commit is contained in:
parent
22f21225a1
commit
46987dac70
@ -1,22 +1,11 @@
|
|||||||
module Merged
|
module Merged
|
||||||
class CardStyle < ActiveYaml::Base
|
class CardStyle < Style
|
||||||
set_root_path Engine.root + "config"
|
|
||||||
|
|
||||||
fields :template , :text , :header, :fields
|
fields :template , :text , :header, :fields
|
||||||
|
|
||||||
def card_preview
|
def card_preview
|
||||||
"merged/card_preview/" + template
|
"merged/card_preview/" + template
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
module Merged
|
module Merged
|
||||||
class PageStyle < ActiveYaml::Base
|
class PageStyle < Style
|
||||||
set_root_path Engine.root + "config"
|
|
||||||
|
|
||||||
fields :type , :description
|
fields :type , :description
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
module Merged
|
module Merged
|
||||||
class SectionStyle < ActiveYaml::Base
|
class SectionStyle < Style
|
||||||
set_root_path Engine.root + "config"
|
|
||||||
|
|
||||||
fields :template , :text , :header, :fields , :cards
|
fields :template , :text , :header, :fields , :cards
|
||||||
|
|
||||||
def has_cards?
|
def has_cards?
|
||||||
@ -12,15 +11,5 @@ module Merged
|
|||||||
"merged/section_preview/" + template
|
"merged/section_preview/" + template
|
||||||
end
|
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
|
||||||
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