FEATURE: allow for custom HTML inside the <head> tags

This commit is contained in:
Régis Hanol 2014-01-02 16:22:04 +01:00
parent 02ea23a4ad
commit abf910d210
7 changed files with 41 additions and 40 deletions

View File

@ -1,32 +1,26 @@
<h3>{{model.title}}</h3>
<p class='description'>{{model.description}}</p>
<h3>{{model.title}}</h3>
<p class='description'>{{model.description}}</p>
{{#if model.markdown}}
{{pagedown value=model.content}}
{{/if}}
{{#if model.plainText}}
{{textarea value=model.content class="plain"}}
{{/if}}
{{#if model.html}}
{{aceEditor content=model.content mode="html"}}
{{/if}}
{{#if model.css}}
{{aceEditor content=model.content mode="css"}}
{{/if}}
{{#if model.markdown}}
{{pagedown value=model.content}}
{{/if}}
{{#if model.plainText}}
{{textarea value=model.content class="plain"}}
{{/if}}
{{#if model.html}}
{{aceEditor content=model.content mode="html"}}
{{/if}}
{{#if model.css}}
{{aceEditor content=model.content mode="css"}}
{{/if}}
<div class='controls'>
<button class='btn' {{action saveChanges}} {{bindAttr disabled="saveDisabled"}}>
{{#if saving}}
{{i18n saving}}
{{else}}
{{i18n save}}
{{/if}}
</button>
{{#if saved}}{{i18n saved}}{{/if}}
</div>
<div class='controls'>
<button class='btn' {{action saveChanges}} {{bindAttr disabled="saveDisabled"}}>
{{#if saving}}
{{i18n saving}}
{{else}}
{{i18n save}}
{{/if}}
</button>
{{#if saved}}{{i18n saved}}{{/if}}
</div>

View File

@ -32,6 +32,10 @@ td {border-bottom: 1px solid #ddd; border-top: 1px solid #ddd;}
p {
margin-left: 6px;
}
.ace-wrapper {
height: 400px;
}
}
table.report {
@ -957,4 +961,4 @@ table.api-keys {
.modal-tab {
width: 95%;
}
}
}

View File

@ -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 :privacy_policy, allow_blank: true
add_content_type :faq, allow_blank: true
add_content_type :top, allow_blank: true
add_content_type :bottom, allow_blank: true
add_content_type :top, allow_blank: true, format: :html
add_content_type :bottom, allow_blank: true, format: :html
add_content_type :head, allow_blank: true, format: :html
def site_content_type
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}

View File

@ -21,10 +21,7 @@ class SiteContentType
end
def default_content
if @opts[:default_18n_key].present?
return I18n.t(@opts[:default_18n_key])
end
""
@opts[:default_18n_key].present? ? I18n.t(@opts[:default_18n_key]) : ""
end
end
end

View File

@ -25,6 +25,8 @@
<%= discourse_csrf_tags %>
<%= raw SiteContent.content_for(:head) %>
<%= yield :head %>
</head>

View File

@ -10,6 +10,7 @@
<%= render :partial => "common/special_font_face" %>
<%= render :partial => "common/discourse_stylesheet" %>
<%= discourse_csrf_tags %>
<%= raw SiteContent.content_for(:head) %>
</head>
<body>
<%- unless customization_disabled? %>

View File

@ -499,9 +499,12 @@ en:
login_required:
title: "Login Required: Homepage"
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:
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:
title: "Bottom of the pages"
description: "HTML that will be added at the bottom of every pages"