mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 22:06:33 +08:00
FEATURE: allow for custom HTML inside the <head> tags
This commit is contained in:
parent
02ea23a4ad
commit
abf910d210
|
@ -1,26 +1,20 @@
|
||||||
|
<h3>{{model.title}}</h3>
|
||||||
|
<p class='description'>{{model.description}}</p>
|
||||||
|
|
||||||
<h3>{{model.title}}</h3>
|
{{#if model.markdown}}
|
||||||
<p class='description'>{{model.description}}</p>
|
|
||||||
|
|
||||||
{{#if model.markdown}}
|
|
||||||
{{pagedown value=model.content}}
|
{{pagedown value=model.content}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if model.plainText}}
|
||||||
{{#if model.plainText}}
|
|
||||||
{{textarea value=model.content class="plain"}}
|
{{textarea value=model.content class="plain"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if model.html}}
|
||||||
{{#if model.html}}
|
|
||||||
{{aceEditor content=model.content mode="html"}}
|
{{aceEditor content=model.content mode="html"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if model.css}}
|
||||||
{{#if model.css}}
|
|
||||||
{{aceEditor content=model.content mode="css"}}
|
{{aceEditor content=model.content mode="css"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<div class='controls'>
|
||||||
|
|
||||||
<div class='controls'>
|
|
||||||
<button class='btn' {{action saveChanges}} {{bindAttr disabled="saveDisabled"}}>
|
<button class='btn' {{action saveChanges}} {{bindAttr disabled="saveDisabled"}}>
|
||||||
{{#if saving}}
|
{{#if saving}}
|
||||||
{{i18n saving}}
|
{{i18n saving}}
|
||||||
|
@ -29,4 +23,4 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</button>
|
</button>
|
||||||
{{#if saved}}{{i18n saved}}{{/if}}
|
{{#if saved}}{{i18n saved}}{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,6 +32,10 @@ td {border-bottom: 1px solid #ddd; border-top: 1px solid #ddd;}
|
||||||
p {
|
p {
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ace-wrapper {
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table.report {
|
table.report {
|
||||||
|
|
|
@ -20,9 +20,9 @@ class SiteContent < ActiveRecord::Base
|
||||||
add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message'
|
add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message'
|
||||||
add_content_type :privacy_policy, allow_blank: true
|
add_content_type :privacy_policy, allow_blank: true
|
||||||
add_content_type :faq, allow_blank: true
|
add_content_type :faq, allow_blank: true
|
||||||
add_content_type :top, allow_blank: true
|
add_content_type :top, allow_blank: true, format: :html
|
||||||
add_content_type :bottom, allow_blank: true
|
add_content_type :bottom, allow_blank: true, format: :html
|
||||||
|
add_content_type :head, allow_blank: true, format: :html
|
||||||
|
|
||||||
def site_content_type
|
def site_content_type
|
||||||
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}
|
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}
|
||||||
|
|
|
@ -21,10 +21,7 @@ class SiteContentType
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_content
|
def default_content
|
||||||
if @opts[:default_18n_key].present?
|
@opts[:default_18n_key].present? ? I18n.t(@opts[:default_18n_key]) : ""
|
||||||
return I18n.t(@opts[:default_18n_key])
|
|
||||||
end
|
|
||||||
""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
<%= discourse_csrf_tags %>
|
<%= discourse_csrf_tags %>
|
||||||
|
|
||||||
|
<%= raw SiteContent.content_for(:head) %>
|
||||||
|
|
||||||
<%= yield :head %>
|
<%= yield :head %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<%= render :partial => "common/special_font_face" %>
|
<%= render :partial => "common/special_font_face" %>
|
||||||
<%= render :partial => "common/discourse_stylesheet" %>
|
<%= render :partial => "common/discourse_stylesheet" %>
|
||||||
<%= discourse_csrf_tags %>
|
<%= discourse_csrf_tags %>
|
||||||
|
<%= raw SiteContent.content_for(:head) %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%- unless customization_disabled? %>
|
<%- unless customization_disabled? %>
|
||||||
|
|
|
@ -499,9 +499,12 @@ en:
|
||||||
login_required:
|
login_required:
|
||||||
title: "Login Required: Homepage"
|
title: "Login Required: Homepage"
|
||||||
description: "The text displayed for unauthorized users when login is required on the site."
|
description: "The text displayed for unauthorized users when login is required on the site."
|
||||||
|
head:
|
||||||
|
title: "HTML head"
|
||||||
|
description: "HTML that will be inserted inside the <head></head> tags"
|
||||||
top:
|
top:
|
||||||
title: "Top of the pages"
|
title: "Top of the pages"
|
||||||
description: "HTML that will be added at the top of every pages (after the header, before the navigation or the topic title)"
|
description: "HTML that will be added at the top of every pages (after the header, before the navigation or the topic title)."
|
||||||
bottom:
|
bottom:
|
||||||
title: "Bottom of the pages"
|
title: "Bottom of the pages"
|
||||||
description: "HTML that will be added at the bottom of every pages"
|
description: "HTML that will be added at the bottom of every pages"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user