discourse/app/models/email_style.rb
Neil Lalonde f061aee818 FEATURE: support SCSS in custom email style
In the CSS tab of Admin > Customize > Email Style, SCSS can now be used.
2019-10-23 15:42:37 -04:00

46 lines
780 B
Ruby

# frozen_string_literal: true
class EmailStyle
include ActiveModel::Serialization
attr_accessor :html, :css, :default_html, :default_css
def id
'email-style'
end
def html
SiteSetting.email_custom_template.presence || default_html
end
def css
SiteSetting.email_custom_css || default_css
end
def compiled_css
SiteSetting.email_custom_css_compiled || self.class.default_css_compiled
end
def default_html
self.class.default_template
end
def default_css
self.class.default_css
end
def self.default_template
@_default_template ||= File.read(
File.join(Rails.root, 'app', 'views', 'email', 'default_template.html')
)
end
def self.default_css
''
end
def self.default_css_compiled
''
end
end