Refactor theme fields so they support custom theme defined vars

This paves the way to allowing themes to specify uploads and so on.
This commit is contained in:
Sam
2017-05-02 16:01:01 -04:00
parent 1f6ffd5fb0
commit 946f25098f
14 changed files with 120 additions and 52 deletions

View File

@ -20,10 +20,10 @@ describe Stylesheet::Manager do
user_id: -1
)
theme.set_field(:common, "scss", ".common{.scss{color: red;}}")
theme.set_field(:desktop, "scss", ".desktop{.scss{color: red;}}")
theme.set_field(:mobile, "scss", ".mobile{.scss{color: red;}}")
theme.set_field(:common, "embedded_scss", ".embedded{.scss{color: red;}}")
theme.set_field(target: :common, name: "scss", value: ".common{.scss{color: red;}}")
theme.set_field(target: :desktop, name: "scss", value: ".desktop{.scss{color: red;}}")
theme.set_field(target: :mobile, name: "scss", value: ".mobile{.scss{color: red;}}")
theme.set_field(target: :common, name: "embedded_scss", value: ".embedded{.scss{color: red;}}")
theme.save!
@ -33,10 +33,10 @@ describe Stylesheet::Manager do
user_id: -1,
)
child_theme.set_field(:common, "scss", ".child_common{.scss{color: red;}}")
child_theme.set_field(:desktop, "scss", ".child_desktop{.scss{color: red;}}")
child_theme.set_field(:mobile, "scss", ".child_mobile{.scss{color: red;}}")
child_theme.set_field(:common, "embedded_scss", ".child_embedded{.scss{color: red;}}")
child_theme.set_field(target: :common, name: "scss", value: ".child_common{.scss{color: red;}}")
child_theme.set_field(target: :desktop, name: "scss", value: ".child_desktop{.scss{color: red;}}")
child_theme.set_field(target: :mobile, name: "scss", value: ".child_mobile{.scss{color: red;}}")
child_theme.set_field(target: :common, name: "embedded_scss", value: ".child_embedded{.scss{color: red;}}")
child_theme.save!
theme.add_child_theme!(child_theme)
@ -55,7 +55,7 @@ describe Stylesheet::Manager do
expect(css).to match(/\.desktop/)
child_theme.set_field(:desktop, :scss, ".nothing{color: green;}")
child_theme.set_field(target: :desktop, name: :scss, value: ".nothing{color: green;}")
child_theme.save!
new_link = Stylesheet::Manager.stylesheet_link_tag(:desktop_theme, 'all', theme.key)