2019-07-30 14:05:08 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class EmailStyle
|
|
|
|
include ActiveModel::Serialization
|
|
|
|
|
|
|
|
def id
|
2023-01-09 06:20:10 -06:00
|
|
|
"email-style"
|
2019-07-30 14:05:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def html
|
|
|
|
SiteSetting.email_custom_template.presence || default_html
|
|
|
|
end
|
|
|
|
|
|
|
|
def css
|
|
|
|
SiteSetting.email_custom_css || default_css
|
|
|
|
end
|
|
|
|
|
2019-10-23 14:41:58 -05:00
|
|
|
def compiled_css
|
2019-10-23 18:21:24 -05:00
|
|
|
SiteSetting.email_custom_css_compiled.presence || css
|
2019-10-23 14:41:58 -05:00
|
|
|
end
|
|
|
|
|
2019-07-30 14:05:08 -05:00
|
|
|
def default_html
|
|
|
|
self.class.default_template
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_css
|
|
|
|
self.class.default_css
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.default_template
|
2023-01-09 06:20:10 -06:00
|
|
|
@_default_template ||=
|
|
|
|
File.read(File.join(Rails.root, "app", "views", "email", "default_template.html"))
|
2019-07-30 14:05:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.default_css
|
2023-01-09 06:20:10 -06:00
|
|
|
""
|
2019-07-30 14:05:08 -05:00
|
|
|
end
|
|
|
|
end
|