Add embed class name setup for embeddable hosts
This commit is contained in:
parent
9b84cd832c
commit
4bf8548dc5
|
@ -30,7 +30,7 @@ export default Ember.Component.extend(bufferedProperty('host'), {
|
||||||
save() {
|
save() {
|
||||||
if (this.get('cantSave')) { return; }
|
if (this.get('cantSave')) { return; }
|
||||||
|
|
||||||
const props = this.get('buffered').getProperties('host', 'path_whitelist');
|
const props = this.get('buffered').getProperties('host', 'path_whitelist', 'class_name');
|
||||||
props.category_id = this.get('categoryId');
|
props.category_id = this.get('categoryId');
|
||||||
|
|
||||||
const host = this.get('host');
|
const host = this.get('host');
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
<td>
|
<td>
|
||||||
{{input value=buffered.host placeholder="example.com" enter="save" class="host-name"}}
|
{{input value=buffered.host placeholder="example.com" enter="save" class="host-name"}}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{input value=buffered.class_name placeholder="class" enter="save" class="class-name"}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{input value=buffered.path_whitelist placeholder="/blog/.*" enter="save" class="path-whitelist"}}
|
{{input value=buffered.path_whitelist placeholder="/blog/.*" enter="save" class="path-whitelist"}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -14,6 +17,7 @@
|
||||||
</td>
|
</td>
|
||||||
{{else}}
|
{{else}}
|
||||||
<td>{{host.host}}</td>
|
<td>{{host.host}}</td>
|
||||||
|
<td>{{host.class_name}}</td>
|
||||||
<td>{{host.path_whitelist}}</td>
|
<td>{{host.path_whitelist}}</td>
|
||||||
<td>{{category-badge host.category}}</td>
|
<td>{{category-badge host.category}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
{{#if embedding.embeddable_hosts}}
|
{{#if embedding.embeddable_hosts}}
|
||||||
<table class='embedding'>
|
<table class='embedding'>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='width: 30%'>{{i18n "admin.embedding.host"}}</th>
|
<th style='width: 25%'>{{i18n "admin.embedding.host"}}</th>
|
||||||
<th style='width: 30%'>{{i18n "admin.embedding.path_whitelist"}}</th>
|
<th style='width: 15%'>{{i18n "admin.embedding.class_name"}}</th>
|
||||||
<th style='width: 30%'>{{i18n "admin.embedding.category"}}</th>
|
<th style='width: 25%'>{{i18n "admin.embedding.path_whitelist"}}</th>
|
||||||
|
<th style='width: 25%'>{{i18n "admin.embedding.category"}}</th>
|
||||||
<th style='width: 10%'> </th>
|
<th style='width: 10%'> </th>
|
||||||
</tr>
|
</tr>
|
||||||
{{#each embedding.embeddable_hosts as |host|}}
|
{{#each embedding.embeddable_hosts as |host|}}
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Admin::EmbeddableHostsController < Admin::AdminController
|
||||||
def save_host(host)
|
def save_host(host)
|
||||||
host.host = params[:embeddable_host][:host]
|
host.host = params[:embeddable_host][:host]
|
||||||
host.path_whitelist = params[:embeddable_host][:path_whitelist]
|
host.path_whitelist = params[:embeddable_host][:path_whitelist]
|
||||||
|
host.class_name = params[:embeddable_host][:class_name]
|
||||||
host.category_id = params[:embeddable_host][:category_id]
|
host.category_id = params[:embeddable_host][:category_id]
|
||||||
host.category_id = SiteSetting.uncategorized_category_id if host.category_id.blank?
|
host.category_id = SiteSetting.uncategorized_category_id if host.category_id.blank?
|
||||||
|
|
||||||
|
|
|
@ -57,4 +57,5 @@ end
|
||||||
# created_at :datetime
|
# created_at :datetime
|
||||||
# updated_at :datetime
|
# updated_at :datetime
|
||||||
# path_whitelist :string
|
# path_whitelist :string
|
||||||
|
# class_name :string
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class EmbeddableHostSerializer < ApplicationSerializer
|
class EmbeddableHostSerializer < ApplicationSerializer
|
||||||
|
|
||||||
TO_SERIALIZE = [:id, :host, :path_whitelist, :category_id]
|
TO_SERIALIZE = [:id, :host, :path_whitelist, :class_name, :category_id]
|
||||||
|
|
||||||
attributes *TO_SERIALIZE
|
attributes *TO_SERIALIZE
|
||||||
|
|
||||||
|
|
|
@ -3465,6 +3465,7 @@ en:
|
||||||
sample: "Use the following HTML code into your site to create and embed discourse topics. Replace <b>REPLACE_ME</b> with the canonical URL of the page you are embedding it on."
|
sample: "Use the following HTML code into your site to create and embed discourse topics. Replace <b>REPLACE_ME</b> with the canonical URL of the page you are embedding it on."
|
||||||
title: "Embedding"
|
title: "Embedding"
|
||||||
host: "Allowed Hosts"
|
host: "Allowed Hosts"
|
||||||
|
class_name: "Class Name"
|
||||||
path_whitelist: "Path Whitelist"
|
path_whitelist: "Path Whitelist"
|
||||||
edit: "edit"
|
edit: "edit"
|
||||||
category: "Post to Category"
|
category: "Post to Category"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddEmbedClassNameToEmbeddableHosts < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :embeddable_hosts, :class_name, :string
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue