Author SHA1 Message Date
Kelvin Tan 23b8e3f607 DEV: Update to Font Awesome 6 icon names 2024-12-04 08:30:40 +08:00
69 changed files with 2549 additions and 2837 deletions
-3
View File
@@ -1,6 +1,3 @@
< 3.5.0.beta8-dev: e51aad3bfd41cf2cb9557e025e833122a9f6c892
< 3.5.0.beta5-dev: bd9af0b9a577bfd2c01cc8b81a782a4e8b81b9c5
< 3.5.0.beta1-dev: 6ceba62e985223c269782c4bc9a1bdc4a5adba28
< 3.4.0.beta2-dev: 7685ebf396c93e8accc5a76a81fcec4384a73fa3 < 3.4.0.beta2-dev: 7685ebf396c93e8accc5a76a81fcec4384a73fa3
< 3.4.0.beta1-dev: da38a4c053b68d7076db4441cfe86b473979945d < 3.4.0.beta1-dev: da38a4c053b68d7076db4441cfe86b473979945d
< 3.3.0.beta1-dev: 062efc8a547c19474eaeefae464837d63a5e5fb3 < 3.3.0.beta1-dev: 062efc8a547c19474eaeefae464837d63a5e5fb3
+51 -66
View File
@@ -1,95 +1,80 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activesupport (8.0.2) activesupport (7.1.3.3)
base64 base64
benchmark (>= 0.3)
bigdecimal bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1) concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5) connection_pool (>= 2.2.5)
drb drb
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1) minitest (>= 5.1)
securerandom (>= 0.3) mutex_m
tzinfo (~> 2.0, >= 2.0.5) tzinfo (~> 2.0)
uri (>= 0.13.1) ast (2.4.2)
ast (2.4.3) base64 (0.2.0)
base64 (0.3.0) bigdecimal (3.1.8)
benchmark (0.4.1) concurrent-ruby (1.2.3)
bigdecimal (3.2.0) connection_pool (2.4.1)
concurrent-ruby (1.3.5) drb (2.2.1)
connection_pool (2.5.3) i18n (1.14.5)
drb (2.2.3)
i18n (1.14.7)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
json (2.12.2) json (2.7.2)
language_server-protocol (3.17.0.5) language_server-protocol (3.17.0.3)
lint_roller (1.1.0) minitest (5.23.1)
logger (1.7.0) mutex_m (0.2.0)
minitest (5.25.5) parallel (1.24.0)
parallel (1.27.0) parser (3.3.1.0)
parser (3.3.8.0)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
prettier_print (1.2.1) prettier_print (1.2.1)
prism (1.4.0) racc (1.8.0)
racc (1.8.1) rack (3.0.11)
rack (3.1.16)
rainbow (3.1.1) rainbow (3.1.1)
regexp_parser (2.10.0) regexp_parser (2.9.2)
rubocop (1.75.8) rexml (3.3.9)
rubocop (1.64.0)
json (~> 2.3) json (~> 2.3)
language_server-protocol (~> 3.17.0.2) language_server-protocol (>= 3.17.0)
lint_roller (~> 1.1.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.3.0.2) parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0) regexp_parser (>= 1.8, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0) rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.44.1) rubocop-ast (1.31.3)
parser (>= 3.3.7.2) parser (>= 3.3.1.0)
prism (~> 1.4) rubocop-capybara (2.20.0)
rubocop-capybara (2.22.1) rubocop (~> 1.41)
lint_roller (~> 1.1) rubocop-discourse (3.8.0)
rubocop (~> 1.72, >= 1.72.1)
rubocop-discourse (3.12.1)
activesupport (>= 6.1) activesupport (>= 6.1)
lint_roller (>= 1.1.0) rubocop (>= 1.59.0)
rubocop (>= 1.73.2) rubocop-capybara (>= 2.0.0)
rubocop-capybara (>= 2.22.0) rubocop-factory_bot (>= 2.0.0)
rubocop-factory_bot (>= 2.27.0) rubocop-rails (>= 2.25.0)
rubocop-rails (>= 2.30.3) rubocop-rspec (>= 2.25.0)
rubocop-rspec (>= 3.0.1) rubocop-factory_bot (2.25.1)
rubocop-rspec_rails (>= 2.31.0) rubocop (~> 1.41)
rubocop-factory_bot (2.27.1) rubocop-rails (2.25.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rails (2.32.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.75.0, < 2.0) rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.6.0) rubocop-rspec (2.29.2)
lint_roller (~> 1.1) rubocop (~> 1.40)
rubocop (~> 1.72, >= 1.72.1) rubocop-capybara (~> 2.17)
rubocop-rspec_rails (2.31.0) rubocop-factory_bot (~> 2.22)
lint_roller (~> 1.1) rubocop-rspec_rails (~> 2.28)
rubocop (~> 1.72, >= 1.72.1) rubocop-rspec_rails (2.28.3)
rubocop-rspec (~> 3.5) rubocop (~> 1.40)
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
securerandom (0.4.1)
syntax_tree (6.2.0) syntax_tree (6.2.0)
prettier_print (>= 1.2.0) prettier_print (>= 1.2.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4) unicode-display_width (2.5.0)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
PLATFORMS PLATFORMS
ruby ruby
@@ -99,4 +84,4 @@ DEPENDENCIES
syntax_tree syntax_tree
BUNDLED WITH BUNDLED WITH
2.6.9 2.5.10
-3
View File
@@ -1,8 +1,5 @@
# Official Discourse Advertising Plugin # Official Discourse Advertising Plugin
> [!IMPORTANT]
> This plugin has now been bundled into Discourse core. See: https://meta.discourse.org/t/bundling-more-popular-plugins-with-discourse-core/373574
Official Plugin Topic & Documentation: https://meta.discourse.org/t/official-advertising-ad-plugin-for-discourse/33734 Official Plugin Topic & Documentation: https://meta.discourse.org/t/official-advertising-ad-plugin-for-discourse/33734
This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum. This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum.
@@ -1,34 +0,0 @@
import { action } from "@ember/object";
import { mapBy } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import { makeArray } from "discourse/lib/helpers";
import HouseAdsChooser from "./house-ads-chooser";
import HouseAdsSetting from "./house-ads-setting";
@classNames("house-ads-setting house-ads-list-setting")
export default class HouseAdsListSetting extends HouseAdsSetting {
@mapBy("allAds", "name") adNames;
@action
changeAdValue(value) {
const settingValue = makeArray(value).join("|");
this.set("adValue", settingValue);
}
<template>
<label for={{this.name}}>{{this.title}}</label>
<HouseAdsChooser
@settingValue={{this.adValue}}
@choices={{this.adNames}}
@onChange={{this.changeAdValue}}
/>
<div class="setting-controls">
{{#if this.changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="xmark" />
{{/if}}
</div>
<p class="help">{{this.help}}</p>
</template>
}
@@ -1,62 +0,0 @@
import { LinkTo } from "@ember/routing";
import RouteTemplate from "ember-route-template";
import DButton from "discourse/components/d-button";
import routeAction from "discourse/helpers/route-action";
import { i18n } from "discourse-i18n";
import HouseAdsListSetting from "../components/house-ads-list-setting";
export default RouteTemplate(
<template>
<section class="house-ads-settings content-body">
<div>{{i18n "admin.adplugin.house_ads.description"}}</div>
{{#if @controller.houseAds.length}}
<form class="form-horizontal">
<HouseAdsListSetting
@name="topic_list_top"
@value={{@controller.adSettings.topic_list_top}}
@allAds={{@controller.houseAds}}
@adSettings={{@controller.adSettings}}
/>
<HouseAdsListSetting
@name="topic_above_post_stream"
@value={{@controller.adSettings.topic_above_post_stream}}
@allAds={{@controller.houseAds}}
@adSettings={{@controller.adSettings}}
/>
<HouseAdsListSetting
@name="topic_above_suggested"
@value={{@controller.adSettings.topic_above_suggested}}
@allAds={{@controller.houseAds}}
@adSettings={{@controller.adSettings}}
/>
<HouseAdsListSetting
@name="post_bottom"
@value={{@controller.adSettings.post_bottom}}
@allAds={{@controller.houseAds}}
@adSettings={{@controller.adSettings}}
/>
<HouseAdsListSetting
@name="topic_list_between"
@value={{@controller.adSettings.topic_list_between}}
@allAds={{@controller.houseAds}}
@adSettings={{@controller.adSettings}}
/>
<DButton
@label="admin.adplugin.house_ads.more_settings"
@icon="gear"
@action={{routeAction "moreSettings"}}
class="btn-default"
/>
</form>
{{else}}
<p>
{{#LinkTo route="adminPlugins.houseAds.show" model="new"}}
{{i18n "admin.adplugin.house_ads.get_started"}}
{{/LinkTo}}
</p>
{{/if}}
</section>
</template>
);
@@ -1,97 +0,0 @@
import { Input } from "@ember/component";
import { fn, hash } from "@ember/helper";
import RouteTemplate from "ember-route-template";
import AceEditor from "discourse/components/ace-editor";
import DButton from "discourse/components/d-button";
import TextField from "discourse/components/text-field";
import { i18n } from "discourse-i18n";
import GroupChooser from "select-kit/components/group-chooser";
import HouseAdsCategorySelector from "../components/house-ads-category-selector";
export default RouteTemplate(
<template>
<section class="edit-house-ad content-body">
<h1><TextField
@value={{@controller.buffered.name}}
class="house-ad-name"
/></h1>
<div class="controls">
<AceEditor
@content={{@controller.buffered.html}}
@onChange={{fn (mut @controller.buffered.html)}}
@mode="html"
/>
</div>
<div class="controls">
<div class="visibility-settings">
<div>
<Input
@type="checkbox"
@checked={{@controller.buffered.visible_to_logged_in_users}}
class="visible-to-logged-in-checkbox"
/>
<span>{{i18n
"admin.adplugin.house_ads.show_to_logged_in_users"
}}</span>
</div>
<div>
<Input
class="visible-to-anonymous-checkbox"
@type="checkbox"
@checked={{@controller.buffered.visible_to_anons}}
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_anons"}}</span>
</div>
<HouseAdsCategorySelector
@categories={{@controller.site.categories}}
@selectedCategories={{@controller.selectedCategories}}
@onChange={{@controller.setCategoryIds}}
@options={{hash allowAny=true}}
class="house-ads-categories"
/>
<div class="description">
{{i18n "admin.adplugin.house_ads.category_chooser_description"}}
</div>
<GroupChooser
@content={{@controller.site.groups}}
@onChange={{@controller.setGroupIds}}
@value={{@controller.selectedGroups}}
class="banner-groups"
/>
<div class="description">
{{i18n "admin.adplugin.house_ads.group_chooser_description"}}
</div>
</div>
<DButton
@action={{@controller.save}}
@disabled={{@controller.disabledSave}}
@label="admin.adplugin.house_ads.save"
class="btn-primary save-button"
/>
{{#if @controller.saving}}
{{@controller.savingStatus}}
{{else}}
{{#unless @controller.disabledSave}}
<DButton @action={{@controller.cancel}} @label="cancel" />
{{/unless}}
{{/if}}
<DButton
@action={{@controller.openPreview}}
@label="admin.adplugin.house_ads.preview"
/>
<DButton
@action={{@controller.destroy}}
@label="admin.adplugin.house_ads.delete"
class="btn-danger delete-button"
/>
</div>
</section>
</template>
);
@@ -1,43 +0,0 @@
import { LinkTo } from "@ember/routing";
import RouteTemplate from "ember-route-template";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
export default RouteTemplate(
<template>
<div class="adplugin-mgmt">
<h1>{{i18n "admin.adplugin.house_ads.title"}}</h1>
{{#if @controller.model.length}}
<div class="content-list">
<div class="house-ads-actions">
<LinkTo
@route="adminPlugins.houseAds.show"
@model="new"
class="btn btn-primary"
>
{{icon "plus"}}
<span>{{i18n "admin.adplugin.house_ads.new"}}</span>
</LinkTo>
<LinkTo
@route="adminPlugins.houseAds.index"
class="btn btn-default"
>
{{icon "gear"}}
<span>{{i18n "admin.adplugin.house_ads.settings"}}</span>
</LinkTo>
</div>
<ul class="house-ads-list">
{{#each @controller.model as |ad|}}
<li class="house-ads-list-item">
{{#LinkTo route="adminPlugins.houseAds.show" model=ad.id}}
{{ad.name}}
{{/LinkTo}}
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{outlet}}
</div>
</template>
);
@@ -1,6 +1,6 @@
import { computed } from "@ember/object"; import { action, computed } from "@ember/object";
import { classNames } from "@ember-decorators/component"; import { classNames } from "@ember-decorators/component";
import { makeArray } from "discourse/lib/helpers"; import { makeArray } from "discourse-common/lib/helpers";
import MultiSelectComponent from "select-kit/components/multi-select"; import MultiSelectComponent from "select-kit/components/multi-select";
@classNames("house-ads-chooser") @classNames("house-ads-chooser")
@@ -22,6 +22,11 @@ export default class HouseAdsChooser extends MultiSelectComponent {
.filter(Boolean); .filter(Boolean);
} }
// TODO: kept for legacy, remove when Discourse is 2.5
mutateValues(values) {
this.set("settingValue", values.join(this.tokenSeparator));
}
computeValues() { computeValues() {
return this.settingValue.split(this.tokenSeparator).filter(Boolean); return this.settingValue.split(this.tokenSeparator).filter(Boolean);
} }
@@ -30,4 +35,10 @@ export default class HouseAdsChooser extends MultiSelectComponent {
get content() { get content() {
return makeArray(this.choices); return makeArray(this.choices);
} }
@action
onChange(value) {
const settingValue = makeArray(value).join(this.tokenSeparator);
this.onChange?.(settingValue);
}
} }
@@ -0,0 +1,13 @@
<label for={{this.name}}>{{this.title}}</label>
{{house-ads-chooser
settingValue=this.adValue
choices=this.adNames
onChange=(action (mut this.adValue))
}}
<div class="setting-controls">
{{#if this.changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="times" />
{{/if}}
</div>
<p class="help">{{this.help}}</p>
@@ -0,0 +1,8 @@
import { mapBy } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
import HouseAdsSetting from "discourse/plugins/discourse-adplugin/discourse/components/house-ads-setting";
@classNames("house-ads-setting house-ads-list-setting")
export default class HouseAdsListSetting extends HouseAdsSetting {
@mapBy("allAds", "name") adNames;
}
@@ -0,0 +1,9 @@
<label for={{this.name}}>{{this.title}}</label>
<TextField @value={{this.adValue}} @classNames="house-ads-text-input" />
<div class="setting-controls">
{{#if this.changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="times" />
{{/if}}
</div>
<p class="help">{{this.help}}</p>
@@ -1,12 +1,10 @@
import Component from "@ember/component"; import Component from "@ember/component";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { classNames } from "@ember-decorators/component"; import { classNames } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import TextField from "discourse/components/text-field";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n as computedI18n, propertyNotEqual } from "discourse/lib/computed"; import { i18n, propertyNotEqual } from "discourse/lib/computed";
import { i18n } from "discourse-i18n"; import I18n from "I18n";
@classNames("house-ads-setting") @classNames("house-ads-setting")
export default class HouseAdsSetting extends Component { export default class HouseAdsSetting extends Component {
@@ -14,8 +12,8 @@ export default class HouseAdsSetting extends Component {
saving = false; saving = false;
savingStatus = ""; savingStatus = "";
@computedI18n("name", "admin.adplugin.house_ads.%@.title") title; @i18n("name", "admin.adplugin.house_ads.%@.title") title;
@computedI18n("name", "admin.adplugin.house_ads.%@.description") help; @i18n("name", "admin.adplugin.house_ads.%@.description") help;
@propertyNotEqual("adValue", "value") changed; @propertyNotEqual("adValue", "value") changed;
init() { init() {
@@ -28,7 +26,7 @@ export default class HouseAdsSetting extends Component {
if (!this.get("saving")) { if (!this.get("saving")) {
this.setProperties({ this.setProperties({
saving: true, saving: true,
savingStatus: i18n("saving"), savingStatus: I18n.t("saving"),
}); });
ajax(`/admin/plugins/pluginad/house_settings/${this.get("name")}.json`, { ajax(`/admin/plugins/pluginad/house_settings/${this.get("name")}.json`, {
@@ -40,7 +38,7 @@ export default class HouseAdsSetting extends Component {
adSettings.set(this.get("name"), this.get("adValue")); adSettings.set(this.get("name"), this.get("adValue"));
this.setProperties({ this.setProperties({
value: this.get("adValue"), value: this.get("adValue"),
savingStatus: i18n("saved"), savingStatus: I18n.t("saved"),
}); });
}) })
.catch(popupAjaxError) .catch(popupAjaxError)
@@ -57,16 +55,4 @@ export default class HouseAdsSetting extends Component {
cancel() { cancel() {
this.set("adValue", this.get("value")); this.set("adValue", this.get("value"));
} }
<template>
<label for={{this.name}}>{{this.title}}</label>
<TextField @value={{this.adValue}} @classNames="house-ads-text-input" />
<div class="setting-controls">
{{#if this.changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="xmark" />
{{/if}}
</div>
<p class="help">{{this.help}}</p>
</template>
} }
@@ -1,6 +1,6 @@
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import DModal from "discourse/components/d-modal"; import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n"; import i18n from "discourse-common/helpers/i18n";
const Preview = <template> const Preview = <template>
<DModal <DModal
@@ -3,7 +3,6 @@ import { alias } from "@ember/object/computed";
export default class AdminPluginsHouseAdsIndexController extends Controller { export default class AdminPluginsHouseAdsIndexController extends Controller {
@controller("adminPlugins.houseAds") adminPluginsHouseAds; @controller("adminPlugins.houseAds") adminPluginsHouseAds;
@alias("adminPluginsHouseAds.model") houseAds; @alias("adminPluginsHouseAds.model") houseAds;
@alias("adminPluginsHouseAds.houseAdsSettings") adSettings; @alias("adminPluginsHouseAds.houseAdsSettings") adSettings;
} }
@@ -7,7 +7,7 @@ import { observes } from "@ember-decorators/object";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import Category from "discourse/models/category"; import Category from "discourse/models/category";
import { i18n } from "discourse-i18n"; import I18n from "I18n";
import Preview from "../components/modal/preview"; import Preview from "../components/modal/preview";
export default class adminPluginsHouseAdsShow extends Controller { export default class adminPluginsHouseAdsShow extends Controller {
@@ -43,7 +43,7 @@ export default class adminPluginsHouseAdsShow extends Controller {
async save() { async save() {
if (!this.saving) { if (!this.saving) {
this.saving = true; this.saving = true;
this.savingStatus = i18n("saving"); this.savingStatus = I18n.t("saving");
const data = {}; const data = {};
const newRecord = !this.buffered.id; const newRecord = !this.buffered.id;
if (!newRecord) { if (!newRecord) {
@@ -66,7 +66,7 @@ export default class adminPluginsHouseAdsShow extends Controller {
data, data,
} }
); );
this.savingStatus = i18n("saved"); this.savingStatus = I18n.t("saved");
const houseAds = this.houseAdsController.model; const houseAds = this.houseAdsController.model;
if (newRecord) { if (newRecord) {
this.buffered.id = ajaxData.house_ad.id; this.buffered.id = ajaxData.house_ad.id;
@@ -1,12 +1,12 @@
import { TrackedObject } from "@ember-compat/tracked-built-ins"; import { TrackedObject } from "@ember-compat/tracked-built-ins";
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n"; import I18n from "I18n";
export default class AdminPluginsHouseAdsShow extends DiscourseRoute { export default class AdminPluginsHouseAdsShow extends DiscourseRoute {
model(params) { model(params) {
if (params.ad_id === "new") { if (params.ad_id === "new") {
return new TrackedObject({ return new TrackedObject({
name: i18n("admin.adplugin.house_ads.new_name"), name: I18n.t("admin.adplugin.house_ads.new_name"),
html: "", html: "",
visible_to_logged_in_users: true, visible_to_logged_in_users: true,
visible_to_anons: true, visible_to_anons: true,
@@ -0,0 +1,51 @@
<section class="house-ads-settings content-body">
<div>{{i18n "admin.adplugin.house_ads.description"}}</div>
{{#if this.houseAds.length}}
<form class="form-horizontal">
{{house-ads-list-setting
name="topic_list_top"
value=this.adSettings.topic_list_top
allAds=this.houseAds
adSettings=this.adSettings
}}
{{house-ads-list-setting
name="topic_above_post_stream"
value=this.adSettings.topic_above_post_stream
allAds=this.houseAds
adSettings=this.adSettings
}}
{{house-ads-list-setting
name="topic_above_suggested"
value=this.adSettings.topic_above_suggested
allAds=this.houseAds
adSettings=this.adSettings
}}
{{house-ads-list-setting
name="post_bottom"
value=this.adSettings.post_bottom
allAds=this.houseAds
adSettings=this.adSettings
}}
{{house-ads-list-setting
name="topic_list_between"
value=this.adSettings.topic_list_between
allAds=this.houseAds
adSettings=this.adSettings
}}
<DButton
@label="admin.adplugin.house_ads.more_settings"
@icon="cog"
@action={{route-action "moreSettings"}}
class="btn-default"
/>
</form>
{{else}}
<p>
{{#link-to route="adminPlugins.houseAds.show" model="new"}}
{{i18n "admin.adplugin.house_ads.get_started"}}
{{/link-to}}
</p>
{{/if}}
</section>
@@ -0,0 +1,78 @@
<section class="edit-house-ad content-body">
<h1><TextField @value={{this.buffered.name}} class="house-ad-name" /></h1>
<div class="controls">
<AceEditor
@content={{this.buffered.html}}
@onChange={{fn (mut this.buffered.html)}}
@mode="html"
/>
</div>
<div class="controls">
<div class="visibility-settings">
<div>
<Input
@type="checkbox"
@checked={{this.buffered.visible_to_logged_in_users}}
class="visible-to-logged-in-checkbox"
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_logged_in_users"}}</span>
</div>
<div>
<Input
class="visible-to-anonymous-checkbox"
@type="checkbox"
@checked={{this.buffered.visible_to_anons}}
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_anons"}}</span>
</div>
<HouseAdsCategorySelector
@categories={{this.site.categories}}
@selectedCategories={{this.selectedCategories}}
@onChange={{this.setCategoryIds}}
@options={{hash allowAny=true}}
class="house-ads-categories"
/>
<div class="description">
{{i18n "admin.adplugin.house_ads.category_chooser_description"}}
</div>
<GroupChooser
@content={{this.site.groups}}
@onChange={{this.setGroupIds}}
@value={{this.selectedGroups}}
class="banner-groups"
/>
<div class="description">
{{i18n "admin.adplugin.house_ads.group_chooser_description"}}
</div>
</div>
<DButton
@action={{this.save}}
@disabled={{this.disabledSave}}
@label="admin.adplugin.house_ads.save"
class="btn-primary save-button"
/>
{{#if this.saving}}
{{this.savingStatus}}
{{else}}
{{#unless this.disabledSave}}
<DButton @action={{this.cancel}} @label="cancel" />
{{/unless}}
{{/if}}
<DButton
@action={{this.openPreview}}
@label="admin.adplugin.house_ads.preview"
/>
<DButton
@action={{this.destroy}}
@label="admin.adplugin.house_ads.delete"
class="btn-danger delete-button"
/>
</div>
</section>
@@ -0,0 +1,31 @@
<div class="adplugin-mgmt">
<h1>{{i18n "admin.adplugin.house_ads.title"}}</h1>
{{#if this.model.length}}
<div class="content-list">
<div class="house-ads-actions">
<LinkTo
@route="adminPlugins.houseAds.show"
@model="new"
class="btn btn-primary"
>
{{d-icon "plus"}}
<span>{{i18n "admin.adplugin.house_ads.new"}}</span>
</LinkTo>
<LinkTo @route="adminPlugins.houseAds.index" class="btn btn-default">
{{d-icon "gear"}}
<span>{{i18n "admin.adplugin.house_ads.settings"}}</span>
</LinkTo>
</div>
<ul class="house-ads-list">
{{#each this.model as |ad|}}
<li class="house-ads-list-item">
{{#link-to route="adminPlugins.houseAds.show" model=ad.id}}
{{ad.name}}
{{/link-to}}
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{outlet}}
</div>
@@ -1,7 +1,7 @@
import Component from "@ember/component"; import Component from "@ember/component";
import { alias, or } from "@ember/object/computed"; import { alias, or } from "@ember/object/computed";
import { service } from "@ember/service"; import { service } from "@ember/service";
import discourseComputed from "discourse/lib/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { import {
isNthPost, isNthPost,
isNthTopicListItem, isNthTopicListItem,
@@ -0,0 +1,13 @@
{{#each this.adComponents as |adComponent|}}
{{! Trick to force full destroy/re-render of component when route changes }}
{{#each (array this.router.currentRoute)}}
{{component
adComponent
placement=this.placement
category=this.category
postNumber=this.postNumber
indexNumber=this.indexNumber
tagName=this.childTagName
}}
{{/each}}
{{/each}}
@@ -1,26 +1,13 @@
import { array } from "@ember/helper";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { service } from "@ember/service"; import { service } from "@ember/service";
import { isBlank } from "@ember/utils"; import { isBlank } from "@ember/utils";
import { tagName } from "@ember-decorators/component"; import { tagName } from "@ember-decorators/component";
import discourseComputed from "discourse/lib/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { isNthPost, isNthTopicListItem } from "../helpers/slot-position"; import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
import AdComponent from "./ad-component"; import {
import AdbutlerAd from "./adbutler-ad"; isNthPost,
import AmazonProductLinks from "./amazon-product-links"; isNthTopicListItem,
import CarbonadsAd from "./carbonads-ad"; } from "discourse/plugins/discourse-adplugin/discourse/helpers/slot-position";
import GoogleAdsense from "./google-adsense";
import GoogleDfpAd from "./google-dfp-ad";
import HouseAd from "./house-ad";
const AD_COMPONENTS = {
"house-ad": HouseAd,
"google-adsense": GoogleAdsense,
"google-dfp-ad": GoogleDfpAd,
"amazon-product-links": AmazonProductLinks,
"carbonads-ad": CarbonadsAd,
"adbutler-ad": AdbutlerAd,
};
const adConfig = EmberObject.create({ const adConfig = EmberObject.create({
"google-adsense": { "google-adsense": {
@@ -214,7 +201,7 @@ export default class AdSlot extends AdComponent {
* Depends on `router.currentRoute` so that we refresh ads when navigating around. * Depends on `router.currentRoute` so that we refresh ads when navigating around.
*/ */
@discourseComputed("placement", "availableAdTypes", "router.currentRoute") @discourseComputed("placement", "availableAdTypes", "router.currentRoute")
adComponentNames(placement, availableAdTypes) { adComponents(placement, availableAdTypes) {
if ( if (
!availableAdTypes.includes("house-ad") || !availableAdTypes.includes("house-ad") ||
availableAdTypes.length === 1 availableAdTypes.length === 1
@@ -253,23 +240,4 @@ export default class AdSlot extends AdComponent {
return networkNames; return networkNames;
} }
get adComponents() {
return this.adComponentNames.map((name) => AD_COMPONENTS[name]);
}
<template>
{{#each this.adComponents as |Ad|}}
{{! Trick to force full destroy/re-render of component when route changes }}
{{#each (array this.router.currentRoute)}}
<Ad
@placement={{this.placement}}
@category={{this.category}}
@postNumber={{this.postNumber}}
@indexNumber={{this.indexNumber}}
@tagName={{this.childTagName}}
/>
{{/each}}
{{/each}}
</template>
} }
@@ -0,0 +1,3 @@
{{#if this.showAd}}
<div id={{this.divId}} class={{this.className}}></div>
{{/if}}
@@ -1,9 +1,9 @@
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
import RSVP from "rsvp"; import RSVP from "rsvp";
import discourseComputed from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import loadScript from "discourse/lib/load-script"; import loadScript from "discourse/lib/load-script";
import AdComponent from "./ad-component"; import { isTesting } from "discourse-common/config/environment";
import discourseComputed from "discourse-common/utils/decorators";
import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad-component";
let _loaded = false, let _loaded = false,
_promise = null, _promise = null,
@@ -150,10 +150,4 @@ export default class AdbutlerAd extends AdComponent {
} }
return this.isNthPost(parseInt(this.siteSettings.adbutler_nth_post, 10)); return this.isNthPost(parseInt(this.siteSettings.adbutler_nth_post, 10));
} }
<template>
{{#if this.showAd}}
<div id={{this.divId}} class={{this.className}}></div>
{{/if}}
</template>
} }
@@ -0,0 +1,34 @@
{{#if this.showAd}}
{{#if this.site.mobileView}}
<div
class="amazon-product-links-label"
style={{this.adTitleStyleMobile}}
><h2>{{i18n "adplugin.advertisement_label"}}</h2></div>
<iframe
style={{this.adWrapperStyleMobile}}
marginwidth="0"
marginheight="0"
scrolling="no"
frameborder="0"
src={{this.userInputMobile}}
title={{i18n "adplugin.advertisement_label"}}
>
</iframe>
{{else}}
<div class="amazon-product-links-label"><h2>{{i18n
"adplugin.advertisement_label"
}}</h2></div>
<div class="container" align="center">
<iframe
style={{this.adWrapperStyle}}
marginwidth="0"
marginheight="0"
scrolling="no"
frameborder="0"
src={{this.userInput}}
title={{i18n "adplugin.advertisement_label"}}
>
</iframe>
</div>
{{/if}}
{{/if}}

Some files were not shown because too many files have changed in this diff Show More