Added Setting to define custom HTML Email CSS font.
This commit is contained in:
parent
95e5eb57a8
commit
2ecc60f22a
3 changed files with 115 additions and 79 deletions
|
@ -1,7 +1,8 @@
|
||||||
|
if ActiveRecord::Base.connection.table_exists?( Setting.table_name )
|
||||||
|
|
||||||
Rails.application.config.html_email_css_font = "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;"
|
html_email_css_font = Setting.get('html_email_css_font')
|
||||||
|
|
||||||
Rails.application.config.html_email_body = <<~HERE
|
Rails.application.config.html_email_body = <<~HERE
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -9,7 +10,7 @@ Rails.application.config.html_email_body = <<~HERE
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
#{Rails.application.config.html_email_css_font};
|
#{html_email_css_font};
|
||||||
}
|
}
|
||||||
img {
|
img {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -76,6 +77,7 @@ Rails.application.config.html_email_body = <<~HERE
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body style="#{Rails.application.config.html_email_css_font}">###html###</body>
|
<body style="#{html_email_css_font}">###html###</body>
|
||||||
</html>
|
</html>
|
||||||
HERE
|
HERE
|
||||||
|
end
|
||||||
|
|
21
db/migrate/20180306084119_custom_html_email_css_font.rb
Normal file
21
db/migrate/20180306084119_custom_html_email_css_font.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
class CustomHtmlEmailCssFont < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'HTML Email CSS Font',
|
||||||
|
name: 'html_email_css_font',
|
||||||
|
area: 'Core',
|
||||||
|
description: 'Defines the CSS font information for HTML Emails.',
|
||||||
|
options: {},
|
||||||
|
state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;",
|
||||||
|
preferences: {
|
||||||
|
permission: ['admin'],
|
||||||
|
},
|
||||||
|
frontend: false
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -3739,3 +3739,16 @@ Setting.create_if_not_exists(
|
||||||
preferences: { online_service_disable: true },
|
preferences: { online_service_disable: true },
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'HTML Email CSS Font',
|
||||||
|
name: 'html_email_css_font',
|
||||||
|
area: 'Core',
|
||||||
|
description: 'Defines the CSS font information for HTML Emails.',
|
||||||
|
options: {},
|
||||||
|
state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;",
|
||||||
|
preferences: {
|
||||||
|
permission: ['admin'],
|
||||||
|
},
|
||||||
|
frontend: false
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue