Skip to content

A platform for community discussion. Free, open, simple.

DEV: [gjs-codemod] convert admin files to gjs

David Taylorb29e0b6e1b60
diff --git a/app/assets/javascripts/admin/addon/components/admin-backups-logs.gjs b/app/assets/javascripts/admin/addon/components/admin-backups-logs.gjs
index bbf787f1905..be2702a68bd 100644
--- a/app/assets/javascripts/admin/addon/components/admin-backups-logs.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-backups-logs.gjs
@@ -75,13 +75,15 @@ export default class AdminBackupsLogs extends Component {
this.set("showLoadingSpinner", false);
}
}
-}
-{{#if this.hasFormattedLogs}}
- <pre>{{this.formattedLogs}}</pre>
-{{else}}
- <p>{{this.noLogsMessage}}</p>
-{{/if}}
-{{#if this.showLoadingSpinner}}
- <div class="spinner small"></div>
-{{/if}}
\ No newline at end of file
+ <template>
+ {{#if this.hasFormattedLogs}}
+ <pre>{{this.formattedLogs}}</pre>
+ {{else}}
+ <p>{{this.noLogsMessage}}</p>
+ {{/if}}
+ {{#if this.showLoadingSpinner}}
+ <div class="spinner small"></div>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-list.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-list.gjs
index ec2e2ef6833..4603ee352be 100644
--- a/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-list.gjs
@@ -1,26 +1,33 @@
-<div class="container admin-api_keys">
- {{#if @apiKeys}}
- <table class="d-admin-table admin-api_keys__items">
- <thead>
- <th>{{i18n "admin.api.key"}}</th>
- <th>{{i18n "admin.api.description"}}</th>
- <th>{{i18n "admin.api.user"}}</th>
- <th>{{i18n "admin.api.created"}}</th>
- <th>{{i18n "admin.api.scope"}}</th>
- <th>{{i18n "admin.api.last_used"}}</th>
- </thead>
- <tbody>
- {{#each @apiKeys as |apiKey|}}
- <ApiKeyItem @apiKey={{apiKey}} />
- {{/each}}
- </tbody>
- </table>
- {{else}}
- <AdminConfigAreaEmptyList
- @ctaLabel="admin.api_keys.add"
- @ctaRoute="adminApiKeys.new"
- @ctaClass="admin-api_keys__add-api_key"
- @emptyLabel="admin.api_keys.no_api_keys"
- />
- {{/if}}
-</div>
\ No newline at end of file
+import { i18n } from "discourse-i18n";
+import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
+import ApiKeyItem from "admin/components/api-key-item";
+
+const ApiKeysList = <template>
+ <div class="container admin-api_keys">
+ {{#if @apiKeys}}
+ <table class="d-admin-table admin-api_keys__items">
+ <thead>
+ <th>{{i18n "admin.api.key"}}</th>
+ <th>{{i18n "admin.api.description"}}</th>
+ <th>{{i18n "admin.api.user"}}</th>
+ <th>{{i18n "admin.api.created"}}</th>
+ <th>{{i18n "admin.api.scope"}}</th>
+ <th>{{i18n "admin.api.last_used"}}</th>
+ </thead>
+ <tbody>
+ {{#each @apiKeys as |apiKey|}}
+ <ApiKeyItem @apiKey={{apiKey}} />
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
+ <AdminConfigAreaEmptyList
+ @ctaLabel="admin.api_keys.add"
+ @ctaRoute="adminApiKeys.new"
+ @ctaClass="admin-api_keys__add-api_key"
+ @emptyLabel="admin.api_keys.no_api_keys"
+ />
+ {{/if}}
+ </div>
+</template>;
+export default ApiKeysList;
diff --git a/app/assets/javascripts/admin/addon/components/admin-editable-field.gjs b/app/assets/javascripts/admin/addon/components/admin-editable-field.gjs
index 52dda1c8bcf..19bbd79e394 100644
--- a/app/assets/javascripts/admin/addon/components/admin-editable-field.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-editable-field.gjs
@@ -1,6 +1,10 @@
import Component from "@ember/component";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
@tagName("")
export default class AdminEditableField extends Component {
@@ -19,31 +23,33 @@ export default class AdminEditableField extends Component {
// Action has to toggle 'editing' property.
this.action(this.buffer);
}
-}
-<div class="field">{{i18n this.name}}</div>
-<div class="value">
- {{#if this.editing}}
- <TextField
- @value={{this.buffer}}
- @autofocus="autofocus"
- @autocomplete="off"
- />
- {{else}}
- <a href {{on "click" this.edit}} class="inline-editable-field">
- <span>{{this.value}}</span>
- </a>
- {{/if}}
-</div>
-<div class="controls">
- {{#if this.editing}}
- <DButton
- class="btn-default"
- @action={{this.save}}
- @label="admin.user_fields.save"
- />
- <a href {{on "click" this.edit}}>{{i18n "cancel"}}</a>
- {{else}}
- <DButton class="btn-default" @action={{this.edit}} @icon="pencil" />
- {{/if}}
-</div>
\ No newline at end of file
+ <template>
+ <div class="field">{{i18n this.name}}</div>
+ <div class="value">
+ {{#if this.editing}}
+ <TextField
+ @value={{this.buffer}}
+ @autofocus="autofocus"
+ @autocomplete="off"
+ />
+ {{else}}
+ <a href {{on "click" this.edit}} class="inline-editable-field">
+ <span>{{this.value}}</span>
+ </a>
+ {{/if}}
+ </div>
+ <div class="controls">
+ {{#if this.editing}}
+ <DButton
+ class="btn-default"
+ @action={{this.save}}
+ @label="admin.user_fields.save"
+ />
+ <a href {{on "click" this.edit}}>{{i18n "cancel"}}</a>
+ {{else}}
+ <DButton class="btn-default" @action={{this.edit}} @icon="pencil" />
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-form-row.gjs b/app/assets/javascripts/admin/addon/components/admin-form-row.gjs
index ac7c480b24a..77125175df5 100644
--- a/app/assets/javascripts/admin/addon/components/admin-form-row.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-form-row.gjs
@@ -1,24 +1,29 @@
import Component from "@ember/component";
import { classNames } from "@ember-decorators/component";
+import concatClass from "discourse/helpers/concat-class";
+import { i18n } from "discourse-i18n";
+import eq from "truth-helpers/helpers/eq";
@classNames("row")
-export default class AdminFormRow extends Component {}
-
-<div class="form-element label-area">
- {{#if this.label}}
- <label
- class={{concat-class (if (eq @type "checkbox") "checkbox-label")}}
- >{{i18n this.label}}</label>
- {{else}}
- &nbsp;
- {{/if}}
-</div>
-<div class="form-element input-area">
- {{#if this.wrapLabel}}
- <label
- class={{concat-class (if (eq @type "checkbox") "checkbox-label")}}
- >{{yield}}</label>
- {{else}}
- {{yield}}
- {{/if}}
-</div>
\ No newline at end of file
+export default class AdminFormRow extends Component {
+ <template>
+ <div class="form-element label-area">
+ {{#if this.label}}
+ <label
+ class={{concatClass (if (eq @type "checkbox") "checkbox-label")}}
+ >{{i18n this.label}}</label>
+ {{else}}
+ &nbsp;
+ {{/if}}
+ </div>
+ <div class="form-element input-area">
+ {{#if this.wrapLabel}}
+ <label
+ class={{concatClass (if (eq @type "checkbox") "checkbox-label")}}
+ >{{yield}}</label>
+ {{else}}
+ {{yield}}
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-history.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-history.gjs
index e8b35cee033..7b436cb8695 100644
--- a/app/assets/javascripts/admin/addon/components/admin-penalty-history.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-history.gjs
@@ -1,6 +1,7 @@
import Component from "@ember/component";
import { classNames } from "@ember-decorators/component";
import discourseComputed from "discourse/lib/decorators";
+import { i18n } from "discourse-i18n";
@classNames("penalty-history")
export default class AdminPenaltyHistory extends Component {
@@ -19,19 +20,21 @@ export default class AdminPenaltyHistory extends Component {
}
return "";
}
-}
-<div
- class="suspended-count {{this.suspendedCountClass}}"
- title={{i18n "admin.user.last_six_months"}}
->
- <label>{{i18n "admin.user.suspended_count"}}</label>
- <span>{{this.user.penalty_counts.suspended}}</span>
-</div>
-<div
- class="silenced-count {{this.silencedCountClass}}"
- title={{i18n "admin.user.last_six_months"}}
->
- <label>{{i18n "admin.user.silenced_count"}}</label>
- <span>{{this.user.penalty_counts.silenced}}</span>
-</div>
\ No newline at end of file
+ <template>
+ <div
+ class="suspended-count {{this.suspendedCountClass}}"
+ title={{i18n "admin.user.last_six_months"}}
+ >
+ <label>{{i18n "admin.user.suspended_count"}}</label>
+ <span>{{this.user.penalty_counts.suspended}}</span>
+ </div>
+ <div
+ class="silenced-count {{this.silencedCountClass}}"
+ title={{i18n "admin.user.last_six_months"}}
+ >
+ <label>{{i18n "admin.user.silenced_count"}}</label>
+ <span>{{this.user.penalty_counts.silenced}}</span>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-post-action.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-post-action.gjs
index fd78e9a7c62..5f5d8e920f2 100644
--- a/app/assets/javascripts/admin/addon/components/admin-penalty-post-action.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-post-action.gjs
@@ -1,8 +1,10 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
import { action } from "@ember/object";
import { equal } from "@ember/object/computed";
+import htmlSafe from "discourse/helpers/html-safe";
import discourseComputed, { afterRender } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
@@ -37,23 +39,25 @@ export default class AdminPenaltyPostAction extends Component {
body.scrollTo(0, body.clientHeight);
elem.querySelector(".post-editor").focus();
}
-}
-<div class="penalty-post-controls">
- <label>
- <div class="penalty-post-label">
- {{html-safe (i18n "admin.user.penalty_post_actions")}}
+ <template>
+ <div class="penalty-post-controls">
+ <label>
+ <div class="penalty-post-label">
+ {{htmlSafe (i18n "admin.user.penalty_post_actions")}}
+ </div>
+ </label>
+ <ComboBox
+ @value={{this.postAction}}
+ @content={{this.penaltyActions}}
+ @onChange={{this.penaltyChanged}}
+ />
</div>
- </label>
- <ComboBox
- @value={{this.postAction}}
- @content={{this.penaltyActions}}
- @onChange={{this.penaltyChanged}}
- />
-</div>
-
-{{#if this.editing}}
- <div class="penalty-post-edit">
- <Textarea @value={{this.postEdit}} class="post-editor" />
- </div>
-{{/if}}
\ No newline at end of file
+
+ {{#if this.editing}}
+ <div class="penalty-post-edit">
+ <Textarea @value={{this.postEdit}} class="post-editor" />
+ </div>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs
index 16cadb34b9d..77e222c41da 100644
--- a/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs
@@ -1,9 +1,13 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
import { action } from "@ember/object";
import { equal } from "@ember/object/computed";
import { tagName } from "@ember-decorators/component";
+import TextField from "discourse/components/text-field";
+import htmlSafe from "discourse/helpers/html-safe";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import eq from "truth-helpers/helpers/eq";
const CUSTOM_REASON_KEY = "custom";
@@ -52,54 +56,56 @@ export default class AdminPenaltyReason extends Component {
);
}
}
-}
-<div class="penalty-reason-controls">
- {{#if (eq @penaltyType "suspend")}}
- <label class="suspend-reason-title">{{i18n
- "admin.user.suspend_reason_title"
- }}</label>
- <ComboBox
- @content={{this.reasons}}
- @value={{this.selectedReason}}
- @onChange={{this.setSelectedReason}}
- class="suspend-reason"
- />
+ <template>
+ <div class="penalty-reason-controls">
+ {{#if (eq @penaltyType "suspend")}}
+ <label class="suspend-reason-title">{{i18n
+ "admin.user.suspend_reason_title"
+ }}</label>
+ <ComboBox
+ @content={{this.reasons}}
+ @value={{this.selectedReason}}
+ @onChange={{this.setSelectedReason}}
+ class="suspend-reason"
+ />
- {{#if this.isCustomReason}}
- <TextField
- @value={{this.customReason}}
- @onChange={{this.setCustomReason}}
- class="suspend-reason"
- />
- {{/if}}
- {{else if (eq @penaltyType "silence")}}
- <label class="silence-reason-title">
- {{html-safe (i18n "admin.user.silence_reason_label")}}</label>
+ {{#if this.isCustomReason}}
+ <TextField
+ @value={{this.customReason}}
+ @onChange={{this.setCustomReason}}
+ class="suspend-reason"
+ />
+ {{/if}}
+ {{else if (eq @penaltyType "silence")}}
+ <label class="silence-reason-title">
+ {{htmlSafe (i18n "admin.user.silence_reason_label")}}</label>
- <ComboBox
- @content={{this.reasons}}
- @value={{this.selectedReason}}
- @onChange={{this.setSelectedReason}}
- class="silence-reason"
- />
+ <ComboBox
+ @content={{this.reasons}}
+ @value={{this.selectedReason}}
+ @onChange={{this.setSelectedReason}}
+ class="silence-reason"
+ />
- {{#if this.isCustomReason}}
- <TextField
- @value={{this.customReason}}
- @onChange={{this.setCustomReason}}
- @placeholderKey="admin.user.silence_reason_placeholder"
- class="silence-reason"
- />
- {{/if}}
- {{/if}}
-</div>
+ {{#if this.isCustomReason}}
+ <TextField
+ @value={{this.customReason}}
+ @onChange={{this.setCustomReason}}
+ @placeholderKey="admin.user.silence_reason_placeholder"
+ class="silence-reason"
+ />
+ {{/if}}
+ {{/if}}
+ </div>
-<div class="penalty-message-controls">
- <label>{{i18n "admin.user.suspend_message"}}</label>
- <Textarea
- @value={{this.message}}
- class="suspend-message"
- placeholder={{i18n "admin.user.suspend_message_placeholder"}}
- />
-</div>
\ No newline at end of file
+ <div class="penalty-message-controls">
+ <label>{{i18n "admin.user.suspend_message"}}</label>
+ <Textarea
+ @value={{this.message}}
+ class="suspend-message"
+ placeholder={{i18n "admin.user.suspend_message_placeholder"}}
+ />
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs
index 184afbcebc2..a8fc59876b0 100644
--- a/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs
@@ -1,7 +1,17 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { fn, get, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import avatar from "discourse/helpers/avatar";
+import formatDuration from "discourse/helpers/format-duration";
+import htmlSafe from "discourse/helpers/html-safe";
+import number from "discourse/helpers/number";
import { ajax } from "discourse/lib/ajax";
+import { i18n } from "discourse-i18n";
+import not from "truth-helpers/helpers/not";
export default class AdminPenaltySimilarUsers extends Component {
@tracked isLoading;
@@ -45,51 +55,53 @@ export default class AdminPenaltySimilarUsers extends Component {
this.args.onUsersChanged(this.selectedUserIds);
}
-}
-<div class="penalty-similar-users">
- <p class="alert alert-warning">
- {{html-safe
- (i18n
- "admin.user.other_matches"
- )
- }}
- </p>
+ <template>
+ <div class="penalty-similar-users">
+ <p class="alert alert-warning">
+ {{htmlSafe
+ (i18n
+ "admin.user.other_matches"
+ )
+ }}
+ </p>
- <ConditionalLoadingSpinner @condition={{this.isLoading}}>
- <table class="table">
- <thead>
- <tr>
- <th></th>
- <th>{{i18n "username"}}</th>
- <th>{{i18n "last_seen"}}</th>
- <th>{{i18n "admin.user.topics_entered"}}</th>
- <th>{{i18n "admin.user.posts_read_count"}}</th>
- <th>{{i18n "admin.user.time_read"}}</th>
- <th>{{i18n "created"}}</th>
- </tr>
- </thead>
+ <ConditionalLoadingSpinner @condition={{this.isLoading}}>
+ <table class="table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>{{i18n "username"}}</th>
+ <th>{{i18n "last_seen"}}</th>
+ <th>{{i18n "admin.user.topics_entered"}}</th>
+ <th>{{i18n "admin.user.posts_read_count"}}</th>
+ <th>{{i18n "admin.user.time_read"}}</th>
+ <th>{{i18n "created"}}</th>
+ </tr>
+ </thead>
- <tbody>
- {{#each this.similarUsers as |user|}}
- <tr>
- <td>
- <Input
- @type="checkbox"
- disabled={{not (get user this.penaltyField)}}
- {{on "click" (fn this.selectUserId user.id)}}
- />
- </td>
- <td>{{avatar user imageSize="small"}} {{user.username}}</td>
- <td>{{format-duration user.last_seen_age}}</td>
- <td>{{number user.topics_entered}}</td>
- <td>{{number user.posts_read_count}}</td>
- <td>{{format-duration user.time_read}}</td>
- <td>{{format-duration user.created_at_age}}</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- </ConditionalLoadingSpinner>
-</div>
\ No newline at end of file
+ <tbody>
+ {{#each this.similarUsers as |user|}}
+ <tr>
+ <td>
+ <Input
+ @type="checkbox"
+ disabled={{not (get user this.penaltyField)}}
+ {{on "click" (fn this.selectUserId user.id)}}
+ />
+ </td>
+ <td>{{avatar user imageSize="small"}} {{user.username}}</td>
+ <td>{{formatDuration user.last_seen_age}}</td>
+ <td>{{number user.topics_entered}}</td>
+ <td>{{number user.posts_read_count}}</td>
+ <td>{{formatDuration user.time_read}}</td>
+ <td>{{formatDuration user.created_at_age}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </ConditionalLoadingSpinner>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-counters.gjs b/app/assets/javascripts/admin/addon/components/admin-report-counters.gjs
index 7bab1ddf04b..87f6173611e 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-counters.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-counters.gjs
@@ -1,42 +1,46 @@
import Component from "@ember/component";
import { attributeBindings, classNames } from "@ember-decorators/component";
+import icon from "discourse/helpers/d-icon";
+import number from "discourse/helpers/number";
@classNames("admin-report-counters")
@attributeBindings("model.description:title")
-export default class AdminReportCounters extends Component {}
+export default class AdminReportCounters extends Component {
+ <template>
+ <div class="cell title">
+ {{#if this.model.icon}}
+ {{icon this.model.icon}}
+ {{/if}}
+ <a href={{this.model.reportUrl}}>{{this.model.title}}</a>
+ </div>
-<div class="cell title">
- {{#if this.model.icon}}
- {{d-icon this.model.icon}}
- {{/if}}
- <a href={{this.model.reportUrl}}>{{this.model.title}}</a>
-</div>
+ <div class="cell value today-count">{{number this.model.todayCount}}</div>
-<div class="cell value today-count">{{number this.model.todayCount}}</div>
+ <div
+ class="cell value yesterday-count {{this.model.yesterdayTrend}}"
+ title={{this.model.yesterdayCountTitle}}
+ >
+ {{number this.model.yesterdayCount}}
+ {{icon this.model.yesterdayTrendIcon}}
+ </div>
-<div
- class="cell value yesterday-count {{this.model.yesterdayTrend}}"
- title={{this.model.yesterdayCountTitle}}
->
- {{number this.model.yesterdayCount}}
- {{d-icon this.model.yesterdayTrendIcon}}
-</div>
+ <div
+ class="cell value sevendays-count {{this.model.sevenDaysTrend}}"
+ title={{this.model.sevenDaysCountTitle}}
+ >
+ {{number this.model.lastSevenDaysCount}}
+ {{icon this.model.sevenDaysTrendIcon}}
+ </div>
-<div
- class="cell value sevendays-count {{this.model.sevenDaysTrend}}"
- title={{this.model.sevenDaysCountTitle}}
->
- {{number this.model.lastSevenDaysCount}}
- {{d-icon this.model.sevenDaysTrendIcon}}
-</div>
+ <div
+ class="cell value thirty-days-count {{this.model.thirtyDaysTrend}}"
+ title={{this.model.thirtyDaysCountTitle}}
+ >
+ {{number this.model.lastThirtyDaysCount}}
-<div
- class="cell value thirty-days-count {{this.model.thirtyDaysTrend}}"
- title={{this.model.thirtyDaysCountTitle}}
->
- {{number this.model.lastThirtyDaysCount}}
-
- {{#if this.model.canDisplayTrendIcon}}
- {{d-icon this.model.thirtyDaysTrendIcon}}
- {{/if}}
-</div>
\ No newline at end of file
+ {{#if this.model.canDisplayTrendIcon}}
+ {{icon this.model.thirtyDaysTrendIcon}}
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-inline-table.gjs b/app/assets/javascripts/admin/addon/components/admin-report-inline-table.gjs
index 8ae2b0483c9..19ec7cb0b00 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-inline-table.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-inline-table.gjs
@@ -1,21 +1,25 @@
import Component from "@ember/component";
import { classNames } from "@ember-decorators/component";
+import icon from "discourse/helpers/d-icon";
+import number from "discourse/helpers/number";
@classNames("admin-report-inline-table")
-export default class AdminReportInlineTable extends Component {}
-
-<div class="table-container">
- {{#each this.model.data as |data|}}
- <a class="table-cell user-{{data.key}}" href={{data.url}}>
- <span class="label">
- {{#if data.icon}}
- {{d-icon data.icon}}
- {{/if}}
- {{data.x}}
- </span>
- <span class="value">
- {{number data.y}}
- </span>
- </a>
- {{/each}}
-</div>
\ No newline at end of file
+export default class AdminReportInlineTable extends Component {
+ <template>
+ <div class="table-container">
+ {{#each this.model.data as |data|}}
+ <a class="table-cell user-{{data.key}}" href={{data.url}}>
+ <span class="label">
+ {{#if data.icon}}
+ {{icon data.icon}}
+ {{/if}}
+ {{data.x}}
+ </span>
+ <span class="value">
+ {{number data.y}}
+ </span>
+ </a>
+ {{/each}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-storage-stats.gjs b/app/assets/javascripts/admin/addon/components/admin-report-storage-stats.gjs
index b5cf42615dd..cad3c69e652 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-storage-stats.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-storage-stats.gjs
@@ -1,6 +1,10 @@
import Component from "@ember/component";
import { alias } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import getUrl from "discourse/helpers/get-url";
+import htmlSafe from "discourse/helpers/html-safe";
import { setting } from "discourse/lib/computed";
import discourseComputed from "discourse/lib/decorators";
import I18n, { i18n } from "discourse-i18n";
@@ -42,59 +46,61 @@ export default class AdminReportStorageStats extends Component {
freeUploadSpace(bytes) {
return I18n.toHumanSize(bytes);
}
-}
-
-{{#if this.showBackupStats}}
- <div class="backups">
- <h3 class="storage-stats-title">
- <a href={{get-url "/admin/backups"}}>{{d-icon "box-archive"}}
- {{i18n "admin.dashboard.backups"}}</a>
- </h3>
- <p>
- {{#if this.backupStats.free_bytes}}
- {{i18n
- "admin.dashboard.space_used_and_free"
- usedSize=this.usedBackupSpace
- freeSize=this.freeBackupSpace
- }}
- {{else}}
- {{i18n "admin.dashboard.space_used" usedSize=this.usedBackupSpace}}
- {{/if}}
- <br />
- {{i18n
- "admin.dashboard.backup_count"
- count=this.backupStats.count
- location=this.backupLocationName
- }}
+ <template>
+ {{#if this.showBackupStats}}
+ <div class="backups">
+ <h3 class="storage-stats-title">
+ <a href={{getUrl "/admin/backups"}}>{{icon "box-archive"}}
+ {{i18n "admin.dashboard.backups"}}</a>
+ </h3>
+ <p>
+ {{#if this.backupStats.free_bytes}}
+ {{i18n
+ "admin.dashboard.space_used_and_free"
+ usedSize=this.usedBackupSpace
+ freeSize=this.freeBackupSpace
+ }}
+ {{else}}
+ {{i18n "admin.dashboard.space_used" usedSize=this.usedBackupSpace}}
+ {{/if}}
- {{#if this.backupStats.last_backup_taken_at}}
- <br />
- {{html-safe
- (i18n
- "admin.dashboard.lastest_backup"
- date=(format-date
- this.backupStats.last_backup_taken_at leaveAgo="true"
- )
- )
- }}
- {{/if}}
- </p>
- </div>
-{{/if}}
+ <br />
+ {{i18n
+ "admin.dashboard.backup_count"
+ count=this.backupStats.count
+ location=this.backupLocationName
+ }}
-<div class="uploads">
- <h3 class="storage-stats-title">{{d-icon "upload"}}
- {{i18n "admin.dashboard.uploads"}}</h3>
- <p>
- {{#if this.uploadStats.free_bytes}}
- {{i18n
- "admin.dashboard.space_used_and_free"
- usedSize=this.usedUploadSpace
- freeSize=this.freeUploadSpace
- }}
- {{else}}
- {{i18n "admin.dashboard.space_used" usedSize=this.usedUploadSpace}}
+ {{#if this.backupStats.last_backup_taken_at}}
+ <br />
+ {{htmlSafe
+ (i18n
+ "admin.dashboard.lastest_backup"
+ date=(formatDate
+ this.backupStats.last_backup_taken_at leaveAgo="true"
+ )
+ )
+ }}
+ {{/if}}
+ </p>
+ </div>
{{/if}}
- </p>
-</div>
\ No newline at end of file
+
+ <div class="uploads">
+ <h3 class="storage-stats-title">{{icon "upload"}}
+ {{i18n "admin.dashboard.uploads"}}</h3>
+ <p>
+ {{#if this.uploadStats.free_bytes}}
+ {{i18n
+ "admin.dashboard.space_used_and_free"
+ usedSize=this.usedUploadSpace
+ freeSize=this.freeUploadSpace
+ }}
+ {{else}}
+ {{i18n "admin.dashboard.space_used" usedSize=this.usedUploadSpace}}
+ {{/if}}
+ </p>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-table-cell.gjs b/app/assets/javascripts/admin/addon/components/admin-report-table-cell.gjs
index 87d93aae442..639f7acf34d 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-table-cell.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-table-cell.gjs
@@ -6,6 +6,7 @@ import {
classNames,
tagName,
} from "@ember-decorators/component";
+import htmlSafe from "discourse/helpers/html-safe";
import discourseComputed from "discourse/lib/decorators";
@tagName("td")
@@ -24,6 +25,6 @@ export default class AdminReportTableCell extends Component {
computedLabel(label, data, options) {
return label.compute(data, options || {});
}
-}
-{{html-safe this.formattedValue}}
\ No newline at end of file
+ <template>{{htmlSafe this.formattedValue}}</template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-table-header.gjs b/app/assets/javascripts/admin/addon/components/admin-report-table-header.gjs
index 606a0ffadc8..ab53ff2e1dc 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-table-header.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-table-header.gjs
@@ -5,6 +5,8 @@ import {
classNames,
tagName,
} from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import htmlSafe from "discourse/helpers/html-safe";
import discourseComputed from "discourse/lib/decorators";
@tagName("th")
@@ -21,18 +23,20 @@ export default class AdminReportTableHeader extends Component {
sortIcon(currentSortDirection) {
return currentSortDirection === 1 ? "caret-up" : "caret-down";
}
-}
-{{#if this.showSortingUI}}
- <DButton
- @action={{this.sortByLabel}}
- @icon={{this.sortIcon}}
- class="sort-btn"
- />
-{{/if}}
+ <template>
+ {{#if this.showSortingUI}}
+ <DButton
+ @action={{this.sortByLabel}}
+ @icon={{this.sortIcon}}
+ class="sort-btn"
+ />
+ {{/if}}
-{{#if this.label.htmlTitle}}
- <span class="title">{{html-safe this.label.htmlTitle}}</span>
-{{else}}
- <span class="title">{{this.label.title}}</span>
-{{/if}}
\ No newline at end of file
+ {{#if this.label.htmlTitle}}
+ <span class="title">{{htmlSafe this.label.htmlTitle}}</span>
+ {{else}}
+ <span class="title">{{this.label.title}}</span>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-table-row.gjs b/app/assets/javascripts/admin/addon/components/admin-report-table-row.gjs
index dbd6cf4cad5..e700ac006d5 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-table-row.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-table-row.gjs
@@ -1,16 +1,19 @@
import Component from "@ember/component";
import { classNames, tagName } from "@ember-decorators/component";
+import AdminReportTableCell from "admin/components/admin-report-table-cell";
@tagName("tr")
@classNames("admin-report-table-row")
export default class AdminReportTableRow extends Component {
options = null;
-}
-{{#each this.labels as |label|}}
- <AdminReportTableCell
- @label={{label}}
- @data={{this.data}}
- @options={{this.options}}
- />
-{{/each}}
\ No newline at end of file
+ <template>
+ {{#each this.labels as |label|}}
+ <AdminReportTableCell
+ @label={{label}}
+ @data={{this.data}}
+ @options={{this.options}}
+ />
+ {{/each}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-report-table.gjs b/app/assets/javascripts/admin/addon/components/admin-report-table.gjs
index 2d5e907a20f..3a9a89acc79 100644
--- a/app/assets/javascripts/admin/addon/components/admin-report-table.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-report-table.gjs
@@ -1,9 +1,14 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { alias } from "@ember/object/computed";
import { classNameBindings, classNames } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
import { makeArray } from "discourse/lib/helpers";
+import { i18n } from "discourse-i18n";
+import AdminReportTableHeader from "admin/components/admin-report-table-header";
+import AdminReportTableRow from "admin/components/admin-report-table-row";
const PAGES_LIMIT = 8;
@@ -183,88 +188,94 @@ export default class AdminReportTable extends Component {
this.set("sortLabel", label);
}
}
-}
-<table class="table">
- <thead>
- <tr>
- {{#if this.model.computedLabels}}
- {{#each this.model.computedLabels as |label|}}
- <AdminReportTableHeader
- @showSortingUI={{this.showSortingUI}}
- @currentSortDirection={{this.sortDirection}}
- @currentSortLabel={{this.sortLabel}}
- @label={{label}}
- @sortByLabel={{fn this.sortByLabel label}}
+ <template>
+ <table class="table">
+ <thead>
+ <tr>
+ {{#if this.model.computedLabels}}
+ {{#each this.model.computedLabels as |label|}}
+ <AdminReportTableHeader
+ @showSortingUI={{this.showSortingUI}}
+ @currentSortDirection={{this.sortDirection}}
+ @currentSortLabel={{this.sortLabel}}
+ @label={{label}}
+ @sortByLabel={{fn this.sortByLabel label}}
+ />
+ {{/each}}
+ {{else}}
+ {{#each this.model.data as |data|}}
+ <th>{{data.x}}</th>
+ {{/each}}
+ {{/if}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#each this.paginatedData as |data|}}
+ <AdminReportTableRow
+ @data={{data}}
+ @labels={{this.model.computedLabels}}
+ @options={{this.options}}
/>
{{/each}}
- {{else}}
- {{#each this.model.data as |data|}}
- <th>{{data.x}}</th>
- {{/each}}
- {{/if}}
- </tr>
- </thead>
- <tbody>
- {{#each this.paginatedData as |data|}}
- <AdminReportTableRow
- @data={{data}}
- @labels={{this.model.computedLabels}}
- @options={{this.options}}
- />
- {{/each}}
-
- {{#if this.showTotalForSample}}
- <tr class="total-row">
- <td colspan={{this.totalsForSample.length}}>
- {{i18n "admin.dashboard.reports.totals_for_sample"}}
- </td>
- </tr>
- <tr class="admin-report-table-row">
- {{#each this.totalsForSample as |total|}}
- <td class="admin-report-table-cell {{total.type}} {{total.property}}">
- {{total.formattedValue}}
- </td>
- {{/each}}
- </tr>
- {{/if}}
-
- {{#if this.showTotal}}
- <tr class="total-row">
- <td colspan="2">
- {{i18n "admin.dashboard.reports.total"}}
- </td>
- </tr>
- <tr class="admin-report-table-row">
- <td class="admin-report-table-cell date x">—</td>
- <td
- class="admin-report-table-cell number y"
- >{{this.formattedTotal}}</td>
- </tr>
- {{/if}}
-
- {{#if this.showAverage}}
- <tr class="total-row">
- <td colspan="2">
- {{i18n "admin.dashboard.reports.average_for_sample"}}
- </td>
- </tr>
- <tr class="admin-report-table-row">
- <td class="admin-report-table-cell date x">—</td>
- <td
- class="admin-report-table-cell number y"
- >{{this.averageForSample}}</td>
- </tr>
- {{/if}}
- </tbody>
-</table>
-
-<div class="pagination">
- {{#each this.pages as |pageState|}}
- <DButton
- @translatedLabel={{pageState.page}}
- @action={{fn this.changePage pageState.index}}
- class={{pageState.class}}
- />
- {{/each}}
-</div>
\ No newline at end of file
+
+ {{#if this.showTotalForSample}}
+ <tr class="total-row">
+ <td colspan={{this.totalsForSample.length}}>
+ {{i18n "admin.dashboard.reports.totals_for_sample"}}
+ </td>
+ </tr>
+ <tr class="admin-report-table-row">
+ {{#each this.totalsForSample as |total|}}
+ <td
+ class="admin-report-table-cell
+ {{total.type}}
+ {{total.property}}"
+ >
+ {{total.formattedValue}}
+ </td>
+ {{/each}}
+ </tr>
+ {{/if}}
+
+ {{#if this.showTotal}}
+ <tr class="total-row">
+ <td colspan="2">
+ {{i18n "admin.dashboard.reports.total"}}
+ </td>
+ </tr>
+ <tr class="admin-report-table-row">
+ <td class="admin-report-table-cell date x">—</td>
+ <td
+ class="admin-report-table-cell number y"
+ >{{this.formattedTotal}}</td>
+ </tr>
+ {{/if}}
+
+ {{#if this.showAverage}}
+ <tr class="total-row">
+ <td colspan="2">
+ {{i18n "admin.dashboard.reports.average_for_sample"}}
+ </td>
+ </tr>
+ <tr class="admin-report-table-row">
+ <td class="admin-report-table-cell date x">—</td>
+ <td
+ class="admin-report-table-cell number y"
+ >{{this.averageForSample}}</td>
+ </tr>
+ {{/if}}
+ </tbody>
+ </table>
+
+ <div class="pagination">
+ {{#each this.pages as |pageState|}}
+ <DButton
+ @translatedLabel={{pageState.page}}
+ @action={{fn this.changePage pageState.index}}
+ class={{pageState.class}}
+ />
+ {{/each}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs b/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs
index 99ace1f24c8..2253aaeed2a 100644
--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs
@@ -1,12 +1,20 @@
import { tracked } from "@glimmer/tracking";
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { array, concat, fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
+import { LinkTo } from "@ember/routing";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
+import AceEditor from "discourse/components/ace-editor";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
import { fmt } from "discourse/lib/computed";
import discourseComputed from "discourse/lib/decorators";
import { isDocumentRTL } from "discourse/lib/text-direction";
import { i18n } from "discourse-i18n";
+import gt from "truth-helpers/helpers/gt";
+import lte from "truth-helpers/helpers/lte";
const JS_DEFAULT_VALUE = `import { apiInitializer } from "discourse/lib/api";
@@ -154,102 +162,108 @@ export default class AdminThemeEditor extends Component {
);
}
}
-}
-{{#if (gt this.visibleTargets.length 1)}}
- <div class="edit-main-nav admin-controls">
- <nav>
- <ul class="nav nav-pills target">
- {{#each this.visibleTargets as |target|}}
+ <template>
+ {{#if (gt this.visibleTargets.length 1)}}
+ <div class="edit-main-nav admin-controls">
+ <nav>
+ <ul class="nav nav-pills target">
+ {{#each this.visibleTargets as |target|}}
+ <li>
+ <LinkTo
+ @route={{this.editRouteName}}
+ @models={{array this.theme.id target.name this.fieldName}}
+ @replace={{true}}
+ title={{this.field.title}}
+ class={{if target.edited "edited" "blank"}}
+ >
+ {{#if target.error}}{{icon "triangle-exclamation"}}{{/if}}
+ {{#if target.icon}}{{icon target.icon}}{{/if}}
+ {{i18n (concat "admin.customize.theme." target.name)}}
+ </LinkTo>
+ </li>
+ {{/each}}
+ <li class="spacer"></li>
+ <li>
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.showAdvanced}}
+ {{on "click" this.toggleShowAdvanced}}
+ />
+ {{i18n "admin.customize.theme.show_advanced"}}
+ </label>
+ </li>
+ </ul>
+ </nav>
+ </div>
+ {{/if}}
+
+ <div class="admin-controls">
+ <nav>
+ <ul class="nav nav-pills fields">
+ {{#each this.visibleFields as |field|}}
+ <li>
+ <LinkTo
+ @route={{this.editRouteName}}
+ @models={{array
+ this.theme.id
+ this.currentTargetName
+ field.name
+ }}
+ @replace={{true}}
+ title={{field.title}}
+ class={{if field.edited "edited" "blank"}}
+ >
+ {{#if field.error}}{{icon "triangle-exclamation"}}{{/if}}
+ {{#if field.icon}}{{icon field.icon}}{{/if}}
+ {{field.translatedName}}
+ </LinkTo>
+ </li>
+ {{/each}}
+
+ <li class="spacer"></li>
<li>
- <LinkTo
- @route={{this.editRouteName}}
- @models={{array this.theme.id target.name this.fieldName}}
- @replace={{true}}
- title={{this.field.title}}
- class={{if target.edited "edited" "blank"}}
- >
- {{#if target.error}}{{d-icon "triangle-exclamation"}}{{/if}}
- {{#if target.icon}}{{d-icon target.icon}}{{/if}}
- {{i18n (concat "admin.customize.theme." target.name)}}
- </LinkTo>
+ {{#if (lte this.visibleTargets.length 1)}}
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.showAdvanced}}
+ {{on "click" this.toggleShowAdvanced}}
+ />
+ {{i18n "admin.customize.theme.show_advanced"}}
+ </label>
+ {{/if}}
+ <a href {{on "click" this.toggleMaximize}} class="no-text">
+ {{icon this.maximizeIcon}}
+ </a>
</li>
- {{/each}}
- <li class="spacer"></li>
- <li>
- <label>
- <Input
- @type="checkbox"
- @checked={{this.showAdvanced}}
- {{on "click" this.toggleShowAdvanced}}
- />
- {{i18n "admin.customize.theme.show_advanced"}}
- </label>
- </li>
- </ul>
- </nav>
- </div>
-{{/if}}
-
-<div class="admin-controls">
- <nav>
- <ul class="nav nav-pills fields">
- {{#each this.visibleFields as |field|}}
- <li>
- <LinkTo
- @route={{this.editRouteName}}
- @models={{array this.theme.id this.currentTargetName field.name}}
- @replace={{true}}
- title={{field.title}}
- class={{if field.edited "edited" "blank"}}
- >
- {{#if field.error}}{{d-icon "triangle-exclamation"}}{{/if}}
- {{#if field.icon}}{{d-icon field.icon}}{{/if}}
- {{field.translatedName}}
- </LinkTo>
- </li>
- {{/each}}
-
- <li class="spacer"></li>
- <li>
- {{#if (lte this.visibleTargets.length 1)}}
- <label>
- <Input
- @type="checkbox"
- @checked={{this.showAdvanced}}
- {{on "click" this.toggleShowAdvanced}}
- />
- {{i18n "admin.customize.theme.show_advanced"}}
- </label>
- {{/if}}
- <a href {{on "click" this.toggleMaximize}} class="no-text">
- {{d-icon this.maximizeIcon}}
- </a>
- </li>
- </ul>
- </nav>
-</div>
-
-{{#if this.error}}
- <pre class="field-error">{{this.error}}</pre>
-{{/if}}
-
-{{#if this.warning}}
- <pre class="field-warning">{{html-safe this.warning}}</pre>
-{{/if}}
-
-<div class="field-info">
- {{this.currentField.title}}
-</div>
-
-<AceEditor
- @content={{this.activeSection}}
- @onChange={{fn (mut this.activeSection)}}
- @editorId={{this.editorId}}
- @mode={{this.activeSectionMode}}
- @autofocus="true"
- @placeholder={{this.placeholder}}
- @htmlPlaceholder={{true}}
- @save={{this.save}}
- @setWarning={{this.setWarning}}
-/>
\ No newline at end of file
+ </ul>
+ </nav>
+ </div>
+
+ {{#if this.error}}
+ <pre class="field-error">{{this.error}}</pre>
+ {{/if}}
+
+ {{#if this.warning}}
+ <pre class="field-warning">{{htmlSafe this.warning}}</pre>
+ {{/if}}
+
+ <div class="field-info">
+ {{this.currentField.title}}
+ </div>
+
+ <AceEditor
+ @content={{this.activeSection}}
+ @onChange={{fn (mut this.activeSection)}}
+ @editorId={{this.editorId}}
+ @mode={{this.activeSectionMode}}
+ @autofocus="true"
+ @placeholder={{this.placeholder}}
+ @htmlPlaceholder={{true}}
+ @save={{this.save}}
+ @setWarning={{this.setWarning}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/color-input.gjs b/app/assets/javascripts/admin/addon/components/color-input.gjs
index 7664279d188..df1b3d55f36 100644
--- a/app/assets/javascripts/admin/addon/components/color-input.gjs
+++ b/app/assets/javascripts/admin/addon/components/color-input.gjs
@@ -1,7 +1,9 @@
import Component from "@ember/component";
+import { on } from "@ember/modifier";
import { action, computed } from "@ember/object";
import { classNames } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
+import TextField from "discourse/components/text-field";
/**
An input field for a color.
@@ -10,6 +12,7 @@ import { observes } from "@ember-decorators/object";
@param brightnessValue is a number from 0 to 255 representing the brightness of the color. See ColorSchemeColor.
@params valid is a boolean indicating if the input field is a valid color.
**/
+
@classNames("color-picker")
export default class ColorInput extends Component {
onlyHex = true;
@@ -71,19 +74,21 @@ export default class ColorInput extends Component {
_valid(color = this.hexValue) {
return /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(color);
}
-}
-{{#if this.onlyHex}}<span class="add-on">#</span>{{/if}}<TextField
- @value={{this.hexValue}}
- @maxlength={{this.maxlength}}
- @input={{this.onHexInput}}
- class="hex-input"
- aria-labelledby={{this.ariaLabelledby}}
-/>
-<input
- class="picker"
- type="color"
- value={{this.normalizedHexValue}}
- {{on "input" this.onPickerInput}}
- aria-labelledby={{this.ariaLabelledby}}
-/>
\ No newline at end of file
+ <template>
+ {{#if this.onlyHex}}<span class="add-on">#</span>{{/if}}<TextField
+ @value={{this.hexValue}}
+ @maxlength={{this.maxlength}}
+ @input={{this.onHexInput}}
+ class="hex-input"
+ aria-labelledby={{this.ariaLabelledby}}
+ />
+ <input
+ class="picker"
+ type="color"
+ value={{this.normalizedHexValue}}
+ {{on "input" this.onPickerInput}}
+ aria-labelledby={{this.ariaLabelledby}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/color-palette-editor.gjs b/app/assets/javascripts/admin/addon/components/color-palette-editor.gjs
index 9368034e0dd..305b5d6465d 100644
--- a/app/assets/javascripts/admin/addon/components/color-palette-editor.gjs
+++ b/app/assets/javascripts/admin/addon/components/color-palette-editor.gjs
@@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
import concatClass from "discourse/helpers/concat-class";
-import dIcon from "discourse/helpers/d-icon";
+import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
export const LIGHT = "light";
@@ -33,7 +33,7 @@ const NavTab = <template>
{{on "keydown" @action}}
...attributes
>
- {{dIcon @icon}}
+ {{icon @icon}}
<span>{{@label}}</span>
</a>
</li>
@@ -133,7 +133,7 @@ const Picker = class extends Component {
{{on "input" this.onInput}}
{{on "change" this.onChange}}
/>
- {{dIcon "hashtag"}}
+ {{icon "hashtag"}}
<input
class="color-palette-editor__text-input"
type="text"
diff --git a/app/assets/javascripts/admin/addon/components/email-styles-editor.gjs b/app/assets/javascripts/admin/addon/components/email-styles-editor.gjs
index 4eb2789f20e..1a55501cb00 100644
--- a/app/assets/javascripts/admin/addon/components/email-styles-editor.gjs
+++ b/app/assets/javascripts/admin/addon/components/email-styles-editor.gjs
@@ -1,7 +1,10 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
import { action, computed } from "@ember/object";
import { reads } from "@ember/object/computed";
import { service } from "@ember/service";
+import AceEditor from "discourse/components/ace-editor";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
@@ -47,23 +50,25 @@ export default class EmailStylesEditor extends Component {
},
});
}
-}
-
-<AceEditor
- @content={{this.editorContents}}
- @onChange={{fn (mut this.editorContents)}}
- @mode={{this.currentEditorMode}}
- @editorId={{this.editorId}}
- @save={{@save}}
-/>
-<div class="admin-footer">
- <div class="buttons">
- <DButton
- @action={{this.reset}}
- @disabled={{this.resetDisabled}}
- @label="admin.customize.email_style.reset"
- class="btn-default"
+ <template>
+ <AceEditor
+ @content={{this.editorContents}}
+ @onChange={{fn (mut this.editorContents)}}
+ @mode={{this.currentEditorMode}}
+ @editorId={{this.editorId}}
+ @save={{@save}}
/>
- </div>
-</div>
\ No newline at end of file
+
+ <div class="admin-footer">
+ <div class="buttons">
+ <DButton
+ @action={{this.reset}}
+ @disabled={{this.resetDisabled}}
+ @label="admin.customize.email_style.reset"
+ class="btn-default"
+ />
+ </div>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/emoji-uploader.gjs b/app/assets/javascripts/admin/addon/components/emoji-uploader.gjs
index 7ffeba61c21..1b7c28e47b6 100644
--- a/app/assets/javascripts/admin/addon/components/emoji-uploader.gjs
+++ b/app/assets/javascripts/admin/addon/components/emoji-uploader.gjs
@@ -1,11 +1,17 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { notEmpty } from "@ember/object/computed";
import { getOwner } from "@ember/owner";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { isEmpty } from "@ember/utils";
+import DButton from "discourse/components/d-button";
+import withEventValue from "discourse/helpers/with-event-value";
import discourseComputed from "discourse/lib/decorators";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
const DEFAULT_GROUP = "default";
@@ -89,62 +95,66 @@ export default class EmojiUploader extends Component {
return "plus";
}
}
-}
-<div class="form-kit">
- <div class="form-kit__container form-kit__field form-kit__field-input-text">
- <label class="form-kit__container-title">
- {{i18n "admin.emoji.name"}}
- </label>
- <div class="form-kit__container-content --large">
- <div class="form-kit__control-input-wrapper">
- <Input
- id="emoji-name"
- class="form-kit__control-input"
- name="name"
- @value={{readonly this.name}}
- {{on "input" (with-event-value (fn (mut this.name)))}}
- />
+ <template>
+ <div class="form-kit">
+ <div
+ class="form-kit__container form-kit__field form-kit__field-input-text"
+ >
+ <label class="form-kit__container-title">
+ {{i18n "admin.emoji.name"}}
+ </label>
+ <div class="form-kit__container-content --large">
+ <div class="form-kit__control-input-wrapper">
+ <Input
+ id="emoji-name"
+ class="form-kit__control-input"
+ name="name"
+ @value={{readonly this.name}}
+ {{on "input" (withEventValue (fn (mut this.name)))}}
+ />
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div
- class="form-kit__container form-kit__field form-kit__field-input-combo-box"
- >
- <label class="form-kit__container-title">
- {{i18n "admin.emoji.group"}}
- </label>
- <div class="form-kit__container-content --large">
- <div class="form-kit__control-input-wrapper">
- <ComboBox
- @name="group"
- @id="emoji-group-selector"
- @value={{this.group}}
- @content={{this.newEmojiGroups}}
- @onChange={{action "createEmojiGroup"}}
- @valueProperty={{null}}
- @nameProperty={{null}}
- @options={{hash allowAny=true}}
- />
+ <div
+ class="form-kit__container form-kit__field form-kit__field-input-combo-box"
+ >
+ <label class="form-kit__container-title">
+ {{i18n "admin.emoji.group"}}
+ </label>
+ <div class="form-kit__container-content --large">
+ <div class="form-kit__control-input-wrapper">
+ <ComboBox
+ @name="group"
+ @id="emoji-group-selector"
+ @value={{this.group}}
+ @content={{this.newEmojiGroups}}
+ @onChange={{action "createEmojiGroup"}}
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @options={{hash allowAny=true}}
+ />
+ </div>
+ </div>
+ </div>
+ <div class="control-group">
+ <div class="input">
+ <input
+ {{didInsert this.uppyUpload.setup}}
+ class="hidden-upload-field"
+ disabled={{this.uppyUpload.uploading}}
+ type="file"
+ multiple="true"
+ accept=".png,.gif"
+ />
+ <DButton
+ @translatedLabel={{this.buttonLabel}}
+ @action={{this.chooseFiles}}
+ @disabled={{this.uppyUpload.uploading}}
+ class="btn-primary"
+ />
+ </div>
</div>
</div>
- </div>
- <div class="control-group">
- <div class="input">
- <input
- {{did-insert this.uppyUpload.setup}}
- class="hidden-upload-field"
- disabled={{this.uppyUpload.uploading}}
- type="file"
- multiple="true"
- accept=".png,.gif"
- />
- <DButton
- @translatedLabel={{this.buttonLabel}}
- @action={{this.chooseFiles}}
- @disabled={{this.uppyUpload.uploading}}
- class="btn-primary"
- />
- </div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs b/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs
index 6696a8f0c74..e12c191c394 100644
--- a/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs
@@ -1,12 +1,17 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action, set, setProperties } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { classNameBindings } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import EmojiPicker from "discourse/components/emoji-picker";
import EmojiPickerDetached from "discourse/components/emoji-picker/detached";
import discourseComputed from "discourse/lib/decorators";
import { emojiUrlFor } from "discourse/lib/text";
import { i18n } from "discourse-i18n";
+import not from "truth-helpers/helpers/not";
@classNameBindings(":value-list", ":emoji-list")
export default class EmojiValueList extends Component {
@@ -160,55 +165,57 @@ export default class EmojiValueList extends Component {
_saveValues() {
this.set("values", this.collection.mapBy("value").join("|"));
}
-}
-{{#if this.collection}}
- <ul class="values emoji-value-list">
- {{#each this.collection as |data index|}}
- <li class="value" data-index={{index}}>
- <DButton
- @action={{fn this.removeValue data}}
- @icon="xmark"
- @disabled={{not data.isEditable}}
- class="btn-default remove-value-btn btn-small"
- />
-
- <div
- class="value-input emoji-details
- {{if data.isEditable 'can-edit'}}
- {{if data.isEditing 'd-editor-textarea-wrapper'}}"
- {{on "click" (fn this.editValue index)}}
- role="button"
- >
- <img
- height="15px"
- width="15px"
- src={{data.emojiUrl}}
- class="emoji-list-emoji"
- />
- <span class="emoji-name">{{data.value}}</span>
- </div>
-
- {{#if this.showUpDownButtons}}
- <DButton
- @action={{fn this.shift -1 index}}
- @icon="arrow-up"
- class="btn-default shift-up-value-btn btn-small"
- />
- <DButton
- @action={{fn this.shift 1 index}}
- @icon="arrow-down"
- class="btn-default shift-down-value-btn btn-small"
- />
- {{/if}}
- </li>
- {{/each}}
- </ul>
-{{/if}}
-
-<div class="value">
- <EmojiPicker
- @label={{i18n "admin.site_settings.emoji_list.add_emoji_button.label"}}
- @didSelectEmoji={{this.emojiSelected}}
- />
-</div>
\ No newline at end of file
+ <template>
+ {{#if this.collection}}
+ <ul class="values emoji-value-list">
+ {{#each this.collection as |data index|}}
+ <li class="value" data-index={{index}}>
+ <DButton
+ @action={{fn this.removeValue data}}
+ @icon="xmark"
+ @disabled={{not data.isEditable}}
+ class="btn-default remove-value-btn btn-small"
+ />
+
+ <div
+ class="value-input emoji-details
+ {{if data.isEditable 'can-edit'}}
+ {{if data.isEditing 'd-editor-textarea-wrapper'}}"
+ {{on "click" (fn this.editValue index)}}
+ role="button"
+ >
+ <img
+ height="15px"
+ width="15px"
+ src={{data.emojiUrl}}
+ class="emoji-list-emoji"
+ />
+ <span class="emoji-name">{{data.value}}</span>
+ </div>
+
+ {{#if this.showUpDownButtons}}
+ <DButton
+ @action={{fn this.shift -1 index}}
+ @icon="arrow-up"
+ class="btn-default shift-up-value-btn btn-small"
+ />
+ <DButton
+ @action={{fn this.shift 1 index}}
+ @icon="arrow-down"
+ class="btn-default shift-down-value-btn btn-small"
+ />
+ {{/if}}
+ </li>
+ {{/each}}
+ </ul>
+ {{/if}}
+
+ <div class="value">
+ <EmojiPicker
+ @label={{i18n "admin.site_settings.emoji_list.add_emoji_button.label"}}
+ @didSelectEmoji={{this.emojiSelected}}
+ />
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/flag-user-lists.gjs b/app/assets/javascripts/admin/addon/components/flag-user-lists.gjs
index d6c645507a3..f23672b9bb0 100644
--- a/app/assets/javascripts/admin/addon/components/flag-user-lists.gjs
+++ b/app/assets/javascripts/admin/addon/components/flag-user-lists.gjs
@@ -1,49 +1,57 @@
import Component from "@ember/component";
import { classNames } from "@ember-decorators/component";
+import UserFlagPercentage from "discourse/components/user-flag-percentage";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import FlagUser from "admin/components/flag-user";
+import dispositionIcon from "admin/helpers/disposition-icon";
+import postActionTitle from "admin/helpers/post-action-title";
@classNames("flag-user-lists")
-export default class FlagUserLists extends Component {}
+export default class FlagUserLists extends Component {
+ <template>
+ <div class="flagged-by">
+ <div class="user-list-title">
+ {{i18n "admin.flags.flagged_by"}}
+ </div>
+ <div class="flag-users">
+ {{#each this.flaggedPost.post_actions as |postAction|}}
+ <FlagUser @user={{postAction.user}} @date={{postAction.created_at}}>
+ <div class="flagger-flag-type">
+ {{postActionTitle
+ postAction.post_action_type_id
+ postAction.name_key
+ }}
+ </div>
+ <UserFlagPercentage
+ @agreed={{postAction.user.flags_agreed}}
+ @disagreed={{postAction.user.flags_disagreed}}
+ @ignored={{postAction.user.flags_ignored}}
+ />
+ </FlagUser>
+ {{/each}}
+ </div>
+ </div>
-<div class="flagged-by">
- <div class="user-list-title">
- {{i18n "admin.flags.flagged_by"}}
- </div>
- <div class="flag-users">
- {{#each this.flaggedPost.post_actions as |postAction|}}
- <FlagUser @user={{postAction.user}} @date={{postAction.created_at}}>
- <div class="flagger-flag-type">
- {{post-action-title
- postAction.post_action_type_id
- postAction.name_key
- }}
+ {{#if this.showResolvedBy}}
+ <div class="flagged-post-resolved-by">
+ <div class="user-list-title">
+ {{i18n "admin.flags.resolved_by"}}
</div>
- <UserFlagPercentage
- @agreed={{postAction.user.flags_agreed}}
- @disagreed={{postAction.user.flags_disagreed}}
- @ignored={{postAction.user.flags_ignored}}
- />
- </FlagUser>
- {{/each}}
- </div>
-</div>
-
-{{#if this.showResolvedBy}}
- <div class="flagged-post-resolved-by">
- <div class="user-list-title">
- {{i18n "admin.flags.resolved_by"}}
- </div>
- <div class="flag-users">
- {{#each this.flaggedPost.post_actions as |postAction|}}
- <FlagUser
- @user={{postAction.disposed_by}}
- @date={{postAction.disposed_at}}
- >
- {{disposition-icon postAction.disposition}}
- {{#if postAction.staff_took_action}}
- {{d-icon "gavel" title="admin.flags.took_action"}}
- {{/if}}
- </FlagUser>
- {{/each}}
- </div>
- </div>
-{{/if}}
\ No newline at end of file
+ <div class="flag-users">
+ {{#each this.flaggedPost.post_actions as |postAction|}}
+ <FlagUser
+ @user={{postAction.disposed_by}}
+ @date={{postAction.disposed_at}}
+ >
+ {{dispositionIcon postAction.disposition}}
+ {{#if postAction.staff_took_action}}
+ {{icon "gavel" title="admin.flags.took_action"}}
+ {{/if}}
+ </FlagUser>
+ {{/each}}
+ </div>
+ </div>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/flag-user.gjs b/app/assets/javascripts/admin/addon/components/flag-user.gjs
index d86e7fb9cf2..3ddbc6e0353 100644
--- a/app/assets/javascripts/admin/addon/components/flag-user.gjs
+++ b/app/assets/javascripts/admin/addon/components/flag-user.gjs
@@ -1,30 +1,37 @@
import Component from "@ember/component";
+import { array } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import avatar from "discourse/helpers/avatar";
+import formatAge from "discourse/helpers/format-age";
+import rawDate from "discourse/helpers/raw-date";
-export default class FlagUser extends Component {}
-
-<div class="flag-user">
- <LinkTo
- @route="adminUser"
- @models={{array this.user.id this.user.username}}
- class="flag-user-avatar"
- >
- {{avatar this.user imageSize="small"}}
- </LinkTo>
- <div class="flag-user-details">
- <div class="flag-user-who">
+export default class FlagUser extends Component {
+ <template>
+ <div class="flag-user">
<LinkTo
@route="adminUser"
@models={{array this.user.id this.user.username}}
- class="flag-user-username"
+ class="flag-user-avatar"
>
- {{this.user.username}}
+ {{avatar this.user imageSize="small"}}
</LinkTo>
- <div title={{raw-date this.date}} class="flag-user-date">
- {{format-age this.date}}
+ <div class="flag-user-details">
+ <div class="flag-user-who">
+ <LinkTo
+ @route="adminUser"
+ @models={{array this.user.id this.user.username}}
+ class="flag-user-username"
+ >
+ {{this.user.username}}
+ </LinkTo>
+ <div title={{rawDate this.date}} class="flag-user-date">
+ {{formatAge this.date}}
+ </div>
+ </div>
+ <div class="flag-user-extra">
+ {{yield}}
+ </div>
</div>
</div>
- <div class="flag-user-extra">
- {{yield}}
- </div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/form-template/form.gjs b/app/assets/javascripts/admin/addon/components/form-template/form.gjs
index 7536f4ac7d4..149120c112b 100644
--- a/app/assets/javascripts/admin/addon/components/form-template/form.gjs
+++ b/app/assets/javascripts/admin/addon/components/form-template/form.gjs
@@ -1,7 +1,12 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import AceEditor from "discourse/components/ace-editor";
+import DButton from "discourse/components/d-button";
+import FormTemplateFormPreview from "discourse/components/modal/form-template-form-preview";
+import TextField from "discourse/components/text-field";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
import FormTemplateValidationOptionsModal from "admin/components/modal/form-template-validation-options";
@@ -135,86 +140,88 @@ export default class FormTemplateForm extends Component {
})
.catch(popupAjaxError);
}
-}
-<div class="form-templates__form">
- <div class="control-group">
- <label for="template-name">
- {{i18n "admin.form_templates.new_template_form.name.label"}}
- </label>
- <TextField
- @value={{this.templateName}}
- @name="template-name"
- @placeholderKey="admin.form_templates.new_template_form.name.placeholder"
- class="form-templates__form-name-input"
- />
- </div>
- <div class="control-group form-templates__editor">
- <div class="form-templates__quick-insert-field-buttons">
- <span>
- {{i18n "admin.form_templates.quick_insert_fields.add_new_field"}}
- </span>
- {{#each this.quickInsertFields as |field|}}
+ <template>
+ <div class="form-templates__form">
+ <div class="control-group">
+ <label for="template-name">
+ {{i18n "admin.form_templates.new_template_form.name.label"}}
+ </label>
+ <TextField
+ @value={{this.templateName}}
+ @name="template-name"
+ @placeholderKey="admin.form_templates.new_template_form.name.placeholder"
+ class="form-templates__form-name-input"
+ />
+ </div>
+ <div class="control-group form-templates__editor">
+ <div class="form-templates__quick-insert-field-buttons">
+ <span>
+ {{i18n "admin.form_templates.quick_insert_fields.add_new_field"}}
+ </span>
+ {{#each this.quickInsertFields as |field|}}
+ <DButton
+ @icon={{field.icon}}
+ @label="admin.form_templates.quick_insert_fields.{{field.type}}"
+ @action={{fn this.onInsertField field.type}}
+ class="btn-flat btn-icon-text quick-insert-{{field.type}}"
+ />
+ {{/each}}
+ <DButton
+ @label="admin.form_templates.validations_modal.button_title"
+ @icon="circle-check"
+ @action={{this.showValidationOptionsModal}}
+ class="btn-flat btn-icon-text form-templates__validations-modal-button"
+ />
+ </div>
<DButton
- @icon={{field.icon}}
- @label="admin.form_templates.quick_insert_fields.{{field.type}}"
- @action={{fn this.onInsertField field.type}}
- class="btn-flat btn-icon-text quick-insert-{{field.type}}"
+ @icon="eye"
+ @label="admin.form_templates.new_template_form.preview"
+ @action={{this.showPreview}}
+ @disabled={{this.disablePreviewButton}}
+ class="form-templates__preview-button"
/>
- {{/each}}
- <DButton
- @label="admin.form_templates.validations_modal.button_title"
- @icon="circle-check"
- @action={{this.showValidationOptionsModal}}
- class="btn-flat btn-icon-text form-templates__validations-modal-button"
- />
+ </div>
+
+ <div class="control-group">
+ <AceEditor
+ @content={{this.templateContent}}
+ @onChange={{fn (mut this.templateContent)}}
+ @mode="yaml"
+ />
+ </div>
+
+ <div class="footer-buttons">
+ <DButton
+ @label="admin.form_templates.new_template_form.submit"
+ @icon="check"
+ @action={{this.onSubmit}}
+ @disabled={{this.disableSubmitButton}}
+ class="btn-primary"
+ />
+
+ <DButton
+ @label="admin.form_templates.new_template_form.cancel"
+ @icon="xmark"
+ @action={{this.onCancel}}
+ />
+
+ {{#if this.isEditing}}
+ <DButton
+ @label="admin.form_templates.view_template.delete"
+ @icon="trash-can"
+ @action={{this.onDelete}}
+ class="btn-danger"
+ />
+ {{/if}}
+ </div>
</div>
- <DButton
- @icon="eye"
- @label="admin.form_templates.new_template_form.preview"
- @action={{this.showPreview}}
- @disabled={{this.disablePreviewButton}}
- class="form-templates__preview-button"
- />
- </div>
-
- <div class="control-group">
- <AceEditor
- @content={{this.templateContent}}
- @onChange={{fn (mut this.templateContent)}}
- @mode="yaml"
- />
- </div>
-
- <div class="footer-buttons">
- <DButton
- @label="admin.form_templates.new_template_form.submit"
- @icon="check"
- @action={{this.onSubmit}}
- @disabled={{this.disableSubmitButton}}
- class="btn-primary"
- />
-
- <DButton
- @label="admin.form_templates.new_template_form.cancel"
- @icon="xmark"
- @action={{this.onCancel}}
- />
-
- {{#if this.isEditing}}
- <DButton
- @label="admin.form_templates.view_template.delete"
- @icon="trash-can"
- @action={{this.onDelete}}
- class="btn-danger"
+
+ {{#if this.showFormTemplateFormPreview}}
+ <FormTemplateFormPreview
+ @closeModal={{fn (mut this.showFormTemplateFormPreview) false}}
+ @content={{this.templateContent}}
/>
{{/if}}
- </div>
-</div>
-
-{{#if this.showFormTemplateFormPreview}}
- <Modal::FormTemplateFormPreview
- @closeModal={{fn (mut this.showFormTemplateFormPreview) false}}
- @content={{this.templateContent}}
- />
-{{/if}}
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/form-template/info-header.gjs b/app/assets/javascripts/admin/addon/components/form-template/info-header.gjs
index e9821a56017..84ad66828c0 100644
--- a/app/assets/javascripts/admin/addon/components/form-template/info-header.gjs
+++ b/app/assets/javascripts/admin/addon/components/form-template/info-header.gjs
@@ -1,4 +1,9 @@
-<div class="form-templates--info">
- <h2>{{i18n "admin.form_templates.title"}}</h2>
- <p class="desc">{{i18n "admin.form_templates.help"}}</p>
-</div>
\ No newline at end of file
+import { i18n } from "discourse-i18n";
+
+const InfoHeader = <template>
+ <div class="form-templates--info">
+ <h2>{{i18n "admin.form_templates.title"}}</h2>
+ <p class="desc">{{i18n "admin.form_templates.help"}}</p>
+ </div>
+</template>;
+export default InfoHeader;
diff --git a/app/assets/javascripts/admin/addon/components/form-template/row-item.gjs b/app/assets/javascripts/admin/addon/components/form-template/row-item.gjs
index 2909a8b2f48..1547395e94e 100644
--- a/app/assets/javascripts/admin/addon/components/form-template/row-item.gjs
+++ b/app/assets/javascripts/admin/addon/components/form-template/row-item.gjs
@@ -1,6 +1,10 @@
import Component from "@glimmer/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import DButton from "discourse/components/d-button";
+import CustomizeFormTemplateView from "discourse/components/modal/customize-form-template-view";
+import categoryLink from "discourse/helpers/category-link";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
@@ -41,41 +45,43 @@ export default class FormTemplateRowItem extends Component {
},
});
}
-}
-<tr class="admin-list-item">
- <td class="col first">{{@template.name}}</td>
- <td class="col categories">
- {{#each this.activeCategories as |category|}}
- {{category-link category}}
- {{/each}}
- </td>
- <td class="col action">
- <DButton
- @title="admin.form_templates.list_table.actions.view"
- @icon="far-eye"
- @action={{fn (mut this.showViewTemplateModal) true}}
- class="btn-view-template"
- />
- <DButton
- @title="admin.form_templates.list_table.actions.edit"
- @icon="pencil"
- @action={{this.editTemplate}}
- class="btn-edit-template"
- />
- <DButton
- @title="admin.form_templates.list_table.actions.delete"
- @icon="trash-can"
- @action={{this.deleteTemplate}}
- class="btn-danger btn-delete-template"
- />
- </td>
-</tr>
+ <template>
+ <tr class="admin-list-item">
+ <td class="col first">{{@template.name}}</td>
+ <td class="col categories">
+ {{#each this.activeCategories as |category|}}
+ {{categoryLink category}}
+ {{/each}}
+ </td>
+ <td class="col action">
+ <DButton
+ @title="admin.form_templates.list_table.actions.view"
+ @icon="far-eye"
+ @action={{fn (mut this.showViewTemplateModal) true}}
+ class="btn-view-template"
+ />
+ <DButton
+ @title="admin.form_templates.list_table.actions.edit"
+ @icon="pencil"
+ @action={{this.editTemplate}}
+ class="btn-edit-template"
+ />
+ <DButton
+ @title="admin.form_templates.list_table.actions.delete"
+ @icon="trash-can"
+ @action={{this.deleteTemplate}}
+ class="btn-danger btn-delete-template"
+ />
+ </td>
+ </tr>
-{{#if this.showViewTemplateModal}}
- <Modal::CustomizeFormTemplateView
- @closeModal={{fn (mut this.showViewTemplateModal) false}}
- @model={{@template}}
- @refreshModel={{@refreshModel}}
- />
-{{/if}}
\ No newline at end of file
+ {{#if this.showViewTemplateModal}}
+ <CustomizeFormTemplateView
+ @closeModal={{fn (mut this.showViewTemplateModal) false}}
+ @model={{@template}}
+ @refreshModel={{@refreshModel}}
+ />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/images-uploader.gjs b/app/assets/javascripts/admin/addon/components/images-uploader.gjs
index f0e7558a8b6..7acaac3d9ba 100644
--- a/app/assets/javascripts/admin/addon/components/images-uploader.gjs
+++ b/app/assets/javascripts/admin/addon/components/images-uploader.gjs
@@ -1,6 +1,8 @@
import Component from "@ember/component";
import { getOwner } from "@ember/owner";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { tagName } from "@ember-decorators/component";
+import icon from "discourse/helpers/d-icon";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import { i18n } from "discourse-i18n";
@@ -24,24 +26,26 @@ export default class ImagesUploader extends Component {
get uploadButtonText() {
return this.uploadingOrProcessing ? i18n("uploading") : i18n("upload");
}
-}
-<label
- class="btn"
- disabled={{this.uploadingOrProcessing}}
- title={{i18n "admin.site_settings.uploaded_image_list.upload.title"}}
->
- {{d-icon "far-image"}}&nbsp;{{this.uploadButtonText}}
- <input
- {{did-insert this.uppyUpload.setup}}
- class="hidden-upload-field"
- disabled={{this.uppyUpload.uploading}}
- type="file"
- accept="image/*"
- multiple
- />
-</label>
-{{#if this.uploadingOrProcessing}}
- <span>{{i18n "upload_selector.uploading"}}
- {{this.uppyUpload.uploadProgress}}%</span>
-{{/if}}
\ No newline at end of file
+ <template>
+ <label
+ class="btn"
+ disabled={{this.uploadingOrProcessing}}
+ title={{i18n "admin.site_settings.uploaded_image_list.upload.title"}}
+ >
+ {{icon "far-image"}}&nbsp;{{this.uploadButtonText}}
+ <input
+ {{didInsert this.uppyUpload.setup}}
+ class="hidden-upload-field"
+ disabled={{this.uppyUpload.uploading}}
+ type="file"
+ accept="image/*"
+ multiple
+ />
+ </label>
+ {{#if this.uploadingOrProcessing}}
+ <span>{{i18n "upload_selector.uploading"}}
+ {{this.uppyUpload.uploadProgress}}%</span>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs b/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
index a39fcc83415..4e99bbd1168 100644
--- a/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
+++ b/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
@@ -1,7 +1,9 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
import { action } from "@ember/object";
import { classNames } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
+import { i18n } from "discourse-i18n";
@classNames("inline-edit")
export default class InlineEditCheckbox extends Component {
@@ -41,21 +43,27 @@ export default class InlineEditCheckbox extends Component {
cancel() {
this.set("buffer", this.checked);
}
-}
-<label class="checkbox-label">
- <Input @type="checkbox" disabled={{this.disabled}} @checked={{this.buffer}} />
- {{i18n this.labelKey}}
-</label>
-{{#if this.changed}}
- <DButton
- @action={{this.apply}}
- @icon="check"
- class="btn-primary btn-small submit-edit"
- />
- <DButton
- @action={{this.cancel}}
- @icon="xmark"
- class="btn-small cancel-edit"
- />
-{{/if}}
\ No newline at end of file
+ <template>
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ disabled={{this.disabled}}
+ @checked={{this.buffer}}
+ />
+ {{i18n this.labelKey}}
+ </label>
+ {{#if this.changed}}
+ <DButton
+ @action={{this.apply}}
+ @icon="check"
+ class="btn-primary btn-small submit-edit"
+ />
+ <DButton
+ @action={{this.cancel}}
+ @icon="xmark"
+ class="btn-small cancel-edit"
+ />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/api-key-urls.gjs b/app/assets/javascripts/admin/addon/components/modal/api-key-urls.gjs
index 0cb5b9c7b44..25bf95aa7e3 100644
--- a/app/assets/javascripts/admin/addon/components/modal/api-key-urls.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/api-key-urls.gjs
@@ -1,16 +1,22 @@
-<DModal
- @title={{i18n "admin.api.scopes.allowed_urls"}}
- @closeModal={{@closeModal}}
->
- <:body>
- <div>
- <ul>
- {{#each @model.urls as |url|}}
- <li>
- <code>{{url}}</code>
- </li>
- {{/each}}
- </ul>
- </div>
- </:body>
-</DModal>
\ No newline at end of file
+import DModal from "discourse/components/d-modal";
+import { i18n } from "discourse-i18n";
+
+const ApiKeyUrls = <template>
+ <DModal
+ @title={{i18n "admin.api.scopes.allowed_urls"}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <div>
+ <ul>
+ {{#each @model.urls as |url|}}
+ <li>
+ <code>{{url}}</code>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
+ </:body>
+ </DModal>
+</template>;
+export default ApiKeyUrls;
diff --git a/app/assets/javascripts/admin/addon/components/modal/badge-preview.gjs b/app/assets/javascripts/admin/addon/components/modal/badge-preview.gjs
index 939d0f40608..21ff268e687 100644
--- a/app/assets/javascripts/admin/addon/components/modal/badge-preview.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/badge-preview.gjs
@@ -1,4 +1,7 @@
import Component from "@glimmer/component";
+import DModal from "discourse/components/d-modal";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
import { escapeExpression } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
@@ -50,60 +53,63 @@ export default class BadgePreview extends Component {
output += "</pre>";
return output;
}
-}
-
-<DModal
- @closeModal={{@closeModal}}
- @title={{i18n "admin.badges.preview.modal_title"}}
- class="badge-query-preview"
->
- <:body>
- {{#if @model.badge.errors}}
- <p class="error-header">
- {{i18n "admin.badges.preview.sql_error_header"}}
- </p>
- <pre class="badge-errors">{{@model.badge.errors}}</pre>
- {{else}}
- <p class="grant-count">
- {{#if @model.badge.grant_count}}
- {{html-safe
- (i18n
- "admin.badges.preview.grant_count" [email protected]_count
- )
- }}
- {{else}}
- {{html-safe (i18n "admin.badges.preview.no_grant_count")}}
- {{/if}}
- </p>
- {{#if this.countWarning}}
- <div class="count-warning">
- <p class="heading">
- {{d-icon "triangle-exclamation"}}
- {{i18n "admin.badges.preview.bad_count_warning.header"}}
+ <template>
+ <DModal
+ @closeModal={{@closeModal}}
+ @title={{i18n "admin.badges.preview.modal_title"}}
+ class="badge-query-preview"
+ >
+ <:body>
+ {{#if @model.badge.errors}}
+ <p class="error-header">
+ {{i18n "admin.badges.preview.sql_error_header"}}
</p>
- <p class="body">
- {{i18n "admin.badges.preview.bad_count_warning.text"}}
+ <pre class="badge-errors">{{@model.badge.errors}}</pre>
+ {{else}}
+ <p class="grant-count">
+ {{#if @model.badge.grant_count}}
+ {{htmlSafe
+ (i18n
+ "admin.badges.preview.grant_count"
+ )
+ }}
+ {{else}}
+ {{htmlSafe (i18n "admin.badges.preview.no_grant_count")}}
+ {{/if}}
</p>
- </div>
- {{/if}}
- {{#if @model.badge.sample}}
- <p class="sample">
- {{i18n "admin.badges.preview.sample"}}
- </p>
- <ul>
- {{#each this.processedSample as |html|}}
- <li>{{html-safe html}}</li>
- {{/each}}
- </ul>
- {{/if}}
+ {{#if this.countWarning}}
+ <div class="count-warning">
+ <p class="heading">
+ {{icon "triangle-exclamation"}}
+ {{i18n "admin.badges.preview.bad_count_warning.header"}}
+ </p>
+ <p class="body">
+ {{i18n "admin.badges.preview.bad_count_warning.text"}}
+ </p>
+ </div>
+ {{/if}}
+
+ {{#if @model.badge.sample}}
+ <p class="sample">
+ {{i18n "admin.badges.preview.sample"}}
+ </p>
+ <ul>
+ {{#each this.processedSample as |html|}}
+ <li>{{htmlSafe html}}</li>
+ {{/each}}
+ </ul>
+ {{/if}}
- {{#if this.hasQueryPlan}}
- <div class="badge-query-plan">
- {{html-safe this.queryPlanHtml}}
- </div>
- {{/if}}
- {{/if}}
- </:body>
-</DModal>
\ No newline at end of file
+ {{#if this.hasQueryPlan}}
+ <div class="badge-query-plan">
+ {{htmlSafe this.queryPlanHtml}}
+ </div>
+ {{/if}}
+ {{/if}}
+ </:body>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/color-scheme-select-base.gjs b/app/assets/javascripts/admin/addon/components/modal/color-scheme-select-base.gjs
index 753ba4630c8..d17934e0fe6 100644
--- a/app/assets/javascripts/admin/addon/components/modal/color-scheme-select-base.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/color-scheme-select-base.gjs
@@ -1,6 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
export default class ColorSchemeSelectBase extends Component {
@tracked
@@ -11,27 +16,29 @@ export default class ColorSchemeSelectBase extends Component {
this.args.model.newColorSchemeWithBase(this.selectedBaseThemeId);
this.args.closeModal();
}
-}
-<DModal
- @title={{i18n "admin.customize.colors.select_base.title"}}
- @closeModal={{@closeModal}}
->
- <:body>
- {{i18n "admin.customize.colors.select_base.description"}}
- <ComboBox
- @content={{@model.baseColorSchemes}}
- @value={{this.selectedBaseThemeId}}
- @onChange={{fn (mut this.selectedBaseThemeId)}}
- @valueProperty="base_scheme_id"
- />
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @action={{this.selectBase}}
- @icon="plus"
- @label="admin.customize.new"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.customize.colors.select_base.title"}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ {{i18n "admin.customize.colors.select_base.description"}}
+ <ComboBox
+ @content={{@model.baseColorSchemes}}
+ @value={{this.selectedBaseThemeId}}
+ @onChange={{fn (mut this.selectedBaseThemeId)}}
+ @valueProperty="base_scheme_id"
+ />
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @action={{this.selectBase}}
+ @icon="plus"
+ @label="admin.customize.new"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/custom-date-range.gjs b/app/assets/javascripts/admin/addon/components/modal/custom-date-range.gjs
index 281018e97cb..01b27572e99 100644
--- a/app/assets/javascripts/admin/addon/components/modal/custom-date-range.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/custom-date-range.gjs
@@ -1,6 +1,10 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import DateTimeInputRange from "discourse/components/date-time-input-range";
+import { i18n } from "discourse-i18n";
export default class CustomDateRange extends Component {
@tracked startDate = this.args.model.startDate;
@@ -17,27 +21,29 @@ export default class CustomDateRange extends Component {
this.args.model.setCustomDateRange(this.startDate, this.endDate);
this.args.closeModal();
}
-}
-<DModal
- class="custom-date-range-modal"
- @title={{i18n "admin.dashboard.reports.dates"}}
- @closeModal={{@closeModal}}
->
- <:body>
- <DateTimeInputRange
- @from={{this.startDate}}
- @to={{this.endDate}}
- @onChange={{this.onChangeDateRange}}
- @showFromTime={{false}}
- @showToTime={{false}}
- />
- </:body>
- <:footer>
- <DButton
- @action={{this.updateDateRange}}
- @label="admin.dashboard.reports.refresh_report"
- @icon="arrows-rotate"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ class="custom-date-range-modal"
+ @title={{i18n "admin.dashboard.reports.dates"}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <DateTimeInputRange
+ @from={{this.startDate}}
+ @to={{this.endDate}}
+ @onChange={{this.onChangeDateRange}}
+ @showFromTime={{false}}
+ @showToTime={{false}}
+ />
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.updateDateRange}}
+ @label="admin.dashboard.reports.refresh_report"
+ @icon="arrows-rotate"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/delete-posts-confirmation.gjs b/app/assets/javascripts/admin/addon/components/modal/delete-posts-confirmation.gjs
index 8d17d8f2e89..267acc4d55c 100644
--- a/app/assets/javascripts/admin/addon/components/modal/delete-posts-confirmation.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/delete-posts-confirmation.gjs
@@ -1,5 +1,9 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
import { i18n } from "discourse-i18n";
export default class DeletePostsConfirmation extends Component {
@@ -15,41 +19,44 @@ export default class DeletePostsConfirmation extends Component {
get deleteDisabled() {
return !this.value || this.text !== this.value;
}
-}
-<DModal
- @title={{html-safe
- (i18n
- "admin.user.delete_posts.confirmation.title" [email protected]
- )
- }}
- @closeModal={{@closeModal}}
->
- <:body>
- <p>{{html-safe
+ <template>
+ <DModal
+ @title={{htmlSafe
(i18n
- "admin.user.delete_posts.confirmation.description"
+ "admin.user.delete_posts.confirmation.title"
- text=this.text
)
- }}</p>
- <Input @type="text" @value={{this.value}} />
- </:body>
- <:footer>
- <DButton
- class="btn-danger"
- @action={{@model.deleteAllPosts}}
- @icon="trash-can"
- @disabled={{this.deleteDisabled}}
- @translatedLabel={{i18n
- "admin.user.delete_posts.confirmation.delete"
}}
- />
- <DButton
- @action={{@closeModal}}
- @label="admin.user.delete_posts.confirmation.cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <p>{{htmlSafe
+ (i18n
+ "admin.user.delete_posts.confirmation.description"
+ text=this.text
+ )
+ }}</p>
+ <Input @type="text" @value={{this.value}} />
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-danger"
+ @action={{@model.deleteAllPosts}}
+ @icon="trash-can"
+ @disabled={{this.deleteDisabled}}
+ @translatedLabel={{i18n
+ "admin.user.delete_posts.confirmation.delete"
+ }}
+ />
+ <DButton
+ @action={{@closeModal}}
+ @label="admin.user.delete_posts.confirmation.cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/delete-user-posts-progress.gjs b/app/assets/javascripts/admin/addon/components/modal/delete-user-posts-progress.gjs
index 7ba7b64ecdc..2bf5de7e78d 100644
--- a/app/assets/javascripts/admin/addon/components/modal/delete-user-posts-progress.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/delete-user-posts-progress.gjs
@@ -1,6 +1,9 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { concat } from "@ember/helper";
import { action } from "@ember/object";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
import { extractError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
@@ -39,19 +42,23 @@ export default class DeleteUserPostsProgress extends Component {
this.flash = extractError(e, i18n("admin.user.delete_posts_failed"));
}
}
-}
-<DModal
- @title={{i18n "admin.user.delete_posts.progress.title"}}
- @closeModal={{@closeModal}}
- class="admin-delete-user-posts-progress-modal"
- @flash={{this.flash}}
- @dismissable={{false}}
->
- <:body>
- <p>{{i18n "admin.user.delete_posts.progress.description"}}</p>
- <div class="progress-bar">
- <span style={{html-safe (concat "width: " this.deletedPercentage "%")}} />
- </div>
- </:body>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.user.delete_posts.progress.title"}}
+ @closeModal={{@closeModal}}
+ class="admin-delete-user-posts-progress-modal"
+ @flash={{this.flash}}
+ @dismissable={{false}}
+ >
+ <:body>
+ <p>{{i18n "admin.user.delete_posts.progress.description"}}</p>
+ <div class="progress-bar">
+ <span
+ style={{htmlSafe (concat "width: " this.deletedPercentage "%")}}
+ />
+ </div>
+ </:body>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/edit-badge-groupings.gjs b/app/assets/javascripts/admin/addon/components/modal/edit-badge-groupings.gjs
index f10254eb5ea..c6ad3deb9a3 100644
--- a/app/assets/javascripts/admin/addon/components/modal/edit-badge-groupings.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/edit-badge-groupings.gjs
@@ -1,9 +1,13 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { A } from "@ember/array";
+import { Input } from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
import { ajax } from "discourse/lib/ajax";
import { i18n } from "discourse-i18n";
@@ -81,64 +85,72 @@ export default class EditBadgeGroupings extends Component {
this.workingCopy.removeAt(index);
this.workingCopy.insertAt(index + delta, item);
}
-}
-<DModal
- @title={{i18n "admin.badges.badge_groupings.modal_title"}}
- @bodyClass="badge-groupings-modal"
- @closeModal={{@closeModal}}
->
- <:body>
- <div class="badge-groupings">
- <ul class="badge-groupings-list">
- {{#each this.workingCopy as |wc|}}
- <li class="badge-grouping-item">
- <div class="badge-grouping">
- {{#if wc.editing}}
- <Input @value={{wc.name}} class="badge-grouping-name-input" />
- {{else}}
- <span>{{wc.displayName}}</span>
- {{/if}}
- </div>
- <div class="actions">
- {{#if wc.editing}}
- <DButton @action={{fn (mut wc.editing) false}} @icon="check" />
- {{else}}
- <DButton
- @action={{fn (mut wc.editing) true}}
- @disabled={{wc.system}}
- @icon="pencil"
- />
- {{/if}}
- <DButton @action={{fn this.up wc}} @icon="chevron-up" />
- <DButton @action={{fn this.down wc}} @icon="chevron-down" />
- <DButton
- @action={{fn this.delete wc}}
- @disabled={{wc.system}}
- @icon="xmark"
- />
- </div>
- </li>
- {{/each}}
- </ul>
- </div>
- <DButton
- @action={{this.add}}
- class="badge-groupings__add-grouping"
- @label="admin.badges.new"
- />
- </:body>
- <:footer>
- <DButton
- @action={{this.saveAll}}
- @label="admin.badges.save"
- class="btn-primary badge-groupings__save"
- @disabled={{this.submitDisabled}}
- />
- <DButton
- class="btn-flat d-modal-cancel"
- @action={{@closeModal}}
- @label="cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.badges.badge_groupings.modal_title"}}
+ @bodyClass="badge-groupings-modal"
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <div class="badge-groupings">
+ <ul class="badge-groupings-list">
+ {{#each this.workingCopy as |wc|}}
+ <li class="badge-grouping-item">
+ <div class="badge-grouping">
+ {{#if wc.editing}}
+ <Input
+ @value={{wc.name}}
+ class="badge-grouping-name-input"
+ />
+ {{else}}
+ <span>{{wc.displayName}}</span>
+ {{/if}}
+ </div>
+ <div class="actions">
+ {{#if wc.editing}}
+ <DButton
+ @action={{fn (mut wc.editing) false}}
+ @icon="check"
+ />
+ {{else}}
+ <DButton
+ @action={{fn (mut wc.editing) true}}
+ @disabled={{wc.system}}
+ @icon="pencil"
+ />
+ {{/if}}
+ <DButton @action={{fn this.up wc}} @icon="chevron-up" />
+ <DButton @action={{fn this.down wc}} @icon="chevron-down" />
+ <DButton
+ @action={{fn this.delete wc}}
+ @disabled={{wc.system}}
+ @icon="xmark"
+ />
+ </div>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
+ <DButton
+ @action={{this.add}}
+ class="badge-groupings__add-grouping"
+ @label="admin.badges.new"
+ />
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.saveAll}}
+ @label="admin.badges.save"
+ class="btn-primary badge-groupings__save"
+ @disabled={{this.submitDisabled}}
+ />
+ <DButton
+ class="btn-flat d-modal-cancel"
+ @action={{@closeModal}}
+ @label="cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/form-template-validation-options.gjs b/app/assets/javascripts/admin/addon/components/modal/form-template-validation-options.gjs
index 650d11fbad7..d5ddffa514f 100644
--- a/app/assets/javascripts/admin/addon/components/modal/form-template-validation-options.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/form-template-validation-options.gjs
@@ -1,4 +1,5 @@
import Component from "@glimmer/component";
+import DModal from "discourse/components/d-modal";
import { i18n } from "discourse-i18n";
const TABLE_HEADER_KEYS = ["key", "type", "description"];
@@ -29,31 +30,33 @@ export default class FormTemplateValidationOptions extends Component {
return translatedValidations;
}
-}
-<DModal
- class="form-templates__validation-options admin-form-template-validation-options-modal"
- @title={{i18n "admin.form_templates.validations_modal.modal_title"}}
- @closeModal={{@closeModal}}
->
- <:body>
- <table>
- <thead>
- <tr>
- {{#each this.tableHeaders as |header|}}
- <th>{{header}}</th>
- {{/each}}
- </tr>
- </thead>
- <tbody>
- {{#each this.validations as |item|}}
- <tr>
- <td><pre>{{item.key}}</pre></td>
- <td>{{item.type}}</td>
- <td>{{item.description}}</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- </:body>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ class="form-templates__validation-options admin-form-template-validation-options-modal"
+ @title={{i18n "admin.form_templates.validations_modal.modal_title"}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <table>
+ <thead>
+ <tr>
+ {{#each this.tableHeaders as |header|}}
+ <th>{{header}}</th>
+ {{/each}}
+ </tr>
+ </thead>
+ <tbody>
+ {{#each this.validations as |item|}}
+ <tr>
+ <td><pre>{{item.key}}</pre></td>
+ <td>{{item.type}}</td>
+ <td>{{item.description}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </:body>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/incoming-email.gjs b/app/assets/javascripts/admin/addon/components/modal/incoming-email.gjs
index e1beb0f6664..25462a4df36 100644
--- a/app/assets/javascripts/admin/addon/components/modal/incoming-email.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/incoming-email.gjs
@@ -1,54 +1,61 @@
-<DModal
- class="admin-incoming-email-modal"
- @title={{i18n "admin.email.incoming_emails.modal.title"}}
- @closeModal={{@closeModal}}
- @bodyClass="incoming-emails"
->
- <:body>
- <div class="control-group">
- <label>{{i18n "admin.email.incoming_emails.modal.error"}}</label>
- <div class="controls">
- <p>{{@model.error}}</p>
- {{#if @model.error_description}}
- <p class="error-description">{{@model.error_description}}</p>
- {{/if}}
- </div>
- </div>
-
- <hr />
+import { Textarea } from "@ember/component";
+import DModal from "discourse/components/d-modal";
+import { i18n } from "discourse-i18n";
- <div class="control-group">
- <label>{{i18n "admin.email.incoming_emails.modal.headers"}}</label>
- <div class="controls">
- <Textarea @value={{@model.headers}} wrap="off" />
+const IncomingEmail = <template>
+ <DModal
+ class="admin-incoming-email-modal"
+ @title={{i18n "admin.email.incoming_emails.modal.title"}}
+ @closeModal={{@closeModal}}
+ @bodyClass="incoming-emails"
+ >
+ <:body>
+ <div class="control-group">
+ <label>{{i18n "admin.email.incoming_emails.modal.error"}}</label>
+ <div class="controls">
+ <p>{{@model.error}}</p>
+ {{#if @model.error_description}}
+ <p class="error-description">{{@model.error_description}}</p>
+ {{/if}}
+ </div>
</div>
- </div>
- <div class="control-group">
- <label>{{i18n "admin.email.incoming_emails.modal.subject"}}</label>
- <div class="controls">
- {{@model.subject}}
- </div>
- </div>
+ <hr />
- <div class="control-group">
- <label>{{i18n "admin.email.incoming_emails.modal.body"}}</label>
- <div class="controls">
- <Textarea @value={{@model.body}} />
+ <div class="control-group">
+ <label>{{i18n "admin.email.incoming_emails.modal.headers"}}</label>
+ <div class="controls">
+ <Textarea @value={{@model.headers}} wrap="off" />
+ </div>
</div>
- </div>
- {{#if @model.rejection_message}}
- <hr />
+ <div class="control-group">
+ <label>{{i18n "admin.email.incoming_emails.modal.subject"}}</label>
+ <div class="controls">
+ {{@model.subject}}
+ </div>
+ </div>
<div class="control-group">
- <label>{{i18n
- "admin.email.incoming_emails.modal.rejection_message"
- }}</label>
+ <label>{{i18n "admin.email.incoming_emails.modal.body"}}</label>
<div class="controls">
- <Textarea @value={{@model.rejection_message}} />
+ <Textarea @value={{@model.body}} />
</div>
</div>
- {{/if}}
- </:body>
-</DModal>
\ No newline at end of file
+
+ {{#if @model.rejection_message}}
+ <hr />
+
+ <div class="control-group">
+ <label>{{i18n
+ "admin.email.incoming_emails.modal.rejection_message"
+ }}</label>
+ <div class="controls">
+ <Textarea @value={{@model.rejection_message}} />
+ </div>
+ </div>
+ {{/if}}
+ </:body>
+ </DModal>
+</template>;
+export default IncomingEmail;
diff --git a/app/assets/javascripts/admin/addon/components/modal/merge-users-confirmation.gjs b/app/assets/javascripts/admin/addon/components/modal/merge-users-confirmation.gjs
index ff8a7814843..c13d2e17509 100644
--- a/app/assets/javascripts/admin/addon/components/modal/merge-users-confirmation.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/merge-users-confirmation.gjs
@@ -1,5 +1,10 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { fn } from "@ember/helper";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
import { i18n } from "discourse-i18n";
export default class MergeUsersConfirmation extends Component {
@@ -15,41 +20,43 @@ export default class MergeUsersConfirmation extends Component {
targetUsername: this.args.model.targetUsername,
});
}
-}
-<DModal
- @title={{html-safe
- (i18n "admin.user.merge.confirmation.title" [email protected])
- }}
- @closeModal={{@closeModal}}
->
- <:body>
- <p>
- {{html-safe
- (i18n
- "admin.user.merge.confirmation.description"
- text=this.text
- )
- }}
- </p>
- <Input @type="text" @value={{this.value}} />
- </:body>
- <:footer>
- <DButton
- class="btn-danger"
- @action={{fn @model.merge @model.targetUsername}}
- @icon="trash-can"
- @disabled={{this.mergeDisabled}}
- @translatedLabel={{i18n
- "admin.user.merge.confirmation.transfer_and_delete"
+ <template>
+ <DModal
+ @title={{htmlSafe
+ (i18n "admin.user.merge.confirmation.title" [email protected])
}}
- />
- <DButton
- @action={{@closeModal}}
- @label="admin.user.merge.confirmation.cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <p>
+ {{htmlSafe
+ (i18n
+ "admin.user.merge.confirmation.description"
+ text=this.text
+ )
+ }}
+ </p>
+ <Input @type="text" @value={{this.value}} />
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-danger"
+ @action={{fn @model.merge @model.targetUsername}}
+ @icon="trash-can"
+ @disabled={{this.mergeDisabled}}
+ @translatedLabel={{i18n
+ "admin.user.merge.confirmation.transfer_and_delete"
+ }}
+ />
+ <DButton
+ @action={{@closeModal}}
+ @label="admin.user.merge.confirmation.cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/merge-users-progress.gjs b/app/assets/javascripts/admin/addon/components/modal/merge-users-progress.gjs
index dc9c2244f98..121efe11a6e 100644
--- a/app/assets/javascripts/admin/addon/components/modal/merge-users-progress.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/merge-users-progress.gjs
@@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { service } from "@ember/service";
+import DModal from "discourse/components/d-modal";
import { bind } from "discourse/lib/decorators";
import DiscourseURL from "discourse/lib/url";
import { i18n } from "discourse-i18n";
@@ -36,14 +37,16 @@ export default class MergeUsersProgress extends Component {
this.message = i18n("admin.user.merge_failed");
}
}
-}
-<DModal
- @title={{i18n "admin.user.merge.progress.title"}}
- @dismissable={{false}}
- @closeModal={{@closeModal}}
->
- <:body>
- {{this.message}}
- </:body>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.user.merge.progress.title"}}
+ @dismissable={{false}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ {{this.message}}
+ </:body>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/merge-users-prompt.gjs b/app/assets/javascripts/admin/addon/components/modal/merge-users-prompt.gjs
index 33bd814df35..8eab12d66d1 100644
--- a/app/assets/javascripts/admin/addon/components/modal/merge-users-prompt.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/merge-users-prompt.gjs
@@ -1,5 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, get, hash } from "@ember/helper";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default class MergeUsersPrompt extends Component {
@tracked targetUsername;
@@ -10,41 +16,50 @@ export default class MergeUsersPrompt extends Component {
this.args.model.user.username === this.targetUsername[0]
);
}
-}
-<DModal
- @title={{html-safe
- (i18n "admin.user.merge.prompt.title" [email protected])
- }}
- @closeModal={{@closeModal}}
->
- <:body>
- <p>
- {{html-safe
- (i18n
- "admin.user.merge.prompt.description" [email protected]
- )
- }}
- </p>
- <EmailGroupUserChooser
- @value={{this.targetUsername}}
- @options={{hash
- maximum=1
- filterPlaceholder="admin.user.merge.prompt.target_username_placeholder"
+ <template>
+ <DModal
+ @title={{htmlSafe
+ (i18n "admin.user.merge.prompt.title" [email protected])
}}
- />
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @action={{fn @model.showMergeConfirmation (get this.targetUsername "0")}}
- @icon="trash-can"
- @disabled={{this.mergeDisabled}}
- @translatedLabel={{i18n
- "admin.user.merge.confirmation.transfer_and_delete"
- }}
- />
- <DButton @action={{@closeModal}} @label="admin.user.merge.prompt.cancel" />
- </:footer>
-</DModal>
\ No newline at end of file
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <p>
+ {{htmlSafe
+ (i18n
+ "admin.user.merge.prompt.description"
+ )
+ }}
+ </p>
+ <EmailGroupUserChooser
+ @value={{this.targetUsername}}
+ @options={{hash
+ maximum=1
+ filterPlaceholder="admin.user.merge.prompt.target_username_placeholder"
+ }}
+ />
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @action={{fn
+ @model.showMergeConfirmation
+ (get this.targetUsername "0")
+ }}
+ @icon="trash-can"
+ @disabled={{this.mergeDisabled}}
+ @translatedLabel={{i18n
+ "admin.user.merge.confirmation.transfer_and_delete"
+ }}
+ />
+ <DButton
+ @action={{@closeModal}}
+ @label="admin.user.merge.prompt.cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs b/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs
index eeb7a220fc4..d825d366c37 100644
--- a/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs
@@ -1,10 +1,19 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import FutureDateInput from "discourse/components/future-date-input";
+import htmlSafe from "discourse/helpers/html-safe";
import { extractError } from "discourse/lib/ajax-error";
import I18n, { i18n } from "discourse-i18n";
+import AdminPenaltyPostAction from "admin/components/admin-penalty-post-action";
+import AdminPenaltyReason from "admin/components/admin-penalty-reason";
+import AdminPenaltySimilarUsers from "admin/components/admin-penalty-similar-users";
+import eq from "truth-helpers/helpers/eq";
export default class PenalizeUser extends Component {
@service dialog;
@@ -127,85 +136,87 @@ export default class PenalizeUser extends Component {
similarUsersChanged(userIds) {
this.otherUserIds = userIds;
}
-}
-<DModal
- class="{{@model.penaltyType}}-user-modal"
- @title={{i18n this.modalTitle}}
- @closeModal={{this.warnBeforeClosing}}
- @flash={{this.flash}}
->
- <:body>
- {{#if this.canPenalize}}
- <div class="penalty-duration-controls">
- {{#if (eq @model.penaltyType "suspend")}}
- <FutureDateInput
- @label="admin.user.suspend_duration"
- @clearable={{false}}
- @input={{this.penalizeUntil}}
- @onChangeInput={{fn (mut this.penalizeUntil)}}
- class="suspend-until"
- />
- {{else if (eq @model.penaltyType "silence")}}
- <FutureDateInput
- @label="admin.user.silence_duration"
- @clearable={{false}}
- @input={{this.penalizeUntil}}
- @onChangeInput={{fn (mut this.penalizeUntil)}}
- class="silence-until"
+ <template>
+ <DModal
+ class="{{@model.penaltyType}}-user-modal"
+ @title={{i18n this.modalTitle}}
+ @closeModal={{this.warnBeforeClosing}}
+ @flash={{this.flash}}
+ >
+ <:body>
+ {{#if this.canPenalize}}
+ <div class="penalty-duration-controls">
+ {{#if (eq @model.penaltyType "suspend")}}
+ <FutureDateInput
+ @label="admin.user.suspend_duration"
+ @clearable={{false}}
+ @input={{this.penalizeUntil}}
+ @onChangeInput={{fn (mut this.penalizeUntil)}}
+ class="suspend-until"
+ />
+ {{else if (eq @model.penaltyType "silence")}}
+ <FutureDateInput
+ @label="admin.user.silence_duration"
+ @clearable={{false}}
+ @input={{this.penalizeUntil}}
+ @onChangeInput={{fn (mut this.penalizeUntil)}}
+ class="silence-until"
+ />
+ {{/if}}
+ </div>
+ {{#if (eq @model.penaltyType "suspend")}}
+ <div class="penalty-reason-visibility">
+ {{#if this.siteSettings.hide_suspension_reasons}}
+ {{htmlSafe (i18n "admin.user.suspend_reason_hidden_label")}}
+ {{else}}
+ {{htmlSafe (i18n "admin.user.suspend_reason_label")}}
+ {{/if}}
+ </div>
+ {{/if}}
+ <AdminPenaltyReason
+ @penaltyType={{@model.penaltyType}}
+ @reason={{this.reason}}
+ @message={{this.message}}
/>
- {{/if}}
- </div>
- {{#if (eq @model.penaltyType "suspend")}}
- <div class="penalty-reason-visibility">
- {{#if this.siteSettings.hide_suspension_reasons}}
- {{html-safe (i18n "admin.user.suspend_reason_hidden_label")}}
- {{else}}
- {{html-safe (i18n "admin.user.suspend_reason_label")}}
+ {{#if @model.postId}}
+ <AdminPenaltyPostAction
+ @postId={{@model.postId}}
+ @postAction={{this.postAction}}
+ @postEdit={{this.postEdit}}
+ />
{{/if}}
- </div>
- {{/if}}
- <AdminPenaltyReason
- @penaltyType={{@model.penaltyType}}
- @reason={{this.reason}}
- @message={{this.message}}
- />
- {{#if @model.postId}}
- <AdminPenaltyPostAction
- @postId={{@model.postId}}
- @postAction={{this.postAction}}
- @postEdit={{this.postEdit}}
+ {{#if @model.user.similar_users_count}}
+ <AdminPenaltySimilarUsers
+ @penaltyType={{@model.penaltyType}}
+ @user={{@model.user}}
+ @selectedUserIds={{this.otherUserIds}}
+ @onUsersChanged={{this.similarUsersChanged}}
+ />
+ {{/if}}
+ {{else}}
+ {{#if (eq @model.penaltyType "suspend")}}
+ <div class="cant-suspend">{{i18n "admin.user.cant_suspend"}}</div>
+ {{else if (eq @model.penaltyType "silence")}}
+ <div class="cant-silence">{{i18n "admin.user.cant_silence"}}</div>
+ {{/if}}
+ {{/if}}
+ </:body>
+ <:footer>
+ <div class="penalty-history">{{htmlSafe this.penaltyHistory}}</div>
+ <DButton
+ class="btn-danger perform-penalize"
+ @action={{this.penalizeUser}}
+ @disabled={{this.submitDisabled}}
+ @icon="ban"
+ @label={{this.buttonLabel}}
/>
- {{/if}}
- {{#if @model.user.similar_users_count}}
- <AdminPenaltySimilarUsers
- @penaltyType={{@model.penaltyType}}
- @user={{@model.user}}
- @selectedUserIds={{this.otherUserIds}}
- @onUsersChanged={{this.similarUsersChanged}}
+ <DButton
+ class="btn-flat d-modal-cancel"
+ @action={{this.warnBeforeClosing}}
+ @label="cancel"
/>
- {{/if}}
- {{else}}
- {{#if (eq @model.penaltyType "suspend")}}
- <div class="cant-suspend">{{i18n "admin.user.cant_suspend"}}</div>
- {{else if (eq @model.penaltyType "silence")}}
- <div class="cant-silence">{{i18n "admin.user.cant_silence"}}</div>
- {{/if}}
- {{/if}}
- </:body>
- <:footer>
- <div class="penalty-history">{{html-safe this.penaltyHistory}}</div>
- <DButton
- class="btn-danger perform-penalize"
- @action={{this.penalizeUser}}
- @disabled={{this.submitDisabled}}
- @icon="ban"
- @label={{this.buttonLabel}}
- />
- <DButton
- class="btn-flat d-modal-cancel"
- @action={{this.warnBeforeClosing}}
- @label="cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/reseed.gjs b/app/assets/javascripts/admin/addon/components/modal/reseed.gjs
index 4f053999cd3..f66abd16c86 100644
--- a/app/assets/javascripts/admin/addon/components/modal/reseed.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/reseed.gjs
@@ -1,7 +1,12 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import DModalCancel from "discourse/components/d-modal-cancel";
import { ajax } from "discourse/lib/ajax";
import { i18n } from "discourse-i18n";
@@ -54,64 +59,66 @@ export default class Reseed extends Component {
this.reseeding = false;
}
}
-}
-<DModal
- @closeModal={{@closeModal}}
- @title={{i18n "admin.reseed.modal.title"}}
- @subtitle={{i18n "admin.reseed.modal.subtitle"}}
- class="reseed-modal"
- @flash={{this.flash}}
->
- <:body>
- <ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.categories}}
- <fieldset>
- <legend class="options-group-title">
- {{i18n "admin.reseed.modal.categories"}}
- </legend>
- {{#each this.categories as |category|}}
- <label>
- <Input
- class="option"
- @type="checkbox"
- @checked={{category.selected}}
- />
- <span>{{category.name}}</span>
- </label>
- {{/each}}
- </fieldset>
- {{/if}}
- <br />
- {{#if this.topics}}
- <fieldset>
- <legend class="options-group-title">
- {{i18n "admin.reseed.modal.topics"}}
- </legend>
- {{#each this.topics as |topic|}}
- <label>
- <Input
- class="option"
- @type="checkbox"
- @checked={{topic.selected}}
- />
- <span>{{topic.name}}</span>
- </label>
- {{/each}}
- </fieldset>
- {{/if}}
- </ConditionalLoadingSpinner>
- </:body>
- <:footer>
- <DButton
- @action={{this.reseed}}
- @label="admin.reseed.modal.replace"
- @isLoading={{this.reseeding}}
- class="btn-danger"
- />
+ <template>
+ <DModal
+ @closeModal={{@closeModal}}
+ @title={{i18n "admin.reseed.modal.title"}}
+ @subtitle={{i18n "admin.reseed.modal.subtitle"}}
+ class="reseed-modal"
+ @flash={{this.flash}}
+ >
+ <:body>
+ <ConditionalLoadingSpinner @condition={{this.loading}}>
+ {{#if this.categories}}
+ <fieldset>
+ <legend class="options-group-title">
+ {{i18n "admin.reseed.modal.categories"}}
+ </legend>
+ {{#each this.categories as |category|}}
+ <label>
+ <Input
+ class="option"
+ @type="checkbox"
+ @checked={{category.selected}}
+ />
+ <span>{{category.name}}</span>
+ </label>
+ {{/each}}
+ </fieldset>
+ {{/if}}
+ <br />
+ {{#if this.topics}}
+ <fieldset>
+ <legend class="options-group-title">
+ {{i18n "admin.reseed.modal.topics"}}
+ </legend>
+ {{#each this.topics as |topic|}}
+ <label>
+ <Input
+ class="option"
+ @type="checkbox"
+ @checked={{topic.selected}}
+ />
+ <span>{{topic.name}}</span>
+ </label>
+ {{/each}}
+ </fieldset>
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.reseed}}
+ @label="admin.reseed.modal.replace"
+ @isLoading={{this.reseeding}}
+ class="btn-danger"
+ />
- {{#unless this.reseeding}}
- <DModalCancel @close={{@closeModal}} />
- {{/unless}}
- </:footer>
-</DModal>
\ No newline at end of file
+ {{#unless this.reseeding}}
+ <DModalCancel @close={{@closeModal}} />
+ {{/unless}}
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/site-setting-default-categories.gjs b/app/assets/javascripts/admin/addon/components/modal/site-setting-default-categories.gjs
index 56ffe47fa19..2266336ce79 100644
--- a/app/assets/javascripts/admin/addon/components/modal/site-setting-default-categories.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/site-setting-default-categories.gjs
@@ -1,5 +1,9 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
export default class SiteSettingDefaultCategories extends Component {
@action
@@ -13,28 +17,30 @@ export default class SiteSettingDefaultCategories extends Component {
this.args.model.setUpdateExistingUsers(false);
this.args.closeModal();
}
-}
-<DModal
- class="incoming-emails"
- @title={{html-safe @model.siteSetting.key}}
- @closeModal={{this.cancel}}
->
- <:body>
- {{i18n
- "admin.site_settings.default_categories.modal_description"
- }}
- </:body>
- <:footer>
- <DButton
- @action={{this.updateExistingUsers}}
- class="btn-primary"
- @label="admin.site_settings.default_categories.modal_yes"
- />
- <DButton
- @action={{this.cancel}}
- @label="admin.site_settings.default_categories.modal_no"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ class="incoming-emails"
+ @title={{htmlSafe @model.siteSetting.key}}
+ @closeModal={{this.cancel}}
+ >
+ <:body>
+ {{i18n
+ "admin.site_settings.default_categories.modal_description"
+ }}
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.updateExistingUsers}}
+ class="btn-primary"
+ @label="admin.site_settings.default_categories.modal_yes"
+ />
+ <DButton
+ @action={{this.cancel}}
+ @label="admin.site_settings.default_categories.modal_no"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/staff-action-log-change.gjs b/app/assets/javascripts/admin/addon/components/modal/staff-action-log-change.gjs
index bf1cb7fcbb0..328d298220b 100644
--- a/app/assets/javascripts/admin/addon/components/modal/staff-action-log-change.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/staff-action-log-change.gjs
@@ -1,7 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
import { ajax } from "discourse/lib/ajax";
+import { i18n } from "discourse-i18n";
export default class AdminStaffActionLogComponent extends Component {
@tracked diff;
@@ -18,18 +22,20 @@ export default class AdminStaffActionLogComponent extends Component {
);
this.diff = diff.side_by_side;
}
-}
-<DModal
- @title={{i18n "admin.logs.staff_actions.modal_title"}}
- @closeModal={{@closeModal}}
- @bodyClass="theme-change-modal-body"
- class="history-modal"
->
- <:body>
- {{html-safe this.diff}}
- </:body>
- <:footer>
- <DButton class="btn-primary" @action={{@closeModal}} @label="close" />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.logs.staff_actions.modal_title"}}
+ @closeModal={{@closeModal}}
+ @bodyClass="theme-change-modal-body"
+ class="history-modal"
+ >
+ <:body>
+ {{htmlSafe this.diff}}
+ </:body>
+ <:footer>
+ <DButton class="btn-primary" @action={{@closeModal}} @label="close" />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/staff-action-log-details.gjs b/app/assets/javascripts/admin/addon/components/modal/staff-action-log-details.gjs
index 726a2255cb0..9b6a29c57fd 100644
--- a/app/assets/javascripts/admin/addon/components/modal/staff-action-log-details.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/staff-action-log-details.gjs
@@ -1,12 +1,19 @@
-<DModal
- @title={{i18n "admin.logs.staff_actions.modal_title"}}
- @closeModal={{@closeModal}}
- class="log-details-modal"
->
- <:body>
- <pre>{{@model.staffActionLog.details}}</pre>
- </:body>
- <:footer>
- <DButton @action={{@closeModal}} @label="close" />
- </:footer>
-</DModal>
\ No newline at end of file
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import { i18n } from "discourse-i18n";
+
+const StaffActionLogDetails = <template>
+ <DModal
+ @title={{i18n "admin.logs.staff_actions.modal_title"}}
+ @closeModal={{@closeModal}}
+ class="log-details-modal"
+ >
+ <:body>
+ <pre>{{@model.staffActionLog.details}}</pre>
+ </:body>
+ <:footer>
+ <DButton @action={{@closeModal}} @label="close" />
+ </:footer>
+ </DModal>
+</template>;
+export default StaffActionLogDetails;
diff --git a/app/assets/javascripts/admin/addon/components/modal/start-backup.gjs b/app/assets/javascripts/admin/addon/components/modal/start-backup.gjs
index 5a82b80721d..470cc7104fb 100644
--- a/app/assets/javascripts/admin/addon/components/modal/start-backup.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/start-backup.gjs
@@ -1,7 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import htmlSafe from "discourse/helpers/html-safe";
import { i18n } from "discourse-i18n";
export default class StartBackup extends Component {
@@ -35,32 +39,34 @@ export default class StartBackup extends Component {
this.args.model.startBackup(this.includeUploads);
this.args.closeModal();
}
-}
-<DModal
- @title={{i18n "admin.backups.operations.backup.confirm"}}
- @closeModal={{@closeModal}}
- class="start-backup-modal"
->
- <:body>
- {{#if this.warningMessage}}
- <div class={{this.warningCssClasses}}>{{html-safe
- this.warningMessage
- }}</div>
- {{/if}}
- {{#if this.canManageUploadsInBackup}}
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.includeUploads}} />
- {{i18n "admin.backups.operations.backup.include_uploads"}}
- </label>
- {{/if}}
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @action={{this.startBackup}}
- @label="yes_value"
- />
- <DButton class="btn-flat" @action={{@closeModal}} @label="cancel" />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "admin.backups.operations.backup.confirm"}}
+ @closeModal={{@closeModal}}
+ class="start-backup-modal"
+ >
+ <:body>
+ {{#if this.warningMessage}}
+ <div class={{this.warningCssClasses}}>{{htmlSafe
+ this.warningMessage
+ }}</div>
+ {{/if}}
+ {{#if this.canManageUploadsInBackup}}
+ <label class="checkbox-label">
+ <Input @type="checkbox" @checked={{this.includeUploads}} />
+ {{i18n "admin.backups.operations.backup.include_uploads"}}
+ </label>
+ {{/if}}
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @action={{this.startBackup}}
+ @label="yes_value"
+ />
+ <DButton class="btn-flat" @action={{@closeModal}} @label="cancel" />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/modal/uploaded-image-list.gjs b/app/assets/javascripts/admin/addon/components/modal/uploaded-image-list.gjs
index d94a77e8ffb..9cf92c3c6e2 100644
--- a/app/assets/javascripts/admin/addon/components/modal/uploaded-image-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/uploaded-image-list.gjs
@@ -1,6 +1,14 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import boundAvatarTemplate from "discourse/helpers/bound-avatar-template";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import ImagesUploader from "admin/components/images-uploader";
export default class UploadedImageList extends Component {
@tracked
@@ -24,33 +32,39 @@ export default class UploadedImageList extends Component {
this.args.model.changeValue(this.images.join("|"));
this.args.closeModal();
}
-}
-<DModal
- class="uploaded-image-list"
- @title={{i18n @model.title}}
- @closeModal={{@closeModal}}
->
- <:body>
- <div class="selectable-avatars">
- {{#each this.images as |image|}}
- <a href class="selectable-avatar" {{on "click" (fn this.remove image)}}>
- {{bound-avatar-template image "huge"}}
- <span class="selectable-avatar__remove">{{d-icon
- "circle-xmark"
- }}</span>
- </a>
- {{else}}
- <p>{{i18n "admin.site_settings.uploaded_image_list.empty"}}</p>
- {{/each}}
- </div>
- </:body>
- <:footer>
- <DButton @action={{this.close}} @label="close" />
- <ImagesUploader
- @uploading={{this.uploading}}
- @done={{this.uploadDone}}
- class="pull-right"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ class="uploaded-image-list"
+ @title={{i18n @model.title}}
+ @closeModal={{@closeModal}}
+ >
+ <:body>
+ <div class="selectable-avatars">
+ {{#each this.images as |image|}}
+ <a
+ href
+ class="selectable-avatar"
+ {{on "click" (fn this.remove image)}}
+ >
+ {{boundAvatarTemplate image "huge"}}
+ <span class="selectable-avatar__remove">{{icon
+ "circle-xmark"
+ }}</span>
+ </a>
+ {{else}}
+ <p>{{i18n "admin.site_settings.uploaded_image_list.empty"}}</p>
+ {{/each}}
+ </div>
+ </:body>
+ <:footer>
+ <DButton @action={{this.close}} @label="close" />
+ <ImagesUploader
+ @uploading={{this.uploading}}
+ @done={{this.uploadDone}}
+ class="pull-right"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/permalink-form.gjs b/app/assets/javascripts/admin/addon/components/permalink-form.gjs
index 0153c4450c1..539d7f2ed8f 100644
--- a/app/assets/javascripts/admin/addon/components/permalink-form.gjs
+++ b/app/assets/javascripts/admin/addon/components/permalink-form.gjs
@@ -1,12 +1,16 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
import { fmt } from "discourse/lib/computed";
import discourseComputed, { bind } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
import Permalink from "admin/models/permalink";
+import ComboBox from "select-kit/components/combo-box";
@tagName("")
export default class PermalinkForm extends Component {
@@ -90,43 +94,45 @@ export default class PermalinkForm extends Component {
);
}
}
-}
-<div class="permalink-form">
- <div class="inline-form">
- <label>{{i18n "admin.permalink.form.label"}}</label>
-
- <TextField
- @value={{this.url}}
- @disabled={{this.formSubmitted}}
- @placeholderKey="admin.permalink.url"
- @autocorrect="off"
- @autocapitalize="off"
- class="permalink-url"
- />
-
- <ComboBox
- @content={{this.permalinkTypes}}
- @value={{this.permalinkType}}
- @onChange={{fn (mut this.permalinkType)}}
- class="permalink-type"
- />
-
- <TextField
- @value={{this.permalinkTypeValue}}
- @disabled={{this.formSubmitted}}
- @placeholderKey={{this.permalinkTypePlaceholder}}
- @autocorrect="off"
- @autocapitalize="off"
- @keyDown={{this.submitFormOnEnter}}
- class="permalink-destination"
- />
-
- <DButton
- @action={{this.onSubmit}}
- @disabled={{this.formSubmitted}}
- @label="admin.permalink.form.add"
- class="permalink-add"
- />
- </div>
-</div>
\ No newline at end of file
+ <template>
+ <div class="permalink-form">
+ <div class="inline-form">
+ <label>{{i18n "admin.permalink.form.label"}}</label>
+
+ <TextField
+ @value={{this.url}}
+ @disabled={{this.formSubmitted}}
+ @placeholderKey="admin.permalink.url"
+ @autocorrect="off"
+ @autocapitalize="off"
+ class="permalink-url"
+ />
+
+ <ComboBox
+ @content={{this.permalinkTypes}}
+ @value={{this.permalinkType}}
+ @onChange={{fn (mut this.permalinkType)}}
+ class="permalink-type"
+ />
+
+ <TextField
+ @value={{this.permalinkTypeValue}}
+ @disabled={{this.formSubmitted}}
+ @placeholderKey={{this.permalinkTypePlaceholder}}
+ @autocorrect="off"
+ @autocapitalize="off"
+ @keyDown={{this.submitFormOnEnter}}
+ class="permalink-destination"
+ />
+
+ <DButton
+ @action={{this.onSubmit}}
+ @disabled={{this.formSubmitted}}
+ @label="admin.permalink.form.add"
+ class="permalink-add"
+ />
+ </div>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/report-filters/bool.gjs b/app/assets/javascripts/admin/addon/components/report-filters/bool.gjs
index ec1cf37d2e8..0f5da3e18e6 100644
--- a/app/assets/javascripts/admin/addon/components/report-filters/bool.gjs
+++ b/app/assets/javascripts/admin/addon/components/report-filters/bool.gjs
@@ -1,3 +1,5 @@
+import { Input } from "@ember/component";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import FilterComponent from "admin/components/report-filters/filter";
@@ -13,10 +15,12 @@ export default class Bool extends FilterComponent {
onChange() {
this.applyFilter(this.filter.id, !this.checked || undefined);
}
-}
-<Input
- @type="checkbox"
- @checked={{this.checked}}
- {{on "click" this.onChange}}
-/>
\ No newline at end of file
+ <template>
+ <Input
+ @type="checkbox"
+ @checked={{this.checked}}
+ {{on "click" this.onChange}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/report-filters/category.gjs b/app/assets/javascripts/admin/addon/components/report-filters/category.gjs
index 45658cb70fb..e96a587e6f6 100644
--- a/app/assets/javascripts/admin/addon/components/report-filters/category.gjs
+++ b/app/assets/javascripts/admin/addon/components/report-filters/category.gjs
@@ -1,6 +1,8 @@
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { readOnly } from "@ember/object/computed";
import FilterComponent from "admin/components/report-filters/filter";
+import SearchAdvancedCategoryChooser from "select-kit/components/search-advanced-category-chooser";
export default class Category extends FilterComponent {
@readOnly("filter.default") category;
@@ -9,10 +11,12 @@ export default class Category extends FilterComponent {
onChange(categoryId) {
this.applyFilter(this.filter.id, categoryId || undefined);
}
-}
-<SearchAdvancedCategoryChooser
- @value={{this.category}}
- @onChange={{this.onChange}}
- @options={{hash filterable=true disabled=this.filter.disabled}}
-/>
\ No newline at end of file
+ <template>
+ <SearchAdvancedCategoryChooser
+ @value={{this.category}}
+ @onChange={{this.onChange}}
+ @options={{hash filterable=true disabled=this.filter.disabled}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/report-filters/group.gjs b/app/assets/javascripts/admin/addon/components/report-filters/group.gjs
index eaa5eaf4b3a..32fe7e1e4f5 100644
--- a/app/assets/javascripts/admin/addon/components/report-filters/group.gjs
+++ b/app/assets/javascripts/admin/addon/components/report-filters/group.gjs
@@ -1,6 +1,8 @@
+import { hash } from "@ember/helper";
import { computed } from "@ember/object";
import { classNames } from "@ember-decorators/component";
import FilterComponent from "admin/components/report-filters/filter";
+import ComboBox from "select-kit/components/combo-box";
@classNames("group-filter")
export default class Group extends FilterComponent {
@@ -15,17 +17,19 @@ export default class Group extends FilterComponent {
get groupId() {
return this.filter.default ? parseInt(this.filter.default, 10) : null;
}
-}
-<ComboBox
- @valueProperty="value"
- @content={{this.groupOptions}}
- @value={{this.groupId}}
- @onChange={{this.onChange}}
- @options={{hash
- allowAny=this.filter.allow_any
- autoInsertNoneItem=this.filter.auto_insert_none_item
- filterable=true
- none="admin.dashboard.reports.groups"
- }}
-/>
\ No newline at end of file
+ <template>
+ <ComboBox
+ @valueProperty="value"
+ @content={{this.groupOptions}}
+ @value={{this.groupId}}
+ @onChange={{this.onChange}}
+ @options={{hash
+ allowAny=this.filter.allow_any
+ autoInsertNoneItem=this.filter.auto_insert_none_item
+ filterable=true
+ none="admin.dashboard.reports.groups"
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/report-filters/list.gjs b/app/assets/javascripts/admin/addon/components/report-filters/list.gjs
index 03d659a81f1..58c41902e8c 100644
--- a/app/assets/javascripts/admin/addon/components/report-filters/list.gjs
+++ b/app/assets/javascripts/admin/addon/components/report-filters/list.gjs
@@ -1,16 +1,20 @@
+import { hash } from "@ember/helper";
import FilterComponent from "admin/components/report-filters/filter";
+import ComboBox from "select-kit/components/combo-box";
-export default class List extends FilterComponent {}
-
-<ComboBox
- @content={{this.filter.choices}}
- @value={{this.filter.default}}
- @onChange={{this.onChange}}
- @options={{hash
- allowAny=this.filter.allow_any
- autoInsertNoneItem=this.filter.auto_insert_none_item
- filterable=true
- none="admin.dashboard.report_filter_any"
- disabled=this.filter.disabled
- }}
-/>
\ No newline at end of file
+export default class List extends FilterComponent {
+ <template>
+ <ComboBox
+ @content={{this.filter.choices}}
+ @value={{this.filter.default}}
+ @onChange={{this.onChange}}
+ @options={{hash
+ allowAny=this.filter.allow_any
+ autoInsertNoneItem=this.filter.auto_insert_none_item
+ filterable=true
+ none="admin.dashboard.report_filter_any"
+ disabled=this.filter.disabled
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/screened-ip-address-form.gjs b/app/assets/javascripts/admin/addon/components/screened-ip-address-form.gjs
index 2bd371a7150..78a20e42dcc 100644
--- a/app/assets/javascripts/admin/addon/components/screened-ip-address-form.gjs
+++ b/app/assets/javascripts/admin/addon/components/screened-ip-address-form.gjs
@@ -1,11 +1,15 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { classNames, tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
import ScreenedIpAddress from "admin/models/screened-ip-address";
+import ComboBox from "select-kit/components/combo-box";
/**
A form to create an IP address that will be blocked or allowed.
@@ -87,28 +91,30 @@ export default class ScreenedIpAddressForm extends Component {
});
}
}
-}
-<label>{{i18n "admin.logs.screened_ips.form.label"}}</label>
-<TextField
- @value={{this.ip_address}}
- @disabled={{this.formSubmitted}}
- @placeholderKey="admin.logs.screened_ips.form.ip_address"
- @autocorrect="off"
- @autocapitalize="off"
- class="ip-address-input"
-/>
+ <template>
+ <label>{{i18n "admin.logs.screened_ips.form.label"}}</label>
+ <TextField
+ @value={{this.ip_address}}
+ @disabled={{this.formSubmitted}}
+ @placeholderKey="admin.logs.screened_ips.form.ip_address"
+ @autocorrect="off"
+ @autocapitalize="off"
+ class="ip-address-input"
+ />
-<ComboBox
- @content={{this.actionNames}}
- @value={{this.actionName}}
- @onChange={{fn (mut this.actionName)}}
-/>
+ <ComboBox
+ @content={{this.actionNames}}
+ @value={{this.actionName}}
+ @onChange={{fn (mut this.actionName)}}
+ />
-<DButton
- @action={{this.submitForm}}
- @disabled={{this.formSubmitted}}
- @label="admin.logs.screened_ips.form.add"
- type="submit"
- class="btn-default"
-/>
\ No newline at end of file
+ <DButton
+ @action={{this.submitForm}}
+ @disabled={{this.formSubmitted}}
+ @label="admin.logs.screened_ips.form.add"
+ type="submit"
+ class="btn-default"
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/secret-value-list.gjs b/app/assets/javascripts/admin/addon/components/secret-value-list.gjs
index d2720a2b8c3..3994026f112 100644
--- a/app/assets/javascripts/admin/addon/components/secret-value-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/secret-value-list.gjs
@@ -1,7 +1,11 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action, set } from "@ember/object";
import { isEmpty } from "@ember/utils";
import { classNameBindings } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
import { i18n } from "discourse-i18n";
@classNameBindings(":value-list", ":secret-value-list")
@@ -113,48 +117,50 @@ export default class SecretValueList extends Component {
return [];
}
}
-}
-{{#if this.collection}}
- <div class="values">
- {{#each this.collection as |value index|}}
- <div class="value" data-index={{index}}>
- <DButton
- @action={{fn this.removeValue value}}
- @icon="xmark"
- class="btn-default remove-value-btn btn-small"
- />
- <Input
- @value={{value.key}}
- class="value-input"
- {{on "focusout" (fn this.changeKey index)}}
- />
- <Input
- @value={{value.secret}}
- class="value-input"
- @type={{if this.isSecret "password" "text"}}
- {{on "focusout" (fn this.changeSecret index)}}
- />
+ <template>
+ {{#if this.collection}}
+ <div class="values">
+ {{#each this.collection as |value index|}}
+ <div class="value" data-index={{index}}>
+ <DButton
+ @action={{fn this.removeValue value}}
+ @icon="xmark"
+ class="btn-default remove-value-btn btn-small"
+ />
+ <Input
+ @value={{value.key}}
+ class="value-input"
+ {{on "focusout" (fn this.changeKey index)}}
+ />
+ <Input
+ @value={{value.secret}}
+ class="value-input"
+ @type={{if this.isSecret "password" "text"}}
+ {{on "focusout" (fn this.changeSecret index)}}
+ />
+ </div>
+ {{/each}}
</div>
- {{/each}}
- </div>
-{{/if}}
-
-<div class="value">
- <TextField
- @value={{this.newKey}}
- @placeholder={{this.setting.placeholder.key}}
- class="new-value-input key"
- />
- <Input
- @type="password"
- @value={{this.newSecret}}
- class="new-value-input secret"
- placeholder={{this.setting.placeholder.value}}
- />
- <DButton
- @action={{this.addValue}}
- @icon="plus"
- class="add-value-btn btn-small"
- />
-</div>
\ No newline at end of file
+ {{/if}}
+
+ <div class="value">
+ <TextField
+ @value={{this.newKey}}
+ @placeholder={{this.setting.placeholder.key}}
+ class="new-value-input key"
+ />
+ <Input
+ @type="password"
+ @value={{this.newSecret}}
+ class="new-value-input secret"
+ placeholder={{this.setting.placeholder.value}}
+ />
+ <DButton
+ @action={{this.addValue}}
+ @icon="plus"
+ class="add-value-btn btn-small"
+ />
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/setting-validation-message.gjs b/app/assets/javascripts/admin/addon/components/setting-validation-message.gjs
index c5b65e749cb..a2d655d0fa0 100644
--- a/app/assets/javascripts/admin/addon/components/setting-validation-message.gjs
+++ b/app/assets/javascripts/admin/addon/components/setting-validation-message.gjs
@@ -1,8 +1,11 @@
import Component from "@ember/component";
+import icon from "discourse/helpers/d-icon";
-export default class SettingValidationMessage extends Component {}
-
-<div class="validation-error {{unless this.message 'hidden'}}">
- {{d-icon "xmark"}}
- {{this.message}}
-</div>
\ No newline at end of file
+export default class SettingValidationMessage extends Component {
+ <template>
+ <div class="validation-error {{unless this.message 'hidden'}}">
+ {{icon "xmark"}}
+ {{this.message}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/silence-details.gjs b/app/assets/javascripts/admin/addon/components/silence-details.gjs
index 3a930eb40ba..9f9e1780386 100644
--- a/app/assets/javascripts/admin/addon/components/silence-details.gjs
+++ b/app/assets/javascripts/admin/addon/components/silence-details.gjs
@@ -1,29 +1,34 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
import { tagName } from "@ember-decorators/component";
+import TextField from "discourse/components/text-field";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
@tagName("")
-export default class SilenceDetails extends Component {}
-
-<div class="penalty-reason-controls">
- <label>
- <div class="silence-reason-label">
- {{html-safe (i18n "admin.user.silence_reason_label")}}
+export default class SilenceDetails extends Component {
+ <template>
+ <div class="penalty-reason-controls">
+ <label>
+ <div class="silence-reason-label">
+ {{htmlSafe (i18n "admin.user.silence_reason_label")}}
+ </div>
+ </label>
+ <TextField
+ @value={{this.reason}}
+ @placeholderKey="admin.user.silence_reason_placeholder"
+ class="silence-reason"
+ />
</div>
- </label>
- <TextField
- @value={{this.reason}}
- @placeholderKey="admin.user.silence_reason_placeholder"
- class="silence-reason"
- />
-</div>
-<label>
- <div class="silence-message-label">
- {{i18n "admin.user.silence_message"}}
- </div>
-</label>
-<Textarea
- @value={{this.message}}
- class="silence-message"
- placeholder={{i18n "admin.user.silence_message_placeholder"}}
-/>
\ No newline at end of file
+ <label>
+ <div class="silence-message-label">
+ {{i18n "admin.user.silence_message"}}
+ </div>
+ </label>
+ <Textarea
+ @value={{this.message}}
+ class="silence-message"
+ placeholder={{i18n "admin.user.silence_message_placeholder"}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/simple-list.gjs b/app/assets/javascripts/admin/addon/components/simple-list.gjs
index 7bd49be3ba2..30623b83d9e 100644
--- a/app/assets/javascripts/admin/addon/components/simple-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/simple-list.gjs
@@ -1,10 +1,16 @@
import { arrayContentDidChange } from "@ember/-internals/metal";
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { empty } from "@ember/object/computed";
import { isEmpty } from "@ember/utils";
import { classNameBindings } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import gt from "truth-helpers/helpers/gt";
@classNameBindings(":simple-list", ":value-list")
export default class SimpleList extends Component {
@@ -90,70 +96,72 @@ export default class SimpleList extends Component {
? values.split(delimiter || "\n").filter(Boolean)
: [];
}
-}
-
-{{#if this.collection}}
- <div class="values">
- {{#each this.collection as |value index|}}
- <div data-index={{index}} class="value">
- <DButton
- @action={{fn this.removeValue value}}
- @icon="xmark"
- class="btn-default remove-value-btn btn-small"
- />
- <Input
- title={{value}}
- @value={{value}}
- class="value-input"
- {{on "focusout" (fn this.changeValue index)}}
- />
+ <template>
+ {{#if this.collection}}
+ <div class="values">
+ {{#each this.collection as |value index|}}
+ <div data-index={{index}} class="value">
+ <DButton
+ @action={{fn this.removeValue value}}
+ @icon="xmark"
+ class="btn-default remove-value-btn btn-small"
+ />
+
+ <Input
+ title={{value}}
+ @value={{value}}
+ class="value-input"
+ {{on "focusout" (fn this.changeValue index)}}
+ />
+
+ {{#if this.showUpDownButtons}}
+ <DButton
+ @action={{fn this.shift -1 index}}
+ @icon="arrow-up"
+ class="btn-default shift-up-value-btn btn-small"
+ />
+ <DButton
+ @action={{fn this.shift 1 index}}
+ @icon="arrow-down"
+ class="btn-default shift-down-value-btn btn-small"
+ />
+ {{/if}}
+ </div>
+ {{/each}}
+ </div>
+ {{/if}}
- {{#if this.showUpDownButtons}}
- <DButton
- @action={{fn this.shift -1 index}}
- @icon="arrow-up"
- class="btn-default shift-up-value-btn btn-small"
- />
- <DButton
- @action={{fn this.shift 1 index}}
- @icon="arrow-down"
- class="btn-default shift-down-value-btn btn-small"
+ <div class="simple-list-input">
+ {{#if this.isPredefinedList}}
+ {{#if (gt this.validValues.length 0)}}
+ <ComboBox
+ @content={{this.validValues}}
+ @value={{this.newValue}}
+ @onChange={{this.addValue}}
+ @valueProperty={{this.setting.computedValueProperty}}
+ @nameProperty={{this.setting.computedNameProperty}}
+ @options={{hash castInteger=true allowAny=false}}
+ class="add-value-input"
/>
{{/if}}
- </div>
- {{/each}}
- </div>
-{{/if}}
-
-<div class="simple-list-input">
- {{#if this.isPredefinedList}}
- {{#if (gt this.validValues.length 0)}}
- <ComboBox
- @content={{this.validValues}}
- @value={{this.newValue}}
- @onChange={{this.addValue}}
- @valueProperty={{this.setting.computedValueProperty}}
- @nameProperty={{this.setting.computedNameProperty}}
- @options={{hash castInteger=true allowAny=false}}
- class="add-value-input"
- />
- {{/if}}
- {{else}}
- <Input
- @type="text"
- @value={{this.newValue}}
- placeholder={{i18n "admin.site_settings.simple_list.add_item"}}
- class="add-value-input"
- autocomplete="off"
- autocorrect="off"
- autocapitalize="off"
- />
- <DButton
- @action={{fn this.addValue this.newValue}}
- @disabled={{this.inputEmpty}}
- @icon="plus"
- class="add-value-btn btn-small"
- />
- {{/if}}
-</div>
\ No newline at end of file
+ {{else}}
+ <Input
+ @type="text"
+ @value={{this.newValue}}
+ placeholder={{i18n "admin.site_settings.simple_list.add_item"}}
+ class="add-value-input"
+ autocomplete="off"
+ autocorrect="off"
+ autocapitalize="off"
+ />
+ <DButton
+ @action={{fn this.addValue this.newValue}}
+ @disabled={{this.inputEmpty}}
+ @icon="plus"
+ class="add-value-btn btn-small"
+ />
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-customization-change-details.gjs b/app/assets/javascripts/admin/addon/components/site-customization-change-details.gjs
index d9d23df9424..97c73f2e16e 100644
--- a/app/assets/javascripts/admin/addon/components/site-customization-change-details.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-customization-change-details.gjs
@@ -1,59 +1,63 @@
import Component from "@ember/component";
+import { i18n } from "discourse-i18n";
+import SiteCustomizationChangeField from "admin/components/site-customization-change-field";
-export default class SiteCustomizationChangeDetails extends Component {}
+export default class SiteCustomizationChangeDetails extends Component {
+ <template>
+ <section class="field">
+ <b>{{i18n "admin.customize.enabled"}}</b>:
+ {{this.change.enabled}}
+ </section>
-<section class="field">
- <b>{{i18n "admin.customize.enabled"}}</b>:
- {{this.change.enabled}}
-</section>
+ <SiteCustomizationChangeField
+ @field={{this.change.stylesheet}}
+ @name="admin.customize.css"
+ />
+ <SiteCustomizationChangeField
+ @icon="mobile"
+ @field={{this.change.mobile_stylesheet}}
+ @name="admin.customize.css"
+ />
-<SiteCustomizationChangeField
- @field={{this.change.stylesheet}}
- @name="admin.customize.css"
-/>
-<SiteCustomizationChangeField
- @icon="mobile"
- @field={{this.change.mobile_stylesheet}}
- @name="admin.customize.css"
-/>
+ <SiteCustomizationChangeField
+ @field={{this.change.header}}
+ @name="admin.customize.header"
+ />
+ <SiteCustomizationChangeField
+ @icon="mobile"
+ @field={{this.change.mobile_header}}
+ @name="admin.customize.header"
+ />
-<SiteCustomizationChangeField
- @field={{this.change.header}}
- @name="admin.customize.header"
-/>
-<SiteCustomizationChangeField
- @icon="mobile"
- @field={{this.change.mobile_header}}
- @name="admin.customize.header"
-/>
+ <SiteCustomizationChangeField
+ @field={{this.change.top}}
+ @name="admin.customize.top"
+ />
+ <SiteCustomizationChangeField
+ @icon="mobile"
+ @field={{this.change.mobile_top}}
+ @name="admin.customize.top"
+ />
-<SiteCustomizationChangeField
- @field={{this.change.top}}
- @name="admin.customize.top"
-/>
-<SiteCustomizationChangeField
- @icon="mobile"
- @field={{this.change.mobile_top}}
- @name="admin.customize.top"
-/>
+ <SiteCustomizationChangeField
+ @field={{this.change.footer}}
+ @name="admin.customize.footer"
+ />
+ <SiteCustomizationChangeField
+ @icon="mobile"
+ @field={{this.change.mobile_footer}}
+ @name="admin.customize.footer"
+ />
-<SiteCustomizationChangeField
- @field={{this.change.footer}}
- @name="admin.customize.footer"
-/>
-<SiteCustomizationChangeField
- @icon="mobile"
- @field={{this.change.mobile_footer}}
- @name="admin.customize.footer"
-/>
-
-<SiteCustomizationChangeField
- @icon="file-text-o"
- @field={{this.change.head_tag}}
- @name="admin.customize.head_tag.text"
-/>
-<SiteCustomizationChangeField
- @icon="file-text-o"
- @field={{this.change.body_tag}}
- @name="admin.customize.body_tag.text"
-/>
\ No newline at end of file
+ <SiteCustomizationChangeField
+ @icon="file-text-o"
+ @field={{this.change.head_tag}}
+ @name="admin.customize.head_tag.text"
+ />
+ <SiteCustomizationChangeField
+ @icon="file-text-o"
+ @field={{this.change.body_tag}}
+ @name="admin.customize.body_tag.text"
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-customization-change-field.gjs b/app/assets/javascripts/admin/addon/components/site-customization-change-field.gjs
index faf2feb5867..d4e4471224a 100644
--- a/app/assets/javascripts/admin/addon/components/site-customization-change-field.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-customization-change-field.gjs
@@ -1,14 +1,17 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
+import { i18n } from "discourse-i18n";
-export default class SiteCustomizationChangeField extends Component {}
-
-{{#if this.field}}
- <section class="field">
- <b>{{i18n this.name}}</b>: ({{i18n
- "character_count"
- count=this.field.length
- }})
- <br />
- <Textarea @value={{this.field}} class="plain" />
- </section>
-{{/if}}
\ No newline at end of file
+export default class SiteCustomizationChangeField extends Component {
+ <template>
+ {{#if this.field}}
+ <section class="field">
+ <b>{{i18n this.name}}</b>: ({{i18n
+ "character_count"
+ count=this.field.length
+ }})
+ <br />
+ <Textarea @value={{this.field}} class="plain" />
+ </section>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-setting.gjs b/app/assets/javascripts/admin/addon/components/site-setting.gjs
index 94ad47d9cbd..f0f248b8a3a 100644
--- a/app/assets/javascripts/admin/addon/components/site-setting.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-setting.gjs
@@ -1,8 +1,16 @@
import { cached, tracked } from "@glimmer/tracking";
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { dependentKeyCompat } from "@ember/object/compat";
import { readOnly } from "@ember/object/computed";
+import { getOwner } from "@ember/owner";
+import { LinkTo } from "@ember/routing";
import BufferedProxy from "ember-buffered-proxy/proxy";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import SettingValidationMessage from "admin/components/setting-validation-message";
+import Description from "admin/components/site-settings/description";
import SettingComponent from "admin/mixins/setting-component";
import SiteSetting from "admin/models/site-setting";
@@ -14,6 +22,12 @@ export default class SiteSettingComponent extends Component.extend(
@readOnly("setting.staffLogFilter") staffLogFilter;
+ get resolvedComponent() {
+ return getOwner(this).resolveRegistration(
+ `component:${this.componentName}`
+ );
+ }
+
@cached
@dependentKeyCompat
get buffered() {
@@ -28,92 +42,93 @@ export default class SiteSettingComponent extends Component.extend(
updateExistingUsers: this.updateExistingUsers,
});
}
-}
-<div class="setting-label">
- <h3>
- {{this.settingName}}
+ <template>
+ <div class="setting-label">
+ <h3>
+ {{this.settingName}}
- {{#if this.staffLogFilter}}
- <LinkTo
- @route="adminLogs.staffActionLogs"
- @query={{hash filters=this.staffLogFilter force_refresh=true}}
- title={{i18n "admin.settings.history"}}
- >
- <span class="history-icon">
- {{d-icon "clock-rotate-left"}}
- </span>
- </LinkTo>
- {{/if}}
- </h3>
+ {{#if this.staffLogFilter}}
+ <LinkTo
+ @route="adminLogs.staffActionLogs"
+ @query={{hash filters=this.staffLogFilter force_refresh=true}}
+ title={{i18n "admin.settings.history"}}
+ >
+ <span class="history-icon">
+ {{icon "clock-rotate-left"}}
+ </span>
+ </LinkTo>
+ {{/if}}
+ </h3>
- {{#if this.defaultIsAvailable}}
- <DButton
- class="btn-link"
- @action={{this.setDefaultValues}}
- @translatedLabel={{this.setting.setDefaultValuesLabel}}
- />
- {{/if}}
-</div>
+ {{#if this.defaultIsAvailable}}
+ <DButton
+ class="btn-link"
+ @action={{this.setDefaultValues}}
+ @translatedLabel={{this.setting.setDefaultValuesLabel}}
+ />
+ {{/if}}
+ </div>
-<div class="setting-value">
- {{#if this.settingEditButton}}
- <DButton
- @action={{this.settingEditButton.action}}
- @icon={{this.settingEditButton.icon}}
- @label={{this.settingEditButton.label}}
- class="setting-value-edit-button"
- />
+ <div class="setting-value">
+ {{#if this.settingEditButton}}
+ <DButton
+ @action={{this.settingEditButton.action}}
+ @icon={{this.settingEditButton.icon}}
+ @label={{this.settingEditButton.label}}
+ class="setting-value-edit-button"
+ />
- <SiteSettings::Description @description={{this.setting.description}} />
- {{else}}
- {{component
- this.componentName
- setting=this.setting
- value=this.buffered.value
- preview=this.preview
- isSecret=this.isSecret
- allowAny=this.allowAny
- changeValueCallback=this.changeValueCallback
- setValidationMessage=this.setValidationMessage
- }}
- <SettingValidationMessage @message={{this.validationMessage}} />
- {{#if this.displayDescription}}
- <SiteSettings::Description @description={{this.setting.description}} />
- {{/if}}
- {{/if}}
-</div>
+ <Description @description={{this.setting.description}} />
+ {{else}}
+ <this.resolvedComponent
+ @setting={{this.setting}}
+ @value={{this.buffered.value}}
+ @preview={{this.preview}}
+ @isSecret={{this.isSecret}}
+ @allowAny={{this.allowAny}}
+ @changeValueCallback={{this.changeValueCallback}}
+ @setValidationMessage={{this.setValidationMessage}}
+ />
+ <SettingValidationMessage @message={{this.validationMessage}} />
+ {{#if this.displayDescription}}
+ <Description @description={{this.setting.description}} />
+ {{/if}}
+ {{/if}}
+ </div>
-{{#if this.dirty}}
- <div class="setting-controls">
- <DButton
- @action={{this.update}}
- @icon="check"
- @disabled={{this.disableSaveButton}}
- @ariaLabel="admin.settings.save"
- class="ok setting-controls__ok"
- />
- <DButton
- @action={{this.cancel}}
- @icon="xmark"
- @ariaLabel="admin.settings.cancel"
- class="cancel setting-controls__cancel"
- />
- </div>
-{{else if this.overridden}}
- {{#if this.setting.secret}}
- <DButton
- @action={{this.toggleSecret}}
- @icon="far-eye-slash"
- @ariaLabel="admin.settings.unmask"
- class="setting-toggle-secret"
- />
- {{/if}}
+ {{#if this.dirty}}
+ <div class="setting-controls">
+ <DButton
+ @action={{this.update}}
+ @icon="check"
+ @disabled={{this.disableSaveButton}}
+ @ariaLabel="admin.settings.save"
+ class="ok setting-controls__ok"
+ />
+ <DButton
+ @action={{this.cancel}}
+ @icon="xmark"
+ @ariaLabel="admin.settings.cancel"
+ class="cancel setting-controls__cancel"
+ />
+ </div>
+ {{else if this.overridden}}
+ {{#if this.setting.secret}}
+ <DButton
+ @action={{this.toggleSecret}}
+ @icon="far-eye-slash"
+ @ariaLabel="admin.settings.unmask"
+ class="setting-toggle-secret"
+ />
+ {{/if}}
- <DButton
- class="btn-default undo setting-controls__undo"
- @action={{this.resetDefault}}
- @icon="arrow-rotate-left"
- @label="admin.settings.reset"
- />
-{{/if}}
\ No newline at end of file
+ <DButton
+ class="btn-default undo setting-controls__undo"
+ @action={{this.resetDefault}}
+ @icon="arrow-rotate-left"
+ @label="admin.settings.reset"
+ />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/enum.gjs b/app/assets/javascripts/admin/addon/components/site-settings/enum.gjs
index fcc4d74fefc..b26ab35dd7a 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/enum.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/enum.gjs
@@ -1,14 +1,18 @@
import Component from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import ComboBox from "select-kit/components/combo-box";
-export default class Enum extends Component {}
+export default class Enum extends Component {
+ <template>
+ <ComboBox
+ @content={{this.setting.validValues}}
+ @value={{this.value}}
+ @onChange={{fn (mut this.value)}}
+ @valueProperty={{this.setting.computedValueProperty}}
+ @nameProperty={{this.setting.computedNameProperty}}
+ @options={{hash castInteger=true allowAny=this.setting.allowsNone}}
+ />
-<ComboBox
- @content={{this.setting.validValues}}
- @value={{this.value}}
- @onChange={{fn (mut this.value)}}
- @valueProperty={{this.setting.computedValueProperty}}
- @nameProperty={{this.setting.computedNameProperty}}
- @options={{hash castInteger=true allowAny=this.setting.allowsNone}}
-/>
-
-{{this.preview}}
\ No newline at end of file
+ {{this.preview}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/group-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/group-list.gjs
index 28b76808bd8..8901a329cc0 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/group-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/group-list.gjs
@@ -1,5 +1,6 @@
import Component from "@ember/component";
import { action, computed } from "@ember/object";
+import ListSetting from "select-kit/components/list-setting";
export default class GroupList extends Component {
tokenSeparator = "|";
@@ -22,14 +23,16 @@ export default class GroupList extends Component {
onChangeGroupListSetting(value) {
this.set("value", value.join(this.tokenSeparator));
}
-}
-<ListSetting
- @value={{this.settingValue}}
- @choices={{this.groupChoices}}
- @settingName="name"
- @mandatoryValues={{this.setting.mandatory_values}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChangeGroupListSetting}}
-/>
\ No newline at end of file
+ <template>
+ <ListSetting
+ @value={{this.settingValue}}
+ @choices={{this.groupChoices}}
+ @settingName="name"
+ @mandatoryValues={{this.setting.mandatory_values}}
+ @nameProperty={{this.nameProperty}}
+ @valueProperty={{this.valueProperty}}
+ @onChange={{this.onChangeGroupListSetting}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/host-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/host-list.gjs
index 5e0d57a1cf5..da3b5396387 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/host-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/host-list.gjs
@@ -1,5 +1,7 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action, computed } from "@ember/object";
+import ListSetting from "select-kit/components/list-setting";
export default class HostList extends Component {
tokenSeparator = "|";
@@ -18,12 +20,14 @@ export default class HostList extends Component {
this.set("value", value.join(this.tokenSeparator));
}
-}
-<ListSetting
- @value={{this.settingValue}}
- @settingName={{this.setting.setting}}
- @choices={{this.settingValue}}
- @onChange={{this.onChange}}
- @options={{hash allowAny=this.allowAny}}
-/>
\ No newline at end of file
+ <template>
+ <ListSetting
+ @value={{this.settingValue}}
+ @settingName={{this.setting.setting}}
+ @choices={{this.settingValue}}
+ @onChange={{this.onChange}}
+ @options={{hash allowAny=this.allowAny}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/list.gjs
index e9678a0d0dd..38b6edcaae7 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/list.gjs
@@ -1,9 +1,12 @@
import Component from "@ember/component";
+import ValueList from "admin/components/value-list";
-export default class List extends Component {}
-
-<ValueList
- @values={{this.value}}
- @inputDelimiter="|"
- @choices={{this.setting.choices}}
-/>
\ No newline at end of file
+export default class List extends Component {
+ <template>
+ <ValueList
+ @values={{this.value}}
+ @inputDelimiter="|"
+ @choices={{this.setting.choices}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/named-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/named-list.gjs
index f4150870e8e..1984fd27901 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/named-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/named-list.gjs
@@ -1,5 +1,7 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action, computed } from "@ember/object";
+import ListSetting from "select-kit/components/list-setting";
export default class NamedList extends Component {
tokenSeparator = "|";
@@ -30,14 +32,16 @@ export default class NamedList extends Component {
onChangeListSetting(value) {
this.set("value", value.join(this.tokenSeparator));
}
-}
-<ListSetting
- @value={{this.settingValue}}
- @settingName={{this.setting.setting}}
- @choices={{this.settingChoices}}
- @nameProperty="name"
- @valueProperty="value"
- @onChange={{this.onChangeListSetting}}
- @options={{hash allowAny=this.allowAny}}
-/>
\ No newline at end of file
+ <template>
+ <ListSetting
+ @value={{this.settingValue}}
+ @settingName={{this.setting.setting}}
+ @choices={{this.settingChoices}}
+ @nameProperty="name"
+ @valueProperty="value"
+ @onChange={{this.onChangeListSetting}}
+ @options={{hash allowAny=this.allowAny}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/secret-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/secret-list.gjs
index ff2dc53f380..c8611ada0c5 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/secret-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/secret-list.gjs
@@ -1,10 +1,13 @@
import Component from "@ember/component";
+import SecretValueList from "admin/components/secret-value-list";
-export default class SecretList extends Component {}
-
-<SecretValueList
- @setting={{this.setting}}
- @values={{this.value}}
- @isSecret={{this.isSecret}}
- @setValidationMessage={{this.setValidationMessage}}
-/>
\ No newline at end of file
+export default class SecretList extends Component {
+ <template>
+ <SecretValueList
+ @setting={{this.setting}}
+ @values={{this.value}}
+ @isSecret={{this.isSecret}}
+ @setValidationMessage={{this.setValidationMessage}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/simple-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/simple-list.gjs
index 2281448669d..e0130304bad 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/simple-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/simple-list.gjs
@@ -1,19 +1,22 @@
import Component from "@ember/component";
import { action } from "@ember/object";
+import SimpleList from "admin/components/simple-list";
-export default class SimpleList extends Component {
+export default class SiteSettingSimpleList extends Component {
inputDelimiter = "|";
@action
onChange(value) {
this.set("value", value.join(this.inputDelimiter || "\n"));
}
-}
-<SimpleList
- @values={{this.value}}
- @inputDelimiter={{this.inputDelimiter}}
- @onChange={{this.onChange}}
- @choices={{this.setting.choices}}
- @allowAny={{this.setting.allow_any}}
-/>
\ No newline at end of file
+ <template>
+ <SimpleList
+ @values={{this.value}}
+ @inputDelimiter={{this.inputDelimiter}}
+ @onChange={{this.onChange}}
+ @choices={{this.setting.choices}}
+ @allowAny={{this.setting.allow_any}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/string.gjs b/app/assets/javascripts/admin/addon/components/site-settings/string.gjs
index c2d25e1c1f8..e5dbd56da5d 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/string.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/string.gjs
@@ -1,16 +1,19 @@
-import Component from "@ember/component";
+import Component, { Input, Textarea } from "@ember/component";
+import TextField from "discourse/components/text-field";
-export default class String extends Component {}
-
-{{#if this.setting.textarea}}
- <Textarea @value={{this.value}} class="input-setting-textarea" />
-{{else if this.isSecret}}
- <Input
- @type="password"
- @value={{this.value}}
- class="input-setting-string"
- autocomplete="new-password"
- />
-{{else}}
- <TextField @value={{this.value}} @classNames="input-setting-string" />
-{{/if}}
\ No newline at end of file
+export default class String extends Component {
+ <template>
+ {{#if this.setting.textarea}}
+ <Textarea @value={{this.value}} class="input-setting-textarea" />
+ {{else if this.isSecret}}
+ <Input
+ @type="password"
+ @value={{this.value}}
+ class="input-setting-string"
+ autocomplete="new-password"
+ />
+ {{else}}
+ <TextField @value={{this.value}} @classNames="input-setting-string" />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/tag-group-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/tag-group-list.gjs
index b83accd09ba..93d605ebce3 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/tag-group-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/tag-group-list.gjs
@@ -1,6 +1,8 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import discourseComputed from "discourse/lib/decorators";
+import TagGroupChooser from "select-kit/components/tag-group-chooser";
export default class TagGroupList extends Component {
@discourseComputed("value")
@@ -12,10 +14,14 @@ export default class TagGroupList extends Component {
onTagGroupChange(tagGroups) {
this.set("value", tagGroups.join("|"));
}
-}
-<TagGroupChooser
- @tagGroups={{this.selectedTagGroups}}
- @onChange={{this.onTagGroupChange}}
- @options={{hash filterPlaceholder="category.required_tag_group.placeholder"}}
-/>
\ No newline at end of file
+ <template>
+ <TagGroupChooser
+ @tagGroups={{this.selectedTagGroups}}
+ @onChange={{this.onTagGroupChange}}
+ @options={{hash
+ filterPlaceholder="category.required_tag_group.placeholder"
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/tag-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/tag-list.gjs
index 813e48aff39..3cfec2d3377 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/tag-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/tag-list.gjs
@@ -1,6 +1,8 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import discourseComputed from "discourse/lib/decorators";
+import TagChooser from "select-kit/components/tag-chooser";
export default class TagList extends Component {
@discourseComputed("value")
@@ -12,12 +14,14 @@ export default class TagList extends Component {
changeSelectedTags(tags) {
this.set("value", tags.join("|"));
}
-}
-<TagChooser
- @tags={{this.selectedTags}}
- @onChange={{this.changeSelectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
-/>
\ No newline at end of file
+ <template>
+ <TagChooser
+ @tags={{this.selectedTags}}
+ @onChange={{this.changeSelectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/upload.gjs b/app/assets/javascripts/admin/addon/components/site-settings/upload.gjs
index b30e2c6f7d3..a85b788b386 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/upload.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/upload.gjs
@@ -1,19 +1,23 @@
import Component from "@ember/component";
+import { concat, fn, hash } from "@ember/helper";
import { action } from "@ember/object";
+import UppyImageUploader from "discourse/components/uppy-image-uploader";
export default class Upload extends Component {
@action
uploadDone(upload) {
this.set("value", upload.url);
}
-}
-<UppyImageUploader
- @imageUrl={{this.value}}
- @placeholderUrl={{this.setting.placeholder}}
- @onUploadDone={{this.uploadDone}}
- @onUploadDeleted={{fn (mut this.value) null}}
- @additionalParams={{hash for_site_setting=true}}
- @type="site_setting"
- @id={{concat "site-setting-image-uploader-" this.setting.setting}}
-/>
\ No newline at end of file
+ <template>
+ <UppyImageUploader
+ @imageUrl={{this.value}}
+ @placeholderUrl={{this.setting.placeholder}}
+ @onUploadDone={{this.uploadDone}}
+ @onUploadDeleted={{fn (mut this.value) null}}
+ @additionalParams={{hash for_site_setting=true}}
+ @type="site_setting"
+ @id={{concat "site-setting-image-uploader-" this.setting.setting}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/uploaded-image-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/uploaded-image-list.gjs
index f53365ab2b2..3ea3d165bc3 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/uploaded-image-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/uploaded-image-list.gjs
@@ -1,6 +1,8 @@
import Component from "@ember/component";
+import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import DButton from "discourse/components/d-button";
import UploadedImageListModal from "admin/components/modal/uploaded-image-list";
export default class UploadedImageList extends Component {
@@ -16,12 +18,14 @@ export default class UploadedImageList extends Component {
},
});
}
-}
-<DButton
- @label="admin.site_settings.uploaded_image_list.label"
- @action={{fn
- this.showUploadModal
- (hash value=this.value setting=this.setting)
- }}
-/>
\ No newline at end of file
+ <template>
+ <DButton
+ @label="admin.site_settings.uploaded_image_list.label"
+ @action={{fn
+ this.showUploadModal
+ (hash value=this.value setting=this.setting)
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/url-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/url-list.gjs
index 6890f5af173..cf3bf796f12 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/url-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/url-list.gjs
@@ -1,5 +1,8 @@
import Component from "@ember/component";
+import ValueList from "admin/components/value-list";
-export default class UrlList extends Component {}
-
-<ValueList @values={{this.value}} @addKey="admin.site_settings.add_url" />
\ No newline at end of file
+export default class UrlList extends Component {
+ <template>
+ <ValueList @values={{this.value}} @addKey="admin.site_settings.add_url" />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/site-settings/value-list.gjs b/app/assets/javascripts/admin/addon/components/site-settings/value-list.gjs
index 10b323b564c..7fe4c367ff3 100644
--- a/app/assets/javascripts/admin/addon/components/site-settings/value-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/site-settings/value-list.gjs
@@ -1,5 +1,6 @@
import Component from "@ember/component";
+import ValueList from "admin/components/value-list";
-export default class ValueList extends Component {}
-
-<ValueList @values={{this.value}} />
\ No newline at end of file
+export default class SiteSettingValueList extends Component {
+ <template><ValueList @values={{this.value}} /></template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/staff-actions.gjs b/app/assets/javascripts/admin/addon/components/staff-actions.gjs
index a45ff4b6e70..03eaaf8be0c 100644
--- a/app/assets/javascripts/admin/addon/components/staff-actions.gjs
+++ b/app/assets/javascripts/admin/addon/components/staff-actions.gjs
@@ -1,4 +1,5 @@
import Component from "@ember/component";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { tagName } from "@ember-decorators/component";
import DiscourseURL from "discourse/lib/url";
@@ -21,9 +22,11 @@ export default class StaffActions extends Component {
DiscourseURL.routeTo(`/t/${dataset.linkTopicId}`);
}
}
-}
-{{! template-lint-disable no-invalid-interactive }}
-<div class="table staff-actions" {{on "click" this.openLinks}}>
- {{yield}}
-</div>
\ No newline at end of file
+ <template>
+ {{! template-lint-disable no-invalid-interactive }}
+ <div class="table staff-actions" {{on "click" this.openLinks}}>
+ {{yield}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/theme-settings-editor.gjs b/app/assets/javascripts/admin/addon/components/theme-settings-editor.gjs
index cd9c24b827f..72bfdc87889 100644
--- a/app/assets/javascripts/admin/addon/components/theme-settings-editor.gjs
+++ b/app/assets/javascripts/admin/addon/components/theme-settings-editor.gjs
@@ -1,7 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import AceEditor from "discourse/components/ace-editor";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
export default class ThemeSettingsEditor extends Component {
@@ -204,32 +208,34 @@ export default class ThemeSettingsEditor extends Component {
changedSetting.value
);
}
-}
-<div class="settings-editor">
- <div>
- <AceEditor
- @content={{this.editedContent}}
- @onChange={{fn (mut this.editedContent)}}
- @mode="html"
- />
-
- {{#each this.errors as |error|}}
- <div class="validation-error">
- {{d-icon "xmark"}}
- <b>{{error.setting}}</b>:
- {{error.errorMessage}}
+ <template>
+ <div class="settings-editor">
+ <div>
+ <AceEditor
+ @content={{this.editedContent}}
+ @onChange={{fn (mut this.editedContent)}}
+ @mode="html"
+ />
+
+ {{#each this.errors as |error|}}
+ <div class="validation-error">
+ {{icon "xmark"}}
+ <b>{{error.setting}}</b>:
+ {{error.errorMessage}}
+ </div>
+ {{/each}}
+ </div>
+
+ <div class="buttons">
+ <DButton
+ @action={{this.save}}
+ id="save"
+ class="btn-primary save"
+ @disabled={{this.saveButtonDisabled}}
+ @translatedLabel={{i18n "admin.customize.theme.save"}}
+ />
</div>
- {{/each}}
- </div>
-
- <div class="buttons">
- <DButton
- @action={{this.save}}
- id="save"
- class="btn-primary save"
- @disabled={{this.saveButtonDisabled}}
- @translatedLabel={{i18n "admin.customize.theme.save"}}
- />
- </div>
-</div>
\ No newline at end of file
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/theme-upload-add.gjs b/app/assets/javascripts/admin/addon/components/theme-upload-add.gjs
index feac7228073..5905bd4b14d 100644
--- a/app/assets/javascripts/admin/addon/components/theme-upload-add.gjs
+++ b/app/assets/javascripts/admin/addon/components/theme-upload-add.gjs
@@ -1,7 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { isEmpty } from "@ember/utils";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
@@ -112,52 +116,54 @@ export default class ThemeUploadAdd extends Component {
this.flash = extractError(e);
}
}
-}
-<DModal
- class="add-upload-modal"
- @title={{i18n "admin.customize.theme.add_upload"}}
- @closeModal={{@closeModal}}
- @flash={{this.flash}}
->
- <:body>
- <div class="inputs">
- <section class="field">
- <input
- {{on "change" this.updateName}}
- type="file"
- id="file-input"
- accept="*"
+ <template>
+ <DModal
+ class="add-upload-modal"
+ @title={{i18n "admin.customize.theme.add_upload"}}
+ @closeModal={{@closeModal}}
+ @flash={{this.flash}}
+ >
+ <:body>
+ <div class="inputs">
+ <section class="field">
+ <input
+ {{on "change" this.updateName}}
+ type="file"
+ id="file-input"
+ accept="*"
+ />
+ <label for="file-input">
+ {{i18n "admin.customize.theme.upload_file_tip"}}
+ </label>
+ </section>
+ <section class="field">
+ <label for="theme-variable-name">
+ {{i18n "admin.customize.theme.variable_name"}}
+ </label>
+ <Input id="theme-variable-name" @value={{this.name}} />
+ </section>
+ {{#if this.fileSelected}}
+ {{#if this.errorMessage}}
+ <span class="alert alert-error">{{this.errorMessage}}</span>
+ {{/if}}
+ {{/if}}
+ </div>
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.upload}}
+ @disabled={{this.disabled}}
+ @icon="upload"
+ @label="admin.customize.theme.upload"
+ class="btn-primary"
+ />
+ <DButton
+ @action={{@closeModal}}
+ @label="cancel"
+ class="btn-transparent d-modal-cancel"
/>
- <label for="file-input">
- {{i18n "admin.customize.theme.upload_file_tip"}}
- </label>
- </section>
- <section class="field">
- <label for="theme-variable-name">
- {{i18n "admin.customize.theme.variable_name"}}
- </label>
- <Input id="theme-variable-name" @value={{this.name}} />
- </section>
- {{#if this.fileSelected}}
- {{#if this.errorMessage}}
- <span class="alert alert-error">{{this.errorMessage}}</span>
- {{/if}}
- {{/if}}
- </div>
- </:body>
- <:footer>
- <DButton
- @action={{this.upload}}
- @disabled={{this.disabled}}
- @icon="upload"
- @label="admin.customize.theme.upload"
- class="btn-primary"
- />
- <DButton
- @action={{@closeModal}}
- @label="cancel"
- class="btn-transparent d-modal-cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/themes-list.gjs b/app/assets/javascripts/admin/addon/components/themes-list.gjs
index 33f28d0f061..ec0b0b3c74f 100644
--- a/app/assets/javascripts/admin/addon/components/themes-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/themes-list.gjs
@@ -1,12 +1,23 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { equal, gt, gte } from "@ember/object/computed";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import DeleteThemesConfirm from "discourse/components/modal/delete-themes-confirm";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
import discourseComputed, { bind } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import ThemesListItem from "admin/components/themes-list-item";
import { COMPONENTS, THEMES } from "admin/models/theme";
+import ComboBox from "select-kit/components/combo-box";
+import and from "truth-helpers/helpers/and";
+import eq from "truth-helpers/helpers/eq";
+import not from "truth-helpers/helpers/not";
+import or from "truth-helpers/helpers/or";
const ALL_FILTER = "all";
const ACTIVE_FILTER = "active";
@@ -262,143 +273,149 @@ export default class ThemesList extends Component {
},
});
}
-}
-<div class="themes-list-header">
- <DButton
- @action={{fn this.changeView this.THEMES}}
- @label="admin.customize.theme.title"
- class={{concat-class "themes-tab" "tab" (if this.themesTabActive "active")}}
- />
- <DButton
- @action={{fn this.changeView this.COMPONENTS}}
- @label="admin.customize.theme.components"
- @icon="puzzle-piece"
- class={{concat-class
- "components-tab"
- "tab"
- (if this.componentsTabActive "active")
- }}
- />
-</div>
-
-{{#if this.showSearchAndFilter}}
- <div class="themes-list-search">
- <Input
- class="themes-list-search__input"
- placeholder={{i18n "admin.customize.theme.search_placeholder"}}
- autocomplete="off"
- @type="search"
- @value={{mut this.searchTerm}}
- />
- {{d-icon "magnifying-glass"}}
- </div>
- <div class="themes-list-filter">
- <div class="themes-list-filter__label">
- {{i18n "admin.customize.theme.filter_by"}}
+ <template>
+ <div class="themes-list-header">
+ <DButton
+ @action={{fn this.changeView this.THEMES}}
+ @label="admin.customize.theme.title"
+ class={{concatClass
+ "themes-tab"
+ "tab"
+ (if this.themesTabActive "active")
+ }}
+ />
+ <DButton
+ @action={{fn this.changeView this.COMPONENTS}}
+ @label="admin.customize.theme.components"
+ @icon="puzzle-piece"
+ class={{concatClass
+ "components-tab"
+ "tab"
+ (if this.componentsTabActive "active")
+ }}
+ />
</div>
- <ComboBox
- @content={{this.selectableFilters}}
- @value={{this.filter}}
- class="themes-list-filter__input"
- />
- </div>
-{{/if}}
-<div class="themes-list-container">
- {{#if this.hasThemes}}
- {{#if (and this.hasActiveThemes (not this.inactiveFilter))}}
- {{#each this.activeThemes as |theme|}}
- <ThemesListItem
- @theme={{theme}}
- @navigateToTheme={{fn this.navigateToTheme theme}}
+
+ {{#if this.showSearchAndFilter}}
+ <div class="themes-list-search">
+ <Input
+ class="themes-list-search__input"
+ placeholder={{i18n "admin.customize.theme.search_placeholder"}}
+ autocomplete="off"
+ @type="search"
+ @value={{mut this.searchTerm}}
/>
- {{/each}}
-
- {{#if (and this.hasInactiveThemes (not this.activeFilter))}}
- <div class="themes-list-container__item inactive-indicator">
- <span class="empty">
- <div class="info">
- {{#if this.selectInactiveMode}}
- <Input
- @type="checkbox"
- @checked={{or
- (eq this.allInactiveSelected true)
- (eq this.someInactiveSelected true)
- }}
- class="toggle-all-inactive"
- indeterminate={{this.someInactiveSelected}}
- {{on "click" this.toggleAllInactive}}
- />
- {{else}}
- <DButton
- class="btn-transparent select-inactive-mode"
- @action={{this.toggleInactiveMode}}
- >
- {{d-icon "list"}}
- </DButton>
- {{/if}}
- {{#if this.selectInactiveMode}}
- <span class="select-inactive-mode-label">
- {{i18n
- "admin.customize.theme.selected"
- count=this.selectedCount
- }}
- </span>
- {{else if this.themesTabActive}}
- <span class="header">
- {{i18n "admin.customize.theme.inactive_themes"}}
- </span>
- {{else}}
- <span class="header">
- {{i18n "admin.customize.theme.inactive_components"}}
- </span>
- {{/if}}
-
- {{#if this.selectInactiveMode}}
- <a
- href
- {{on "click" this.toggleInactiveMode}}
- class="cancel-select-inactive-mode"
- >
- {{i18n "admin.customize.theme.cancel"}}
- </a>
- <DButton
- class="btn btn-delete"
- @action={{this.deleteConfirmation}}
- @disabled={{eq this.selectedCount 0}}
- >
- {{d-icon "trash-can"}}
- Delete
- </DButton>
- {{/if}}
+ {{icon "magnifying-glass"}}
+ </div>
+ <div class="themes-list-filter">
+ <div class="themes-list-filter__label">
+ {{i18n "admin.customize.theme.filter_by"}}
+ </div>
+ <ComboBox
+ @content={{this.selectableFilters}}
+ @value={{this.filter}}
+ class="themes-list-filter__input"
+ />
+ </div>
+ {{/if}}
+ <div class="themes-list-container">
+ {{#if this.hasThemes}}
+ {{#if (and this.hasActiveThemes (not this.inactiveFilter))}}
+ {{#each this.activeThemes as |theme|}}
+ <ThemesListItem
+ @theme={{theme}}
+ @navigateToTheme={{fn this.navigateToTheme theme}}
+ />
+ {{/each}}
+
+ {{#if (and this.hasInactiveThemes (not this.activeFilter))}}
+ <div class="themes-list-container__item inactive-indicator">
+ <span class="empty">
+ <div class="info">
+ {{#if this.selectInactiveMode}}
+ <Input
+ @type="checkbox"
+ @checked={{or
+ (eq this.allInactiveSelected true)
+ (eq this.someInactiveSelected true)
+ }}
+ class="toggle-all-inactive"
+ indeterminate={{this.someInactiveSelected}}
+ {{on "click" this.toggleAllInactive}}
+ />
+ {{else}}
+ <DButton
+ class="btn-transparent select-inactive-mode"
+ @action={{this.toggleInactiveMode}}
+ >
+ {{icon "list"}}
+ </DButton>
+ {{/if}}
+ {{#if this.selectInactiveMode}}
+ <span class="select-inactive-mode-label">
+ {{i18n
+ "admin.customize.theme.selected"
+ count=this.selectedCount
+ }}
+ </span>
+ {{else if this.themesTabActive}}
+ <span class="header">
+ {{i18n "admin.customize.theme.inactive_themes"}}
+ </span>
+ {{else}}
+ <span class="header">
+ {{i18n "admin.customize.theme.inactive_components"}}
+ </span>
+ {{/if}}
+
+ {{#if this.selectInactiveMode}}
+ <a
+ href
+ {{on "click" this.toggleInactiveMode}}
+ class="cancel-select-inactive-mode"
+ >
+ {{i18n "admin.customize.theme.cancel"}}
+ </a>
+ <DButton
+ class="btn btn-delete"
+ @action={{this.deleteConfirmation}}
+ @disabled={{eq this.selectedCount 0}}
+ >
+ {{icon "trash-can"}}
+ Delete
+ </DButton>
+ {{/if}}
+ </div>
+ </span>
</div>
- </span>
+ {{/if}}
+ {{/if}}
+
+ {{#if (and this.hasInactiveThemes (not this.activeFilter))}}
+ {{#each this.inactiveThemes as |theme|}}
+ <ThemesListItem
+ class="inactive-theme"
+ @theme={{theme}}
+ @navigateToTheme={{fn this.navigateToTheme theme}}
+ @selectInactiveMode={{this.selectInactiveMode}}
+ />
+ {{/each}}
+ {{/if}}
+ {{else}}
+ <div class="themes-list-container__item">
+ <span class="empty">{{i18n "admin.customize.theme.empty"}}</span>
</div>
{{/if}}
- {{/if}}
+ </div>
- {{#if (and this.hasInactiveThemes (not this.activeFilter))}}
- {{#each this.inactiveThemes as |theme|}}
- <ThemesListItem
- class="inactive-theme"
- @theme={{theme}}
- @navigateToTheme={{fn this.navigateToTheme theme}}
- @selectInactiveMode={{this.selectInactiveMode}}
- />
- {{/each}}
- {{/if}}
- {{else}}
- <div class="themes-list-container__item">
- <span class="empty">{{i18n "admin.customize.theme.empty"}}</span>
+ <div class="create-actions">
+ <DButton
+ @action={{this.installModal}}
+ @icon="upload"
+ @label="admin.customize.install"
+ class="btn-primary"
+ />
</div>
- {{/if}}
-</div>
-
-<div class="create-actions">
- <DButton
- @action={{this.installModal}}
- @icon="upload"
- @label="admin.customize.install"
- class="btn-primary"
- />
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/value-list.gjs b/app/assets/javascripts/admin/addon/components/value-list.gjs
index 1c345f87172..297b0183738 100644
--- a/app/assets/javascripts/admin/addon/components/value-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/value-list.gjs
@@ -1,9 +1,13 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { empty, reads } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
import { makeArray } from "discourse/lib/helpers";
+import ComboBox from "select-kit/components/combo-box";
@classNames("value-list")
export default class ValueList extends Component {
@@ -140,47 +144,49 @@ export default class ValueList extends Component {
return [];
}
}
-}
-{{#if this.collection}}
- <div class="values">
- {{#each this.collection as |value index|}}
- <div data-index={{index}} class="value">
- <DButton
- @action={{fn this.removeValue value}}
- @icon="xmark"
- class="btn-default remove-value-btn btn-small"
- />
-
- <Input
- title={{value}}
- @value={{value}}
- class="value-input"
- {{on "focusout" (fn this.changeValue index)}}
- />
-
- {{#if this.showUpDownButtons}}
- <DButton
- @action={{fn this.shift -1 index}}
- @icon="arrow-up"
- class="btn-default shift-up-value-btn btn-small"
- />
- <DButton
- @action={{fn this.shift 1 index}}
- @icon="arrow-down"
- class="btn-default shift-down-value-btn btn-small"
- />
- {{/if}}
+ <template>
+ {{#if this.collection}}
+ <div class="values">
+ {{#each this.collection as |value index|}}
+ <div data-index={{index}} class="value">
+ <DButton
+ @action={{fn this.removeValue value}}
+ @icon="xmark"
+ class="btn-default remove-value-btn btn-small"
+ />
+
+ <Input
+ title={{value}}
+ @value={{value}}
+ class="value-input"
+ {{on "focusout" (fn this.changeValue index)}}
+ />
+
+ {{#if this.showUpDownButtons}}
+ <DButton
+ @action={{fn this.shift -1 index}}
+ @icon="arrow-up"
+ class="btn-default shift-up-value-btn btn-small"
+ />
+ <DButton
+ @action={{fn this.shift 1 index}}
+ @icon="arrow-down"
+ class="btn-default shift-down-value-btn btn-small"
+ />
+ {{/if}}
+ </div>
+ {{/each}}
</div>
- {{/each}}
- </div>
-{{/if}}
-
-<ComboBox
- @valueProperty={{null}}
- @nameProperty={{null}}
- @value={{this.newValue}}
- @content={{this.filteredChoices}}
- @onChange={{this.selectChoice}}
- @options={{hash allowAny=true none=this.noneKey}}
-/>
\ No newline at end of file
+ {{/if}}
+
+ <ComboBox
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @value={{this.newValue}}
+ @content={{this.filteredChoices}}
+ @onChange={{this.selectChoice}}
+ @options={{hash allowAny=true none=this.noneKey}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/version-checks.gjs b/app/assets/javascripts/admin/addon/components/version-checks.gjs
index 2593c7c60b9..ad947d9b079 100644
--- a/app/assets/javascripts/admin/addon/components/version-checks.gjs
+++ b/app/assets/javascripts/admin/addon/components/version-checks.gjs
@@ -1,149 +1,157 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
+import CustomHtml from "discourse/components/custom-html";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import dashIfEmpty from "discourse/helpers/dash-if-empty";
+import { i18n } from "discourse-i18n";
-export default class VersionChecks extends Component {}
-
-<div class="section-title">
- <h2>
- {{i18n "admin.dashboard.version"}}
- </h2>
-</div>
-
-<div
- class="dashboard-stats version-check
- {{if this.versionCheck.critical_updates 'critical' 'normal'}}"
->
- <div class="version-number">
- <h4>
- {{i18n "admin.dashboard.installed_version"}}
- </h4>
- <h3>
- {{dash-if-empty this.versionCheck.installed_version}}
- </h3>
- {{#if this.versionCheck.gitLink}}
- <div class="sha-link">
- (
- <a
- href={{this.versionCheck.gitLink}}
- rel="noopener noreferrer"
- target="_blank"
- >
- {{this.versionCheck.shortSha}}
- </a>
- )
- </div>
- {{/if}}
- </div>
- {{#if this.versionCheck.noCheckPerformed}}
- <div class="version-number">
- <h4>
- {{i18n "admin.dashboard.latest_version"}}
- </h4>
- <h3>
- —
- </h3>
- </div>
- <div class="version-status">
- <div class="face">
- <span class="icon critical-updates-available">
- {{d-icon "far-face-frown"}}
- </span>
- </div>
- <div class="version-notes">
- <span class="normal-note">
- {{i18n "admin.dashboard.no_check_performed"}}
- </span>
- </div>
+export default class VersionChecks extends Component {
+ <template>
+ <div class="section-title">
+ <h2>
+ {{i18n "admin.dashboard.version"}}
+ </h2>
</div>
- {{else if this.versionCheck.stale_data}}
- <div class="version-number">
- <h4>
- {{i18n "admin.dashboard.latest_version"}}
- </h4>
- <h3>
- {{#if this.versionCheck.version_check_pending}}
- {{dash-if-empty this.versionCheck.installed_version}}
- {{/if}}
- </h3>
- </div>
- <div class="version-status">
- <div class="face">
- {{#if this.versionCheck.version_check_pending}}
- <span class="icon up-to-date">
- {{d-icon "far-face-smile"}}
- </span>
- {{else}}
- <span class="icon critical-updates-available">
- {{d-icon "far-face-frown"}}
- </span>
+
+ <div
+ class="dashboard-stats version-check
+ {{if this.versionCheck.critical_updates 'critical' 'normal'}}"
+ >
+ <div class="version-number">
+ <h4>
+ {{i18n "admin.dashboard.installed_version"}}
+ </h4>
+ <h3>
+ {{dashIfEmpty this.versionCheck.installed_version}}
+ </h3>
+ {{#if this.versionCheck.gitLink}}
+ <div class="sha-link">
+ (
+ <a
+ href={{this.versionCheck.gitLink}}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ {{this.versionCheck.shortSha}}
+ </a>
+ )
+ </div>
{{/if}}
</div>
- <div class="version-notes">
- <span class="normal-note">
- {{#if this.versionCheck.version_check_pending}}
- {{i18n "admin.dashboard.version_check_pending"}}
- {{else}}
- {{i18n "admin.dashboard.stale_data"}}
- {{/if}}
- </span>
- </div>
- </div>
- {{else}}
- <div class="version-number">
- <h4>
- {{i18n "admin.dashboard.latest_version"}}
- </h4>
- <h3>
- {{dash-if-empty this.versionCheck.latest_version}}
- </h3>
- </div>
- <div class="version-status">
- <div class="face">
- {{#if this.versionCheck.upToDate}}
- <span class="icon up-to-date">
- {{d-icon "far-face-smile"}}
- </span>
- {{else}}
- <span
- class="icon
- {{if
- this.versionCheck.critical_updates
- 'critical-updates-available'
- 'updates-available'
- }}"
- >
- {{#if this.versionCheck.behindByOneVersion}}
- {{d-icon "far-face-meh"}}
+ {{#if this.versionCheck.noCheckPerformed}}
+ <div class="version-number">
+ <h4>
+ {{i18n "admin.dashboard.latest_version"}}
+ </h4>
+ <h3>
+ —
+ </h3>
+ </div>
+ <div class="version-status">
+ <div class="face">
+ <span class="icon critical-updates-available">
+ {{icon "far-face-frown"}}
+ </span>
+ </div>
+ <div class="version-notes">
+ <span class="normal-note">
+ {{i18n "admin.dashboard.no_check_performed"}}
+ </span>
+ </div>
+ </div>
+ {{else if this.versionCheck.stale_data}}
+ <div class="version-number">
+ <h4>
+ {{i18n "admin.dashboard.latest_version"}}
+ </h4>
+ <h3>
+ {{#if this.versionCheck.version_check_pending}}
+ {{dashIfEmpty this.versionCheck.installed_version}}
+ {{/if}}
+ </h3>
+ </div>
+ <div class="version-status">
+ <div class="face">
+ {{#if this.versionCheck.version_check_pending}}
+ <span class="icon up-to-date">
+ {{icon "far-face-smile"}}
+ </span>
{{else}}
- {{d-icon "far-face-frown"}}
+ <span class="icon critical-updates-available">
+ {{icon "far-face-frown"}}
+ </span>
{{/if}}
- </span>
- {{/if}}
- </div>
- <div class="version-notes">
- {{#if this.versionCheck.upToDate}}
- {{i18n "admin.dashboard.up_to_date"}}
- {{else}}
- <span class="critical-note">
- {{i18n "admin.dashboard.critical_available"}}
- </span>
- <span class="normal-note">
- {{i18n "admin.dashboard.updates_available"}}
- </span>
- {{i18n "admin.dashboard.please_update"}}
- {{/if}}
- </div>
- </div>
- {{/if}}
+ </div>
+ <div class="version-notes">
+ <span class="normal-note">
+ {{#if this.versionCheck.version_check_pending}}
+ {{i18n "admin.dashboard.version_check_pending"}}
+ {{else}}
+ {{i18n "admin.dashboard.stale_data"}}
+ {{/if}}
+ </span>
+ </div>
+ </div>
+ {{else}}
+ <div class="version-number">
+ <h4>
+ {{i18n "admin.dashboard.latest_version"}}
+ </h4>
+ <h3>
+ {{dashIfEmpty this.versionCheck.latest_version}}
+ </h3>
+ </div>
+ <div class="version-status">
+ <div class="face">
+ {{#if this.versionCheck.upToDate}}
+ <span class="icon up-to-date">
+ {{icon "far-face-smile"}}
+ </span>
+ {{else}}
+ <span
+ class="icon
+ {{if
+ this.versionCheck.critical_updates
+ 'critical-updates-available'
+ 'updates-available'
+ }}"
+ >
+ {{#if this.versionCheck.behindByOneVersion}}
+ {{icon "far-face-meh"}}
+ {{else}}
+ {{icon "far-face-frown"}}
+ {{/if}}
+ </span>
+ {{/if}}
+ </div>
+ <div class="version-notes">
+ {{#if this.versionCheck.upToDate}}
+ {{i18n "admin.dashboard.up_to_date"}}
+ {{else}}
+ <span class="critical-note">
+ {{i18n "admin.dashboard.critical_available"}}
+ </span>
+ <span class="normal-note">
+ {{i18n "admin.dashboard.updates_available"}}
+ </span>
+ {{i18n "admin.dashboard.please_update"}}
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
- <CustomHtml
- @name="update-header"
- @versionCheck={{this.versionCheck}}
- @tagName="div"
- @classNames="update-header"
- />
+ <CustomHtml
+ @name="update-header"
+ @versionCheck={{this.versionCheck}}
+ @tagName="div"
+ @classNames="update-header"
+ />
- <PluginOutlet
- @name="admin-upgrade-header"
- @outletArgs={{hash versionCheck=this.versionCheck}}
- />
-</div>
\ No newline at end of file
+ <PluginOutlet
+ @name="admin-upgrade-header"
+ @outletArgs={{hash versionCheck=this.versionCheck}}
+ />
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/watched-word-form.gjs b/app/assets/javascripts/admin/addon/components/watched-word-form.gjs
index b15ec3d5466..95101c1410a 100644
--- a/app/assets/javascripts/admin/addon/components/watched-word-form.gjs
+++ b/app/assets/javascripts/admin/addon/components/watched-word-form.gjs
@@ -1,14 +1,19 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { empty, equal } from "@ember/object/computed";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { classNames, tagName } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
import WatchedWord from "admin/models/watched-word";
+import TagChooser from "select-kit/components/tag-chooser";
+import WatchedWords from "select-kit/components/watched-words";
@tagName("form")
@classNames("watched-word-form")
@@ -127,109 +132,113 @@ export default class WatchedWordForm extends Component {
.finally(this.set("formSubmitted", false));
}
}
-}
-<div class="watched-word-input">
- <label for="watched-word">{{i18n "admin.watched_words.form.label"}}</label>
- <WatchedWords
- @id="watched-words"
- @value={{this.words}}
- @onChange={{fn (mut this.words)}}
- @options={{hash
- filterPlaceholder=this.placeholderKey
- disabled=this.formSubmitted
- }}
- />
-</div>
-
-{{#if this.canReplace}}
- <div class="watched-word-input">
- <label for="watched-replacement">{{i18n
- "admin.watched_words.form.replace_label"
- }}</label>
- <TextField
- @id="watched-replacement"
- @value={{this.replacement}}
- @disabled={{this.formSubmitted}}
- @autocorrect="off"
- @autocapitalize="off"
- @placeholderKey="admin.watched_words.form.replace_placeholder"
- class="watched-word-input-field"
- />
- </div>
-{{/if}}
-
-{{#if this.canTag}}
- <div class="watched-word-input">
- <label for="watched-tag">{{i18n
- "admin.watched_words.form.tag_label"
- }}</label>
- <TagChooser
- @id="watched-tag"
- @tags={{this.selectedTags}}
- @onChange={{this.changeSelectedTags}}
- @everyTag={{true}}
- @options={{hash allowAny=true disabled=this.formSubmitted}}
- class="watched-word-input-field"
- />
- </div>
-{{/if}}
-
-{{#if this.canLink}}
- <div class="watched-word-input">
- <label for="watched-link">{{i18n
- "admin.watched_words.form.link_label"
- }}</label>
- <TextField
- @id="watched-link"
- @value={{this.replacement}}
- @disabled={{this.formSubmitted}}
- @autocorrect="off"
- @autocapitalize="off"
- @placeholderKey="admin.watched_words.form.link_placeholder"
- class="watched-word-input-field"
- />
- </div>
-{{/if}}
-
-<div class="watched-word-input">
- <label for="watched-case-sensitivity">{{i18n
- "admin.watched_words.form.case_sensitivity_label"
- }}</label>
- <label class="case-sensitivity-checkbox checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.isCaseSensitive}}
- disabled={{this.formSubmitted}}
- />
- {{i18n "admin.watched_words.form.case_sensitivity_description"}}
- </label>
-</div>
-
-{{#if this.canReplace}}
- <div class="watched-word-input">
- <label for="watched-html">{{i18n
- "admin.watched_words.form.html_label"
- }}</label>
- <label class="html-checkbox checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.isHtml}}
- disabled={{this.formSubmitted}}
+ <template>
+ <div class="watched-word-input">
+ <label for="watched-word">{{i18n
+ "admin.watched_words.form.label"
+ }}</label>
+ <WatchedWords
+ @id="watched-words"
+ @value={{this.words}}
+ @onChange={{fn (mut this.words)}}
+ @options={{hash
+ filterPlaceholder=this.placeholderKey
+ disabled=this.formSubmitted
+ }}
/>
- {{i18n "admin.watched_words.form.html_description"}}
- </label>
- </div>
-{{/if}}
-
-<DButton
- @action={{this.submitForm}}
- @disabled={{this.submitDisabled}}
- @label="admin.watched_words.form.add"
- type="submit"
- class="btn-primary"
-/>
-
-{{#if this.showMessage}}
- <span class="success-message">{{this.message}}</span>
-{{/if}}
\ No newline at end of file
+ </div>
+
+ {{#if this.canReplace}}
+ <div class="watched-word-input">
+ <label for="watched-replacement">{{i18n
+ "admin.watched_words.form.replace_label"
+ }}</label>
+ <TextField
+ @id="watched-replacement"
+ @value={{this.replacement}}
+ @disabled={{this.formSubmitted}}
+ @autocorrect="off"
+ @autocapitalize="off"
+ @placeholderKey="admin.watched_words.form.replace_placeholder"
+ class="watched-word-input-field"
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.canTag}}
+ <div class="watched-word-input">
+ <label for="watched-tag">{{i18n
+ "admin.watched_words.form.tag_label"
+ }}</label>
+ <TagChooser
+ @id="watched-tag"
+ @tags={{this.selectedTags}}
+ @onChange={{this.changeSelectedTags}}
+ @everyTag={{true}}
+ @options={{hash allowAny=true disabled=this.formSubmitted}}
+ class="watched-word-input-field"
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.canLink}}
+ <div class="watched-word-input">
+ <label for="watched-link">{{i18n
+ "admin.watched_words.form.link_label"
+ }}</label>
+ <TextField
+ @id="watched-link"
+ @value={{this.replacement}}
+ @disabled={{this.formSubmitted}}
+ @autocorrect="off"
+ @autocapitalize="off"
+ @placeholderKey="admin.watched_words.form.link_placeholder"
+ class="watched-word-input-field"
+ />
+ </div>
+ {{/if}}
+
+ <div class="watched-word-input">
+ <label for="watched-case-sensitivity">{{i18n
+ "admin.watched_words.form.case_sensitivity_label"
+ }}</label>
+ <label class="case-sensitivity-checkbox checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.isCaseSensitive}}
+ disabled={{this.formSubmitted}}
+ />
+ {{i18n "admin.watched_words.form.case_sensitivity_description"}}
+ </label>
+ </div>
+
+ {{#if this.canReplace}}
+ <div class="watched-word-input">
+ <label for="watched-html">{{i18n
+ "admin.watched_words.form.html_label"
+ }}</label>
+ <label class="html-checkbox checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.isHtml}}
+ disabled={{this.formSubmitted}}
+ />
+ {{i18n "admin.watched_words.form.html_description"}}
+ </label>
+ </div>
+ {{/if}}
+
+ <DButton
+ @action={{this.submitForm}}
+ @disabled={{this.submitDisabled}}
+ @label="admin.watched_words.form.add"
+ type="submit"
+ class="btn-primary"
+ />
+
+ {{#if this.showMessage}}
+ <span class="success-message">{{this.message}}</span>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/watched-word-uploader.gjs b/app/assets/javascripts/admin/addon/components/watched-word-uploader.gjs
index 407b165beb7..a31d8401f1f 100644
--- a/app/assets/javascripts/admin/addon/components/watched-word-uploader.gjs
+++ b/app/assets/javascripts/admin/addon/components/watched-word-uploader.gjs
@@ -1,8 +1,10 @@
import Component from "@ember/component";
import { alias } from "@ember/object/computed";
import { getOwner } from "@ember/owner";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
+import icon from "discourse/helpers/d-icon";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import { i18n } from "discourse-i18n";
@@ -26,15 +28,17 @@ export default class WatchedWordUploader extends Component {
});
@alias("uppyUpload.uploading") addDisabled;
-}
-<label class="btn btn-default {{if this.addDisabled 'disabled'}}">
- {{d-icon "upload"}}
- {{i18n "admin.watched_words.form.upload"}}
- <input
- {{did-insert this.uppyUpload.setup}}
- class="hidden-upload-field"
- disabled={{this.addDisabled}}
- type="file"
- />
-</label>
\ No newline at end of file
+ <template>
+ <label class="btn btn-default {{if this.addDisabled 'disabled'}}">
+ {{icon "upload"}}
+ {{i18n "admin.watched_words.form.upload"}}
+ <input
+ {{didInsert this.uppyUpload.setup}}
+ class="hidden-upload-field"
+ disabled={{this.addDisabled}}
+ type="file"
+ />
+ </label>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/webhook-event-chooser.gjs b/app/assets/javascripts/admin/addon/components/webhook-event-chooser.gjs
index 0999d8c4dd9..4c8d9cba643 100644
--- a/app/assets/javascripts/admin/addon/components/webhook-event-chooser.gjs
+++ b/app/assets/javascripts/admin/addon/components/webhook-event-chooser.gjs
@@ -1,4 +1,5 @@
import Component from "@glimmer/component";
+import { Input } from "@ember/component";
import { i18n } from "discourse-i18n";
export default class WebhookEventChooser extends Component {
@@ -34,9 +35,11 @@ export default class WebhookEventChooser extends Component {
);
}
}
-}
-<label class="hook-event">
- <Input @type="checkbox" @checked={{this.enabled}} name="event-choice" />
- {{this.details}}
-</label>
\ No newline at end of file
+ <template>
+ <label class="hook-event">
+ <Input @type="checkbox" @checked={{this.enabled}} name="event-choice" />
+ {{this.details}}
+ </label>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/webhook-event.gjs b/app/assets/javascripts/admin/addon/components/webhook-event.gjs
index 25361b5c4e6..9bab0ed4d89 100644
--- a/app/assets/javascripts/admin/addon/components/webhook-event.gjs
+++ b/app/assets/javascripts/admin/addon/components/webhook-event.gjs
@@ -2,6 +2,8 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ensureJSON, plainJSON, prettyJSON } from "discourse/lib/formatter";
@@ -99,48 +101,50 @@ export default class WebhookEvent extends Component {
this.expandDetails = null;
}
}
-}
-<li>
- <div class="col first status">
- {{#if @event.redelivering}}
- {{d-icon "arrows-rotate"}}
- {{else}}
- <span class={{this.statusColorClasses}}>{{@event.status}}</span>
- {{/if}}
- </div>
-
- <div class="col event-id">{{@event.id}}</div>
-
- <div class="col timestamp">{{this.createdAt}}</div>
-
- <div class="col completion">{{this.completion}}</div>
-
- <div class="col actions">
- <DButton
- @icon={{this.expandRequestIcon}}
- @action={{this.toggleRequest}}
- @label="admin.web_hooks.events.request"
- />
- <DButton
- @icon={{this.expandResponseIcon}}
- @action={{this.toggleResponse}}
- @label="admin.web_hooks.events.response"
- />
- <DButton
- @icon="arrows-rotate"
- @action={{this.redeliver}}
- @label="admin.web_hooks.events.redeliver"
- />
- </div>
-
- {{#if this.expandDetails}}
- <div class="details">
- <h3>{{i18n "admin.web_hooks.events.headers"}}</h3>
- <pre><code>{{this.headers}}</code></pre>
-
- <h3>{{this.bodyLabel}}</h3>
- <pre><code>{{this.body}}</code></pre>
- </div>
- {{/if}}
-</li>
\ No newline at end of file
+ <template>
+ <li>
+ <div class="col first status">
+ {{#if @event.redelivering}}
+ {{icon "arrows-rotate"}}
+ {{else}}
+ <span class={{this.statusColorClasses}}>{{@event.status}}</span>
+ {{/if}}
+ </div>
+
+ <div class="col event-id">{{@event.id}}</div>
+
+ <div class="col timestamp">{{this.createdAt}}</div>
+
+ <div class="col completion">{{this.completion}}</div>
+
+ <div class="col actions">
+ <DButton
+ @icon={{this.expandRequestIcon}}
+ @action={{this.toggleRequest}}
+ @label="admin.web_hooks.events.request"
+ />
+ <DButton
+ @icon={{this.expandResponseIcon}}
+ @action={{this.toggleResponse}}
+ @label="admin.web_hooks.events.response"
+ />
+ <DButton
+ @icon="arrows-rotate"
+ @action={{this.redeliver}}
+ @label="admin.web_hooks.events.redeliver"
+ />
+ </div>
+
+ {{#if this.expandDetails}}
+ <div class="details">
+ <h3>{{i18n "admin.web_hooks.events.headers"}}</h3>
+ <pre><code>{{this.headers}}</code></pre>
+
+ <h3>{{this.bodyLabel}}</h3>
+ <pre><code>{{this.body}}</code></pre>
+ </div>
+ {{/if}}
+ </li>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/components/webhook-events.gjs b/app/assets/javascripts/admin/addon/components/webhook-events.gjs
index 19c8591d662..a7ddd9b809f 100644
--- a/app/assets/javascripts/admin/addon/components/webhook-events.gjs
+++ b/app/assets/javascripts/admin/addon/components/webhook-events.gjs
@@ -1,12 +1,24 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { gt, readOnly } from "@ember/object/computed";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
+import didUpdate from "@ember/render-modifiers/modifiers/did-update";
+import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import CountI18n from "discourse/components/count-i18n";
+import DButton from "discourse/components/d-button";
+import LoadMore from "discourse/components/load-more";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bind } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import WebhookEvent from "admin/components/webhook-event";
+import ComboBox from "select-kit/components/combo-box";
+import not from "truth-helpers/helpers/not";
export default class WebhookEvents extends Component {
@service messageBus;
@@ -185,84 +197,86 @@ export default class WebhookEvents extends Component {
},
});
}
-}
-<div
- class="web-hook-events-listing"
- {{did-insert this.subscribe}}
- {{did-update this.reloadEvents @status}}
- {{will-destroy this.unsubscribe}}
->
- <div class="web-hook-events-actions">
- <ComboBox
- @value={{@status}}
- @content={{this.statuses}}
- @onChange={{fn (mut @status)}}
- @options={{hash none="admin.web_hooks.events.filter_status.all"}}
- class="delivery-status-filters"
- />
-
- <DButton
- @icon="arrows-rotate"
- @label="admin.web_hooks.events.redeliver_failed"
- @action={{this.redeliverFailed}}
- @disabled={{not this.redeliverEnabled}}
- />
-
- <DButton
- @icon="paper-plane"
- @label="admin.web_hooks.events.ping"
- @action={{this.ping}}
- @disabled={{not this.pingEnabled}}
- class="webhook-events__ping-button"
- />
- </div>
-
- {{#if this.events}}
- <LoadMore @selector=".web-hook-events li" @action={{this.loadMore}}>
- <div class="web-hook-events content-list">
- <div class="heading-container">
- <div class="col heading first status">
- {{i18n "admin.web_hooks.events.status"}}
- </div>
- <div class="col heading event-id">
- {{i18n "admin.web_hooks.events.event_id"}}
- </div>
- <div class="col heading timestamp">
- {{i18n "admin.web_hooks.events.timestamp"}}
- </div>
- <div class="col heading completion">
- {{i18n "admin.web_hooks.events.completion"}}
- </div>
- <div class="col heading actions">
- {{i18n "admin.web_hooks.events.actions"}}
- </div>
- </div>
-
- {{#if this.hasIncoming}}
- <a
- href
- tabindex="0"
- {{on "click" this.showInserted}}
- class="alert alert-info clickable"
- >
- <CountI18n
- @key="admin.web_hooks.events.incoming"
- @count={{this.incomingCount}}
- />
- </a>
- {{/if}}
-
- <ul>
- {{#each this.events as |event|}}
- <WebhookEvent @event={{event}} />
- {{/each}}
- </ul>
+ <template>
+ <div
+ class="web-hook-events-listing"
+ {{didInsert this.subscribe}}
+ {{didUpdate this.reloadEvents @status}}
+ {{willDestroy this.unsubscribe}}
+ >
+ <div class="web-hook-events-actions">
+ <ComboBox
+ @value={{@status}}
+ @content={{this.statuses}}
+ @onChange={{fn (mut @status)}}
+ @options={{hash none="admin.web_hooks.events.filter_status.all"}}
+ class="delivery-status-filters"
+ />
+
+ <DButton
+ @icon="arrows-rotate"
+ @label="admin.web_hooks.events.redeliver_failed"
+ @action={{this.redeliverFailed}}
+ @disabled={{not this.redeliverEnabled}}
+ />
+
+ <DButton
+ @icon="paper-plane"
+ @label="admin.web_hooks.events.ping"
+ @action={{this.ping}}
+ @disabled={{not this.pingEnabled}}
+ class="webhook-events__ping-button"
+ />
</div>
- <ConditionalLoadingSpinner @condition={{this.events.loadingMore}} />
- </LoadMore>
- {{else}}
- <p>{{i18n "admin.web_hooks.events.none"}}</p>
- {{/if}}
-</div>
\ No newline at end of file
+ {{#if this.events}}
+ <LoadMore @selector=".web-hook-events li" @action={{this.loadMore}}>
+ <div class="web-hook-events content-list">
+ <div class="heading-container">
+ <div class="col heading first status">
+ {{i18n "admin.web_hooks.events.status"}}
+ </div>
+ <div class="col heading event-id">
+ {{i18n "admin.web_hooks.events.event_id"}}
+ </div>
+ <div class="col heading timestamp">
+ {{i18n "admin.web_hooks.events.timestamp"}}
+ </div>
+ <div class="col heading completion">
+ {{i18n "admin.web_hooks.events.completion"}}
+ </div>
+ <div class="col heading actions">
+ {{i18n "admin.web_hooks.events.actions"}}
+ </div>
+ </div>
+
+ {{#if this.hasIncoming}}
+ <a
+ href
+ tabindex="0"
+ {{on "click" this.showInserted}}
+ class="alert alert-info clickable"
+ >
+ <CountI18n
+ @key="admin.web_hooks.events.incoming"
+ @count={{this.incomingCount}}
+ />
+ </a>
+ {{/if}}
+
+ <ul>
+ {{#each this.events as |event|}}
+ <WebhookEvent @event={{event}} />
+ {{/each}}
+ </ul>
+ </div>
+
+ <ConditionalLoadingSpinner @condition={{this.events.loadingMore}} />
+ </LoadMore>
+ {{else}}
+ <p>{{i18n "admin.web_hooks.events.none"}}</p>
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/admin/addon/templates/admin-badges.gjs b/app/assets/javascripts/admin/addon/templates/admin-badges.gjs
index 1d257fbd164..c1357a1d0c4 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-badges.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-badges.gjs
@@ -1,60 +1,75 @@
-<div class="badges">
- <DPageHeader
- @titleLabel={{i18n "admin.config.badges.title"}}
- @descriptionLabel={{i18n "admin.config.badges.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/understanding-and-using-badges/32540"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/badges"
- @label={{i18n "admin.config.badges.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @route="adminBadges.show"
- @routeModels="new"
- @icon="plus"
- @label="admin.badges.new"
- class="new-badge"
- />
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import BadgeButton from "discourse/components/badge-button";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
- <actions.Default
- @route="adminBadges.award"
- @routeModels="new"
- @icon="upload"
- @label="admin.badges.mass_award.title"
- class="award-badge"
- />
+export default RouteTemplate(
+ <template>
+ <div class="badges">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.badges.title"}}
+ @descriptionLabel={{i18n "admin.config.badges.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/understanding-and-using-badges/32540"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/badges"
+ @label={{i18n "admin.config.badges.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @route="adminBadges.show"
+ @routeModels="new"
+ @icon="plus"
+ @label="admin.badges.new"
+ class="new-badge"
+ />
- <actions.Default
- @action={{routeAction "editGroupings"}}
- @title="admin.badges.group_settings"
- @label="admin.badges.group_settings"
- @icon="gear"
- class="edit-groupings-btn"
- />
- </:actions>
- </DPageHeader>
+ <actions.Default
+ @route="adminBadges.award"
+ @routeModels="new"
+ @icon="upload"
+ @label="admin.badges.mass_award.title"
+ class="award-badge"
+ />
- <div class="admin-container">
- <div class="content-list">
- <ul class="admin-badge-list">
- {{#each this.model as |badge|}}
- <li class="admin-badge-list-item">
- <LinkTo @route={{this.selectedRoute}} @model={{badge.id}}>
- <BadgeButton @badge={{badge}} />
- {{#if badge.newBadge}}
- <span class="list-badge">{{i18n
- "filters.new.lower_title"
- }}</span>
- {{/if}}
- </LinkTo>
- </li>
- {{/each}}
- </ul>
+ <actions.Default
+ @action={{routeAction "editGroupings"}}
+ @title="admin.badges.group_settings"
+ @label="admin.badges.group_settings"
+ @icon="gear"
+ class="edit-groupings-btn"
+ />
+ </:actions>
+ </DPageHeader>
+
+ <div class="admin-container">
+ <div class="content-list">
+ <ul class="admin-badge-list">
+ {{#each @controller.model as |badge|}}
+ <li class="admin-badge-list-item">
+ <LinkTo
+ @route={{@controller.selectedRoute}}
+ @model={{badge.id}}
+ >
+ <BadgeButton @badge={{badge}} />
+ {{#if badge.newBadge}}
+ <span class="list-badge">{{i18n
+ "filters.new.lower_title"
+ }}</span>
+ {{/if}}
+ </LinkTo>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
+ {{outlet}}
+ </div>
</div>
- {{outlet}}
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/admin-badges/award.gjs b/app/assets/javascripts/admin/addon/templates/admin-badges/award.gjs
index 4b0e4cbf77a..b31f7694497 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-badges/award.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-badges/award.gjs
@@ -1,96 +1,111 @@
-<section class="current-badge content-body">
- <h2>{{i18n "admin.badges.mass_award.title"}}</h2>
- <p>{{i18n "admin.badges.mass_award.description"}}</p>
+import { Input } from "@ember/component";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import iconOrImage from "discourse/helpers/icon-or-image";
+import { i18n } from "discourse-i18n";
- {{#if this.model}}
- <form class="form-horizontal">
- <div class="badge-preview control-group">
- {{#if this.model}}
- {{icon-or-image this.model}}
- <span class="badge-display-name">{{this.model.name}}</span>
- {{else}}
- <span class="badge-placeholder">{{i18n
- "admin.badges.mass_award.no_badge_selected"
- }}</span>
- {{/if}}
- </div>
- <div class="control-group">
- <h4>{{i18n "admin.badges.mass_award.upload_csv"}}</h4>
- <input
- type="file"
- id="massAwardCSVUpload"
- accept=".csv"
- onchange={{action "updateFileSelected"}}
- />
- </div>
- <div class="control-group">
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.replaceBadgeOwners}} />
- {{i18n "admin.badges.mass_award.replace_owners"}}
- </label>
- {{#if this.model.multiple_grant}}
- <label class="grant-existing-holders">
- <Input
- @type="checkbox"
- @checked={{this.grantExistingHolders}}
- class="grant-existing-holders-checkbox"
+export default RouteTemplate(
+ <template>
+ <section class="current-badge content-body">
+ <h2>{{i18n "admin.badges.mass_award.title"}}</h2>
+ <p>{{i18n "admin.badges.mass_award.description"}}</p>
+
+ {{#if @controller.model}}
+ <form class="form-horizontal">
+ <div class="badge-preview control-group">
+ {{#if @controller.model}}
+ {{iconOrImage @controller.model}}
+ <span class="badge-display-name">{{@controller.model.name}}</span>
+ {{else}}
+ <span class="badge-placeholder">{{i18n
+ "admin.badges.mass_award.no_badge_selected"
+ }}</span>
+ {{/if}}
+ </div>
+ <div class="control-group">
+ <h4>{{i18n "admin.badges.mass_award.upload_csv"}}</h4>
+ <input
+ type="file"
+ id="massAwardCSVUpload"
+ accept=".csv"
+ onchange={{@controller.updateFileSelected}}
/>
- {{i18n "admin.badges.mass_award.grant_existing_holders"}}
- </label>
- {{/if}}
- </div>
- <DButton
- @action={{this.massAward}}
- @disabled={{this.massAwardButtonDisabled}}
- @icon="certificate"
- @label="admin.badges.mass_award.perform"
- type="submit"
- class="btn-primary"
- />
- <LinkTo @route="adminBadges.index" class="btn btn-normal">
- {{d-icon "xmark"}}
- <span>{{i18n "cancel"}}</span>
- </LinkTo>
- </form>
- {{#if this.saving}}
- {{i18n "uploading"}}
- {{/if}}
- {{#if this.resultsMessage}}
- <p>
- {{#if this.success}}
- {{d-icon "check" class="bulk-award-status-icon success"}}
- {{else}}
- {{d-icon "xmark" class="bulk-award-status-icon failure"}}
+ </div>
+ <div class="control-group">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{@controller.replaceBadgeOwners}}
+ />
+ {{i18n "admin.badges.mass_award.replace_owners"}}
+ </label>
+ {{#if @controller.model.multiple_grant}}
+ <label class="grant-existing-holders">
+ <Input
+ @type="checkbox"
+ @checked={{@controller.grantExistingHolders}}
+ class="grant-existing-holders-checkbox"
+ />
+ {{i18n "admin.badges.mass_award.grant_existing_holders"}}
+ </label>
+ {{/if}}
+ </div>
+ <DButton
+ @action={{@controller.massAward}}
+ @disabled={{@controller.massAwardButtonDisabled}}
+ @icon="certificate"
+ @label="admin.badges.mass_award.perform"
+ type="submit"
+ class="btn-primary"
+ />
+ <LinkTo @route="adminBadges.index" class="btn btn-normal">
+ {{icon "xmark"}}
+ <span>{{i18n "cancel"}}</span>
+ </LinkTo>
+ </form>
+ {{#if @controller.saving}}
+ {{i18n "uploading"}}
{{/if}}
- {{this.resultsMessage}}
- </p>
- {{#if this.unmatchedEntries.length}}
- <p>
- {{d-icon
- "triangle-exclamation"
- class="bulk-award-status-icon failure"
- }}
- <span>
- {{#if this.unmatchedEntriesTruncated}}
- {{i18n
- "admin.badges.mass_award.csv_has_unmatched_users_truncated_list"
- count=this.unmatchedEntriesCount
- }}
+ {{#if @controller.resultsMessage}}
+ <p>
+ {{#if @controller.success}}
+ {{icon "check" class="bulk-award-status-icon success"}}
{{else}}
- {{i18n "admin.badges.mass_award.csv_has_unmatched_users"}}
+ {{icon "xmark" class="bulk-award-status-icon failure"}}
{{/if}}
- </span>
- </p>
- <ul>
- {{#each this.unmatchedEntries as |entry|}}
- <li>{{entry}}</li>
- {{/each}}
- </ul>
+ {{@controller.resultsMessage}}
+ </p>
+ {{#if @controller.unmatchedEntries.length}}
+ <p>
+ {{icon
+ "triangle-exclamation"
+ class="bulk-award-status-icon failure"
+ }}
+ <span>
+ {{#if @controller.unmatchedEntriesTruncated}}
+ {{i18n
+ "admin.badges.mass_award.csv_has_unmatched_users_truncated_list"
+ }}
+ {{else}}
+ {{i18n "admin.badges.mass_award.csv_has_unmatched_users"}}
+ {{/if}}
+ </span>
+ </p>
+ <ul>
+ {{#each @controller.unmatchedEntries as |entry|}}
+ <li>{{entry}}</li>
+ {{/each}}
+ </ul>
+ {{/if}}
+ {{/if}}
+ {{else}}
+ <span class="badge-required">{{i18n
+ "admin.badges.mass_award.no_badge_selected"
+ }}</span>
{{/if}}
- {{/if}}
- {{else}}
- <span class="badge-required">{{i18n
- "admin.badges.mass_award.no_badge_selected"
- }}</span>
- {{/if}}
-</section>
\ No newline at end of file
+ </section>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/admin-badges/index.gjs b/app/assets/javascripts/admin/addon/templates/admin-badges/index.gjs
index cbe0feebeba..108a8c6481b 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-badges/index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-badges/index.gjs
@@ -1,4 +1,11 @@
-<section class="current-badge content-body">
- <h2>{{i18n "admin.badges.badge_intro.title"}}</h2>
- <p>{{i18n "admin.badges.badge_intro.description"}}</p>
-</section>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import { i18n } from "discourse-i18n";
+
+export default RouteTemplate(
+ <template>
+ <section class="current-badge content-body">
+ <h2>{{i18n "admin.badges.badge_intro.title"}}</h2>
+ <p>{{i18n "admin.badges.badge_intro.description"}}</p>
+ </section>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/admin-badges/show.gjs b/app/assets/javascripts/admin/addon/templates/admin-badges/show.gjs
index fb700f38086..8279bcb2b6d 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-badges/show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-badges/show.gjs
@@ -1,347 +1,375 @@
-<Form
- @data={{this.formData}}
- @onSubmit={{this.handleSubmit}}
- @validate={{this.validateForm}}
- @onRegisterApi={{this.registerApi}}
- class="badge-form current-badge content-body"
- as |form data|
->
+import { concat, fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import Form from "discourse/components/form";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import iconOrImage from "discourse/helpers/icon-or-image";
+import number from "discourse/helpers/number";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
- <h2 class="current-badge-header">
- {{iconOrImage data}}
- <span class="badge-display-name">{{data.name}}</span>
- </h2>
+export default RouteTemplate(
+ <template>
+ <Form
+ @data={{@controller.formData}}
+ @onSubmit={{@controller.handleSubmit}}
+ @validate={{@controller.validateForm}}
+ @onRegisterApi={{@controller.registerApi}}
+ class="badge-form current-badge content-body"
+ as |form data|
+ >
- <form.Field
- @name="enabled"
- @validation="required"
- @title={{i18n "admin.badges.status"}}
- as |field|
- >
- <field.Question
- @yesLabel={{i18n "admin.badges.enabled"}}
- @noLabel={{i18n "admin.badges.disabled"}}
- />
- </form.Field>
+ <h2 class="current-badge-header">
+ {{iconOrImage data}}
+ <span class="badge-display-name">{{data.name}}</span>
+ </h2>
- {{#if this.readOnly}}
- <form.Container data-name="name" @title={{i18n "admin.badges.name"}}>
- <span class="readonly-field">
- {{this.model.name}}
- </span>
- <LinkTo
- @route="adminSiteText"
- @query={{hash q=(concat this.textCustomizationPrefix "name")}}
+ <form.Field
+ @name="enabled"
+ @validation="required"
+ @title={{i18n "admin.badges.status"}}
+ as |field|
>
- {{d-icon "pencil"}}
- </LinkTo>
- </form.Container>
- {{else}}
- <form.Field
- @title={{i18n "admin.badges.name"}}
- @name="name"
- @disabled={{this.readOnly}}
- @validation="required"
- as |field|
- >
- <field.Input />
- </form.Field>
- {{/if}}
+ <field.Question
+ @yesLabel={{i18n "admin.badges.enabled"}}
+ @noLabel={{i18n "admin.badges.disabled"}}
+ />
+ </form.Field>
- <form.Section @title="Design">
- <form.Field
- @name="badge_type_id"
- @title={{i18n "admin.badges.badge_type"}}
- @disabled={{this.readOnly}}
- as |field|
- >
- <field.Select as |select|>
- {{#each this.badgeTypes as |badgeType|}}
- <select.Option @value={{badgeType.id}}>
- {{badgeType.name}}
- </select.Option>
- {{/each}}
- </field.Select>
- </form.Field>
+ {{#if @controller.readOnly}}
+ <form.Container data-name="name" @title={{i18n "admin.badges.name"}}>
+ <span class="readonly-field">
+ {{@controller.model.name}}
+ </span>
+ <LinkTo
+ @route="adminSiteText"
+ @query={{hash
+ q=(concat @controller.textCustomizationPrefix "name")
+ }}
+ >
+ {{icon "pencil"}}
+ </LinkTo>
+ </form.Container>
+ {{else}}
+ <form.Field
+ @title={{i18n "admin.badges.name"}}
+ @name="name"
+ @disabled={{@controller.readOnly}}
+ @validation="required"
+ as |field|
+ >
+ <field.Input />
+ </form.Field>
+ {{/if}}
- <form.ConditionalContent
- @activeName={{if data.image_url "upload-image" "choose-icon"}}
- as |cc|
- >
- <cc.Conditions as |Condition|>
- <Condition @name="choose-icon">
- {{i18n "admin.badges.select_an_icon"}}
- </Condition>
- <Condition @name="upload-image">
- {{i18n "admin.badges.upload_an_image"}}
- </Condition>
- </cc.Conditions>
- <cc.Contents as |Content|>
- <Content @name="choose-icon">
+ <form.Section @title="Design">
+ <form.Field
+ @name="badge_type_id"
+ @title={{i18n "admin.badges.badge_type"}}
+ @disabled={{@controller.readOnly}}
+ as |field|
+ >
+ <field.Select as |select|>
+ {{#each @controller.badgeTypes as |badgeType|}}
+ <select.Option @value={{badgeType.id}}>
+ {{badgeType.name}}
+ </select.Option>
+ {{/each}}
+ </field.Select>
+ </form.Field>
+
+ <form.ConditionalContent
+ @activeName={{if data.image_url "upload-image" "choose-icon"}}
+ as |cc|
+ >
+ <cc.Conditions as |Condition|>
+ <Condition @name="choose-icon">
+ {{i18n "admin.badges.select_an_icon"}}
+ </Condition>
+ <Condition @name="upload-image">
+ {{i18n "admin.badges.upload_an_image"}}
+ </Condition>
+ </cc.Conditions>
+ <cc.Contents as |Content|>
+ <Content @name="choose-icon">
+ <form.Field
+ @title={{i18n "admin.badges.icon"}}
+ @showTitle={{false}}
+ @name="icon"
+ @onSet={{@controller.onSetIcon}}
+ @format="small"
+ as |field|
+ >
+ <field.Icon />
+ </form.Field>
+ </Content>
+ <Content @name="upload-image">
+ <form.Field
+ @name="image_url"
+ @showTitle={{false}}
+ @title={{i18n "admin.badges.image"}}
+ @onSet={{@controller.onSetImage}}
+ @onUnset={{@controller.onUnsetImage}}
+ as |field|
+ >
+ <field.Image @type="badge_image" />
+ </form.Field>
+ </Content>
+ </cc.Contents>
+ </form.ConditionalContent>
+
+ {{#if @controller.readOnly}}
+ <form.Container
+ data-name="description"
+ @title={{i18n "admin.badges.description"}}
+ >
+ <span class="readonly-field">
+ {{@controller.model.description}}
+ </span>
+ <LinkTo
+ @route="adminSiteText"
+ @query={{hash
+ q=(concat @controller.textCustomizationPrefix "description")
+ }}
+ >
+ {{icon "pencil"}}
+ </LinkTo>
+ </form.Container>
+ {{else}}
<form.Field
- @title={{i18n "admin.badges.icon"}}
- @showTitle={{false}}
- @name="icon"
- @onSet={{this.onSetIcon}}
- @format="small"
+ @title={{i18n "admin.badges.description"}}
+ @name="description"
+ @disabled={{@controller.readOnly}}
as |field|
>
- <field.Icon />
+ <field.Textarea />
</form.Field>
- </Content>
- <Content @name="upload-image">
+ {{/if}}
+
+ {{#if @controller.readOnly}}
+ <form.Container
+ data-name="long_description"
+ @title={{i18n "admin.badges.long_description"}}
+ >
+ <span class="readonly-field">
+ {{@controller.model.long_description}}
+ </span>
+
+ <LinkTo
+ @route="adminSiteText"
+ @query={{hash
+ q=(concat
+ @controller.textCustomizationPrefix "long_description"
+ )
+ }}
+ >
+ {{icon "pencil"}}
+ </LinkTo>
+ </form.Container>
+ {{else}}
<form.Field
- @name="image_url"
- @showTitle={{false}}
- @title={{i18n "admin.badges.image"}}
- @onSet={{this.onSetImage}}
- @onUnset={{this.onUnsetImage}}
+ @name="long_description"
+ @title={{i18n "admin.badges.long_description"}}
+ @disabled={{@controller.readOnly}}
as |field|
>
- <field.Image @type="badge_image" />
+ <field.Textarea />
</form.Field>
- </Content>
- </cc.Contents>
- </form.ConditionalContent>
+ {{/if}}
+ </form.Section>
- {{#if this.readOnly}}
- <form.Container
- data-name="description"
- @title={{i18n "admin.badges.description"}}
- >
- <span class="readonly-field">
- {{this.model.description}}
- </span>
- <LinkTo
- @route="adminSiteText"
- @query={{hash q=(concat this.textCustomizationPrefix "description")}}
- >
- {{d-icon "pencil"}}
- </LinkTo>
- </form.Container>
- {{else}}
- <form.Field
- @title={{i18n "admin.badges.description"}}
- @name="description"
- @disabled={{this.readOnly}}
- as |field|
- >
- <field.Textarea />
- </form.Field>
- {{/if}}
+ {{#if @controller.siteSettings.enable_badge_sql}}
+ <form.Section @title="Query">
+ <form.Field
+ @name="query"
+ @title={{i18n "admin.badges.query"}}
+ @disabled={{@controller.readOnly}}
+ as |field|
+ >
+ <field.Code @lang="sql" />
+ </form.Field>
- {{#if this.readOnly}}
- <form.Container
- data-name="long_description"
- @title={{i18n "admin.badges.long_description"}}
- >
- <span class="readonly-field">
- {{this.model.long_description}}
- </span>
+ {{#if (@controller.hasQuery data.query)}}
+ <form.Container>
+ <form.Button
+ @isLoading={{@controller.preview_loading}}
+ @label="admin.badges.preview.link_text"
+ class="preview-badge"
+ @action={{fn @controller.showPreview data "false"}}
+ />
+ <form.Button
+ @isLoading={{@controller.preview_loading}}
+ @label="admin.badges.preview.plan_text"
+ class="preview-badge-plan"
+ @action={{fn @controller.showPreview data "true"}}
+ />
+ </form.Container>
- <LinkTo
- @route="adminSiteText"
- @query={{hash
- q=(concat this.textCustomizationPrefix "long_description")
- }}
- >
- {{d-icon "pencil"}}
- </LinkTo>
- </form.Container>
- {{else}}
- <form.Field
- @name="long_description"
- @title={{i18n "admin.badges.long_description"}}
- @disabled={{this.readOnly}}
- as |field|
- >
- <field.Textarea />
- </form.Field>
- {{/if}}
- </form.Section>
+ <form.CheckboxGroup as |group|>
+ <group.Field
+ @name="auto_revoke"
+ @disabled={{@controller.readOnly}}
+ @showTitle={{false}}
+ @title={{i18n "admin.badges.auto_revoke"}}
+ as |field|
+ >
+ <field.Checkbox />
+ </group.Field>
- {{#if this.siteSettings.enable_badge_sql}}
- <form.Section @title="Query">
- <form.Field
- @name="query"
- @title={{i18n "admin.badges.query"}}
- @disabled={{this.readOnly}}
- as |field|
- >
- <field.Code @lang="sql" />
- </form.Field>
+ <group.Field
+ @name="target_posts"
+ @disabled={{@controller.readOnly}}
+ @title={{i18n "admin.badges.target_posts"}}
+ @showTitle={{false}}
+ as |field|
+ >
+ <field.Checkbox />
+ </group.Field>
+ </form.CheckboxGroup>
- {{#if (this.hasQuery data.query)}}
- <form.Container>
- <form.Button
- @isLoading={{this.preview_loading}}
- @label="admin.badges.preview.link_text"
- class="preview-badge"
- @action={{fn this.showPreview data "false"}}
- />
- <form.Button
- @isLoading={{this.preview_loading}}
- @label="admin.badges.preview.plan_text"
- class="preview-badge-plan"
- @action={{fn this.showPreview data "true"}}
- />
- </form.Container>
+ <form.Field
+ @name="trigger"
+ @disabled={{@controller.readOnly}}
+ @validation="required"
+ @title={{i18n "admin.badges.trigger"}}
+ as |field|
+ >
+ <field.Select as |select|>
+ {{#each @controller.badgeTriggers as |badgeType|}}
+ <select.Option @value={{badgeType.id}}>
+ {{badgeType.name}}
+ </select.Option>
+ {{/each}}
+ </field.Select>
+ </form.Field>
+ {{/if}}
+ </form.Section>
+ {{/if}}
- <form.CheckboxGroup as |group|>
+ <form.Section @title="Settings">
+ <form.Field
+ @name="badge_grouping_id"
+ @disabled={{@controller.readOnly}}
+ @validation="required"
+ @title={{i18n "admin.badges.badge_grouping"}}
+ as |field|
+ >
+ <field.Menu
+ @selection={{@controller.currentBadgeGrouping data}}
+ as |menu|
+ >
+ {{#each @controller.badgeGroupings as |grouping|}}
+ <menu.Item @value={{grouping.id}}>{{grouping.name}}</menu.Item>
+ {{/each}}
+ <menu.Divider />
+ <menu.Item @action={{routeAction "editGroupings"}}>Add new group</menu.Item>
+ </field.Menu>
+ </form.Field>
+
+ <form.CheckboxGroup
+ @title={{i18n "admin.badges.usage_heading"}}
+ as |group|
+ >
<group.Field
- @name="auto_revoke"
- @disabled={{this.readOnly}}
+ @title={{i18n "admin.badges.allow_title"}}
@showTitle={{false}}
- @title={{i18n "admin.badges.auto_revoke"}}
+ @name="allow_title"
+ @format="full"
as |field|
>
<field.Checkbox />
</group.Field>
<group.Field
- @name="target_posts"
- @disabled={{this.readOnly}}
- @title={{i18n "admin.badges.target_posts"}}
+ @title={{i18n "admin.badges.multiple_grant"}}
@showTitle={{false}}
+ @name="multiple_grant"
+ @disabled={{@controller.readOnly}}
+ @format="full"
as |field|
>
<field.Checkbox />
</group.Field>
</form.CheckboxGroup>
- <form.Field
- @name="trigger"
- @disabled={{this.readOnly}}
- @validation="required"
- @title={{i18n "admin.badges.trigger"}}
- as |field|
+ <form.CheckboxGroup
+ @title={{i18n "admin.badges.visibility_heading"}}
+ as |group|
>
- <field.Select as |select|>
- {{#each this.badgeTriggers as |badgeType|}}
- <select.Option @value={{badgeType.id}}>
- {{badgeType.name}}
- </select.Option>
- {{/each}}
- </field.Select>
- </form.Field>
- {{/if}}
- </form.Section>
- {{/if}}
-
- <form.Section @title="Settings">
- <form.Field
- @name="badge_grouping_id"
- @disabled={{this.readOnly}}
- @validation="required"
- @title={{i18n "admin.badges.badge_grouping"}}
- as |field|
- >
- <field.Menu @selection={{this.currentBadgeGrouping data}} as |menu|>
- {{#each this.badgeGroupings as |grouping|}}
- <menu.Item @value={{grouping.id}}>{{grouping.name}}</menu.Item>
- {{/each}}
- <menu.Divider />
- <menu.Item @action={{route-action "editGroupings"}}>Add new group</menu.Item>
- </field.Menu>
- </form.Field>
-
- <form.CheckboxGroup @title={{i18n "admin.badges.usage_heading"}} as |group|>
- <group.Field
- @title={{i18n "admin.badges.allow_title"}}
- @showTitle={{false}}
- @name="allow_title"
- @format="full"
- as |field|
- >
- <field.Checkbox />
- </group.Field>
-
- <group.Field
- @title={{i18n "admin.badges.multiple_grant"}}
- @showTitle={{false}}
- @name="multiple_grant"
- @disabled={{this.readOnly}}
- @format="full"
- as |field|
- >
- <field.Checkbox />
- </group.Field>
- </form.CheckboxGroup>
-
- <form.CheckboxGroup
- @title={{i18n "admin.badges.visibility_heading"}}
- as |group|
- >
- <group.Field
- @title={{i18n "admin.badges.listable"}}
- @showTitle={{false}}
- @name="listable"
- @disabled={{this.readOnly}}
- @format="full"
- as |field|
- >
- <field.Checkbox />
- </group.Field>
+ <group.Field
+ @title={{i18n "admin.badges.listable"}}
+ @showTitle={{false}}
+ @name="listable"
+ @disabled={{@controller.readOnly}}
+ @format="full"
+ as |field|
+ >
+ <field.Checkbox />
+ </group.Field>
- <group.Field
- @title={{i18n "admin.badges.show_posts"}}
- @showTitle={{false}}
- @name="show_posts"
- @disabled={{this.readOnly}}
- @format="full"
- as |field|
- >
- <field.Checkbox />
- </group.Field>
+ <group.Field
+ @title={{i18n "admin.badges.show_posts"}}
+ @showTitle={{false}}
+ @name="show_posts"
+ @disabled={{@controller.readOnly}}
+ @format="full"
+ as |field|
+ >
+ <field.Checkbox />
+ </group.Field>
- <group.Field
- @title={{i18n "admin.badges.show_in_post_header"}}
- @showTitle={{false}}
- @name="show_in_post_header"
- @disabled={{this.disableBadgeOnPosts data}}
- @format="full"
- as |field|
- >
- <field.Checkbox>
- {{#if (this.postHeaderDescription data)}}
- {{i18n "admin.badges.show_in_post_header_disabled"}}
- {{/if}}
- </field.Checkbox>
- </group.Field>
- </form.CheckboxGroup>
- </form.Section>
+ <group.Field
+ @title={{i18n "admin.badges.show_in_post_header"}}
+ @showTitle={{false}}
+ @name="show_in_post_header"
+ @disabled={{@controller.disableBadgeOnPosts data}}
+ @format="full"
+ as |field|
+ >
+ <field.Checkbox>
+ {{#if (@controller.postHeaderDescription data)}}
+ {{i18n "admin.badges.show_in_post_header_disabled"}}
+ {{/if}}
+ </field.Checkbox>
+ </group.Field>
+ </form.CheckboxGroup>
+ </form.Section>
- <PluginOutlet
- @name="admin-above-badge-buttons"
- @outletArgs={{hash badge=this.buffered form=form}}
- />
+ <PluginOutlet
+ @name="admin-above-badge-buttons"
+ @outletArgs={{hash [email protected] form=form}}
+ />
- <form.Actions>
- <form.Submit />
+ <form.Actions>
+ <form.Submit />
- {{#unless this.readOnly}}
- <form.Button
- @action={{this.handleDelete}}
- class="badge-form__delete-badge-btn btn-danger"
- >
- {{i18n "admin.badges.delete"}}
- </form.Button>
- {{/unless}}
- </form.Actions>
+ {{#unless @controller.readOnly}}
+ <form.Button
+ @action={{@controller.handleDelete}}
+ class="badge-form__delete-badge-btn btn-danger"
+ >
+ {{i18n "admin.badges.delete"}}
+ </form.Button>
+ {{/unless}}
+ </form.Actions>
- {{#if this.grant_count}}
- <div class="content-body current-badge-actions">
- <div>
- <LinkTo @route="badges.show" @model={{this}}>
- {{html-safe
- (i18n
- "badges.awarded"
- count=this.displayCount
- number=(number this.displayCount)
- )
- }}
- </LinkTo>
- </div>
- </div>
- {{/if}}
-</Form>
\ No newline at end of file
+ {{#if @controller.grant_count}}
+ <div class="content-body current-badge-actions">
+ <div>
+ <LinkTo @route="badges.show" @model={{@controller}}>
+ {{htmlSafe
+ (i18n
+ "badges.awarded"
+ number=(number @controller.displayCount)
+ )
+ }}
+ </LinkTo>
+ </div>
+ </div>
+ {{/if}}
+ </Form>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/admin.gjs b/app/assets/javascripts/admin/addon/templates/admin.gjs
index 0c2000916c7..788904cf347 100644
--- a/app/assets/javascripts/admin/addon/templates/admin.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin.gjs
@@ -1,13 +1,22 @@
-{{hide-application-footer}}
-{{html-class "admin-area"}}
-{{body-class "admin-interface"}}
+import RouteTemplate from "ember-route-template";
+import bodyClass from "discourse/helpers/body-class";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlClass from "discourse/helpers/html-class";
-<div class="row">
- <div class="full-width">
- <div class="boxed white admin-content">
- <div class="admin-contents {{this.adminContentsClassName}}">
- {{outlet}}
+export default RouteTemplate(
+ <template>
+ {{hideApplicationFooter}}
+ {{htmlClass "admin-area"}}
+ {{bodyClass "admin-interface"}}
+
+ <div class="row">
+ <div class="full-width">
+ <div class="boxed white admin-content">
+ <div class="admin-contents {{@controller.adminContentsClassName}}">
+ {{outlet}}
+ </div>
+ </div>
</div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/api-keys/index.gjs b/app/assets/javascripts/admin/addon/templates/api-keys/index.gjs
index a6c7054b341..3710790d60c 100644
--- a/app/assets/javascripts/admin/addon/templates/api-keys/index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/api-keys/index.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::ApiKeysList @apiKeys={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import ApiKeysList from "admin/components/admin-config-areas/api-keys-list";
+
+export default RouteTemplate(
+ <template><ApiKeysList @apiKeys={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/api-keys/new.gjs b/app/assets/javascripts/admin/addon/templates/api-keys/new.gjs
index d910ce0ca18..434b7ae500c 100644
--- a/app/assets/javascripts/admin/addon/templates/api-keys/new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/api-keys/new.gjs
@@ -1 +1,4 @@
-<AdminConfigAreas::ApiKeysNew />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import ApiKeysNew from "admin/components/admin-config-areas/api-keys-new";
+
+export default RouteTemplate(<template><ApiKeysNew /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/api-keys/show.gjs b/app/assets/javascripts/admin/addon/templates/api-keys/show.gjs
index 1b141dd3301..dcfa1cb9ffc 100644
--- a/app/assets/javascripts/admin/addon/templates/api-keys/show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/api-keys/show.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::ApiKeysShow @apiKey={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import ApiKeysShow from "admin/components/admin-config-areas/api-keys-show";
+
+export default RouteTemplate(
+ <template><ApiKeysShow @apiKey={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/backups-index.gjs b/app/assets/javascripts/admin/addon/templates/backups-index.gjs
index 05f30c062d1..ede6629dd4a 100644
--- a/app/assets/javascripts/admin/addon/templates/backups-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/backups-index.gjs
@@ -1,106 +1,123 @@
-<DPageSubheader @titleLabel={{i18n "admin.backups.files_title"}}>
- <:actions as |actions|>
- <actions.Wrapped as |wrapped|>
- {{#if this.localBackupStorage}}
- <UppyBackupUploader
- class={{wrapped.buttonClass}}
- @done={{route-action "uploadSuccess"}}
- @localBackupStorage={{this.localBackupStorage}}
- />
- {{else}}
- <UppyBackupUploader
- class={{wrapped.buttonClass}}
- @done={{route-action "remoteUploadSuccess"}}
- />
- {{/if}}
- </actions.Wrapped>
- </:actions>
-</DPageSubheader>
+import { fn } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import DropdownMenu from "discourse/components/dropdown-menu";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+import UppyBackupUploader from "admin/components/uppy-backup-uploader";
+import humanSize from "admin/helpers/human-size";
+import DMenu from "float-kit/components/d-menu";
-{{#if this.status.restoreDisabled}}
- <div class="backup-message alert alert-info">
- {{dIcon "circle-info"}}
- {{html-safe
- (i18n
- "admin.backups.operations.restore.is_disabled"
- url=this.restoreSettingsUrl
- )
- }}
- </div>
-{{/if}}
-
-<table class="d-admin-table admin-backups-list">
- <thead>
- <th>{{i18n "admin.backups.columns.filename"}}</th>
- <th class="backup-size">{{i18n "admin.backups.columns.size"}}</th>
- <th></th>
- </thead>
- <tbody>
- {{#each this.model as |backup|}}
- <tr
- class="d-admin-row__content backup-item-row"
- data-backup-filename={{backup.filename}}
- >
- <td class="d-admin-row__overview">
- <div class="backup-filename">
- {{backup.filename}}
- </div>
- </td>
- <td class="d-admin-row__detail backup-size">
- <div class="d-admin-row__mobile-label">
- {{i18n "admin.backups.columns.size"}}
- </div>
- {{human-size backup.size}}
- </td>
- <td class="d-admin-row__controls backup-controls">
- <div class="d-admin-row__controls-options">
- <DButton
- @action={{fn this.download backup}}
- @title="admin.backups.operations.download.title"
- @label="admin.backups.operations.download.label"
- class="btn-default btn-small backup-item-row__download"
+export default RouteTemplate(
+ <template>
+ <DPageSubheader @titleLabel={{i18n "admin.backups.files_title"}}>
+ <:actions as |actions|>
+ <actions.Wrapped as |wrapped|>
+ {{#if @controller.localBackupStorage}}
+ <UppyBackupUploader
+ class={{wrapped.buttonClass}}
+ @done={{routeAction "uploadSuccess"}}
+ @localBackupStorage={{@controller.localBackupStorage}}
+ />
+ {{else}}
+ <UppyBackupUploader
+ class={{wrapped.buttonClass}}
+ @done={{routeAction "remoteUploadSuccess"}}
/>
+ {{/if}}
+ </actions.Wrapped>
+ </:actions>
+ </DPageSubheader>
+
+ {{#if @controller.status.restoreDisabled}}
+ <div class="backup-message alert alert-info">
+ {{icon "circle-info"}}
+ {{htmlSafe
+ (i18n
+ "admin.backups.operations.restore.is_disabled"
+ )
+ }}
+ </div>
+ {{/if}}
+
+ <table class="d-admin-table admin-backups-list">
+ <thead>
+ <th>{{i18n "admin.backups.columns.filename"}}</th>
+ <th class="backup-size">{{i18n "admin.backups.columns.size"}}</th>
+ <th></th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |backup|}}
+ <tr
+ class="d-admin-row__content backup-item-row"
+ data-backup-filename={{backup.filename}}
+ >
+ <td class="d-admin-row__overview">
+ <div class="backup-filename">
+ {{backup.filename}}
+ </div>
+ </td>
+ <td class="d-admin-row__detail backup-size">
+ <div class="d-admin-row__mobile-label">
+ {{i18n "admin.backups.columns.size"}}
+ </div>
+ {{humanSize backup.size}}
+ </td>
+ <td class="d-admin-row__controls backup-controls">
+ <div class="d-admin-row__controls-options">
+ <DButton
+ @action={{fn @controller.download backup}}
+ @title="admin.backups.operations.download.title"
+ @label="admin.backups.operations.download.label"
+ class="btn-default btn-small backup-item-row__download"
+ />
- <DMenu
- @identifier="backup-item-menu"
- @title={{i18n "more_options"}}
- @icon="ellipsis-vertical"
- class="btn-default btn-small"
- >
- <:content>
- <DropdownMenu as |dropdown|>
- <dropdown.item>
- <DButton
- @icon="play"
- @action={{fn (route-action "startRestore") backup}}
- @disabled={{this.status.restoreDisabled}}
- @title={{this.restoreTitle}}
- @label="admin.backups.operations.restore.label"
- class="btn-transparent backup-item-row__restore"
- />
- </dropdown.item>
- <dropdown.item>
- <DButton
- @icon="trash-can"
- @action={{fn (route-action "destroyBackup") backup}}
- @disabled={{this.status.isOperationRunning}}
- @title={{this.deleteTitle}}
- @label="admin.backups.operations.destroy.title"
- class="btn-transparent btn-danger backup-item-row__delete"
- />
- </dropdown.item>
- </DropdownMenu>
- </:content>
- </DMenu>
- </div>
- </td>
- </tr>
- {{else}}
- <tr>
- <td>{{i18n "admin.backups.none"}}</td>
- <td></td>
- <td></td>
- </tr>
- {{/each}}
- </tbody>
-</table>
\ No newline at end of file
+ <DMenu
+ @identifier="backup-item-menu"
+ @title={{i18n "more_options"}}
+ @icon="ellipsis-vertical"
+ class="btn-default btn-small"
+ >
+ <:content>
+ <DropdownMenu as |dropdown|>
+ <dropdown.item>
+ <DButton
+ @icon="play"
+ @action={{fn (routeAction "startRestore") backup}}
+ @disabled={{@controller.status.restoreDisabled}}
+ @title={{@controller.restoreTitle}}
+ @label="admin.backups.operations.restore.label"
+ class="btn-transparent backup-item-row__restore"
+ />
+ </dropdown.item>
+ <dropdown.item>
+ <DButton
+ @icon="trash-can"
+ @action={{fn (routeAction "destroyBackup") backup}}
+ @disabled={{@controller.status.isOperationRunning}}
+ @title={{@controller.deleteTitle}}
+ @label="admin.backups.operations.destroy.title"
+ class="btn-transparent btn-danger backup-item-row__delete"
+ />
+ </dropdown.item>
+ </DropdownMenu>
+ </:content>
+ </DMenu>
+ </div>
+ </td>
+ </tr>
+ {{else}}
+ <tr>
+ <td>{{i18n "admin.backups.none"}}</td>
+ <td></td>
+ <td></td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/backups-logs.gjs b/app/assets/javascripts/admin/addon/templates/backups-logs.gjs
index 088f677d895..e4175812a2c 100644
--- a/app/assets/javascripts/admin/addon/templates/backups-logs.gjs
+++ b/app/assets/javascripts/admin/addon/templates/backups-logs.gjs
@@ -1,6 +1,18 @@
-<DBreadcrumbsItem
- @path="/admin/backups/logs"
- @label={{i18n "admin.backups.menu.logs"}}
-/>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import { i18n } from "discourse-i18n";
+import AdminBackupsLogs from "admin/components/admin-backups-logs";
-<AdminBackupsLogs @logs={{this.logs}} @status={{this.status}} />
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DBreadcrumbsItem
+ @path="/admin/backups/logs"
+ @label={{i18n "admin.backups.menu.logs"}}
+ />
+
+ <AdminBackupsLogs
+ @logs={{@controller.logs}}
+ @status={{@controller.status}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/backups-settings.gjs b/app/assets/javascripts/admin/addon/templates/backups-settings.gjs
index 72d8a08ed0b..f0098c03c73 100644
--- a/app/assets/javascripts/admin/addon/templates/backups-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/backups-settings.gjs
@@ -1,6 +1,13 @@
-<AdminAreaSettings
- @categories="backups"
- @path="/admin/backups/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
-/>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <AdminAreaSettings
+ @categories="backups"
+ @path="/admin/backups/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/backups.gjs b/app/assets/javascripts/admin/addon/templates/backups.gjs
index d33d5877050..aa6358ba1c1 100644
--- a/app/assets/javascripts/admin/addon/templates/backups.gjs
+++ b/app/assets/javascripts/admin/addon/templates/backups.gjs
@@ -1,42 +1,54 @@
-<div class="admin-backups admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.backups.title"}}
- @descriptionLabel={{i18n "admin.config.backups.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/backups"
- @label={{i18n "admin.config.backups.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <AdminBackupsActions @actions={{actions}} @backups={{@model}} />
- </:actions>
- <:tabs>
- <NavItem
- @route="admin.backups.settings"
- @label="settings"
- class="admin-backups-tabs__settings"
- />
- <NavItem
- @route="admin.backups.index"
- @label="admin.backups.menu.backup_files"
- class="admin-backups-tabs__files"
- />
- <NavItem
- @route="admin.backups.logs"
- @label="admin.backups.menu.logs"
- class="admin-backups-tabs__logs"
- />
- <PluginOutlet @name="downloader" @connectorTagName="div" />
- </:tabs>
- </DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import { i18n } from "discourse-i18n";
+import AdminBackupsActions from "admin/components/admin-backups-actions";
- <PluginOutlet @name="before-backup-list" @connectorTagName="div" />
+export default RouteTemplate(
+ <template>
+ <div class="admin-backups admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.backups.title"}}
+ @descriptionLabel={{i18n "admin.config.backups.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/backups"
+ @label={{i18n "admin.config.backups.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <AdminBackupsActions @actions={{actions}} @backups={{@model}} />
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="admin.backups.settings"
+ @label="settings"
+ class="admin-backups-tabs__settings"
+ />
+ <NavItem
+ @route="admin.backups.index"
+ @label="admin.backups.menu.backup_files"
+ class="admin-backups-tabs__files"
+ />
+ <NavItem
+ @route="admin.backups.logs"
+ @label="admin.backups.menu.logs"
+ class="admin-backups-tabs__logs"
+ />
+ <PluginOutlet @name="downloader" @connectorTagName="div" />
+ </:tabs>
+ </DPageHeader>
- <div class="admin-container admin-config-page__main-area">
- {{outlet}}
- </div>
-</div>
\ No newline at end of file
+ <PluginOutlet @name="before-backup-list" @connectorTagName="div" />
+
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-about.gjs b/app/assets/javascripts/admin/addon/templates/config-about.gjs
index 31d06f6657e..9c8218e46b9 100644
--- a/app/assets/javascripts/admin/addon/templates/config-about.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-about.gjs
@@ -1,21 +1,33 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.about.title"}}
- @descriptionLabel={{i18n
- "admin.config.about.header_description"
- (hash basePath=(base-path))
- }}
- @hideTabs={{true}}
- @learnMoreUrl="https://meta.discourse.org/t/understanding-and-customizing-the-about-page/332161"
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/config/about"
- @label={{i18n "admin.config.about.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import basePath from "discourse/helpers/base-path";
+import { i18n } from "discourse-i18n";
+import About from "admin/components/admin-config-areas/about";
-<div class="admin-container admin-config-page__main-area">
- <AdminConfigAreas::About @data={{this.model.site_settings}} />
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.about.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.about.header_description"
+ (hash basePath=(basePath))
+ }}
+ @hideTabs={{true}}
+ @learnMoreUrl="https://meta.discourse.org/t/understanding-and-customizing-the-about-page/332161"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/config/about"
+ @label={{i18n "admin.config.about.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ <About @data={{@controller.model.site_settings}} />
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-color-palettes-show.gjs b/app/assets/javascripts/admin/addon/templates/config-color-palettes-show.gjs
index 67c091a199a..9b650eff2c7 100644
--- a/app/assets/javascripts/admin/addon/templates/config-color-palettes-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-color-palettes-show.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::ColorPalette @colorPalette={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import ColorPalette from "admin/components/admin-config-areas/color-palette";
+
+export default RouteTemplate(
+ <template><ColorPalette @colorPalette={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-customize-components.gjs b/app/assets/javascripts/admin/addon/templates/config-customize-components.gjs
index 04f7aef6182..cc4c651f744 100644
--- a/app/assets/javascripts/admin/addon/templates/config-customize-components.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-customize-components.gjs
@@ -1,6 +1,17 @@
-<DBreadcrumbsItem
- @path="/admin/config/customize/components"
- @label={{i18n "admin.config_areas.themes_and_components.components.title"}}
-/>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import { i18n } from "discourse-i18n";
+import Components from "admin/components/admin-config-areas/components";
-<AdminConfigAreas::Components @components={{this.model}} />
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DBreadcrumbsItem
+ @path="/admin/config/customize/components"
+ @label={{i18n
+ "admin.config_areas.themes_and_components.components.title"
+ }}
+ />
+
+ <Components @components={{@controller.model}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-customize-themes.gjs b/app/assets/javascripts/admin/addon/templates/config-customize-themes.gjs
index ad3d36d238e..1a4e41f6a90 100644
--- a/app/assets/javascripts/admin/addon/templates/config-customize-themes.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-customize-themes.gjs
@@ -1,6 +1,15 @@
-<DBreadcrumbsItem
- @path="/admin/config/customize/themes"
- @label={{i18n "admin.config_areas.themes_and_components.themes.title"}}
-/>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import { i18n } from "discourse-i18n";
+import Themes from "admin/components/admin-config-areas/themes";
-<AdminConfigAreas::Themes @themes={{this.model}} />
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DBreadcrumbsItem
+ @path="/admin/config/customize/themes"
+ @label={{i18n "admin.config_areas.themes_and_components.themes.title"}}
+ />
+
+ <Themes @themes={{@controller.model}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-customize.gjs b/app/assets/javascripts/admin/addon/templates/config-customize.gjs
index 078cb2057af..9b97df69e58 100644
--- a/app/assets/javascripts/admin/addon/templates/config-customize.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-customize.gjs
@@ -1,28 +1,39 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.themes_and_components.title"}}
- @descriptionLabel={{i18n
- "admin.config.themes_and_components.header_description"
- }}
- @learnMoreUrl="https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- </:breadcrumbs>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import { i18n } from "discourse-i18n";
- <:tabs>
- <NavItem
- @route="adminConfig.customize.themes"
- @label="admin.config.themes.title"
- />
- <NavItem
- @route="adminConfig.customize.components"
- @label="admin.config.components.title"
- />
- </:tabs>
-</DPageHeader>
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.themes_and_components.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.themes_and_components.header_description"
+ }}
+ @learnMoreUrl="https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ </:breadcrumbs>
-<div class="admin-container admin-config-page__main-area">
- <PluginOutlet @name="admin-config-customize">
- {{outlet}}
- </PluginOutlet>
-</div>
\ No newline at end of file
+ <:tabs>
+ <NavItem
+ @route="adminConfig.customize.themes"
+ @label="admin.config.themes.title"
+ />
+ <NavItem
+ @route="adminConfig.customize.components"
+ @label="admin.config.components.title"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ <PluginOutlet @name="admin-config-customize">
+ {{outlet}}
+ </PluginOutlet>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-flags-edit.gjs b/app/assets/javascripts/admin/addon/templates/config-flags-edit.gjs
index 15877a741e0..959744a5e4e 100644
--- a/app/assets/javascripts/admin/addon/templates/config-flags-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-flags-edit.gjs
@@ -1 +1,6 @@
-<AdminFlagsForm @flag={{@model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminFlagsForm from "admin/components/admin-flags-form";
+
+export default RouteTemplate(
+ <template><AdminFlagsForm @flag={{@model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-flags-index.gjs b/app/assets/javascripts/admin/addon/templates/config-flags-index.gjs
index eb2faa393b2..eee4a536d1c 100644
--- a/app/assets/javascripts/admin/addon/templates/config-flags-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-flags-index.gjs
@@ -1 +1,4 @@
-<AdminConfigAreas::Flags />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import Flags from "admin/components/admin-config-areas/flags";
+
+export default RouteTemplate(<template><Flags /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/config-flags-new.gjs b/app/assets/javascripts/admin/addon/templates/config-flags-new.gjs
index d9147e6c680..c4cebd66e33 100644
--- a/app/assets/javascripts/admin/addon/templates/config-flags-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-flags-new.gjs
@@ -1 +1,4 @@
-<AdminFlagsForm />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminFlagsForm from "admin/components/admin-flags-form";
+
+export default RouteTemplate(<template><AdminFlagsForm /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/config-flags-settings.gjs b/app/assets/javascripts/admin/addon/templates/config-flags-settings.gjs
index 3e3e14722fa..e43d9227c56 100644
--- a/app/assets/javascripts/admin/addon/templates/config-flags-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-flags-settings.gjs
@@ -1,6 +1,13 @@
-<AdminAreaSettings
- @area="flags"
- @path="/admin/config/flags/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
-/>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <AdminAreaSettings
+ @area="flags"
+ @path="/admin/config/flags/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/config-flags.gjs b/app/assets/javascripts/admin/addon/templates/config-flags.gjs
index f51c46c610d..e7daacdaf0a 100644
--- a/app/assets/javascripts/admin/addon/templates/config-flags.gjs
+++ b/app/assets/javascripts/admin/addon/templates/config-flags.gjs
@@ -1,38 +1,48 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.flags.title"}}
- @descriptionLabel={{i18n "admin.config.flags.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/moderation-flags/325589"
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/config/flags"
- @label={{i18n "admin.config.flags.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @route="adminConfig.flags.new"
- @title="admin.config_areas.flags.add"
- @label="admin.config_areas.flags.add"
- @disabled={{this.addFlagButtonDisabled}}
- class="admin-flags__header-add-flag"
- />
- </:actions>
- <:tabs>
- <NavItem
- @route="adminConfig.flags.settings"
- @label="settings"
- class="admin-flags-tabs__settings"
- />
- <NavItem
- @route="adminConfig.flags.index"
- @label="admin.config_areas.flags.flags_tab"
- class="admin-flags-tabs__flags"
- />
- </:tabs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
-<div class="admin-container admin-config-page__main-area">
- {{outlet}}
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.flags.title"}}
+ @descriptionLabel={{i18n "admin.config.flags.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/moderation-flags/325589"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/config/flags"
+ @label={{i18n "admin.config.flags.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @route="adminConfig.flags.new"
+ @title="admin.config_areas.flags.add"
+ @label="admin.config_areas.flags.add"
+ @disabled={{@controller.addFlagButtonDisabled}}
+ class="admin-flags__header-add-flag"
+ />
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="adminConfig.flags.settings"
+ @label="settings"
+ class="admin-flags-tabs__settings"
+ />
+ <NavItem
+ @route="adminConfig.flags.index"
+ @label="admin.config_areas.flags.flags_tab"
+ class="admin-flags-tabs__flags"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-colors-index.gjs b/app/assets/javascripts/admin/addon/templates/customize-colors-index.gjs
index 3547a81761e..4436ba0be94 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-colors-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-colors-index.gjs
@@ -1,3 +1,10 @@
-<div class="alert alert-info about-customize-colors">{{i18n
- "admin.customize.colors.about"
- }}</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import { i18n } from "discourse-i18n";
+
+export default RouteTemplate(
+ <template>
+ <div class="alert alert-info about-customize-colors">{{i18n
+ "admin.customize.colors.about"
+ }}</div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-colors-show.gjs b/app/assets/javascripts/admin/addon/templates/customize-colors-show.gjs
index 16b570e1d98..4109e7309fd 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-colors-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-colors-show.gjs
@@ -1,132 +1,155 @@
-<div class="color-scheme show-current-style">
- <div class="admin-container">
- <h1>{{#if this.model.theme_id}}{{this.model.name}}{{else}}<TextField
- @value={{this.model.name}}
- class="style-name"
- />{{/if}}</h1>
- <div class="controls">
- {{#unless this.model.theme_id}}
- <DButton
- @action={{this.save}}
- @disabled={{this.model.disableSave}}
- @label="admin.customize.save"
- class="btn-primary"
- />
- {{/unless}}
- <DButton
- @action={{fn this.copy this.model}}
- @icon="copy"
- @label="admin.customize.copy"
- class="btn-default"
- />
- <DButton
- @action={{fn this.copyToClipboard this.model}}
- @icon="far-clipboard"
- @label="admin.customize.copy_to_clipboard"
- class="btn-default copy-to-clipboard"
- />
- <span
- class="saving {{unless this.model.savingStatus 'hidden'}}"
- >{{this.model.savingStatus}}</span>
- {{#if this.model.theme_id}}
- <span class="not-editable">
- {{i18n "admin.customize.theme_owner"}}
- <LinkTo
- @route="adminCustomizeThemes.show"
- @models={{array "themes" this.model.theme_id}}
- >{{this.model.theme_name}}</LinkTo>
- </span>
- {{else}}
- <DButton
- @action={{this.destroy}}
- @icon="trash-can"
- @label="admin.customize.delete"
- class="btn-danger"
- />
- {{/if}}
- </div>
+import { Input } from "@ember/component";
+import { array, fn } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
+import concatClass from "discourse/helpers/concat-class";
+import { i18n } from "discourse-i18n";
+import ColorInput from "admin/components/color-input";
+import InlineEditCheckbox from "admin/components/inline-edit-checkbox";
- <div class="admin-controls">
- <div class="pull-left">
- {{#if this.model.theme_id}}
- <InlineEditCheckbox
- @action={{action "applyUserSelectable"}}
- @labelKey="admin.customize.theme.color_scheme_user_selectable"
- @checked={{this.model.user_selectable}}
- @modelId={{this.model.id}}
+export default RouteTemplate(
+ <template>
+ <div class="color-scheme show-current-style">
+ <div class="admin-container">
+ <h1>{{#if
+ @controller.model.theme_id
+ }}{{@controller.model.name}}{{else}}<TextField
+ @value={{@controller.model.name}}
+ class="style-name"
+ />{{/if}}</h1>
+ <div class="controls">
+ {{#unless @controller.model.theme_id}}
+ <DButton
+ @action={{@controller.save}}
+ @disabled={{@controller.model.disableSave}}
+ @label="admin.customize.save"
+ class="btn-primary"
+ />
+ {{/unless}}
+ <DButton
+ @action={{fn @controller.copy @controller.model}}
+ @icon="copy"
+ @label="admin.customize.copy"
+ class="btn-default"
+ />
+ <DButton
+ @action={{fn @controller.copyToClipboard @controller.model}}
+ @icon="far-clipboard"
+ @label="admin.customize.copy_to_clipboard"
+ class="btn-default copy-to-clipboard"
/>
+ <span
+ class="saving {{unless @controller.model.savingStatus 'hidden'}}"
+ >{{@controller.model.savingStatus}}</span>
+ {{#if @controller.model.theme_id}}
+ <span class="not-editable">
+ {{i18n "admin.customize.theme_owner"}}
+ <LinkTo
+ @route="adminCustomizeThemes.show"
+ @models={{array "themes" @controller.model.theme_id}}
+ >{{@controller.model.theme_name}}</LinkTo>
+ </span>
+ {{else}}
+ <DButton
+ @action={{@controller.destroy}}
+ @icon="trash-can"
+ @label="admin.customize.delete"
+ class="btn-danger"
+ />
+ {{/if}}
+ </div>
+
+ <div class="admin-controls">
+ <div class="pull-left">
+ {{#if @controller.model.theme_id}}
+ <InlineEditCheckbox
+ @action={{@controller.applyUserSelectable}}
+ @labelKey="admin.customize.theme.color_scheme_user_selectable"
+ @checked={{@controller.model.user_selectable}}
+ @modelId={{@controller.model.id}}
+ />
+ {{else}}
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{@controller.model.user_selectable}}
+ />
+ {{i18n "admin.customize.theme.color_scheme_user_selectable"}}
+ </label>
+ {{/if}}
+ </div>
+
+ {{#unless @controller.model.theme_id}}
+ <div class="pull-right">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{@controller.onlyOverridden}}
+ />
+ {{i18n "admin.settings.show_overriden"}}
+ </label>
+ </div>
+ {{/unless}}
+ </div>
+
+ {{#if @controller.colors.length}}
+ <table class="table colors">
+ <thead>
+ <tr>
+ <th></th>
+ <th class="hex">{{i18n "admin.customize.color"}}</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each @controller.colors as |c|}}
+ <tr
+ class="{{if c.changed 'changed'}}
+ {{if c.valid 'valid' 'invalid'}}"
+ >
+ <td class="name" title={{c.name}}>
+ <h3>{{c.translatedName}}</h3>
+ <p class="description">{{c.description}}</p>
+ </td>
+ <td class="hex"><ColorInput
+ @hexValue={{c.hex}}
+ @brightnessValue={{c.brightness}}
+ @valid={{c.valid}}
+ /></td>
+ <td class="actions">
+ {{#unless @controller.model.theme_id}}
+ <DButton
+ @action={{fn @controller.revert c}}
+ @title="admin.customize.colors.revert_title"
+ @label="admin.customize.colors.revert"
+ class={{concatClass
+ "btn-default"
+ "revert"
+ (unless c.savedIsOverriden "invisible")
+ }}
+ />
+ <DButton
+ @action={{fn @controller.undo c}}
+ @title="admin.customize.colors.undo_title"
+ @label="admin.customize.colors.undo"
+ class={{concatClass
+ "btn-default"
+ "undo"
+ (unless c.changed "invisible")
+ }}
+ />
+ {{/unless}}
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
{{else}}
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.model.user_selectable}} />
- {{i18n "admin.customize.theme.color_scheme_user_selectable"}}
- </label>
+ <p>{{i18n "search.no_results"}}</p>
{{/if}}
</div>
-
- {{#unless this.model.theme_id}}
- <div class="pull-right">
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.onlyOverridden}} />
- {{i18n "admin.settings.show_overriden"}}
- </label>
- </div>
- {{/unless}}
</div>
-
- {{#if this.colors.length}}
- <table class="table colors">
- <thead>
- <tr>
- <th></th>
- <th class="hex">{{i18n "admin.customize.color"}}</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {{#each this.colors as |c|}}
- <tr
- class="{{if c.changed 'changed'}}
- {{if c.valid 'valid' 'invalid'}}"
- >
- <td class="name" title={{c.name}}>
- <h3>{{c.translatedName}}</h3>
- <p class="description">{{c.description}}</p>
- </td>
- <td class="hex"><ColorInput
- @hexValue={{c.hex}}
- @brightnessValue={{c.brightness}}
- @valid={{c.valid}}
- /></td>
- <td class="actions">
- {{#unless this.model.theme_id}}
- <DButton
- @action={{fn this.revert c}}
- @title="admin.customize.colors.revert_title"
- @label="admin.customize.colors.revert"
- class={{concat-class
- "btn-default"
- "revert"
- (unless c.savedIsOverriden "invisible")
- }}
- />
- <DButton
- @action={{fn this.undo c}}
- @title="admin.customize.colors.undo_title"
- @label="admin.customize.colors.undo"
- class={{concat-class
- "btn-default"
- "undo"
- (unless c.changed "invisible")
- }}
- />
- {{/unless}}
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else}}
- <p>{{i18n "search.no_results"}}</p>
- {{/if}}
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-colors.gjs b/app/assets/javascripts/admin/addon/templates/customize-colors.gjs
index fe0dc829d9e..f755f1655b5 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-colors.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-colors.gjs
@@ -1,46 +1,61 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.color_palettes.title"}}
- @descriptionLabel={{i18n "admin.config.color_palettes.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/allow-users-to-select-new-color-palettes/60857"
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/colors"
- @label={{i18n "admin.config.color_palettes.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DButton from "discourse/components/d-button";
+import DPageHeader from "discourse/components/d-page-header";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
-<div class="content-list color-schemes">
- <ul>
- {{#each this.model as |scheme|}}
- {{#unless scheme.is_base}}
- <li>
- <LinkTo
- @route="adminCustomize.colors.show"
- @model={{scheme}}
- @replace={{true}}
- >
- {{d-icon "paintbrush"}}
- {{scheme.description}}
- </LinkTo>
- </li>
- {{/unless}}
- {{/each}}
- </ul>
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.color_palettes.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.color_palettes.header_description"
+ }}
+ @learnMoreUrl="https://meta.discourse.org/t/allow-users-to-select-new-color-palettes/60857"
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/colors"
+ @label={{i18n "admin.config.color_palettes.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
- <PluginOutlet @name="admin-customize-colors-new-button">
- <DButton
- @action={{this.newColorScheme}}
- @icon="plus"
- @label="admin.customize.new"
- class="btn-default"
- />
- </PluginOutlet>
-</div>
+ <div class="content-list color-schemes">
+ <ul>
+ {{#each @controller.model as |scheme|}}
+ {{#unless scheme.is_base}}
+ <li>
+ <LinkTo
+ @route="adminCustomize.colors.show"
+ @model={{scheme}}
+ @replace={{true}}
+ >
+ {{icon "paintbrush"}}
+ {{scheme.description}}
+ </LinkTo>
+ </li>
+ {{/unless}}
+ {{/each}}
+ </ul>
-{{outlet}}
+ <PluginOutlet @name="admin-customize-colors-new-button">
+ <DButton
+ @action={{@controller.newColorScheme}}
+ @icon="plus"
+ @label="admin.customize.new"
+ class="btn-default"
+ />
+ </PluginOutlet>
+ </div>
-<div class="clearfix"></div>
\ No newline at end of file
+ {{outlet}}
+
+ <div class="clearfix"></div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-email-style-edit.gjs b/app/assets/javascripts/admin/addon/templates/customize-email-style-edit.gjs
index 41cc86fe1f8..3b7a3ecdcdc 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-email-style-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-email-style-edit.gjs
@@ -1,16 +1,24 @@
-<EmailStylesEditor
- @styles={{this.model}}
- @fieldName={{this.fieldName}}
- @save={{action "save"}}
-/>
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import EmailStylesEditor from "admin/components/email-styles-editor";
-<div class="admin-footer">
- <div class="buttons">
- <DButton
- @action={{this.save}}
- @disabled={{this.saveDisabled}}
- @translatedLabel={{this.saveButtonText}}
- class="btn-primary"
+export default RouteTemplate(
+ <template>
+ <EmailStylesEditor
+ @styles={{@controller.model}}
+ @fieldName={{@controller.fieldName}}
+ @save={{@controller.save}}
/>
- </div>
-</div>
\ No newline at end of file
+
+ <div class="admin-footer">
+ <div class="buttons">
+ <DButton
+ @action={{@controller.save}}
+ @disabled={{@controller.saveDisabled}}
+ @translatedLabel={{@controller.saveButtonText}}
+ class="btn-primary"
+ />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-email-style.gjs b/app/assets/javascripts/admin/addon/templates/customize-email-style.gjs
index 4f56dc61f2f..724f9246307 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-email-style.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-email-style.gjs
@@ -1,29 +1,41 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.email_appearance.title"}}
- @descriptionLabel={{i18n "admin.config.email_appearance.header_description"}}
- @shouldDisplay={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/email_style"
- @label={{i18n "admin.customize.email_style.heading"}}
- />
- </:breadcrumbs>
- <:tabs>
- <NavItem
- @label="admin.customize.email_style.html"
- @route="adminCustomizeEmailStyle.edit"
- @routeParam="html"
- />
- <NavItem
- @label="admin.customize.email_style.css"
- @route="adminCustomizeEmailStyle.edit"
- @routeParam="css"
- />
- </:tabs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
-<div class="admin-container">
- {{outlet}}
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.email_appearance.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.email_appearance.header_description"
+ }}
+ @shouldDisplay={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/email_style"
+ @label={{i18n "admin.customize.email_style.heading"}}
+ />
+ </:breadcrumbs>
+ <:tabs>
+ <NavItem
+ @label="admin.customize.email_style.html"
+ @route="adminCustomizeEmailStyle.edit"
+ @routeParam="html"
+ />
+ <NavItem
+ @label="admin.customize.email_style.css"
+ @route="adminCustomizeEmailStyle.edit"
+ @routeParam="css"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-form-templates-edit.gjs b/app/assets/javascripts/admin/addon/templates/customize-form-templates-edit.gjs
index 38c5499bfb4..a06bc4f5594 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-form-templates-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-form-templates-edit.gjs
@@ -1,4 +1,12 @@
-<div class="edit-form-template">
- <FormTemplate::InfoHeader />
- <FormTemplate::Form @model={{this.model}} />
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import Form from "admin/components/form-template/form";
+import InfoHeader from "admin/components/form-template/info-header";
+
+export default RouteTemplate(
+ <template>
+ <div class="edit-form-template">
+ <InfoHeader />
+ <Form @model={{@controller.model}} />
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-form-templates-index.gjs b/app/assets/javascripts/admin/addon/templates/customize-form-templates-index.gjs
index 1fa6e836152..f3d816bcb61 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-form-templates-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-form-templates-index.gjs
@@ -1,35 +1,47 @@
-<div class="form-templates">
- <FormTemplate::InfoHeader />
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import InfoHeader from "admin/components/form-template/info-header";
+import RowItem from "admin/components/form-template/row-item";
- {{#if this.model}}
- <table class="form-templates__table grid">
- <thead>
- <th class="col heading">
- {{i18n "admin.form_templates.list_table.headings.name"}}
- </th>
- <th class="col heading">
- {{i18n "admin.form_templates.list_table.headings.active_categories"}}
- </th>
- <th class="col heading sr-only">
- {{i18n "admin.form_templates.list_table.headings.actions"}}
- </th>
- </thead>
- <tbody>
- {{#each this.model as |template|}}
- <FormTemplate::RowItem
- @template={{template}}
- @refreshModel={{this.reload}}
- />
- {{/each}}
- </tbody>
- </table>
- {{/if}}
+export default RouteTemplate(
+ <template>
+ <div class="form-templates">
+ <InfoHeader />
- <DButton
- @label="admin.form_templates.new_template"
- @title="admin.form_templates.new_template"
- @icon="plus"
- @action={{this.newTemplate}}
- class="btn-primary"
- />
-</div>
\ No newline at end of file
+ {{#if @controller.model}}
+ <table class="form-templates__table grid">
+ <thead>
+ <th class="col heading">
+ {{i18n "admin.form_templates.list_table.headings.name"}}
+ </th>
+ <th class="col heading">
+ {{i18n
+ "admin.form_templates.list_table.headings.active_categories"
+ }}
+ </th>
+ <th class="col heading sr-only">
+ {{i18n "admin.form_templates.list_table.headings.actions"}}
+ </th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |template|}}
+ <RowItem
+ @template={{template}}
+ @refreshModel={{@controller.reload}}
+ />
+ {{/each}}
+ </tbody>
+ </table>
+ {{/if}}
+
+ <DButton
+ @label="admin.form_templates.new_template"
+ @title="admin.form_templates.new_template"
+ @icon="plus"
+ @action={{@controller.newTemplate}}
+ class="btn-primary"
+ />
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-form-templates-new.gjs b/app/assets/javascripts/admin/addon/templates/customize-form-templates-new.gjs
index 71515c6a54c..b1398cb53ff 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-form-templates-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-form-templates-new.gjs
@@ -1,4 +1,12 @@
-<div class="new-form-template">
- <FormTemplate::InfoHeader />
- <FormTemplate::Form />
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import Form from "admin/components/form-template/form";
+import InfoHeader from "admin/components/form-template/info-header";
+
+export default RouteTemplate(
+ <template>
+ <div class="new-form-template">
+ <InfoHeader />
+ <Form />
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-robots-txt.gjs b/app/assets/javascripts/admin/addon/templates/customize-robots-txt.gjs
index 2311eead180..a18a93908f3 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-robots-txt.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-robots-txt.gjs
@@ -1,24 +1,37 @@
-<div class="robots-txt-edit">
- <h3>{{i18n "admin.customize.robots.title"}}</h3>
- <p>{{i18n "admin.customize.robots.warning"}}</p>
- {{#if this.model.overridden}}
- <div class="overridden">
- {{i18n "admin.customize.robots.overridden"}}
+import { Textarea } from "@ember/component";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import SaveControls from "discourse/components/save-controls";
+import { i18n } from "discourse-i18n";
+
+export default RouteTemplate(
+ <template>
+ <div class="robots-txt-edit">
+ <h3>{{i18n "admin.customize.robots.title"}}</h3>
+ <p>{{i18n "admin.customize.robots.warning"}}</p>
+ {{#if @controller.model.overridden}}
+ <div class="overridden">
+ {{i18n "admin.customize.robots.overridden"}}
+ </div>
+ {{/if}}
+ <Textarea
+ @value={{@controller.buffered.robots_txt}}
+ class="robots-txt-input"
+ />
+ <SaveControls
+ @model={{@controller}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ @saveDisabled={{@controller.saveDisabled}}
+ >
+ <DButton
+ @disabled={{@controller.resetDisabled}}
+ @icon="arrow-rotate-left"
+ @action={{@controller.reset}}
+ @label="admin.settings.reset"
+ class="btn-default"
+ />
+ </SaveControls>
</div>
- {{/if}}
- <Textarea @value={{this.buffered.robots_txt}} class="robots-txt-input" />
- <SaveControls
- @model={{this}}
- @action={{action "save"}}
- @saved={{this.saved}}
- @saveDisabled={{this.saveDisabled}}
- >
- <DButton
- @disabled={{this.resetDisabled}}
- @icon="arrow-rotate-left"
- @action={{this.reset}}
- @label="admin.settings.reset"
- class="btn-default"
- />
- </SaveControls>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-edit.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-edit.gjs
index 12933e8f173..5d4a818ac66 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-edit.gjs
@@ -1,59 +1,69 @@
-<div class="current-style {{if this.maximized 'maximized'}}">
- <div class="wrapper">
- <div class="editor-information">
- <DButton
- @title="go_back"
- @action={{this.goBack}}
- @icon="chevron-left"
- class="btn-small editor-back-button"
- />
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import AdminThemeEditor from "admin/components/admin-theme-editor";
- <span class="editor-theme-name-wrapper">
- {{i18n "admin.customize.theme.edit_css_html"}}
- <LinkTo
- @route={{this.showRouteName}}
- @model={{this.model.id}}
- @replace={{true}}
- class="editor-theme-name"
- >
- {{this.model.name}}
- </LinkTo>
- </span>
- </div>
-
- <AdminThemeEditor
- @theme={{this.model}}
- @editRouteName={{this.editRouteName}}
- @currentTargetName={{this.currentTargetName}}
- @fieldName={{this.fieldName}}
- @fieldAdded={{action "fieldAdded"}}
- @maximized={{this.maximized}}
- @save={{action "save"}}
- />
+export default RouteTemplate(
+ <template>
+ <div class="current-style {{if @controller.maximized 'maximized'}}">
+ <div class="wrapper">
+ <div class="editor-information">
+ <DButton
+ @title="go_back"
+ @action={{@controller.goBack}}
+ @icon="chevron-left"
+ class="btn-small editor-back-button"
+ />
- <div class="admin-footer">
- <div class="status-actions">
- {{#unless this.model.changed}}
- <a
- href={{this.previewUrl}}
- rel="noopener noreferrer"
- title={{i18n "admin.customize.explain_preview"}}
- class="preview-link"
- target="_blank"
- >
- {{i18n "admin.customize.preview"}}
- </a>
- {{/unless}}
- </div>
+ <span class="editor-theme-name-wrapper">
+ {{i18n "admin.customize.theme.edit_css_html"}}
+ <LinkTo
+ @route={{@controller.showRouteName}}
+ @model={{@controller.model.id}}
+ @replace={{true}}
+ class="editor-theme-name"
+ >
+ {{@controller.model.name}}
+ </LinkTo>
+ </span>
+ </div>
- <div class="buttons">
- <DButton
- @action={{this.save}}
- @disabled={{this.saveDisabled}}
- @translatedLabel={{this.saveButtonText}}
- class="btn-primary save-theme"
+ <AdminThemeEditor
+ @theme={{@controller.model}}
+ @editRouteName={{@controller.editRouteName}}
+ @currentTargetName={{@controller.currentTargetName}}
+ @fieldName={{@controller.fieldName}}
+ @fieldAdded={{@controller.fieldAdded}}
+ @maximized={{@controller.maximized}}
+ @save={{@controller.save}}
/>
+
+ <div class="admin-footer">
+ <div class="status-actions">
+ {{#unless @controller.model.changed}}
+ <a
+ href={{@controller.previewUrl}}
+ rel="noopener noreferrer"
+ title={{i18n "admin.customize.explain_preview"}}
+ class="preview-link"
+ target="_blank"
+ >
+ {{i18n "admin.customize.preview"}}
+ </a>
+ {{/unless}}
+ </div>
+
+ <div class="buttons">
+ <DButton
+ @action={{@controller.save}}
+ @disabled={{@controller.saveDisabled}}
+ @translatedLabel={{@controller.saveButtonText}}
+ class="btn-primary save-theme"
+ />
+ </div>
+ </div>
</div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-index.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-index.gjs
index 2de6f05bcb7..85f1c77077f 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-index.gjs
@@ -1,27 +1,37 @@
-<div class="themes-intro admin-intro">
- <img src={{this.womanArtistEmojiURL}} alt="" />
- <div class="content-wrapper">
- <h1>{{i18n "admin.customize.theme.themes_intro"}}</h1>
- <div class="create-actions">
- <DButton
- @action={{route-action "installModal"}}
- @icon="upload"
- @label="admin.customize.install"
- class="btn-primary"
- />
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+
+export default RouteTemplate(
+ <template>
+ <div class="themes-intro admin-intro">
+ <img src={{@controller.womanArtistEmojiURL}} alt />
+ <div class="content-wrapper">
+ <h1>{{i18n "admin.customize.theme.themes_intro"}}</h1>
+ <div class="create-actions">
+ <DButton
+ @action={{routeAction "installModal"}}
+ @icon="upload"
+ @label="admin.customize.install"
+ class="btn-primary"
+ />
+ </div>
+ <div class="external-resources">
+ {{#each @controller.externalResources as |resource|}}
+ <a
+ href={{resource.link}}
+ class="external-link"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ {{icon resource.icon}}
+ {{i18n resource.key}}
+ </a>
+ {{/each}}
+ </div>
+ </div>
</div>
- <div class="external-resources">
- {{#each this.externalResources as |resource|}}
- <a
- href={{resource.link}}
- class="external-link"
- rel="noopener noreferrer"
- target="_blank"
- >
- {{d-icon resource.icon}}
- {{i18n resource.key}}
- </a>
- {{/each}}
- </div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-show-schema.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-show-schema.gjs
index 41db673dfe4..1f65bd8a183 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes-show-schema.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-show-schema.gjs
@@ -1,20 +1,28 @@
-<div class="customize-themes-show-schema__header row">
- <LinkTo
- @route="adminCustomizeThemes.show"
- @model={{@model.theme.id}}
- class="btn-transparent customize-themes-show-schema__back"
- >
- {{d-icon "arrow-left"}}{{@model.theme.name}}
- </LinkTo>
- <h2>
- {{i18n
- "admin.customize.theme.schema.title"
- }}
- </h2>
-</div>
+import { hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import Editor from "admin/components/schema-theme-setting/editor";
-<SchemaThemeSetting::Editor
- @themeId={{@model.theme.id}}
- @setting={{@model.setting}}
-/>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <div class="customize-themes-show-schema__header row">
+ <LinkTo
+ @route="adminCustomizeThemes.show"
+ @model={{@model.theme.id}}
+ class="btn-transparent customize-themes-show-schema__back"
+ >
+ {{icon "arrow-left"}}{{@model.theme.name}}
+ </LinkTo>
+ <h2>
+ {{i18n
+ "admin.customize.theme.schema.title"
+ }}
+ </h2>
+ </div>
+
+ <Editor @themeId={{@model.theme.id}} @setting={{@model.setting}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs
index 7633efaa367..5ce5d5a7139 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs
@@ -1,580 +1,625 @@
-{{#if this.editingThemeSetting}}
- {{outlet}}
-{{else}}
- {{#if this.fromNewConfigPage}}
- <div class="back-to-themes-and-components">
- <LinkTo
- @route={{if
- this.model.component
- "adminConfig.customize.components"
- "adminConfig.customize.themes"
- }}
- >
- {{dIcon "angle-left"}}
- {{i18n
- (if
- this.model.component
- "admin.config_areas.themes_and_components.components.back"
- "admin.config_areas.themes_and_components.themes.back"
- )
- }}
- </LinkTo>
- </div>
- {{/if}}
- <div
- class={{concat-class
- "show-current-style"
- (unless this.fromNewConfigPage "legacy")
- }}
- >
- <span>
- <PluginOutlet
- @name="admin-customize-themes-show-top"
- @connectorTagName="div"
- @outletArgs={{hash theme=this.model}}
- />
- </span>
-
- <div class="title">
- {{#if this.editingName}}
- <TextField @value={{this.model.name}} @autofocus="true" />
- <DButton
- @action={{this.finishedEditingName}}
- @icon="check"
- class="btn-primary btn-small submit-edit"
- />
- <DButton
- @action={{this.cancelEditingName}}
- @icon="xmark"
- class="btn-small cancel-edit"
- />
- {{else}}
- <span>{{this.model.name}}</span>
- <DButton
- @action={{this.startEditingName}}
- @icon="pencil"
- class="btn-small"
- />
- {{/if}}
- </div>
-
- <PluginOutlet
- @name="admin-customize-theme-before-errors"
- @outletArgs={{hash theme=this.model}}
- />
-
- {{#each this.model.errors as |error|}}
- <div class="alert alert-error">{{error}}</div>
- {{/each}}
-
- {{#if this.finishInstall}}
- <div class="control-unit">
- {{#if this.sourceIsHttp}}
- <a class="remote-url" href={{this.remoteThemeLink}}>{{i18n
- "admin.customize.theme.source_url"
- }}{{d-icon "link"}}</a>
- {{else}}
- <div class="remote-url">
- <code>{{this.model.remote_theme.remote_url}}</code>
- {{#if this.model.remote_theme.branch}}
- (<code>{{this.model.remote_theme.branch}}</code>)
- {{/if}}
- </div>
- {{/if}}
-
- {{#if this.showRemoteError}}
- <div class="error-message">
- {{d-icon "triangle-exclamation"}}
- {{i18n "admin.customize.theme.repo_unreachable"}}
- </div>
- <div class="raw-error">
- <code>{{this.model.remoteError}}</code>
- </div>
- {{/if}}
-
- <DButton
- @action={{this.updateToLatest}}
- @icon="download"
- @label="admin.customize.theme.finish_install"
- class="btn-primary finish-install"
- />
- <DButton
- @action={{this.destroyTheme}}
- @label="admin.customize.delete"
- @icon="trash-can"
- class="btn-danger"
- />
-
- <span class="status-message">
- {{i18n "admin.customize.theme.last_attempt"}}
- {{format-date this.model.remote_theme.updated_at leaveAgo="true"}}
- </span>
- </div>
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TextField from "discourse/components/text-field";
+import UserLink from "discourse/components/user-link";
+import avatar from "discourse/helpers/avatar";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import formatUsername from "discourse/helpers/format-username";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import InlineEditCheckbox from "admin/components/inline-edit-checkbox";
+import ThemeSettingEditor from "admin/components/theme-setting-editor";
+import ThemeSettingRelativesSelector from "admin/components/theme-setting-relatives-selector";
+import ThemeTranslation from "admin/components/theme-translation";
+import ColorPalettes from "select-kit/components/color-palettes";
+import ComboBox from "select-kit/components/combo-box";
+
+export default RouteTemplate(
+ <template>
+ {{#if @controller.editingThemeSetting}}
+ {{outlet}}
{{else}}
- {{#unless this.model.supported}}
- <div class="alert alert-error">
- {{i18n "admin.customize.theme.required_version.error"}}
- {{#if this.model.remote_theme.minimum_discourse_version}}
- {{i18n
- "admin.customize.theme.required_version.minimum"
- version=this.model.remote_theme.minimum_discourse_version
+ {{#if @controller.fromNewConfigPage}}
+ <div class="back-to-themes-and-components">
+ <LinkTo
+ @route={{if
+ @controller.model.component
+ "adminConfig.customize.components"
+ "adminConfig.customize.themes"
}}
- {{/if}}
- {{#if this.model.remote_theme.maximum_discourse_version}}
+ >
+ {{icon "angle-left"}}
{{i18n
- "admin.customize.theme.required_version.maximum"
- version=this.model.remote_theme.maximum_discourse_version
+ (if
+ @controller.model.component
+ "admin.config_areas.themes_and_components.components.back"
+ "admin.config_areas.themes_and_components.themes.back"
+ )
}}
- {{/if}}
+ </LinkTo>
</div>
- {{/unless}}
-
- {{#unless this.model.enabled}}
- <div class="alert alert-error">
- {{#if this.model.disabled_by}}
- {{i18n "admin.customize.theme.disabled_by"}}
- <UserLink @user={{this.model.disabled_by}}>
- {{avatar this.model.disabled_by imageSize="tiny"}}
- {{this.model.disabled_by.username}}
- </UserLink>
- {{format-date this.model.disabled_at leaveAgo="true"}}
+ {{/if}}
+ <div
+ class={{concatClass
+ "show-current-style"
+ (unless @controller.fromNewConfigPage "legacy")
+ }}
+ >
+ <span>
+ <PluginOutlet
+ @name="admin-customize-themes-show-top"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+
+ <div class="title">
+ {{#if @controller.editingName}}
+ <TextField @value={{@controller.model.name}} @autofocus="true" />
+ <DButton
+ @action={{@controller.finishedEditingName}}
+ @icon="check"
+ class="btn-primary btn-small submit-edit"
+ />
+ <DButton
+ @action={{@controller.cancelEditingName}}
+ @icon="xmark"
+ class="btn-small cancel-edit"
+ />
{{else}}
- {{i18n "admin.customize.theme.disabled"}}
+ <span>{{@controller.model.name}}</span>
+ <DButton
+ @action={{@controller.startEditingName}}
+ @icon="pencil"
+ class="btn-small"
+ />
{{/if}}
- <DButton
- @action={{this.enableComponent}}
- @icon="check"
- @label="admin.customize.theme.enable"
- class="btn-default"
- />
</div>
- {{/unless}}
- <div class="metadata control-unit">
- {{#if this.model.remote_theme}}
- {{#if this.model.remote_theme.remote_url}}
- {{#if this.sourceIsHttp}}
- <a class="remote-url" href={{this.remoteThemeLink}}>{{i18n
+ <PluginOutlet
+ @name="admin-customize-theme-before-errors"
+ @outletArgs={{hash [email protected]}}
+ />
+
+ {{#each @controller.model.errors as |error|}}
+ <div class="alert alert-error">{{error}}</div>
+ {{/each}}
+
+ {{#if @controller.finishInstall}}
+ <div class="control-unit">
+ {{#if @controller.sourceIsHttp}}
+ <a class="remote-url" href={{@controller.remoteThemeLink}}>{{i18n
"admin.customize.theme.source_url"
- }}{{d-icon "link"}}</a>
+ }}{{icon "link"}}</a>
{{else}}
<div class="remote-url">
- <code>{{this.model.remote_theme.remote_url}}</code>
- {{#if this.model.remote_theme.branch}}
- (<code>{{this.model.remote_theme.branch}}</code>)
+ <code>{{@controller.model.remote_theme.remote_url}}</code>
+ {{#if @controller.model.remote_theme.branch}}
+ (<code>{{@controller.model.remote_theme.branch}}</code>)
{{/if}}
</div>
{{/if}}
- {{/if}}
-
- {{#if this.model.remote_theme.about_url}}
- <a
- class="url about-url"
- href={{this.model.remote_theme.about_url}}
- >{{i18n "admin.customize.theme.about_theme"}}{{d-icon "link"}}</a>
- {{/if}}
-
- {{#if this.model.remote_theme.license_url}}
- <a
- class="url license-url"
- href={{this.model.remote_theme.license_url}}
- >{{i18n "admin.customize.theme.license"}}{{d-icon "link"}}</a>
- {{/if}}
- {{#if this.model.description}}
- <span class="theme-description">{{this.model.description}}</span>
- {{/if}}
-
- {{#if this.model.remote_theme.authors}}<span class="authors"><span
- class="heading"
- >{{i18n "admin.customize.theme.authors"}}</span>
- {{this.model.remote_theme.authors}}</span>{{/if}}
+ {{#if @controller.showRemoteError}}
+ <div class="error-message">
+ {{icon "triangle-exclamation"}}
+ {{i18n "admin.customize.theme.repo_unreachable"}}
+ </div>
+ <div class="raw-error">
+ <code>{{@controller.model.remoteError}}</code>
+ </div>
+ {{/if}}
- {{#if this.model.remote_theme.theme_version}}<span
- class="version"
- ><span class="heading">{{i18n
- "admin.customize.theme.version"
- }}</span>
- {{this.model.remote_theme.theme_version}}</span>{{/if}}
+ <DButton
+ @action={{@controller.updateToLatest}}
+ @icon="download"
+ @label="admin.customize.theme.finish_install"
+ class="btn-primary finish-install"
+ />
+ <DButton
+ @action={{@controller.destroyTheme}}
+ @label="admin.customize.delete"
+ @icon="trash-can"
+ class="btn-danger"
+ />
- <div class="control-unit">
- {{#if this.model.remote_theme.is_git}}
- <div class="alert alert-info">
- {{html-safe
- (i18n
- "admin.customize.theme.remote_theme_edits"
- repoURL=this.remoteThemeLink
- )
+ <span class="status-message">
+ {{i18n "admin.customize.theme.last_attempt"}}
+ {{formatDate
+ @controller.model.remote_theme.updated_at
+ leaveAgo="true"
+ }}
+ </span>
+ </div>
+ {{else}}
+ {{#unless @controller.model.supported}}
+ <div class="alert alert-error">
+ {{i18n "admin.customize.theme.required_version.error"}}
+ {{#if @controller.model.remote_theme.minimum_discourse_version}}
+ {{i18n
+ "admin.customize.theme.required_version.minimum"
+ [email protected]_theme.minimum_discourse_version
}}
- </div>
-
- {{#if this.showRemoteError}}
- <div class="error-message">
- {{d-icon "triangle-exclamation"}}
- {{i18n "admin.customize.theme.repo_unreachable"}}
- </div>
- <div class="raw-error">
- <code>{{this.model.remoteError}}</code>
- </div>
{{/if}}
+ {{#if @controller.model.remote_theme.maximum_discourse_version}}
+ {{i18n
+ "admin.customize.theme.required_version.maximum"
+ [email protected]_theme.maximum_discourse_version
+ }}
+ {{/if}}
+ </div>
+ {{/unless}}
- {{#if this.model.remote_theme.commits_behind}}
- <DButton
- @action={{this.updateToLatest}}
- @icon="download"
- @label="admin.customize.theme.update_to_latest"
- class="btn-primary"
- />
+ {{#unless @controller.model.enabled}}
+ <div class="alert alert-error">
+ {{#if @controller.model.disabled_by}}
+ {{i18n "admin.customize.theme.disabled_by"}}
+ <UserLink @user={{@controller.model.disabled_by}}>
+ {{avatar @controller.model.disabled_by imageSize="tiny"}}
+ {{@controller.model.disabled_by.username}}
+ </UserLink>
+ {{formatDate @controller.model.disabled_at leaveAgo="true"}}
{{else}}
- <DButton
- @action={{this.checkForThemeUpdates}}
- @icon="arrows-rotate"
- @label="admin.customize.theme.check_for_updates"
- class="btn-default"
- />
+ {{i18n "admin.customize.theme.disabled"}}
{{/if}}
+ <DButton
+ @action={{@controller.enableComponent}}
+ @icon="check"
+ @label="admin.customize.theme.enable"
+ class="btn-default"
+ />
+ </div>
+ {{/unless}}
- <span class="status-message">
- {{#if this.updatingRemote}}
- {{i18n "admin.customize.theme.updating"}}
+ <div class="metadata control-unit">
+ {{#if @controller.model.remote_theme}}
+ {{#if @controller.model.remote_theme.remote_url}}
+ {{#if @controller.sourceIsHttp}}
+ <a
+ class="remote-url"
+ href={{@controller.remoteThemeLink}}
+ >{{i18n "admin.customize.theme.source_url"}}{{icon
+ "link"
+ }}</a>
{{else}}
- {{#if this.model.remote_theme.commits_behind}}
- {{#if this.hasOverwrittenHistory}}
- {{i18n "admin.customize.theme.has_overwritten_history"}}
- {{else}}
- {{i18n
- "admin.customize.theme.commits_behind"
- count=this.model.remote_theme.commits_behind
- }}
- {{/if}}
- {{#if this.model.remote_theme.github_diff_link}}
- <a href={{this.model.remote_theme.github_diff_link}}>
- {{i18n "admin.customize.theme.compare_commits"}}
- </a>
+ <div class="remote-url">
+ <code>{{@controller.model.remote_theme.remote_url}}</code>
+ {{#if @controller.model.remote_theme.branch}}
+ (<code>{{@controller.model.remote_theme.branch}}</code>)
{{/if}}
+ </div>
+ {{/if}}
+ {{/if}}
+
+ {{#if @controller.model.remote_theme.about_url}}
+ <a
+ class="url about-url"
+ href={{@controller.model.remote_theme.about_url}}
+ >{{i18n "admin.customize.theme.about_theme"}}{{icon "link"}}</a>
+ {{/if}}
+
+ {{#if @controller.model.remote_theme.license_url}}
+ <a
+ class="url license-url"
+ href={{@controller.model.remote_theme.license_url}}
+ >{{i18n "admin.customize.theme.license"}}{{icon "link"}}</a>
+ {{/if}}
+
+ {{#if @controller.model.description}}
+ <span
+ class="theme-description"
+ >{{@controller.model.description}}</span>
+ {{/if}}
+
+ {{#if @controller.model.remote_theme.authors}}<span
+ class="authors"
+ ><span class="heading">{{i18n
+ "admin.customize.theme.authors"
+ }}</span>
+ {{@controller.model.remote_theme.authors}}</span>{{/if}}
+
+ {{#if @controller.model.remote_theme.theme_version}}<span
+ class="version"
+ ><span class="heading">{{i18n
+ "admin.customize.theme.version"
+ }}</span>
+ {{@controller.model.remote_theme.theme_version}}</span>{{/if}}
+
+ <div class="control-unit">
+ {{#if @controller.model.remote_theme.is_git}}
+ <div class="alert alert-info">
+ {{htmlSafe
+ (i18n
+ "admin.customize.theme.remote_theme_edits"
+ )
+ }}
+ </div>
+
+ {{#if @controller.showRemoteError}}
+ <div class="error-message">
+ {{icon "triangle-exclamation"}}
+ {{i18n "admin.customize.theme.repo_unreachable"}}
+ </div>
+ <div class="raw-error">
+ <code>{{@controller.model.remoteError}}</code>
+ </div>
+ {{/if}}
+
+ {{#if @controller.model.remote_theme.commits_behind}}
+ <DButton
+ @action={{@controller.updateToLatest}}
+ @icon="download"
+ @label="admin.customize.theme.update_to_latest"
+ class="btn-primary"
+ />
{{else}}
- {{#unless this.showRemoteError}}
- {{i18n "admin.customize.theme.up_to_date"}}
- {{format-date
- this.model.remote_theme.updated_at
- leaveAgo="true"
- }}
- {{/unless}}
+ <DButton
+ @action={{@controller.checkForThemeUpdates}}
+ @icon="arrows-rotate"
+ @label="admin.customize.theme.check_for_updates"
+ class="btn-default"
+ />
{{/if}}
+
+ <span class="status-message">
+ {{#if @controller.updatingRemote}}
+ {{i18n "admin.customize.theme.updating"}}
+ {{else}}
+ {{#if @controller.model.remote_theme.commits_behind}}
+ {{#if @controller.hasOverwrittenHistory}}
+ {{i18n
+ "admin.customize.theme.has_overwritten_history"
+ }}
+ {{else}}
+ {{i18n
+ "admin.customize.theme.commits_behind"
+ [email protected]_theme.commits_behind
+ }}
+ {{/if}}
+ {{#if @controller.model.remote_theme.github_diff_link}}
+ <a
+ href={{@controller.model.remote_theme.github_diff_link}}
+ >
+ {{i18n "admin.customize.theme.compare_commits"}}
+ </a>
+ {{/if}}
+ {{else}}
+ {{#unless @controller.showRemoteError}}
+ {{i18n "admin.customize.theme.up_to_date"}}
+ {{formatDate
+ @controller.model.remote_theme.updated_at
+ leaveAgo="true"
+ }}
+ {{/unless}}
+ {{/if}}
+ {{/if}}
+ </span>
+ {{else}}
+ <span class="status-message">
+ {{icon "circle-info"}}
+ {{i18n "admin.customize.theme.imported_from_archive"}}
+ </span>
{{/if}}
- </span>
+ </div>
{{else}}
- <span class="status-message">
- {{d-icon "circle-info"}}
- {{i18n "admin.customize.theme.imported_from_archive"}}
+ <span class="heading">{{i18n
+ "admin.customize.theme.creator"
+ }}</span>
+ <span>
+ <UserLink @user={{@controller.model.user}}>
+ {{formatUsername @controller.model.user.username}}
+ </UserLink>
</span>
{{/if}}
</div>
- {{else}}
- <span class="heading">{{i18n "admin.customize.theme.creator"}}</span>
- <span>
- <UserLink @user={{this.model.user}}>
- {{format-username this.model.user.username}}
- </UserLink>
- </span>
- {{/if}}
- </div>
- {{#if this.showCheckboxes}}
- <div class="control-unit">
- {{#unless this.model.component}}
- <InlineEditCheckbox
- @action={{action "applyDefault"}}
- @labelKey="admin.customize.theme.is_default"
- @checked={{this.model.default}}
- @modelId={{this.model.id}}
- />
- <InlineEditCheckbox
- @action={{action "applyUserSelectable"}}
- @labelKey="admin.customize.theme.user_selectable"
- @checked={{this.model.user_selectable}}
- @modelId={{this.model.id}}
- />
- {{/unless}}
- {{#if this.model.remote_theme}}
- <InlineEditCheckbox
- @action={{action "applyAutoUpdateable"}}
- @labelKey="admin.customize.theme.auto_update"
- @checked={{this.model.auto_update}}
- @modelId={{this.model.id}}
- />
- {{/if}}
- </div>
- {{/if}}
-
- {{#unless this.model.component}}
- <section
- class="form-horizontal theme settings control-unit theme-settings__color-scheme"
- >
- <div class="row setting">
- <div class="setting-label">
- {{i18n "admin.customize.theme.color_scheme"}}
- </div>
-
- <div class="setting-value">
- <div class="color-palette-input-group">
- <ColorPalettes
- @content={{this.colorSchemes}}
- @value={{this.colorSchemeId}}
- @icon="paintbrush"
- @options={{hash filterable=true}}
+ {{#if @controller.showCheckboxes}}
+ <div class="control-unit">
+ {{#unless @controller.model.component}}
+ <InlineEditCheckbox
+ @action={{@controller.applyDefault}}
+ @labelKey="admin.customize.theme.is_default"
+ @checked={{@controller.model.default}}
+ @modelId={{@controller.model.id}}
/>
- {{#if this.colorSchemeId}}
- <DButton
- @icon="pencil"
- @action={{this.editColorScheme}}
- @title="admin.customize.theme.edit_color_scheme"
- />
- {{/if}}
- </div>
-
- <div class="desc">{{i18n
- "admin.customize.theme.color_scheme_select"
- }}</div>
- </div>
-
- <div class="setting-controls">
- {{#if this.colorSchemeChanged}}
- <DButton
- @action={{this.changeScheme}}
- @icon="check"
- class="ok submit-edit"
+ <InlineEditCheckbox
+ @action={{@controller.applyUserSelectable}}
+ @labelKey="admin.customize.theme.user_selectable"
+ @checked={{@controller.model.user_selectable}}
+ @modelId={{@controller.model.id}}
/>
- <DButton
- @action={{this.cancelChangeScheme}}
- @icon="xmark"
- class="cancel cancel-edit"
+ {{/unless}}
+ {{#if @controller.model.remote_theme}}
+ <InlineEditCheckbox
+ @action={{@controller.applyAutoUpdateable}}
+ @labelKey="admin.customize.theme.auto_update"
+ @checked={{@controller.model.auto_update}}
+ @modelId={{@controller.model.id}}
/>
{{/if}}
</div>
- </div>
- </section>
- {{/unless}}
-
- {{#if this.model.component}}
- <section class="form-horizontal theme settings control-unit">
- <div class="row setting">
- <ThemeSettingRelativesSelector
- @setting={{this.relativesSelectorSettingsForComponent}}
- @model={{this.model}}
- class="theme-setting"
- />
- </div>
- </section>
- {{else}}
- <section class="form-horizontal theme settings control-unit">
- <div class="row setting">
- <ThemeSettingRelativesSelector
- @setting={{this.relativesSelectorSettingsForTheme}}
- @model={{this.model}}
- class="theme-setting"
- />
- </div>
- </section>
- {{/if}}
-
- {{#unless this.model.remote_theme.is_git}}
- <div class="control-unit">
- <div class="mini-title">{{i18n
- "admin.customize.theme.css_html"
- }}</div>
- {{#if this.model.hasEditedFields}}
- <div class="description">{{i18n
- "admin.customize.theme.custom_sections"
- }}</div>
- <ul>
- {{#each this.editedFieldsFormatted as |field|}}
- <li>{{field}}</li>
- {{/each}}
- </ul>
- {{else}}
- <div class="description">
- {{i18n "admin.customize.theme.edit_css_html_help"}}
- </div>
{{/if}}
- <DButton
- @action={{this.editTheme}}
- @label="admin.customize.theme.edit_css_html"
- class="btn-default edit"
- />
- </div>
+ {{#unless @controller.model.component}}
+ <section
+ class="form-horizontal theme settings control-unit theme-settings__color-scheme"
+ >
+ <div class="row setting">
+ <div class="setting-label">
+ {{i18n "admin.customize.theme.color_scheme"}}
+ </div>
+
+ <div class="setting-value">
+ <div class="color-palette-input-group">
+ <ColorPalettes
+ @content={{@controller.colorSchemes}}
+ @value={{@controller.colorSchemeId}}
+ @icon="paintbrush"
+ @options={{hash filterable=true}}
+ />
+ {{#if @controller.colorSchemeId}}
+ <DButton
+ @icon="pencil"
+ @action={{@controller.editColorScheme}}
+ @title="admin.customize.theme.edit_color_scheme"
+ />
+ {{/if}}
+ </div>
- <div class="control-unit">
- <div class="mini-title">{{i18n "admin.customize.theme.uploads"}}</div>
- {{#if this.model.uploads}}
- <ul class="removable-list">
- {{#each this.model.uploads as |upload|}}
- <li>
- <span class="col">${{upload.name}}:
- <a
- href={{upload.url}}
- rel="noopener noreferrer"
- target="_blank"
- >{{upload.filename}}</a></span>
- <span class="col">
+ <div class="desc">{{i18n
+ "admin.customize.theme.color_scheme_select"
+ }}</div>
+ </div>
+
+ <div class="setting-controls">
+ {{#if @controller.colorSchemeChanged}}
+ <DButton
+ @action={{@controller.changeScheme}}
+ @icon="check"
+ class="ok submit-edit"
+ />
<DButton
- @action={{fn this.removeUpload upload}}
+ @action={{@controller.cancelChangeScheme}}
@icon="xmark"
- class="second btn-default btn-default cancel-edit"
+ class="cancel cancel-edit"
/>
- </span>
- </li>
- {{/each}}
- </ul>
+ {{/if}}
+ </div>
+ </div>
+ </section>
+ {{/unless}}
+
+ {{#if @controller.model.component}}
+ <section class="form-horizontal theme settings control-unit">
+ <div class="row setting">
+ <ThemeSettingRelativesSelector
+ @setting={{@controller.relativesSelectorSettingsForComponent}}
+ @model={{@controller.model}}
+ class="theme-setting"
+ />
+ </div>
+ </section>
{{else}}
- <div class="description">{{i18n
- "admin.customize.theme.no_uploads"
- }}</div>
+ <section class="form-horizontal theme settings control-unit">
+ <div class="row setting">
+ <ThemeSettingRelativesSelector
+ @setting={{@controller.relativesSelectorSettingsForTheme}}
+ @model={{@controller.model}}
+ class="theme-setting"
+ />
+ </div>
+ </section>
{{/if}}
- <DButton
- @action={{this.addUploadModal}}
- @icon="plus"
- @label="admin.customize.theme.add"
- class="btn-default"
- />
- </div>
- {{/unless}}
-
- {{#if this.extraFiles.length}}
- <div class="control-unit">
- <div class="mini-title">{{i18n
- "admin.customize.theme.extra_files"
- }}</div>
- <details>
- <summary>
- {{#if this.model.remote_theme}}
- {{i18n "admin.customize.theme.extra_files_remote"}}
+
+ {{#unless @controller.model.remote_theme.is_git}}
+ <div class="control-unit">
+ <div class="mini-title">{{i18n
+ "admin.customize.theme.css_html"
+ }}</div>
+ {{#if @controller.model.hasEditedFields}}
+ <div class="description">{{i18n
+ "admin.customize.theme.custom_sections"
+ }}</div>
+ <ul>
+ {{#each @controller.editedFieldsFormatted as |field|}}
+ <li>{{field}}</li>
+ {{/each}}
+ </ul>
{{else}}
- {{i18n "admin.customize.theme.extra_files_upload"}}
+ <div class="description">
+ {{i18n "admin.customize.theme.edit_css_html_help"}}
+ </div>
{{/if}}
- </summary>
- <ul>
- {{#each this.extraFiles as |extraFile|}}
- <li>{{extraFile.name}}</li>
- {{/each}}
- </ul>
- </details>
- </div>
- {{/if}}
- {{#if this.hasSettings}}
- <div class="control-unit">
- <div class="mini-title">{{i18n
- "admin.customize.theme.theme_settings"
- }}</div>
- <p><i>{{i18n
- "admin.customize.theme.overriden_settings_explanation"
- }}</i></p>
- <section class="form-horizontal theme settings control-unit">
- {{#each this.settings as |setting|}}
- <ThemeSettingEditor
- @setting={{setting}}
- @model={{this.model}}
- class="theme-setting control-unit"
+ <DButton
+ @action={{@controller.editTheme}}
+ @label="admin.customize.theme.edit_css_html"
+ class="btn-default edit"
/>
- {{/each}}
- </section>
- </div>
- {{/if}}
-
- {{#if this.hasTranslations}}
- <div class="control-unit">
- <div class="translation-selector-container">
- <span class="mini-title">
- {{i18n "admin.customize.theme.theme_translations"}}
- </span>
- <ComboBox
- @valueProperty="value"
- @content={{this.availableLocales}}
- @value={{this.locale}}
- @onChange={{this.updateLocale}}
- @options={{hash filterable=true}}
- class="translation-selector"
- />
- </div>
- <section
- class="form-horizontal theme settings translations control-unit"
- >
+ </div>
- {{#each this.translations as |translation|}}
- <ThemeTranslation
- @translation={{translation}}
- @model={{this.model}}
- class="theme-translation"
+ <div class="control-unit">
+ <div class="mini-title">{{i18n
+ "admin.customize.theme.uploads"
+ }}</div>
+ {{#if @controller.model.uploads}}
+ <ul class="removable-list">
+ {{#each @controller.model.uploads as |upload|}}
+ <li>
+ {{! template-lint-disable no-unnecessary-curly-strings }}
+ {{! workaround for https://github.com/typed-ember/glint/issues/840 }}
+ <span class="col">{{"$"}}{{upload.name}}:
+ <a
+ href={{upload.url}}
+ rel="noopener noreferrer"
+ target="_blank"
+ >{{upload.filename}}</a></span>
+ <span class="col">
+ <DButton
+ @action={{fn @controller.removeUpload upload}}
+ @icon="xmark"
+ class="second btn-default btn-default cancel-edit"
+ />
+ </span>
+ </li>
+ {{/each}}
+ </ul>
+ {{else}}
+ <div class="description">{{i18n
+ "admin.customize.theme.no_uploads"
+ }}</div>
+ {{/if}}
+ <DButton
+ @action={{@controller.addUploadModal}}
+ @icon="plus"
+ @label="admin.customize.theme.add"
+ class="btn-default"
/>
- {{/each}}
- </section>
- </div>
- {{/if}}
+ </div>
+ {{/unless}}
+
+ {{#if @controller.extraFiles.length}}
+ <div class="control-unit">
+ <div class="mini-title">{{i18n
+ "admin.customize.theme.extra_files"
+ }}</div>
+ <details>
+ <summary>
+ {{#if @controller.model.remote_theme}}
+ {{i18n "admin.customize.theme.extra_files_remote"}}
+ {{else}}
+ {{i18n "admin.customize.theme.extra_files_upload"}}
+ {{/if}}
+ </summary>
+ <ul>
+ {{#each @controller.extraFiles as |extraFile|}}
+ <li>{{extraFile.name}}</li>
+ {{/each}}
+ </ul>
+ </details>
+ </div>
+ {{/if}}
+
+ {{#if @controller.hasSettings}}
+ <div class="control-unit">
+ <div class="mini-title">{{i18n
+ "admin.customize.theme.theme_settings"
+ }}</div>
+ <p><i>{{i18n
+ "admin.customize.theme.overriden_settings_explanation"
+ }}</i></p>
+ <section class="form-horizontal theme settings control-unit">
+ {{#each @controller.settings as |setting|}}
+ <ThemeSettingEditor
+ @setting={{setting}}
+ @model={{@controller.model}}
+ class="theme-setting control-unit"
+ />
+ {{/each}}
+ </section>
+ </div>
+ {{/if}}
+
+ {{#if @controller.hasTranslations}}
+ <div class="control-unit">
+ <div class="translation-selector-container">
+ <span class="mini-title">
+ {{i18n "admin.customize.theme.theme_translations"}}
+ </span>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.availableLocales}}
+ @value={{@controller.locale}}
+ @onChange={{@controller.updateLocale}}
+ @options={{hash filterable=true}}
+ class="translation-selector"
+ />
+ </div>
+ <section
+ class="form-horizontal theme settings translations control-unit"
+ >
+
+ {{#each @controller.translations as |translation|}}
+ <ThemeTranslation
+ @translation={{translation}}
+ @model={{@controller.model}}
+ class="theme-translation"
+ />
+ {{/each}}
+ </section>
+ </div>
+ {{/if}}
- <PluginOutlet
- @name="admin-customize-theme-before-controls"
- @outletArgs={{hash theme=this.model}}
- />
- <div class="theme-controls">
- <a
- href={{this.previewUrl}}
- title={{i18n "admin.customize.explain_preview"}}
- rel="noopener noreferrer"
- target="_blank"
- class="btn btn-default"
- >{{d-icon "desktop"}}{{i18n "admin.customize.theme.preview"}}</a>
- <a
- class="btn btn-default export"
- rel="noopener noreferrer"
- target="_blank"
- href={{this.downloadUrl}}
- >{{d-icon "download"}} {{i18n "admin.export_json.button_text"}}</a>
-
- {{#if this.showConvert}}
- <DButton
- @action={{this.switchType}}
- @label="admin.customize.theme.convert"
- @icon={{this.convertIcon}}
- @title={{this.convertTooltip}}
- class="btn-default btn-normal"
+ <PluginOutlet
+ @name="admin-customize-theme-before-controls"
+ @outletArgs={{hash [email protected]}}
/>
- {{/if}}
+ <div class="theme-controls">
+ <a
+ href={{@controller.previewUrl}}
+ title={{i18n "admin.customize.explain_preview"}}
+ rel="noopener noreferrer"
+ target="_blank"
+ class="btn btn-default"
+ >{{icon "desktop"}}{{i18n "admin.customize.theme.preview"}}</a>
+ <a
+ class="btn btn-default export"
+ rel="noopener noreferrer"
+ target="_blank"
+ href={{@controller.downloadUrl}}
+ >{{icon "download"}} {{i18n "admin.export_json.button_text"}}</a>
+
+ {{#if @controller.showConvert}}
+ <DButton
+ @action={{@controller.switchType}}
+ @label="admin.customize.theme.convert"
+ @icon={{@controller.convertIcon}}
+ @title={{@controller.convertTooltip}}
+ class="btn-default btn-normal"
+ />
+ {{/if}}
- {{#if this.model.component}}
- {{#if this.model.enabled}}
- <DButton
- @action={{this.disableComponent}}
- @icon="ban"
- @label="admin.customize.theme.disable"
- class="btn-default"
- />
- {{else}}
+ {{#if @controller.model.component}}
+ {{#if @controller.model.enabled}}
+ <DButton
+ @action={{@controller.disableComponent}}
+ @icon="ban"
+ @label="admin.customize.theme.disable"
+ class="btn-default"
+ />
+ {{else}}
+ <DButton
+ @action={{@controller.enableComponent}}
+ @icon="check"
+ @label="admin.customize.theme.enable"
+ class="btn-default"
+ />
+ {{/if}}
+ {{/if}}
+ {{#if @controller.hasSettings}}
+ <DButton
+ @action={{@controller.showThemeSettingsEditor}}
+ @label="admin.customize.theme.settings_editor"
+ @icon="pencil"
+ @title="admin.customize.theme.settings_editor"
+ class="btn-default btn-normal"
+ />
+ {{/if}}
<DButton
- @action={{this.enableComponent}}
- @icon="check"
- @label="admin.customize.theme.enable"
- class="btn-default"
+ @action={{@controller.destroyTheme}}
+ @label="admin.customize.delete"
+ @icon="trash-can"
+ class="btn-danger"
/>
- {{/if}}
- {{/if}}
- {{#if this.hasSettings}}
- <DButton
- @action={{this.showThemeSettingsEditor}}
- @label="admin.customize.theme.settings_editor"
- @icon="pencil"
- @title="admin.customize.theme.settings_editor"
- class="btn-default btn-normal"
- />
+ </div>
{{/if}}
- <DButton
- @action={{this.destroyTheme}}
- @label="admin.customize.delete"
- @icon="trash-can"
- class="btn-danger"
- />
</div>
{{/if}}
- </div>
-{{/if}}
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes.gjs
index b3161f93602..b89aa12c49f 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes.gjs
@@ -1,44 +1,60 @@
-{{#unless this.fromNewConfigPage}}
- {{#if (eq this.currentTab "themes")}}
- <DPageHeader
- @titleLabel={{i18n "admin.config.themes.title"}}
- @descriptionLabel={{i18n "admin.config.themes.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/91966"
- @hideTabs={{true}}
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/themes"
- @label={{i18n "admin.config.themes.title"}}
- />
- </:breadcrumbs>
- </DPageHeader>
- {{else}}
- <DPageHeader
- @titleLabel={{i18n "admin.config.components.title"}}
- @descriptionLabel={{i18n "admin.config.components.header_description"}}
- @hideTabs={{true}}
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/components"
- @label={{i18n "admin.config.components.title"}}
- />
- </:breadcrumbs>
- </DPageHeader>
- {{/if}}
-{{/unless}}
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+import ThemesList from "admin/components/themes-list";
+import eq from "truth-helpers/helpers/eq";
+import or from "truth-helpers/helpers/or";
-<PluginOutlet @name="admin-customize-themes">
- {{#unless (or this.editingTheme this.fromNewConfigPage)}}
- <ThemesList
- @themes={{this.fullThemes}}
- @components={{this.childThemes}}
- @currentTab={{this.currentTab}}
- @installModal={{route-action "installModal"}}
- />
- {{/unless}}
- {{outlet}}
-</PluginOutlet>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ {{#unless @controller.fromNewConfigPage}}
+ {{#if (eq @controller.currentTab "themes")}}
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.themes.title"}}
+ @descriptionLabel={{i18n "admin.config.themes.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/91966"
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/themes"
+ @label={{i18n "admin.config.themes.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+ {{else}}
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.components.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.components.header_description"
+ }}
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/components"
+ @label={{i18n "admin.config.components.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+ {{/if}}
+ {{/unless}}
+
+ <PluginOutlet @name="admin-customize-themes">
+ {{#unless (or @controller.editingTheme @controller.fromNewConfigPage)}}
+ <ThemesList
+ @themes={{@controller.fullThemes}}
+ @components={{@controller.childThemes}}
+ @currentTab={{@controller.currentTab}}
+ @installModal={{routeAction "installModal"}}
+ />
+ {{/unless}}
+ {{outlet}}
+ </PluginOutlet>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/customize.gjs b/app/assets/javascripts/admin/addon/templates/customize.gjs
index de20dd22a3e..20362c5e11e 100644
--- a/app/assets/javascripts/admin/addon/templates/customize.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize.gjs
@@ -1,3 +1,9 @@
-<div class="admin-config-page">
- {{outlet}}
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+
+export default RouteTemplate(
+ <template>
+ <div class="admin-config-page">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard-new-features.gjs b/app/assets/javascripts/admin/addon/templates/dashboard-new-features.gjs
index 129ed90ceb9..6283fd7e7a4 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard-new-features.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard-new-features.gjs
@@ -1,7 +1,17 @@
-<ConditionalLoadingSpinner @condition={{this.isLoading}}>
- <div class="admin-config-area">
- <h2>{{i18n "admin.dashboard.new_features.title"}}</h2>
- <p>{{html-safe (i18n "admin.dashboard.new_features.subtitle")}}</p>
- <DashboardNewFeatures />
- </div>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import DashboardNewFeatures from "admin/components/dashboard-new-features";
+
+export default RouteTemplate(
+ <template>
+ <ConditionalLoadingSpinner @condition={{@controller.isLoading}}>
+ <div class="admin-config-area">
+ <h2>{{i18n "admin.dashboard.new_features.title"}}</h2>
+ <p>{{htmlSafe (i18n "admin.dashboard.new_features.subtitle")}}</p>
+ <DashboardNewFeatures />
+ </div>
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard.gjs b/app/assets/javascripts/admin/addon/templates/dashboard.gjs
index e61a047b280..f0e63b48eee 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard.gjs
@@ -1,63 +1,82 @@
-<PluginOutlet @name="admin-dashboard-top" @connectorTagName="div" />
-
-<DPageHeader @hideTabs={{true}}>
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin.dashboard.title"}} />
- </:breadcrumbs>
-</DPageHeader>
-
-{{#if this.showVersionChecks}}
- <div class="section-top">
- <div class="version-checks">
- <VersionChecks @versionCheck={{this.versionCheck}} @tagName="" />
- </div>
- </div>
-{{/if}}
-
-<DashboardProblems
- @loadingProblems={{this.loadingProblems}}
- @problems={{this.problems}}
- @problemsTimestamp={{this.problemsTimestamp}}
- @refreshProblems={{action "refreshProblems"}}
-/>
-<nav>
- <ul class="nav nav-pills">
- <li class="navigation-item general">
- <LinkTo @route="admin.dashboard.general" class="navigation-link">
- {{i18n "admin.dashboard.general_tab"}}
- </LinkTo>
- </li>
-
- {{#if this.isModerationTabVisible}}
- <li class="navigation-item moderation">
- <LinkTo @route="admin.dashboardModeration" class="navigation-link">
- {{i18n "admin.dashboard.moderation_tab"}}
- </LinkTo>
- </li>
- {{/if}}
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import { i18n } from "discourse-i18n";
+import DashboardProblems from "admin/components/dashboard-problems";
+import VersionChecks from "admin/components/version-checks";
- {{#if this.isSecurityTabVisible}}
- <li class="navigation-item security">
- <LinkTo @route="admin.dashboardSecurity" class="navigation-link">
- {{i18n "admin.dashboard.security_tab"}}
- </LinkTo>
- </li>
- {{/if}}
+export default RouteTemplate(
+ <template>
+ <PluginOutlet @name="admin-dashboard-top" @connectorTagName="div" />
- {{#if this.isReportsTabVisible}}
- <li class="navigation-item reports">
- <LinkTo @route="admin.dashboardReports" class="navigation-link">
- {{i18n "admin.dashboard.reports_tab"}}
- </LinkTo>
- </li>
+ <DPageHeader @hideTabs={{true}}>
+ <:breadcrumbs>
+ <DBreadcrumbsItem
+ @path="/admin"
+ @label={{i18n "admin.dashboard.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ {{#if @controller.showVersionChecks}}
+ <div class="section-top">
+ <div class="version-checks">
+ <VersionChecks
+ @versionCheck={{@controller.versionCheck}}
+ @tagName=""
+ />
+ </div>
+ </div>
{{/if}}
- <PluginOutlet @name="admin-dashboard-tabs-after" />
- </ul>
-</nav>
+ <DashboardProblems
+ @loadingProblems={{@controller.loadingProblems}}
+ @problems={{@controller.problems}}
+ @problemsTimestamp={{@controller.problemsTimestamp}}
+ @refreshProblems={{@controller.refreshProblems}}
+ />
+ <nav>
+ <ul class="nav nav-pills">
+ <li class="navigation-item general">
+ <LinkTo @route="admin.dashboard.general" class="navigation-link">
+ {{i18n "admin.dashboard.general_tab"}}
+ </LinkTo>
+ </li>
+
+ {{#if @controller.isModerationTabVisible}}
+ <li class="navigation-item moderation">
+ <LinkTo @route="admin.dashboardModeration" class="navigation-link">
+ {{i18n "admin.dashboard.moderation_tab"}}
+ </LinkTo>
+ </li>
+ {{/if}}
+
+ {{#if @controller.isSecurityTabVisible}}
+ <li class="navigation-item security">
+ <LinkTo @route="admin.dashboardSecurity" class="navigation-link">
+ {{i18n "admin.dashboard.security_tab"}}
+ </LinkTo>
+ </li>
+ {{/if}}
+
+ {{#if @controller.isReportsTabVisible}}
+ <li class="navigation-item reports">
+ <LinkTo @route="admin.dashboardReports" class="navigation-link">
+ {{i18n "admin.dashboard.reports_tab"}}
+ </LinkTo>
+ </li>
+ {{/if}}
+
+ <PluginOutlet @name="admin-dashboard-tabs-after" />
+ </ul>
+ </nav>
-{{outlet}}
+ {{outlet}}
-<span>
- <PluginOutlet @name="admin-dashboard-bottom" @connectorTagName="div" />
-</span>
\ No newline at end of file
+ <span>
+ <PluginOutlet @name="admin-dashboard-bottom" @connectorTagName="div" />
+ </span>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard_general.gjs b/app/assets/javascripts/admin/addon/templates/dashboard_general.gjs
index d6b2fdbc779..6cb75228e79 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard_general.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard_general.gjs
@@ -1,208 +1,230 @@
-<ConditionalLoadingSpinner @condition={{this.isLoading}}>
- <PluginOutlet @name="admin-dashboard-general-top" @connectorTagName="div" />
-
- {{#if this.isCommunityHealthVisible}}
- <div class="community-health section">
- <div class="period-section">
- <div class="section-title">
- <h2>
- <a href={{get-url "/admin/dashboard/reports"}}>
- {{i18n "admin.dashboard.community_health"}}
- </a>
- </h2>
-
- <DashboardPeriodSelector
- @period={{this.period}}
- @setPeriod={{this.setPeriod}}
- @startDate={{this.startDate}}
- @endDate={{this.endDate}}
- @setCustomDateRange={{this.setCustomDateRange}}
- @onDateChange={{this.onDateChange}}
- />
+import { hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSection from "discourse/components/conditional-loading-section";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import basePath from "discourse/helpers/base-path";
+import formatDate from "discourse/helpers/format-date";
+import getUrl from "discourse/helpers/get-url";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import AdminReport from "admin/components/admin-report";
+import DashboardPeriodSelector from "admin/components/dashboard-period-selector";
+
+export default RouteTemplate(
+ <template>
+ <ConditionalLoadingSpinner @condition={{@controller.isLoading}}>
+ <PluginOutlet
+ @name="admin-dashboard-general-top"
+ @connectorTagName="div"
+ />
+
+ {{#if @controller.isCommunityHealthVisible}}
+ <div class="community-health section">
+ <div class="period-section">
+ <div class="section-title">
+ <h2>
+ <a href={{getUrl "/admin/dashboard/reports"}}>
+ {{i18n "admin.dashboard.community_health"}}
+ </a>
+ </h2>
+
+ <DashboardPeriodSelector
+ @period={{@controller.period}}
+ @setPeriod={{@controller.setPeriod}}
+ @startDate={{@controller.startDate}}
+ @endDate={{@controller.endDate}}
+ @setCustomDateRange={{@controller.setCustomDateRange}}
+ @onDateChange={{@controller.onDateChange}}
+ />
+ </div>
+
+ <div class="section-body">
+ <div class="charts">
+ {{#if @controller.siteSettings.use_legacy_pageviews}}
+ <AdminReport
+ @dataSourceName="consolidated_page_views"
+ @forcedModes={{@controller.reportModes.stacked_chart}}
+ @filters={{@controller.filters}}
+ />
+ {{else}}
+ <AdminReport
+ @dataSourceName="site_traffic"
+ @forcedModes={{@controller.reportModes.stacked_chart}}
+ @reportOptions={{@controller.siteTrafficOptions}}
+ @filters={{@controller.filters}}
+ />
+ {{/if}}
+
+ <AdminReport
+ @dataSourceName="signups"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+
+ <AdminReport
+ @dataSourceName="topics"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+
+ <AdminReport
+ @dataSourceName="posts"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+
+ <AdminReport
+ @dataSourceName="dau_by_mau"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+
+ <AdminReport
+ @dataSourceName="daily_engaged_users"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+
+ <AdminReport
+ @dataSourceName="new_contributors"
+ @showTrend={{true}}
+ @forcedModes={{@controller.reportModes.chart}}
+ @filters={{@controller.filters}}
+ />
+ </div>
+ </div>
+ </div>
</div>
+ {{/if}}
- <div class="section-body">
- <div class="charts">
- {{#if this.siteSettings.use_legacy_pageviews}}
+ <div class="section-columns">
+ <div class="section-column">
+ {{#if @controller.isActivityMetricsVisible}}
+ {{#if @controller.activityMetrics.length}}
+ <div class="admin-report activity-metrics">
+ <div class="header">
+ <ul class="breadcrumb">
+ <li class="item report">
+ <LinkTo @route="adminReports" class="report-url">
+ {{i18n "admin.dashboard.activity_metrics"}}
+ </LinkTo>
+ </li>
+ </ul>
+ </div>
+ <div class="report-body">
+ <div class="counters-list">
+ <div class="counters-header">
+ <div class="counters-cell"></div>
+ <div class="counters-cell">{{i18n
+ "admin.dashboard.reports.today"
+ }}</div>
+ <div class="counters-cell">{{i18n
+ "admin.dashboard.reports.yesterday"
+ }}</div>
+ <div class="counters-cell">{{i18n
+ "admin.dashboard.reports.last_7_days"
+ }}</div>
+ <div class="counters-cell">{{i18n
+ "admin.dashboard.reports.last_30_days"
+ }}</div>
+ </div>
+
+ {{#each @controller.activityMetrics as |metric|}}
+ <AdminReport
+ @showHeader={{false}}
+ @filters={{@controller.activityMetricsFilters}}
+ @forcedModes={{@controller.reportModes.counters}}
+ @dataSourceName={{metric}}
+ />
+ {{/each}}
+ </div>
+ </div>
+ </div>
+ {{/if}}
+ {{/if}}
+
+ <div class="user-metrics">
+ <ConditionalLoadingSection @isLoading={{@controller.isLoading}}>
<AdminReport
- @dataSourceName="consolidated_page_views"
- @forcedModes={{this.reportModes.stacked_chart}}
- @filters={{this.filters}}
+ @forcedModes={{@controller.reportModes.inline_table}}
+ @dataSourceName="users_by_type"
/>
- {{else}}
+
<AdminReport
- @dataSourceName="site_traffic"
- @forcedModes={{this.reportModes.stacked_chart}}
- @reportOptions={{this.siteTrafficOptions}}
- @filters={{this.filters}}
+ @forcedModes={{@controller.reportModes.inline_table}}
+ @dataSourceName="users_by_trust_level"
/>
- {{/if}}
-
- <AdminReport
- @dataSourceName="signups"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
- />
-
- <AdminReport
- @dataSourceName="topics"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
- />
+ </ConditionalLoadingSection>
+ </div>
+ <div class="misc">
<AdminReport
- @dataSourceName="posts"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
+ @forcedModes={{@controller.reportModes.storage_stats}}
+ @dataSourceName="storage_stats"
+ @showHeader={{false}}
/>
- <AdminReport
- @dataSourceName="dau_by_mau"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
- />
+ <div class="last-dashboard-update">
+ <div>
+ <h4>{{i18n "admin.dashboard.last_updated"}} </h4>
+ <p>{{formatDate
+ @controller.model.attributes.updated_at
+ leaveAgo="true"
+ }}</p>
+ </div>
+ {{#if @controller.model.attributes.discourse_updated_at}}
+ <div>
+ <h4>{{i18n "admin.dashboard.discourse_last_updated"}} </h4>
+ <p>{{formatDate
+ @controller.model.attributes.discourse_updated_at
+ leaveAgo="true"
+ }}</p>
+ <LinkTo @route="admin.whatsNew" class="btn btn-default">
+ {{i18n "admin.dashboard.whats_new_in_discourse"}}
+ </LinkTo>
+ </div>
+ {{/if}}
+ </div>
+ </div>
+ </div>
+ {{#if @controller.isSearchReportsVisible}}
+ <div class="section-column">
<AdminReport
- @dataSourceName="daily_engaged_users"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
+ @filters={{@controller.topReferredTopicsFilters}}
+ @dataSourceName="top_referred_topics"
+ @reportOptions={{@controller.topReferredTopicsOptions}}
/>
<AdminReport
- @dataSourceName="new_contributors"
- @showTrend={{true}}
- @forcedModes={{this.reportModes.chart}}
- @filters={{this.filters}}
+ @dataSourceName="trending_search"
+ @reportOptions={{@controller.trendingSearchOptions}}
+ @filters={{@controller.trendingSearchFilters}}
+ @isEnabled={{@controller.logSearchQueriesEnabled}}
+ @disabledLabel={{@controller.trendingSearchDisabledLabel}}
/>
- </div>
- </div>
- </div>
- </div>
- {{/if}}
-
- <div class="section-columns">
- <div class="section-column">
- {{#if this.isActivityMetricsVisible}}
- {{#if this.activityMetrics.length}}
- <div class="admin-report activity-metrics">
- <div class="header">
- <ul class="breadcrumb">
- <li class="item report">
- <LinkTo @route="adminReports" class="report-url">
- {{i18n "admin.dashboard.activity_metrics"}}
- </LinkTo>
- </li>
- </ul>
- </div>
- <div class="report-body">
- <div class="counters-list">
- <div class="counters-header">
- <div class="counters-cell"></div>
- <div class="counters-cell">{{i18n
- "admin.dashboard.reports.today"
- }}</div>
- <div class="counters-cell">{{i18n
- "admin.dashboard.reports.yesterday"
- }}</div>
- <div class="counters-cell">{{i18n
- "admin.dashboard.reports.last_7_days"
- }}</div>
- <div class="counters-cell">{{i18n
- "admin.dashboard.reports.last_30_days"
- }}</div>
- </div>
-
- {{#each this.activityMetrics as |metric|}}
- <AdminReport
- @showHeader={{false}}
- @filters={{this.activityMetricsFilters}}
- @forcedModes={{this.reportModes.counters}}
- @dataSourceName={{metric}}
- />
- {{/each}}
- </div>
- </div>
+ {{htmlSafe
+ (i18n
+ "admin.dashboard.reports.trending_search.more"
+ basePath=(basePath)
+ )
+ }}
</div>
{{/if}}
- {{/if}}
-
- <div class="user-metrics">
- <ConditionalLoadingSection @isLoading={{this.isLoading}}>
- <AdminReport
- @forcedModes={{this.reportModes.inline_table}}
- @dataSourceName="users_by_type"
- />
-
- <AdminReport
- @forcedModes={{this.reportModes.inline_table}}
- @dataSourceName="users_by_trust_level"
- />
- </ConditionalLoadingSection>
</div>
- <div class="misc">
- <AdminReport
- @forcedModes={{this.reportModes.storage_stats}}
- @dataSourceName="storage_stats"
- @showHeader={{false}}
- />
-
- <div class="last-dashboard-update">
- <div>
- <h4>{{i18n "admin.dashboard.last_updated"}} </h4>
- <p>{{format-date
- this.model.attributes.updated_at
- leaveAgo="true"
- }}</p>
- </div>
- {{#if this.model.attributes.discourse_updated_at}}
- <div>
- <h4>{{i18n "admin.dashboard.discourse_last_updated"}} </h4>
- <p>{{format-date
- this.model.attributes.discourse_updated_at
- leaveAgo="true"
- }}</p>
- <LinkTo @route="admin.whatsNew" class="btn btn-default">
- {{i18n "admin.dashboard.whats_new_in_discourse"}}
- </LinkTo>
- </div>
- {{/if}}
- </div>
- </div>
- </div>
-
- {{#if this.isSearchReportsVisible}}
- <div class="section-column">
- <AdminReport
- @filters={{this.topReferredTopicsFilters}}
- @dataSourceName="top_referred_topics"
- @reportOptions={{this.topReferredTopicsOptions}}
- />
-
- <AdminReport
- @dataSourceName="trending_search"
- @reportOptions={{this.trendingSearchOptions}}
- @filters={{this.trendingSearchFilters}}
- @isEnabled={{this.logSearchQueriesEnabled}}
- @disabledLabel={{this.trendingSearchDisabledLabel}}
- />
- {{html-safe
- (i18n
- "admin.dashboard.reports.trending_search.more" basePath=(base-path)
- )
- }}
- </div>
- {{/if}}
- </div>
-
- <PluginOutlet
- @name="admin-dashboard-general-bottom"
- @connectorTagName="div"
- @outletArgs={{hash filters=this.filters}}
- />
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <PluginOutlet
+ @name="admin-dashboard-general-bottom"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard_moderation.gjs b/app/assets/javascripts/admin/addon/templates/dashboard_moderation.gjs
index bb3d1f2c9f3..b34e867bc8c 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard_moderation.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard_moderation.gjs
@@ -1,59 +1,71 @@
-<div class="sections">
- <PluginOutlet
- @name="admin-dashboard-moderation-top"
- @connectorTagName="div"
- />
-
- {{#if this.isModeratorsActivityVisible}}
- <div class="moderators-activity section">
- <div class="section-title">
- <h2>
- <a href={{get-url "/admin/reports/moderators_activity"}}>
- {{i18n "admin.dashboard.moderators_activity"}}
- </a>
- </h2>
-
- <DashboardPeriodSelector
- @period={{this.period}}
- @setPeriod={{this.setPeriod}}
- @startDate={{this.startDate}}
- @endDate={{this.endDate}}
- @setCustomDateRange={{this.setCustomDateRange}}
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import getUrl from "discourse/helpers/get-url";
+import { i18n } from "discourse-i18n";
+import AdminReport from "admin/components/admin-report";
+import DashboardPeriodSelector from "admin/components/dashboard-period-selector";
+
+export default RouteTemplate(
+ <template>
+ <div class="sections">
+ <PluginOutlet
+ @name="admin-dashboard-moderation-top"
+ @connectorTagName="div"
+ />
+
+ {{#if @controller.isModeratorsActivityVisible}}
+ <div class="moderators-activity section">
+ <div class="section-title">
+ <h2>
+ <a href={{getUrl "/admin/reports/moderators_activity"}}>
+ {{i18n "admin.dashboard.moderators_activity"}}
+ </a>
+ </h2>
+
+ <DashboardPeriodSelector
+ @period={{@controller.period}}
+ @setPeriod={{@controller.setPeriod}}
+ @startDate={{@controller.startDate}}
+ @endDate={{@controller.endDate}}
+ @setCustomDateRange={{@controller.setCustomDateRange}}
+ />
+ </div>
+
+ <div class="section-body">
+ <AdminReport
+ @filters={{@controller.filters}}
+ @showHeader={{false}}
+ @dataSourceName="moderators_activity"
+ />
+ </div>
+ </div>
+ {{/if}}
+
+ <div class="main-section">
+ <AdminReport
+ @dataSourceName="flags_status"
+ @reportOptions={{@controller.flagsStatusOptions}}
+ @filters={{@controller.lastWeekFilters}}
+ />
+
+ <AdminReport
+ @dataSourceName="post_edits"
+ @filters={{@controller.lastWeekFilters}}
/>
- </div>
- <div class="section-body">
<AdminReport
- @filters={{this.filters}}
- @showHeader={{false}}
- @dataSourceName="moderators_activity"
+ @dataSourceName="user_flagging_ratio"
+ @filters={{@controller.lastWeekFilters}}
+ @reportOptions={{@controller.userFlaggingRatioOptions}}
+ />
+
+ <PluginOutlet
+ @name="admin-dashboard-moderation-bottom"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
</div>
</div>
- {{/if}}
-
- <div class="main-section">
- <AdminReport
- @dataSourceName="flags_status"
- @reportOptions={{this.flagsStatusOptions}}
- @filters={{this.lastWeekFilters}}
- />
-
- <AdminReport
- @dataSourceName="post_edits"
- @filters={{this.lastWeekFilters}}
- />
-
- <AdminReport
- @dataSourceName="user_flagging_ratio"
- @filters={{this.lastWeekFilters}}
- @reportOptions={{this.userFlaggingRatioOptions}}
- />
-
- <PluginOutlet
- @name="admin-dashboard-moderation-bottom"
- @connectorTagName="div"
- @outletArgs={{hash filters=this.lastWeekFilters}}
- />
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard_reports.gjs b/app/assets/javascripts/admin/addon/templates/dashboard_reports.gjs
index 566973040e3..f77c84fdde2 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard_reports.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard_reports.gjs
@@ -1 +1,4 @@
-<AdminReports />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminReports from "admin/components/admin-reports";
+
+export default RouteTemplate(<template><AdminReports /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/dashboard_security.gjs b/app/assets/javascripts/admin/addon/templates/dashboard_security.gjs
index d91ce4dcbfc..b1ffc68f7b7 100644
--- a/app/assets/javascripts/admin/addon/templates/dashboard_security.gjs
+++ b/app/assets/javascripts/admin/addon/templates/dashboard_security.gjs
@@ -1,20 +1,31 @@
-<div class="sections">
- <PluginOutlet @name="admin-dashboard-security-top" @connectorTagName="div" />
+import RouteTemplate from "ember-route-template";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import AdminReport from "admin/components/admin-report";
- <div class="main-section">
- <AdminReport
- @dataSourceName="suspicious_logins"
- @filters={{this.lastWeekFilters}}
- />
+export default RouteTemplate(
+ <template>
+ <div class="sections">
+ <PluginOutlet
+ @name="admin-dashboard-security-top"
+ @connectorTagName="div"
+ />
- <AdminReport
- @dataSourceName="staff_logins"
- @filters={{this.lastWeekFilters}}
- />
+ <div class="main-section">
+ <AdminReport
+ @dataSourceName="suspicious_logins"
+ @filters={{@controller.lastWeekFilters}}
+ />
- <PluginOutlet
- @name="admin-dashboard-security-bottom"
- @connectorTagName="div"
- />
- </div>
-</div>
\ No newline at end of file
+ <AdminReport
+ @dataSourceName="staff_logins"
+ @filters={{@controller.lastWeekFilters}}
+ />
+
+ <PluginOutlet
+ @name="admin-dashboard-security-bottom"
+ @connectorTagName="div"
+ />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-advanced-test.gjs b/app/assets/javascripts/admin/addon/templates/email-advanced-test.gjs
index 5b7d277cb91..06b3f06e333 100644
--- a/app/assets/javascripts/admin/addon/templates/email-advanced-test.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-advanced-test.gjs
@@ -1,26 +1,43 @@
-<DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.email.sub_pages.advanced_test.header_description"
- }}
-/>
+/* eslint-disable ember/no-test-import-export */
-<div class="email-advanced-test">
- <label for="email">{{i18n "admin.email.advanced_test.email"}}</label>
- <Textarea name="email" @value={{this.email}} class="email-body" />
- <DButton @action={{action "run"}} @label="admin.email.advanced_test.run" />
-</div>
+import { Textarea } from "@ember/component";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.format}}
- <hr />
- <div class="text">
- <h3>{{i18n "admin.email.advanced_test.text"}}</h3>
- <pre class="full-reason">{{html-safe this.text}}</pre>
- </div>
- <hr />
- <div class="elided">
- <h3>{{i18n "admin.email.advanced_test.elided"}}</h3>
- <pre class="full-reason">{{html-safe this.elided}}</pre>
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.email.sub_pages.advanced_test.header_description"
+ }}
+ />
+
+ <div class="email-advanced-test">
+ <label for="email">{{i18n "admin.email.advanced_test.email"}}</label>
+ <Textarea name="email" @value={{@controller.email}} class="email-body" />
+ <DButton
+ @action={{@controller.run}}
+ @label="admin.email.advanced_test.run"
+ />
</div>
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.format}}
+ <hr />
+ <div class="text">
+ <h3>{{i18n "admin.email.advanced_test.text"}}</h3>
+ <pre class="full-reason">{{htmlSafe @controller.text}}</pre>
+ </div>
+ <hr />
+ <div class="elided">
+ <h3>{{i18n "admin.email.advanced_test.elided"}}</h3>
+ <pre class="full-reason">{{htmlSafe @controller.elided}}</pre>
+ </div>
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-bounced.gjs b/app/assets/javascripts/admin/addon/templates/email-bounced.gjs
index 70a6286ec87..b85db92937f 100644
--- a/app/assets/javascripts/admin/addon/templates/email-bounced.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-bounced.gjs
@@ -1,78 +1,97 @@
-<LoadMore @selector=".email-list tr" @action={{action "loadMore"}}>
- <table class="table email-list">
- <thead>
- <tr>
- <th>{{i18n "admin.email.time"}}</th>
- <th>{{i18n "admin.email.user"}}</th>
- <th>{{i18n "admin.email.to_address"}}</th>
- <th colspan="2">{{i18n "admin.email.email_type"}}</th>
- </tr>
- </thead>
- <tbody>
- <tr class="filters">
- <td>{{i18n "admin.email.logs.filters.title"}}</td>
- <td><TextField
- @value={{this.filter.user}}
- @placeholderKey="admin.email.logs.filters.user_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.address}}
- @placeholderKey="admin.email.logs.filters.address_placeholder"
- /></td>
- <td colspan="2"><TextField
- @value={{this.filter.type}}
- @placeholderKey="admin.email.logs.filters.type_placeholder"
- /></td>
- </tr>
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import LoadMore from "discourse/components/load-more";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import { i18n } from "discourse-i18n";
- {{#each this.model as |l|}}
- <tr>
- <td>{{format-date l.created_at}}</td>
- <td>
- {{#if l.user}}
- <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
- l.user
- imageSize="tiny"
- }}</LinkTo>
- <LinkTo
- @route="adminUser"
- @model={{l.user}}
- >{{l.user.username}}</LinkTo>
- {{else}}
- &mdash;
- {{/if}}
- </td>
- <td class="email-address"><a
- href="mailto:{{l.to_address}}"
- >{{l.to_address}}</a></td>
- <td>
- {{#if l.has_bounce_key}}
- <a href {{on "click" (fn this.handleShowIncomingEmail l.id)}}>
- {{l.email_type}}
- </a>
- {{else}}
- {{l.email_type}}
- {{/if}}
- </td>
- <td class="email-details">
- {{#if l.has_bounce_key}}
- <a
- href
- {{on "click" (fn this.handleShowIncomingEmail l.id)}}
- title={{i18n "admin.email.details_title"}}
- >
- {{d-icon "circle-info"}}
- </a>
- {{/if}}
- </td>
- </tr>
- {{else}}
- {{#unless this.loading}}
- <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
- {{/unless}}
- {{/each}}
- </tbody>
- </table>
-</LoadMore>
+export default RouteTemplate(
+ <template>
+ <LoadMore @selector=".email-list tr" @action={{@controller.loadMore}}>
+ <table class="table email-list">
+ <thead>
+ <tr>
+ <th>{{i18n "admin.email.time"}}</th>
+ <th>{{i18n "admin.email.user"}}</th>
+ <th>{{i18n "admin.email.to_address"}}</th>
+ <th colspan="2">{{i18n "admin.email.email_type"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="filters">
+ <td>{{i18n "admin.email.logs.filters.title"}}</td>
+ <td><TextField
+ @value={{@controller.filter.user}}
+ @placeholderKey="admin.email.logs.filters.user_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.address}}
+ @placeholderKey="admin.email.logs.filters.address_placeholder"
+ /></td>
+ <td colspan="2"><TextField
+ @value={{@controller.filter.type}}
+ @placeholderKey="admin.email.logs.filters.type_placeholder"
+ /></td>
+ </tr>
-<ConditionalLoadingSpinner @condition={{this.loading}} />
\ No newline at end of file
+ {{#each @controller.model as |l|}}
+ <tr>
+ <td>{{formatDate l.created_at}}</td>
+ <td>
+ {{#if l.user}}
+ <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
+ l.user
+ imageSize="tiny"
+ }}</LinkTo>
+ <LinkTo
+ @route="adminUser"
+ @model={{l.user}}
+ >{{l.user.username}}</LinkTo>
+ {{else}}
+ &mdash;
+ {{/if}}
+ </td>
+ <td class="email-address"><a
+ href="mailto:{{l.to_address}}"
+ >{{l.to_address}}</a></td>
+ <td>
+ {{#if l.has_bounce_key}}
+ <a
+ href
+ {{on "click" (fn @controller.handleShowIncomingEmail l.id)}}
+ >
+ {{l.email_type}}
+ </a>
+ {{else}}
+ {{l.email_type}}
+ {{/if}}
+ </td>
+ <td class="email-details">
+ {{#if l.has_bounce_key}}
+ <a
+ href
+ {{on "click" (fn @controller.handleShowIncomingEmail l.id)}}
+ title={{i18n "admin.email.details_title"}}
+ >
+ {{icon "circle-info"}}
+ </a>
+ {{/if}}
+ </td>
+ </tr>
+ {{else}}
+ {{#unless @controller.loading}}
+ <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
+ {{/unless}}
+ {{/each}}
+ </tbody>
+ </table>
+ </LoadMore>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-index.gjs b/app/assets/javascripts/admin/addon/templates/email-index.gjs
index 90a09cbea93..3e777ca28c0 100644
--- a/app/assets/javascripts/admin/addon/templates/email-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-index.gjs
@@ -1,42 +1,53 @@
-<table class="table">
- <tbody>
- <tr>
- <th>{{i18n "admin.email.delivery_method"}}</th>
- <td>{{this.delivery_method}}</td>
- </tr>
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
- {{#each this.model.settings as |s|}}
- <tr>
- <th style="width: 25%">{{s.name}}</th>
- <td>{{s.value}}</td>
- </tr>
- {{/each}}
- </tbody>
-</table>
+export default RouteTemplate(
+ <template>
+ <table class="table">
+ <tbody>
+ <tr>
+ <th>{{i18n "admin.email.delivery_method"}}</th>
+ <td>{{@controller.delivery_method}}</td>
+ </tr>
-<form>
- <div class="admin-controls">
- <div class="controls">
- <div class="inline-form">
- {{#if this.sendingEmail}}
- {{i18n "admin.email.sending_test"}}
- {{else}}
- <TextField
- @value={{this.testEmailAddress}}
- @placeholderKey="admin.email.test_email_address"
- />
- <DButton
- @action={{this.sendTestEmail}}
- @disabled={{this.sendTestEmailDisabled}}
- @label="admin.email.send_test"
- type="submit"
- class="btn-primary"
- />
- {{#if this.sentTestEmailMessage}}
- <span class="result-message">{{this.sentTestEmailMessage}}</span>
- {{/if}}
- {{/if}}
+ {{#each @controller.model.settings as |s|}}
+ <tr>
+ <th style="width: 25%">{{s.name}}</th>
+ <td>{{s.value}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+
+ <form>
+ <div class="admin-controls">
+ <div class="controls">
+ <div class="inline-form">
+ {{#if @controller.sendingEmail}}
+ {{i18n "admin.email.sending_test"}}
+ {{else}}
+ <TextField
+ @value={{@controller.testEmailAddress}}
+ @placeholderKey="admin.email.test_email_address"
+ />
+ <DButton
+ @action={{@controller.sendTestEmail}}
+ @disabled={{@controller.sendTestEmailDisabled}}
+ @label="admin.email.send_test"
+ type="submit"
+ class="btn-primary"
+ />
+ {{#if @controller.sentTestEmailMessage}}
+ <span
+ class="result-message"
+ >{{@controller.sentTestEmailMessage}}</span>
+ {{/if}}
+ {{/if}}
+ </div>
+ </div>
</div>
- </div>
- </div>
-</form>
\ No newline at end of file
+ </form>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-preview-digest.gjs b/app/assets/javascripts/admin/addon/templates/email-preview-digest.gjs
index edad4a3ddf1..f1dc593cc4c 100644
--- a/app/assets/javascripts/admin/addon/templates/email-preview-digest.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-preview-digest.gjs
@@ -1,95 +1,114 @@
-<DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.email.sub_pages.preview_summary.header_description"
- }}
-/>
+import { hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import DatePickerPast from "discourse/components/date-picker-past";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
-<div class="admin-controls email-preview">
- <div class="controls">
- <div class="inline-form">
- <label for="last-seen">{{i18n "admin.email.last_seen_user"}}</label>
- <DatePickerPast @value={{this.lastSeen}} @id="last-seen" />
- <label>{{i18n "admin.email.user"}}:</label>
- <EmailGroupUserChooser
- @value={{this.username}}
- @onChange={{action "updateUsername"}}
- @options={{hash
- maximum=1
- caretDownIcon="caret-down"
- caretUpIcon="caret-up"
- }}
- />
- <DButton
- @action={{this.refresh}}
- @label="admin.email.refresh"
- class="btn-primary digest-refresh-button"
- />
- <div class="toggle">
- <label>{{i18n "admin.email.format"}}</label>
- {{#if this.showHtml}}
- <span>{{i18n "admin.email.html"}}</span>
- |
- <a href {{on "click" this.toggleShowHtml}} class="show-text-link">
- {{i18n "admin.email.text"}}
- </a>
- {{else}}
- <a
- href
- {{on "click" this.toggleShowHtml}}
- class="show-html-link"
- >{{i18n "admin.email.html"}}</a>
- |
- <span>{{i18n "admin.email.text"}}</span>
- {{/if}}
- </div>
- </div>
- </div>
-</div>
-
-<ConditionalLoadingSpinner @condition={{this.loading}}>
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.email.sub_pages.preview_summary.header_description"
+ }}
+ />
- <div class="email-preview-digest">
- {{#if this.showSendEmailForm}}
+ <div class="admin-controls email-preview">
<div class="controls">
<div class="inline-form">
- {{#if this.sendingEmail}}
- {{i18n "admin.email.sending_test"}}
- {{else}}
- <label>{{i18n "admin.email.send_digest_label"}}</label>
- <TextField
- @value={{this.email}}
- @placeholderKey="admin.email.test_email_address"
- />
- <DButton
- @action={{this.sendEmail}}
- @disabled={{this.sendEmailDisabled}}
- @label="admin.email.send_digest"
- class="btn-default"
- />
- {{#if this.sentEmail}}
- <span class="result-message">{{i18n
- "admin.email.sent_test"
- }}</span>
+ <label for="last-seen">{{i18n "admin.email.last_seen_user"}}</label>
+ <DatePickerPast @value={{@controller.lastSeen}} @id="last-seen" />
+ <label>{{i18n "admin.email.user"}}:</label>
+ <EmailGroupUserChooser
+ @value={{@controller.username}}
+ @onChange={{@controller.updateUsername}}
+ @options={{hash
+ maximum=1
+ caretDownIcon="caret-down"
+ caretUpIcon="caret-up"
+ }}
+ />
+ <DButton
+ @action={{@controller.refresh}}
+ @label="admin.email.refresh"
+ class="btn-primary digest-refresh-button"
+ />
+ <div class="toggle">
+ <label>{{i18n "admin.email.format"}}</label>
+ {{#if @controller.showHtml}}
+ <span>{{i18n "admin.email.html"}}</span>
+ |
+ <a
+ href
+ {{on "click" @controller.toggleShowHtml}}
+ class="show-text-link"
+ >
+ {{i18n "admin.email.text"}}
+ </a>
+ {{else}}
+ <a
+ href
+ {{on "click" @controller.toggleShowHtml}}
+ class="show-html-link"
+ >{{i18n "admin.email.html"}}</a>
+ |
+ <span>{{i18n "admin.email.text"}}</span>
{{/if}}
- {{/if}}
+ </div>
</div>
</div>
- {{/if}}
+ </div>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
- <div class="preview-output">
- {{#if this.showHtml}}
- {{#if this.htmlEmpty}}
- <p>{{i18n "admin.email.no_result"}}</p>
- {{else}}
- <iframe
- title={{i18n "admin.email.html_preview"}}
- srcdoc={{this.model.html_content}}
- ></iframe>
+ <div class="email-preview-digest">
+ {{#if @controller.showSendEmailForm}}
+ <div class="controls">
+ <div class="inline-form">
+ {{#if @controller.sendingEmail}}
+ {{i18n "admin.email.sending_test"}}
+ {{else}}
+ <label>{{i18n "admin.email.send_digest_label"}}</label>
+ <TextField
+ @value={{@controller.email}}
+ @placeholderKey="admin.email.test_email_address"
+ />
+ <DButton
+ @action={{@controller.sendEmail}}
+ @disabled={{@controller.sendEmailDisabled}}
+ @label="admin.email.send_digest"
+ class="btn-default"
+ />
+ {{#if @controller.sentEmail}}
+ <span class="result-message">{{i18n
+ "admin.email.sent_test"
+ }}</span>
+ {{/if}}
+ {{/if}}
+ </div>
+ </div>
{{/if}}
- {{else}}
- <pre>{{this.model.text_content}}</pre>
- {{/if}}
- </div>
- </div>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <div class="preview-output">
+ {{#if @controller.showHtml}}
+ {{#if @controller.htmlEmpty}}
+ <p>{{i18n "admin.email.no_result"}}</p>
+ {{else}}
+ <iframe
+ title={{i18n "admin.email.html_preview"}}
+ srcdoc={{@controller.model.html_content}}
+ ></iframe>
+ {{/if}}
+ {{else}}
+ <pre>{{@controller.model.text_content}}</pre>
+ {{/if}}
+ </div>
+ </div>
+
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-received.gjs b/app/assets/javascripts/admin/addon/templates/email-received.gjs
index a1802e672e9..2748c3aa928 100644
--- a/app/assets/javascripts/admin/addon/templates/email-received.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-received.gjs
@@ -1,71 +1,84 @@
-<LoadMore @selector=".email-list tr" @action={{action "loadMore"}}>
- <table class="table email-list">
- <thead>
- <tr>
- <th>{{i18n "admin.email.time"}}</th>
- <th>{{i18n "admin.email.incoming_emails.from_address"}}</th>
- <th>{{i18n "admin.email.incoming_emails.to_addresses"}}</th>
- <th>{{i18n "admin.email.incoming_emails.subject"}}</th>
- </tr>
- </thead>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import LoadMore from "discourse/components/load-more";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import formatDate from "discourse/helpers/format-date";
+import { i18n } from "discourse-i18n";
- <tbody>
- <tr class="filters">
- <td>{{i18n "admin.email.logs.filters.title"}}</td>
- <td><TextField
- @value={{this.filter.from}}
- @placeholderKey="admin.email.incoming_emails.filters.from_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.to}}
- @placeholderKey="admin.email.incoming_emails.filters.to_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.subject}}
- @placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"
- /></td>
- </tr>
+export default RouteTemplate(
+ <template>
+ <LoadMore @selector=".email-list tr" @action={{@controller.loadMore}}>
+ <table class="table email-list">
+ <thead>
+ <tr>
+ <th>{{i18n "admin.email.time"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.from_address"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.to_addresses"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.subject"}}</th>
+ </tr>
+ </thead>
- {{#each this.model as |email|}}
- <tr>
- <td class="time">{{format-date email.created_at}}</td>
- <td class="username">
- <div>
- {{#if email.user}}
- <LinkTo @route="adminUser" @model={{email.user}}>
- {{avatar email.user imageSize="tiny"}}
- {{email.from_address}}
- </LinkTo>
- {{else}}
- &mdash;
- {{/if}}
- </div>
- </td>
- <td class="addresses">
- {{#each email.to_addresses as |to|}}
- <p><a href="mailto:{{to}}" title="TO">{{to}}</a></p>
- {{/each}}
- {{#each email.cc_addresses as |cc|}}
- <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
- {{/each}}
- </td>
- <td>
- {{#if email.post_url}}
- <a href={{email.post_url}}>{{email.subject}}</a>
- {{else}}
- {{email.subject}}
- {{/if}}
- </td>
- </tr>
- {{else}}
- <tr>
- <td colspan="4">
- {{i18n "admin.email.incoming_emails.none"}}
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
-</LoadMore>
+ <tbody>
+ <tr class="filters">
+ <td>{{i18n "admin.email.logs.filters.title"}}</td>
+ <td><TextField
+ @value={{@controller.filter.from}}
+ @placeholderKey="admin.email.incoming_emails.filters.from_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.to}}
+ @placeholderKey="admin.email.incoming_emails.filters.to_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.subject}}
+ @placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"
+ /></td>
+ </tr>
-<ConditionalLoadingSpinner @condition={{this.loading}} />
\ No newline at end of file
+ {{#each @controller.model as |email|}}
+ <tr>
+ <td class="time">{{formatDate email.created_at}}</td>
+ <td class="username">
+ <div>
+ {{#if email.user}}
+ <LinkTo @route="adminUser" @model={{email.user}}>
+ {{avatar email.user imageSize="tiny"}}
+ {{email.from_address}}
+ </LinkTo>
+ {{else}}
+ &mdash;
+ {{/if}}
+ </div>
+ </td>
+ <td class="addresses">
+ {{#each email.to_addresses as |to|}}
+ <p><a href="mailto:{{to}}" title="TO">{{to}}</a></p>
+ {{/each}}
+ {{#each email.cc_addresses as |cc|}}
+ <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
+ {{/each}}
+ </td>
+ <td>
+ {{#if email.post_url}}
+ <a href={{email.post_url}}>{{email.subject}}</a>
+ {{else}}
+ {{email.subject}}
+ {{/if}}
+ </td>
+ </tr>
+ {{else}}
+ <tr>
+ <td colspan="4">
+ {{i18n "admin.email.incoming_emails.none"}}
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </LoadMore>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-rejected.gjs b/app/assets/javascripts/admin/addon/templates/email-rejected.gjs
index 80b4ccc495c..8baa756691b 100644
--- a/app/assets/javascripts/admin/addon/templates/email-rejected.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-rejected.gjs
@@ -1,89 +1,111 @@
-<LoadMore @selector=".email-list tr" @action={{action "loadMore"}}>
- <table class="table email-list">
- <thead>
- <tr>
- <th>{{i18n "admin.email.time"}}</th>
- <th>{{i18n "admin.email.incoming_emails.from_address"}}</th>
- <th>{{i18n "admin.email.incoming_emails.to_addresses"}}</th>
- <th>{{i18n "admin.email.incoming_emails.subject"}}</th>
- <th colspan="2">{{i18n "admin.email.incoming_emails.error"}}</th>
- </tr>
- </thead>
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import LoadMore from "discourse/components/load-more";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import { i18n } from "discourse-i18n";
- <tbody>
- <tr class="filters">
- <td>{{i18n "admin.email.logs.filters.title"}}</td>
- <td><TextField
- @value={{this.filter.from}}
- @placeholderKey="admin.email.incoming_emails.filters.from_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.to}}
- @placeholderKey="admin.email.incoming_emails.filters.to_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.subject}}
- @placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"
- /></td>
- <td colspan="2"><TextField
- @value={{this.filter.error}}
- @placeholderKey="admin.email.incoming_emails.filters.error_placeholder"
- /></td>
- </tr>
+export default RouteTemplate(
+ <template>
+ <LoadMore @selector=".email-list tr" @action={{@controller.loadMore}}>
+ <table class="table email-list">
+ <thead>
+ <tr>
+ <th>{{i18n "admin.email.time"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.from_address"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.to_addresses"}}</th>
+ <th>{{i18n "admin.email.incoming_emails.subject"}}</th>
+ <th colspan="2">{{i18n "admin.email.incoming_emails.error"}}</th>
+ </tr>
+ </thead>
- {{#each this.model as |email|}}
- <tr>
- <td class="time">{{format-date email.created_at}}</td>
- <td class="username">
- <div>
- {{#if email.user}}
- <LinkTo @route="adminUser" @model={{email.user}}>
- {{avatar email.user imageSize="tiny"}}
- {{email.from_address}}
- </LinkTo>
- {{else}}
- {{#if email.from_address}}
- <a
- href="mailto:{{email.from_address}}"
- >{{email.from_address}}</a>
- {{else}}
- &mdash;
- {{/if}}
- {{/if}}
- </div>
- </td>
- <td class="addresses">
- {{#each email.to_addresses as |to|}}
- <p><a href="mailto:{{to}}" title="TO">{{to}}</a></p>
- {{/each}}
- {{#each email.cc_addresses as |cc|}}
- <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
- {{/each}}
- </td>
- <td>{{email.subject}}</td>
- <td class="error">
- <a
- href
- {{on "click" (fn this.handleShowIncomingEmail email.id)}}
- >{{email.error}}</a>
- </td>
- <td class="email-details">
- <a
- href
- {{on "click" (fn this.handleShowIncomingEmail email.id)}}
- title={{i18n "admin.email.details_title"}}
- >
- {{d-icon "circle-info"}}
- </a>
- </td>
- </tr>
- {{else}}
- <tr><td colspan="6">{{i18n
- "admin.email.incoming_emails.none"
- }}</td></tr>
- {{/each}}
- </tbody>
- </table>
-</LoadMore>
+ <tbody>
+ <tr class="filters">
+ <td>{{i18n "admin.email.logs.filters.title"}}</td>
+ <td><TextField
+ @value={{@controller.filter.from}}
+ @placeholderKey="admin.email.incoming_emails.filters.from_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.to}}
+ @placeholderKey="admin.email.incoming_emails.filters.to_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.subject}}
+ @placeholderKey="admin.email.incoming_emails.filters.subject_placeholder"
+ /></td>
+ <td colspan="2"><TextField
+ @value={{@controller.filter.error}}
+ @placeholderKey="admin.email.incoming_emails.filters.error_placeholder"
+ /></td>
+ </tr>
-<ConditionalLoadingSpinner @condition={{this.loading}} />
\ No newline at end of file
+ {{#each @controller.model as |email|}}
+ <tr>
+ <td class="time">{{formatDate email.created_at}}</td>
+ <td class="username">
+ <div>
+ {{#if email.user}}
+ <LinkTo @route="adminUser" @model={{email.user}}>
+ {{avatar email.user imageSize="tiny"}}
+ {{email.from_address}}
+ </LinkTo>
+ {{else}}
+ {{#if email.from_address}}
+ <a
+ href="mailto:{{email.from_address}}"
+ >{{email.from_address}}</a>
+ {{else}}
+ &mdash;
+ {{/if}}
+ {{/if}}
+ </div>
+ </td>
+ <td class="addresses">
+ {{#each email.to_addresses as |to|}}
+ <p><a href="mailto:{{to}}" title="TO">{{to}}</a></p>
+ {{/each}}
+ {{#each email.cc_addresses as |cc|}}
+ <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
+ {{/each}}
+ </td>
+ <td>{{email.subject}}</td>
+ <td class="error">
+ <a
+ href
+ {{on
+ "click"
+ (fn @controller.handleShowIncomingEmail email.id)
+ }}
+ >{{email.error}}</a>
+ </td>
+ <td class="email-details">
+ <a
+ href
+ {{on
+ "click"
+ (fn @controller.handleShowIncomingEmail email.id)
+ }}
+ title={{i18n "admin.email.details_title"}}
+ >
+ {{icon "circle-info"}}
+ </a>
+ </td>
+ </tr>
+ {{else}}
+ <tr><td colspan="6">{{i18n
+ "admin.email.incoming_emails.none"
+ }}</td></tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </LoadMore>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-sent.gjs b/app/assets/javascripts/admin/addon/templates/email-sent.gjs
index 3e4a4334a84..b100dbc82f5 100644
--- a/app/assets/javascripts/admin/addon/templates/email-sent.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-sent.gjs
@@ -1,131 +1,160 @@
-<LoadMore @selector=".email-list tr" @action={{action "loadMore"}}>
- <table class="table email-list">
- <thead>
- <tr>
- <th>{{i18n "admin.email.sent_at"}}</th>
- <th>{{i18n "admin.email.user"}}</th>
- <th>{{i18n "admin.email.to_address"}}</th>
- <th>{{i18n "admin.email.email_type"}}</th>
- <th>{{i18n "admin.email.reply_key"}}</th>
- <th>{{i18n "admin.email.post_link_with_smtp"}}</th>
- </tr>
- </thead>
- <tbody>
- <tr class="filters">
- <td>{{i18n "admin.email.logs.filters.title"}}</td>
- <td><TextField
- @value={{this.filter.user}}
- @placeholderKey="admin.email.logs.filters.user_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.address}}
- @placeholderKey="admin.email.logs.filters.address_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.type}}
- @placeholderKey="admin.email.logs.filters.type_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.reply_key}}
- @placeholderKey="admin.email.logs.filters.reply_key_placeholder"
- /></td>
- <td></td>
- </tr>
+import { fn } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import LoadMore from "discourse/components/load-more";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import slice from "discourse/helpers/slice";
+import { i18n } from "discourse-i18n";
+import DTooltip from "float-kit/components/d-tooltip";
+import gt from "truth-helpers/helpers/gt";
- {{#each this.model as |l|}}
- <tr class="sent-email-item">
- <td class="sent-email-date">{{format-date l.created_at}}</td>
- <td class="sent-email-username">
- {{#if l.user}}
- <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
- l.user
- imageSize="tiny"
- }}</LinkTo>
- <LinkTo
- @route="adminUser"
- @model={{l.user}}
- >{{l.user.username}}</LinkTo>
- {{else}}
- &mdash;
- {{/if}}
- </td>
- <td class="sent-email-address">
- {{#if l.bounced}}{{d-icon
- "arrow-rotate-right"
- title="admin.email.bounced"
- }}{{/if}}
- <p><a
- href="mailto:{{l.to_address}}"
- title="TO"
- >{{l.to_address}}</a></p>
- {{#if l.cc_addresses}}
- {{#if (gt l.cc_addresses.length this.ccAddressDisplayThreshold)}}
- {{#each
- (slice
- 0
- this.ccAddressDisplayThreshold
- (fn this.sortWithAddressFilter l.cc_addresses)
- )
- as |cc|
- }}
- <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
- {{/each}}
- <DTooltip
- @placement="right-start"
- @arrow={{true}}
- @identifier="email-log-cc-addresses"
- @interactive={{true}}
- >
- <:trigger>
- {{i18n "admin.email.logs.email_addresses.see_more"}}
- </:trigger>
- <:content>
- <ul>
- {{#each
- (slice this.ccAddressDisplayThreshold l.cc_addresses)
- as |cc|
- }}
- <li>
- <span>
- <a href="mailto:{{cc}}" title="CC">{{cc}}</a>
- </span>
- </li>
- {{/each}}
- </ul>
- </:content>
- </DTooltip>
+export default RouteTemplate(
+ <template>
+ <LoadMore @selector=".email-list tr" @action={{@controller.loadMore}}>
+ <table class="table email-list">
+ <thead>
+ <tr>
+ <th>{{i18n "admin.email.sent_at"}}</th>
+ <th>{{i18n "admin.email.user"}}</th>
+ <th>{{i18n "admin.email.to_address"}}</th>
+ <th>{{i18n "admin.email.email_type"}}</th>
+ <th>{{i18n "admin.email.reply_key"}}</th>
+ <th>{{i18n "admin.email.post_link_with_smtp"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="filters">
+ <td>{{i18n "admin.email.logs.filters.title"}}</td>
+ <td><TextField
+ @value={{@controller.filter.user}}
+ @placeholderKey="admin.email.logs.filters.user_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.address}}
+ @placeholderKey="admin.email.logs.filters.address_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.type}}
+ @placeholderKey="admin.email.logs.filters.type_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.reply_key}}
+ @placeholderKey="admin.email.logs.filters.reply_key_placeholder"
+ /></td>
+ <td></td>
+ </tr>
- {{else}}
- {{#each l.cc_addresses as |cc|}}
- <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
- {{/each}}
- {{/if}}
- {{/if}}
- </td>
- <td class="sent-email-type">{{l.email_type}}</td>
- <td class="sent-email-reply-key">
- <span title={{l.reply_key}} class="reply-key">{{l.reply_key}}</span>
- </td>
- <td class="sent-email-post-link-with-smtp-response">
- {{#if l.post_url}}
- <a href={{l.post_url}}>
- {{l.post_description}}
- </a>
- {{i18n "admin.email.logs.post_id" post_id=l.post_id}}
- <br />
- /{{/if}}
- <code
- title={{l.smtp_transaction_response}}
- >{{l.smtp_transaction_response}}</code>
- </td>
- </tr>
- {{else}}
- {{#unless this.loading}}
- <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
- {{/unless}}
- {{/each}}
- </tbody>
- </table>
-</LoadMore>
+ {{#each @controller.model as |l|}}
+ <tr class="sent-email-item">
+ <td class="sent-email-date">{{formatDate l.created_at}}</td>
+ <td class="sent-email-username">
+ {{#if l.user}}
+ <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
+ l.user
+ imageSize="tiny"
+ }}</LinkTo>
+ <LinkTo
+ @route="adminUser"
+ @model={{l.user}}
+ >{{l.user.username}}</LinkTo>
+ {{else}}
+ &mdash;
+ {{/if}}
+ </td>
+ <td class="sent-email-address">
+ {{#if l.bounced}}{{icon
+ "arrow-rotate-right"
+ title="admin.email.bounced"
+ }}{{/if}}
+ <p><a
+ href="mailto:{{l.to_address}}"
+ title="TO"
+ >{{l.to_address}}</a></p>
+ {{#if l.cc_addresses}}
+ {{#if
+ (gt
+ l.cc_addresses.length
+ @controller.ccAddressDisplayThreshold
+ )
+ }}
+ {{#each
+ (slice
+ 0
+ @controller.ccAddressDisplayThreshold
+ (fn @controller.sortWithAddressFilter l.cc_addresses)
+ )
+ as |cc|
+ }}
+ <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
+ {{/each}}
+ <DTooltip
+ @placement="right-start"
+ @arrow={{true}}
+ @identifier="email-log-cc-addresses"
+ @interactive={{true}}
+ >
+ <:trigger>
+ {{i18n "admin.email.logs.email_addresses.see_more"}}
+ </:trigger>
+ <:content>
+ <ul>
+ {{#each
+ (slice
+ @controller.ccAddressDisplayThreshold
+ l.cc_addresses
+ )
+ as |cc|
+ }}
+ <li>
+ <span>
+ <a href="mailto:{{cc}}" title="CC">{{cc}}</a>
+ </span>
+ </li>
+ {{/each}}
+ </ul>
+ </:content>
+ </DTooltip>
-<ConditionalLoadingSpinner @condition={{this.loading}} />
\ No newline at end of file
+ {{else}}
+ {{#each l.cc_addresses as |cc|}}
+ <p><a href="mailto:{{cc}}" title="CC">{{cc}}</a></p>
+ {{/each}}
+ {{/if}}
+ {{/if}}
+ </td>
+ <td class="sent-email-type">{{l.email_type}}</td>
+ <td class="sent-email-reply-key">
+ <span
+ title={{l.reply_key}}
+ class="reply-key"
+ >{{l.reply_key}}</span>
+ </td>
+ <td class="sent-email-post-link-with-smtp-response">
+ {{#if l.post_url}}
+ <a href={{l.post_url}}>
+ {{l.post_description}}
+ </a>
+ {{i18n "admin.email.logs.post_id" post_id=l.post_id}}
+ <br />
+ /{{/if}}
+ <code
+ title={{l.smtp_transaction_response}}
+ >{{l.smtp_transaction_response}}</code>
+ </td>
+ </tr>
+ {{else}}
+ {{#unless @controller.loading}}
+ <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
+ {{/unless}}
+ {{/each}}
+ </tbody>
+ </table>
+ </LoadMore>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-skipped.gjs b/app/assets/javascripts/admin/addon/templates/email-skipped.gjs
index 95385c841d1..d795af481d2 100644
--- a/app/assets/javascripts/admin/addon/templates/email-skipped.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-skipped.gjs
@@ -1,68 +1,81 @@
-<LoadMore @selector=".email-list tr" @action={{action "loadMore"}}>
- <table class="table email-list">
- <thead>
- <tr>
- <th>{{i18n "admin.email.time"}}</th>
- <th>{{i18n "admin.email.user"}}</th>
- <th>{{i18n "admin.email.to_address"}}</th>
- <th>{{i18n "admin.email.email_type"}}</th>
- <th>{{i18n "admin.email.skipped_reason"}}</th>
- </tr>
- </thead>
- <tbody>
- <tr class="filters">
- <td>{{i18n "admin.email.logs.filters.title"}}</td>
- <td><TextField
- @value={{this.filter.user}}
- @placeholderKey="admin.email.logs.filters.user_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.address}}
- @placeholderKey="admin.email.logs.filters.address_placeholder"
- /></td>
- <td><TextField
- @value={{this.filter.type}}
- @placeholderKey="admin.email.logs.filters.type_placeholder"
- /></td>
- <td></td>
- </tr>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import LoadMore from "discourse/components/load-more";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import formatDate from "discourse/helpers/format-date";
+import { i18n } from "discourse-i18n";
- {{#each this.model as |l|}}
- <tr>
- <td>{{format-date l.created_at}}</td>
- <td>
- {{#if l.user}}
- <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
- l.user
- imageSize="tiny"
- }}</LinkTo>
- <LinkTo
- @route="adminUser"
- @model={{l.user}}
- >{{l.user.username}}</LinkTo>
- {{else}}
- &mdash;
- {{/if}}
- </td>
- <td class="email-address"><a
- href="mailto:{{l.to_address}}"
- >{{l.to_address}}</a></td>
- <td>{{l.email_type}}</td>
- <td>
- {{#if l.post_url}}
- <a href={{l.post_url}}>{{l.skipped_reason}}</a>
- {{else}}
- {{l.skipped_reason}}
- {{/if}}
- </td>
- </tr>
- {{else}}
- {{#unless this.loading}}
- <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
- {{/unless}}
- {{/each}}
- </tbody>
- </table>
-</LoadMore>
+export default RouteTemplate(
+ <template>
+ <LoadMore @selector=".email-list tr" @action={{@controller.loadMore}}>
+ <table class="table email-list">
+ <thead>
+ <tr>
+ <th>{{i18n "admin.email.time"}}</th>
+ <th>{{i18n "admin.email.user"}}</th>
+ <th>{{i18n "admin.email.to_address"}}</th>
+ <th>{{i18n "admin.email.email_type"}}</th>
+ <th>{{i18n "admin.email.skipped_reason"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="filters">
+ <td>{{i18n "admin.email.logs.filters.title"}}</td>
+ <td><TextField
+ @value={{@controller.filter.user}}
+ @placeholderKey="admin.email.logs.filters.user_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.address}}
+ @placeholderKey="admin.email.logs.filters.address_placeholder"
+ /></td>
+ <td><TextField
+ @value={{@controller.filter.type}}
+ @placeholderKey="admin.email.logs.filters.type_placeholder"
+ /></td>
+ <td></td>
+ </tr>
-<ConditionalLoadingSpinner @condition={{this.loading}} />
\ No newline at end of file
+ {{#each @controller.model as |l|}}
+ <tr>
+ <td>{{formatDate l.created_at}}</td>
+ <td>
+ {{#if l.user}}
+ <LinkTo @route="adminUser" @model={{l.user}}>{{avatar
+ l.user
+ imageSize="tiny"
+ }}</LinkTo>
+ <LinkTo
+ @route="adminUser"
+ @model={{l.user}}
+ >{{l.user.username}}</LinkTo>
+ {{else}}
+ &mdash;
+ {{/if}}
+ </td>
+ <td class="email-address"><a
+ href="mailto:{{l.to_address}}"
+ >{{l.to_address}}</a></td>
+ <td>{{l.email_type}}</td>
+ <td>
+ {{#if l.post_url}}
+ <a href={{l.post_url}}>{{l.skipped_reason}}</a>
+ {{else}}
+ {{l.skipped_reason}}
+ {{/if}}
+ </td>
+ </tr>
+ {{else}}
+ {{#unless @controller.loading}}
+ <tr><td colspan="5">{{i18n "admin.email.logs.none"}}</td></tr>
+ {{/unless}}
+ {{/each}}
+ </tbody>
+ </table>
+ </LoadMore>
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-templates-edit.gjs b/app/assets/javascripts/admin/addon/templates/email-templates-edit.gjs
index 23c5a6eed69..69d08facee3 100644
--- a/app/assets/javascripts/admin/addon/templates/email-templates-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-templates-edit.gjs
@@ -1,38 +1,52 @@
-<ComboBox
- @value={{this.emailTemplate.id}}
- @content={{this.adminEmailTemplates.sortedTemplates}}
- @onChange={{this.adminEmailTemplates.onSelectTemplate}}
- @nameProperty="title"
-/>
+import { Input } from "@ember/component";
+import { hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import DEditor from "discourse/components/d-editor";
+import SaveControls from "discourse/components/save-controls";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
-<div class="email-template">
- <label>{{i18n "admin.customize.email_templates.subject"}}</label>
- {{#if this.hasMultipleSubjects}}
- <h3><LinkTo
- @route="adminSiteText"
- @query={{hash q=this.hasMultipleSubjects}}
- >{{i18n
- "admin.customize.email_templates.multiple_subjects"
- }}</LinkTo></h3>
- {{else}}
- <Input @value={{this.buffered.subject}} />
- {{/if}}
- <br />
+export default RouteTemplate(
+ <template>
+ <ComboBox
+ @value={{@controller.emailTemplate.id}}
+ @content={{@controller.adminEmailTemplates.sortedTemplates}}
+ @onChange={{@controller.adminEmailTemplates.onSelectTemplate}}
+ @nameProperty="title"
+ />
- <label>{{i18n "admin.customize.email_templates.body"}}</label>
- <DEditor @value={{this.buffered.body}} />
+ <div class="email-template">
+ <label>{{i18n "admin.customize.email_templates.subject"}}</label>
+ {{#if @controller.hasMultipleSubjects}}
+ <h3><LinkTo
+ @route="adminSiteText"
+ @query={{hash [email protected]}}
+ >{{i18n
+ "admin.customize.email_templates.multiple_subjects"
+ }}</LinkTo></h3>
+ {{else}}
+ <Input @value={{@controller.buffered.subject}} />
+ {{/if}}
+ <br />
- <SaveControls
- @model={{this.emailTemplate}}
- @action={{action "saveChanges"}}
- @saved={{this.saved}}
- @saveDisabled={{this.saveDisabled}}
- >
- {{#if this.emailTemplate.can_revert}}
- <DButton
- @action={{action "revertChanges"}}
- @label="admin.customize.email_templates.revert"
- />
- {{/if}}
- </SaveControls>
-</div>
\ No newline at end of file
+ <label>{{i18n "admin.customize.email_templates.body"}}</label>
+ <DEditor @value={{@controller.buffered.body}} />
+
+ <SaveControls
+ @model={{@controller.emailTemplate}}
+ @action={{@controller.saveChanges}}
+ @saved={{@controller.saved}}
+ @saveDisabled={{@controller.saveDisabled}}
+ >
+ {{#if @controller.emailTemplate.can_revert}}
+ <DButton
+ @action={{@controller.revertChanges}}
+ @label="admin.customize.email_templates.revert"
+ />
+ {{/if}}
+ </SaveControls>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/email-templates.gjs b/app/assets/javascripts/admin/addon/templates/email-templates.gjs
index e2147cab02d..76ab5bd9893 100644
--- a/app/assets/javascripts/admin/addon/templates/email-templates.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email-templates.gjs
@@ -1 +1,3 @@
-{{outlet}}
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+
+export default RouteTemplate(<template>{{outlet}}</template>);
diff --git a/app/assets/javascripts/admin/addon/templates/email.gjs b/app/assets/javascripts/admin/addon/templates/email.gjs
index e038777a799..b1a6e93d93f 100644
--- a/app/assets/javascripts/admin/addon/templates/email.gjs
+++ b/app/assets/javascripts/admin/addon/templates/email.gjs
@@ -1,52 +1,62 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.email.title"}}
- @descriptionLabel={{i18n "admin.config.email.header_description"}}
- @shouldDisplay={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/email"
- @label={{i18n "admin.config.email.title"}}
- />
- </:breadcrumbs>
- <:tabs>
- <NavItem @route="adminEmail.index" @label="settings" />
- <NavItem
- @route="adminEmail.previewDigest"
- @label="admin.config.email.sub_pages.preview_summary.title"
- />
- <NavItem
- @route="adminEmail.advancedTest"
- @label="admin.config.email.sub_pages.advanced_test.title"
- />
- <NavItem
- @route="adminEmailTemplates"
- @label="admin.config.email.sub_pages.templates.title"
- />
- <NavItem
- @route="adminEmail.sent"
- @label="admin.config.email.sub_pages.sent.title"
- />
- <NavItem
- @route="adminEmail.skipped"
- @label="admin.config.email.sub_pages.skipped.title"
- />
- <NavItem
- @route="adminEmail.bounced"
- @label="admin.config.email.sub_pages.bounced.title"
- />
- <NavItem
- @route="adminEmail.received"
- @label="admin.config.email.sub_pages.received.title"
- />
- <NavItem
- @route="adminEmail.rejected"
- @label="admin.config.email.sub_pages.rejected.title"
- />
- </:tabs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
-<div class="admin-container">
- {{outlet}}
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.email.title"}}
+ @descriptionLabel={{i18n "admin.config.email.header_description"}}
+ @shouldDisplay={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/email"
+ @label={{i18n "admin.config.email.title"}}
+ />
+ </:breadcrumbs>
+ <:tabs>
+ <NavItem @route="adminEmail.index" @label="settings" />
+ <NavItem
+ @route="adminEmail.previewDigest"
+ @label="admin.config.email.sub_pages.preview_summary.title"
+ />
+ <NavItem
+ @route="adminEmail.advancedTest"
+ @label="admin.config.email.sub_pages.advanced_test.title"
+ />
+ <NavItem
+ @route="adminEmailTemplates"
+ @label="admin.config.email.sub_pages.templates.title"
+ />
+ <NavItem
+ @route="adminEmail.sent"
+ @label="admin.config.email.sub_pages.sent.title"
+ />
+ <NavItem
+ @route="adminEmail.skipped"
+ @label="admin.config.email.sub_pages.skipped.title"
+ />
+ <NavItem
+ @route="adminEmail.bounced"
+ @label="admin.config.email.sub_pages.bounced.title"
+ />
+ <NavItem
+ @route="adminEmail.received"
+ @label="admin.config.email.sub_pages.received.title"
+ />
+ <NavItem
+ @route="adminEmail.rejected"
+ @label="admin.config.email.sub_pages.rejected.title"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-crawlers.gjs b/app/assets/javascripts/admin/addon/templates/embedding-crawlers.gjs
index 0ebaf30e070..a2bfa6a5157 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-crawlers.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-crawlers.gjs
@@ -1,32 +1,45 @@
-<DPageSubheader
- @titleLabel={{i18n "admin.embedding.crawlers"}}
- @descriptionLabel={{i18n "admin.embedding.crawlers_description"}}
-/>
+import RouteTemplate from "ember-route-template";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import Form from "discourse/components/form";
+import { i18n } from "discourse-i18n";
-<Form @onSubmit={{this.save}} @data={{this.formData}} as |form|>
- <form.Field
- @name="allowed_embed_selectors"
- @title={{i18n "admin.embedding.allowed_embed_selectors"}}
- @format="large"
- as |field|
- >
- <field.Input placeholder="article, #story, .post" />
- </form.Field>
- <form.Field
- @name="blocked_embed_selectors"
- @title={{i18n "admin.embedding.blocked_embed_selectors"}}
- @format="large"
- as |field|
- >
- <field.Input placeholder=".ad-unit, header" />
- </form.Field>
- <form.Field
- @name="allowed_embed_classnames"
- @title={{i18n "admin.embedding.allowed_embed_classnames"}}
- @format="large"
- as |field|
- >
- <field.Input placeholder="emoji, classname" />
- </form.Field>
- <form.Submit @label="admin.embedding.save" />
-</Form>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @titleLabel={{i18n "admin.embedding.crawlers"}}
+ @descriptionLabel={{i18n "admin.embedding.crawlers_description"}}
+ />
+
+ <Form
+ @onSubmit={{@controller.save}}
+ @data={{@controller.formData}}
+ as |form|
+ >
+ <form.Field
+ @name="allowed_embed_selectors"
+ @title={{i18n "admin.embedding.allowed_embed_selectors"}}
+ @format="large"
+ as |field|
+ >
+ <field.Input placeholder="article, #story, .post" />
+ </form.Field>
+ <form.Field
+ @name="blocked_embed_selectors"
+ @title={{i18n "admin.embedding.blocked_embed_selectors"}}
+ @format="large"
+ as |field|
+ >
+ <field.Input placeholder=".ad-unit, header" />
+ </form.Field>
+ <form.Field
+ @name="allowed_embed_classnames"
+ @title={{i18n "admin.embedding.allowed_embed_classnames"}}
+ @format="large"
+ as |field|
+ >
+ <field.Input placeholder="emoji, classname" />
+ </form.Field>
+ <form.Submit @label="admin.embedding.save" />
+ </Form>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-edit.gjs b/app/assets/javascripts/admin/addon/templates/embedding-edit.gjs
index 93252280384..e0ad695a4bd 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-edit.gjs
@@ -1 +1,6 @@
-<AdminEmbeddingHostForm @host={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminEmbeddingHostForm from "admin/components/admin-embedding-host-form";
+
+export default RouteTemplate(
+ <template><AdminEmbeddingHostForm @host={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-index.gjs b/app/assets/javascripts/admin/addon/templates/embedding-index.gjs
index a06384aa64f..4f2c5c9cf11 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-index.gjs
@@ -1,49 +1,66 @@
-{{#if this.embedding.embeddable_hosts}}
- {{#if this.showEmbeddingCode}}
- <AdminConfigAreaCard
- @heading="admin.embedding.configuration_snippet"
- @collapsable={{true}}
- @collapsed={{true}}
- class="admin-embedding-index__code"
- >
- <:content>
- {{html-safe (i18n "admin.embedding.sample")}}
- <HighlightedCode @code={{this.embeddingCode}} @lang="html" />
- </:content>
- </AdminConfigAreaCard>
- {{/if}}
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import AdminConfigAreaCard from "admin/components/admin-config-area-card";
+import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
+import EmbeddableHost from "admin/components/embeddable-host";
+import HighlightedCode from "admin/components/highlighted-code";
- <table class="d-admin-table">
- <thead>
- <th>{{i18n "admin.embedding.host"}}</th>
- <th>{{i18n "admin.embedding.allowed_paths"}}</th>
- <th>{{i18n "admin.embedding.category"}}</th>
- <th>{{i18n "admin.embedding.tags"}}</th>
- {{#if this.embedding.embed_by_username}}
- <th>{{i18n
- "admin.embedding.post_author_with_default"
- author=this.embedding.embed_by_username
- }}</th>
- {{else}}
- <th>{{i18n "admin.embedding.post_author"}}</th>
+export default RouteTemplate(
+ <template>
+ {{#if @controller.embedding.embeddable_hosts}}
+ {{#if @controller.showEmbeddingCode}}
+ <AdminConfigAreaCard
+ @heading="admin.embedding.configuration_snippet"
+ @collapsable={{true}}
+ @collapsed={{true}}
+ class="admin-embedding-index__code"
+ >
+ <:content>
+ {{htmlSafe (i18n "admin.embedding.sample")}}
+ <HighlightedCode @code={{@controller.embeddingCode}} @lang="html" />
+ </:content>
+ </AdminConfigAreaCard>
{{/if}}
- </thead>
- <tbody>
- {{#each this.embedding.embeddable_hosts as |host|}}
- <EmbeddableHost @host={{host}} @deleteHost={{action "deleteHost"}} />
- {{/each}}
- </tbody>
- </table>
-{{else}}
- <AdminConfigAreaEmptyList
- @ctaLabel="admin.embedding.add_host"
- @ctaRoute="adminEmbedding.new"
- @ctaClass="admin-embedding__add-host"
- @emptyLabel="admin.embedding.get_started"
- />
-{{/if}}
-<PluginOutlet
- @name="after-embeddable-hosts-table"
- @outletArgs={{hash embedding=this.embedding}}
-/>
\ No newline at end of file
+ <table class="d-admin-table">
+ <thead>
+ <th>{{i18n "admin.embedding.host"}}</th>
+ <th>{{i18n "admin.embedding.allowed_paths"}}</th>
+ <th>{{i18n "admin.embedding.category"}}</th>
+ <th>{{i18n "admin.embedding.tags"}}</th>
+ {{#if @controller.embedding.embed_by_username}}
+ <th>{{i18n
+ "admin.embedding.post_author_with_default"
+ [email protected]_by_username
+ }}</th>
+ {{else}}
+ <th>{{i18n "admin.embedding.post_author"}}</th>
+ {{/if}}
+ </thead>
+ <tbody>
+ {{#each @controller.embedding.embeddable_hosts as |host|}}
+ <EmbeddableHost
+ @host={{host}}
+ @deleteHost={{@controller.deleteHost}}
+ />
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
+ <AdminConfigAreaEmptyList
+ @ctaLabel="admin.embedding.add_host"
+ @ctaRoute="adminEmbedding.new"
+ @ctaClass="admin-embedding__add-host"
+ @emptyLabel="admin.embedding.get_started"
+ />
+ {{/if}}
+
+ <PluginOutlet
+ @name="after-embeddable-hosts-table"
+ @outletArgs={{hash [email protected]}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-new.gjs b/app/assets/javascripts/admin/addon/templates/embedding-new.gjs
index 6a602d64c8d..33e9e7c1991 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-new.gjs
@@ -1 +1,4 @@
-<AdminEmbeddingHostForm />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminEmbeddingHostForm from "admin/components/admin-embedding-host-form";
+
+export default RouteTemplate(<template><AdminEmbeddingHostForm /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.gjs b/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.gjs
index 614b54b5175..a33fb2debf0 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.gjs
@@ -1,53 +1,68 @@
-<DPageSubheader @titleLabel={{i18n "admin.embedding.posts_and_topics"}} />
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import Form from "discourse/components/form";
+import { i18n } from "discourse-i18n";
+import UserChooser from "select-kit/components/user-chooser";
-<Form @onSubmit={{this.save}} @data={{this.formData}} as |form|>
- <form.Field
- @name="embed_by_username"
- @title={{i18n "admin.embedding.embed_by_username"}}
- @validation="required"
- as |field|
- >
- <field.Custom>
- <UserChooser
- @value={{field.value}}
- @onChange={{field.set}}
- @options={{hash maximum=1 excludeCurrentUser=false}}
- class="admin-embedding-posts-and-topics-form__embed_by_username"
- />
- </field.Custom>
- </form.Field>
- <form.Field
- @name="embed_post_limit"
- @title={{i18n "admin.embedding.embed_post_limit"}}
- @format="large"
- as |field|
- >
- <field.Input />
- </form.Field>
- <form.Field
- @name="embed_title_scrubber"
- @title={{i18n "admin.embedding.embed_title_scrubber"}}
- @format="large"
- as |field|
- >
- <field.Input placeholder="- site.com$" />
- </form.Field>
- <form.CheckboxGroup as |checkboxGroup|>
- <checkboxGroup.Field
- @name="embed_truncate"
- @title={{i18n "admin.embedding.embed_truncate"}}
- as |field|
- >
- <field.Checkbox />
- </checkboxGroup.Field>
+export default RouteTemplate(
+ <template>
+ <DPageSubheader @titleLabel={{i18n "admin.embedding.posts_and_topics"}} />
- <checkboxGroup.Field
- @name="embed_unlisted"
- @title={{i18n "admin.embedding.embed_unlisted"}}
- as |field|
+ <Form
+ @onSubmit={{@controller.save}}
+ @data={{@controller.formData}}
+ as |form|
>
- <field.Checkbox />
- </checkboxGroup.Field>
- </form.CheckboxGroup>
- <form.Submit @label="admin.embedding.save" />
-</Form>
\ No newline at end of file
+ <form.Field
+ @name="embed_by_username"
+ @title={{i18n "admin.embedding.embed_by_username"}}
+ @validation="required"
+ as |field|
+ >
+ <field.Custom>
+ <UserChooser
+ @value={{field.value}}
+ @onChange={{field.set}}
+ @options={{hash maximum=1 excludeCurrentUser=false}}
+ class="admin-embedding-posts-and-topics-form__embed_by_username"
+ />
+ </field.Custom>
+ </form.Field>
+ <form.Field
+ @name="embed_post_limit"
+ @title={{i18n "admin.embedding.embed_post_limit"}}
+ @format="large"
+ as |field|
+ >
+ <field.Input />
+ </form.Field>
+ <form.Field
+ @name="embed_title_scrubber"
+ @title={{i18n "admin.embedding.embed_title_scrubber"}}
+ @format="large"
+ as |field|
+ >
+ <field.Input placeholder="- site.com$" />
+ </form.Field>
+ <form.CheckboxGroup as |checkboxGroup|>
+ <checkboxGroup.Field
+ @name="embed_truncate"
+ @title={{i18n "admin.embedding.embed_truncate"}}
+ as |field|
+ >
+ <field.Checkbox />
+ </checkboxGroup.Field>
+
+ <checkboxGroup.Field
+ @name="embed_unlisted"
+ @title={{i18n "admin.embedding.embed_unlisted"}}
+ as |field|
+ >
+ <field.Checkbox />
+ </checkboxGroup.Field>
+ </form.CheckboxGroup>
+ <form.Submit @label="admin.embedding.save" />
+ </Form>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding-settings.gjs b/app/assets/javascripts/admin/addon/templates/embedding-settings.gjs
index 4c5a40d01d3..7bb3c338bfe 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding-settings.gjs
@@ -1,6 +1,13 @@
-<AdminAreaSettings
- @area="embedding"
- @path="/admin/customize/embedding/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
-/>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <AdminAreaSettings
+ @area="embedding"
+ @path="/admin/customize/embedding/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/embedding.gjs b/app/assets/javascripts/admin/addon/templates/embedding.gjs
index b7d272921b5..c675ed31d19 100644
--- a/app/assets/javascripts/admin/addon/templates/embedding.gjs
+++ b/app/assets/javascripts/admin/addon/templates/embedding.gjs
@@ -1,49 +1,59 @@
-<div class="admin-embedding admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.embedding.title"}}
- @descriptionLabel={{i18n "admin.config.embedding.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/embedding"
- @label={{i18n "admin.config.embedding.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @route="adminEmbedding.new"
- @title="admin.embedding.add_host"
- @label="admin.embedding.add_host"
- class="admin-embedding__header-add-host"
- />
- </:actions>
- <:tabs>
- <NavItem
- @route="adminEmbedding.settings"
- @label="admin.embedding.nav.settings"
- class="admin-embedding-tabs__settings"
- />
- <NavItem
- @route="adminEmbedding.index"
- @label="admin.embedding.nav.hosts"
- class="admin-embedding-tabs__hosts"
- />
- <NavItem
- @route="adminEmbedding.postsAndTopics"
- @label="admin.embedding.nav.posts_and_topics"
- class="admin-embedding-tabs__posts-and-topics"
- />
- <NavItem
- @route="adminEmbedding.crawlers"
- @label="admin.embedding.nav.crawlers"
- class="admin-embedding-tabs__crawlers"
- />
- </:tabs>
- </DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
- <div class="admin-container admin-config-page__main-area">
- {{outlet}}
- </div>
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <div class="admin-embedding admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.embedding.title"}}
+ @descriptionLabel={{i18n "admin.config.embedding.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/embedding"
+ @label={{i18n "admin.config.embedding.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @route="adminEmbedding.new"
+ @title="admin.embedding.add_host"
+ @label="admin.embedding.add_host"
+ class="admin-embedding__header-add-host"
+ />
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="adminEmbedding.settings"
+ @label="admin.embedding.nav.settings"
+ class="admin-embedding-tabs__settings"
+ />
+ <NavItem
+ @route="adminEmbedding.index"
+ @label="admin.embedding.nav.hosts"
+ class="admin-embedding-tabs__hosts"
+ />
+ <NavItem
+ @route="adminEmbedding.postsAndTopics"
+ @label="admin.embedding.nav.posts_and_topics"
+ class="admin-embedding-tabs__posts-and-topics"
+ />
+ <NavItem
+ @route="adminEmbedding.crawlers"
+ @label="admin.embedding.nav.crawlers"
+ class="admin-embedding-tabs__crawlers"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/emojis-index.gjs b/app/assets/javascripts/admin/addon/templates/emojis-index.gjs
index f61250c26ce..df1b027175f 100644
--- a/app/assets/javascripts/admin/addon/templates/emojis-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/emojis-index.gjs
@@ -1 +1,4 @@
-<AdminConfigAreas::EmojisList />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import EmojisList from "admin/components/admin-config-areas/emojis-list";
+
+export default RouteTemplate(<template><EmojisList /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/emojis-new.gjs b/app/assets/javascripts/admin/addon/templates/emojis-new.gjs
index 79e6d84b190..eb72400eb80 100644
--- a/app/assets/javascripts/admin/addon/templates/emojis-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/emojis-new.gjs
@@ -1 +1,4 @@
-<AdminConfigAreas::EmojisNew />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import EmojisNew from "admin/components/admin-config-areas/emojis-new";
+
+export default RouteTemplate(<template><EmojisNew /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/emojis-settings.gjs b/app/assets/javascripts/admin/addon/templates/emojis-settings.gjs
index 457ef82eb49..01aa2a83b09 100644
--- a/app/assets/javascripts/admin/addon/templates/emojis-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/emojis-settings.gjs
@@ -1,6 +1,13 @@
-<AdminAreaSettings
- @area="emojis"
- @path="/admin/config/emoji/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
-/>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <AdminAreaSettings
+ @area="emojis"
+ @path="/admin/config/emoji/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/emojis.gjs b/app/assets/javascripts/admin/addon/templates/emojis.gjs
index e9d9099e305..59612c712c0 100644
--- a/app/assets/javascripts/admin/addon/templates/emojis.gjs
+++ b/app/assets/javascripts/admin/addon/templates/emojis.gjs
@@ -1,34 +1,44 @@
-<div class="admin-emoji admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.emoji.title"}}
- @descriptionLabel={{i18n "admin.config.emoji.header_description"}}
- @hideTabs={{this.hideTabs}}
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/config/emoji"
- @label={{i18n "admin.config.emoji.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary @route="adminEmojis.new" @label="admin.emoji.add" />
- </:actions>
- <:tabs>
- <NavItem
- @route="adminEmojis.settings"
- @label="settings"
- class="admin-emoji-tabs__settings"
- />
- <NavItem
- @route="adminEmojis.index"
- @label="admin.emoji.title"
- class="admin-emoji-tabs__emoji"
- />
- </:tabs>
- </DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
- <div class="admin-container admin-config-page__main-area">
- {{outlet}}
- </div>
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <div class="admin-emoji admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.emoji.title"}}
+ @descriptionLabel={{i18n "admin.config.emoji.header_description"}}
+ @hideTabs={{@controller.hideTabs}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/config/emoji"
+ @label={{i18n "admin.config.emoji.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary @route="adminEmojis.new" @label="admin.emoji.add" />
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="adminEmojis.settings"
+ @label="settings"
+ class="admin-emoji-tabs__settings"
+ />
+ <NavItem
+ @route="adminEmojis.index"
+ @label="admin.emoji.title"
+ class="admin-emoji-tabs__emoji"
+ />
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/logs.gjs b/app/assets/javascripts/admin/addon/templates/logs.gjs
index 5cf8ad38ceb..f75aca26a75 100644
--- a/app/assets/javascripts/admin/addon/templates/logs.gjs
+++ b/app/assets/javascripts/admin/addon/templates/logs.gjs
@@ -1,44 +1,56 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.staff_action_logs.title"}}
- @descriptionLabel={{i18n "admin.config.staff_action_logs.header_description"}}
- @shouldDisplay={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/logs"
- @label={{i18n "admin.config.staff_action_logs.title"}}
- />
- </:breadcrumbs>
- <:tabs>
- <NavItem
- @route="adminLogs.staffActionLogs"
- @label="admin.config.staff_action_logs.title"
- />
- {{#if this.currentUser.can_see_emails}}
- <NavItem
- @route="adminLogs.screenedEmails"
- @label="admin.config.staff_action_logs.sub_pages.screened_emails.title"
- />
- {{/if}}
- <NavItem
- @route="adminLogs.screenedIpAddresses"
- @label="admin.config.staff_action_logs.sub_pages.screened_ips.title"
- />
- <NavItem
- @route="adminLogs.screenedUrls"
- @label="admin.config.staff_action_logs.sub_pages.screened_urls.title"
- />
- <NavItem
- @route="adminSearchLogs"
- @label="admin.config.staff_action_logs.sub_pages.search_logs.title"
- />
- {{#if this.currentUser.admin}}
- <NavItem @path="/logs" @label="admin.logs.logster.title" />
- {{/if}}
- </:tabs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
-<div class="admin-container">
- {{outlet}}
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.staff_action_logs.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.staff_action_logs.header_description"
+ }}
+ @shouldDisplay={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/logs"
+ @label={{i18n "admin.config.staff_action_logs.title"}}
+ />
+ </:breadcrumbs>
+ <:tabs>
+ <NavItem
+ @route="adminLogs.staffActionLogs"
+ @label="admin.config.staff_action_logs.title"
+ />
+ {{#if @controller.currentUser.can_see_emails}}
+ <NavItem
+ @route="adminLogs.screenedEmails"
+ @label="admin.config.staff_action_logs.sub_pages.screened_emails.title"
+ />
+ {{/if}}
+ <NavItem
+ @route="adminLogs.screenedIpAddresses"
+ @label="admin.config.staff_action_logs.sub_pages.screened_ips.title"
+ />
+ <NavItem
+ @route="adminLogs.screenedUrls"
+ @label="admin.config.staff_action_logs.sub_pages.screened_urls.title"
+ />
+ <NavItem
+ @route="adminSearchLogs"
+ @label="admin.config.staff_action_logs.sub_pages.search_logs.title"
+ />
+ {{#if @controller.currentUser.admin}}
+ <NavItem @path="/logs" @label="admin.logs.logster.title" />
+ {{/if}}
+ </:tabs>
+ </DPageHeader>
+
+ <div class="admin-container">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/logs/screened-emails.gjs b/app/assets/javascripts/admin/addon/templates/logs/screened-emails.gjs
index a16d21fdacb..7c4e7cd29d3 100644
--- a/app/assets/javascripts/admin/addon/templates/logs/screened-emails.gjs
+++ b/app/assets/javascripts/admin/addon/templates/logs/screened-emails.gjs
@@ -1,65 +1,79 @@
-<DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.staff_action_logs.sub_pages.screened_emails.header_description"
- }}
-/>
+import { fn } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import { i18n } from "discourse-i18n";
-<DButton
- @action={{this.exportScreenedEmailList}}
- @title="admin.export_csv.button_title.screened_email"
- @icon="download"
- @label="admin.export_csv.button_text"
- class="btn-default screened-email-export"
-/>
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.staff_action_logs.sub_pages.screened_emails.header_description"
+ }}
+ />
-<br />
+ <DButton
+ @action={{@controller.exportScreenedEmailList}}
+ @title="admin.export_csv.button_title.screened_email"
+ @icon="download"
+ @label="admin.export_csv.button_text"
+ class="btn-default screened-email-export"
+ />
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.model.length}}
+ <br />
- <table class="screened-emails grid">
- <thead>
- <th class="first email">{{i18n "admin.logs.screened_emails.email"}}</th>
- <th class="action">{{i18n "admin.logs.action"}}</th>
- <th class="match_count">{{i18n "admin.logs.match_count"}}</th>
- <th class="last_match_at">{{i18n "admin.logs.last_match_at"}}</th>
- <th class="created_at">{{i18n "admin.logs.created_at"}}</th>
- <th class="ip_address">{{i18n "admin.logs.ip_address"}}</th>
- <th class="action"></th>
- </thead>
- <tbody>
- {{#each this.model as |item|}}
- <tr class="admin-list-item">
- <td class="col first email">
- <div
- class="overflow-ellipsis"
- title={{item.email}}
- >{{item.email}}</div>
- </td>
- <td class="action">{{item.actionName}}</td>
- <td class="match_count"><div class="label">{{i18n
- "admin.logs.match_count"
- }}</div>{{item.match_count}}</td>
- <td class="last_match_at"><div class="label">{{i18n
- "admin.logs.last_match_at"
- }}</div>{{age-with-tooltip item.last_match_at}}</td>
- <td class="created_at"><div class="label">{{i18n
- "admin.logs.created_at"
- }}</div>{{age-with-tooltip item.created_at}}</td>
- <td class="ip_address">{{item.ip_address}}</td>
- <td class="action">
- <DButton
- @action={{fn this.clearBlock item}}
- @icon="check"
- @label="admin.logs.screened_emails.actions.allow"
- />
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.model.length}}
- {{else}}
- {{i18n "search.no_results"}}
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <table class="screened-emails grid">
+ <thead>
+ <th class="first email">{{i18n
+ "admin.logs.screened_emails.email"
+ }}</th>
+ <th class="action">{{i18n "admin.logs.action"}}</th>
+ <th class="match_count">{{i18n "admin.logs.match_count"}}</th>
+ <th class="last_match_at">{{i18n "admin.logs.last_match_at"}}</th>
+ <th class="created_at">{{i18n "admin.logs.created_at"}}</th>
+ <th class="ip_address">{{i18n "admin.logs.ip_address"}}</th>
+ <th class="action"></th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |item|}}
+ <tr class="admin-list-item">
+ <td class="col first email">
+ <div
+ class="overflow-ellipsis"
+ title={{item.email}}
+ >{{item.email}}</div>
+ </td>
+ <td class="action">{{item.actionName}}</td>
+ <td class="match_count"><div class="label">{{i18n
+ "admin.logs.match_count"
+ }}</div>{{item.match_count}}</td>
+ <td class="last_match_at"><div class="label">{{i18n
+ "admin.logs.last_match_at"
+ }}</div>{{ageWithTooltip item.last_match_at}}</td>
+ <td class="created_at"><div class="label">{{i18n
+ "admin.logs.created_at"
+ }}</div>{{ageWithTooltip item.created_at}}</td>
+ <td class="ip_address">{{item.ip_address}}</td>
+ <td class="action">
+ <DButton
+ @action={{fn @controller.clearBlock item}}
+ @icon="check"
+ @label="admin.logs.screened_emails.actions.allow"
+ />
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+
+ {{else}}
+ {{i18n "search.no_results"}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.gjs b/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.gjs
index 8911d0b5654..ced69163e88 100644
--- a/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.gjs
+++ b/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.gjs
@@ -1,134 +1,155 @@
-<DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.staff_action_logs.sub_pages.screened_ips.header_description"
- }}
-/>
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import TextField from "discourse/components/text-field";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import ScreenedIpAddressForm from "admin/components/screened-ip-address-form";
-<div class="screened-ip-controls">
- <div class="filter-screened-ip-address inline-form">
- <TextField
- @value={{this.filter}}
- @placeholderKey="admin.logs.screened_ips.form.filter"
- @autocorrect="off"
- @autocapitalize="off"
- class="ip-address-input"
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.staff_action_logs.sub_pages.screened_ips.header_description"
+ }}
/>
- <DButton
- @action={{this.exportScreenedIpList}}
- @icon="download"
- @title="admin.export_csv.button_title.screened_ip"
- @label="admin.export_csv.button_text"
- class="btn-default"
- />
- </div>
- <ScreenedIpAddressForm @action={{action "recordAdded"}} />
-</div>
+ <div class="screened-ip-controls">
+ <div class="filter-screened-ip-address inline-form">
+ <TextField
+ @value={{@controller.filter}}
+ @placeholderKey="admin.logs.screened_ips.form.filter"
+ @autocorrect="off"
+ @autocapitalize="off"
+ class="ip-address-input"
+ />
+ <DButton
+ @action={{@controller.exportScreenedIpList}}
+ @icon="download"
+ @title="admin.export_csv.button_title.screened_ip"
+ @label="admin.export_csv.button_text"
+ class="btn-default"
+ />
+ </div>
+
+ <ScreenedIpAddressForm @action={{@controller.recordAdded}} />
+ </div>
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.model.length}}
- <table class="admin-logs-table screened-ip-addresses grid">
- <thead class="heading-container">
- <th class="col heading first ip_address">{{i18n
- "admin.logs.ip_address"
- }}</th>
- <th class="col heading action">{{i18n "admin.logs.action"}}</th>
- <th class="col heading match_count">{{i18n
- "admin.logs.match_count"
- }}</th>
- <th class="col heading created_at">{{i18n "admin.logs.created_at"}}</th>
- <th class="col heading last_match_at">{{i18n
- "admin.logs.last_match_at"
- }}</th>
- <th class="col heading actions"></th>
- </thead>
- <tbody>
- {{#each this.model as |item|}}
- <tr class="admin-list-item">
- <td class="col first ip_address">
- {{#if item.editing}}
- <TextField @value={{item.ip_address}} @autofocus="autofocus" />
- {{else}}
- <a
- href
- {{on "click" (fn this.edit item)}}
- class="inline-editable-field"
- >
- {{#if item.isRange}}
- <strong>{{item.ip_address}}</strong>
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.model.length}}
+ <table class="admin-logs-table screened-ip-addresses grid">
+ <thead class="heading-container">
+ <th class="col heading first ip_address">{{i18n
+ "admin.logs.ip_address"
+ }}</th>
+ <th class="col heading action">{{i18n "admin.logs.action"}}</th>
+ <th class="col heading match_count">{{i18n
+ "admin.logs.match_count"
+ }}</th>
+ <th class="col heading created_at">{{i18n
+ "admin.logs.created_at"
+ }}</th>
+ <th class="col heading last_match_at">{{i18n
+ "admin.logs.last_match_at"
+ }}</th>
+ <th class="col heading actions"></th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |item|}}
+ <tr class="admin-list-item">
+ <td class="col first ip_address">
+ {{#if item.editing}}
+ <TextField
+ @value={{item.ip_address}}
+ @autofocus="autofocus"
+ />
+ {{else}}
+ <a
+ href
+ {{on "click" (fn @controller.edit item)}}
+ class="inline-editable-field"
+ >
+ {{#if item.isRange}}
+ <strong>{{item.ip_address}}</strong>
+ {{else}}
+ {{item.ip_address}}
+ {{/if}}
+ </a>
+ {{/if}}
+ </td>
+ <td class="col action">
+ {{#if item.isBlocked}}
+ {{icon "ban"}}
+ {{else}}
+ {{icon "check"}}
+ {{/if}}
+ {{item.actionName}}
+ </td>
+ <td class="col match_count">
+ <div class="label">{{i18n "admin.logs.match_count"}}</div>
+ {{item.match_count}}
+ </td>
+ <td class="col created_at">
+ <div class="label">{{i18n "admin.logs.created_at"}}</div>
+ {{ageWithTooltip item.created_at}}
+ </td>
+ <td class="col last_match_at">
+ {{#if item.last_match_at}}
+ <div class="label">{{i18n "admin.logs.last_match_at"}}</div>
+ {{ageWithTooltip item.last_match_at}}
+ {{/if}}
+ </td>
+ <td class="col actions">
+ {{#if item.editing}}
+ <DButton
+ @action={{fn @controller.save item}}
+ @label="admin.logs.save"
+ class="btn-default"
+ />
+ <DButton
+ @action={{fn @controller.cancel item}}
+ @translatedLabel={{i18n "cancel"}}
+ class="btn-flat"
+ />
{{else}}
- {{item.ip_address}}
+ <DButton
+ @action={{fn @controller.destroyRecord item}}
+ @icon="trash-can"
+ class="btn-default btn-danger"
+ />
+ <DButton
+ @action={{fn @controller.edit item}}
+ @icon="pencil"
+ class="btn-default"
+ />
+ {{#if item.isBlocked}}
+ <DButton
+ @action={{fn @controller.allow item}}
+ @icon="check"
+ @label="admin.logs.screened_ips.actions.do_nothing"
+ class="btn-default"
+ />
+ {{else}}
+ <DButton
+ @action={{fn @controller.block item}}
+ @icon="ban"
+ @label="admin.logs.screened_ips.actions.block"
+ class="btn-default"
+ />
+ {{/if}}
{{/if}}
- </a>
- {{/if}}
- </td>
- <td class="col action">
- {{#if item.isBlocked}}
- {{d-icon "ban"}}
- {{else}}
- {{d-icon "check"}}
- {{/if}}
- {{item.actionName}}
- </td>
- <td class="col match_count">
- <div class="label">{{i18n "admin.logs.match_count"}}</div>
- {{item.match_count}}
- </td>
- <td class="col created_at">
- <div class="label">{{i18n "admin.logs.created_at"}}</div>
- {{age-with-tooltip item.created_at}}
- </td>
- <td class="col last_match_at">
- {{#if item.last_match_at}}
- <div class="label">{{i18n "admin.logs.last_match_at"}}</div>
- {{age-with-tooltip item.last_match_at}}
- {{/if}}
- </td>
- <td class="col actions">
- {{#if item.editing}}
- <DButton
- @action={{fn this.save item}}
- @label="admin.logs.save"
- class="btn-default"
- />
- <DButton
- @action={{fn this.cancel item}}
- @translatedLabel={{i18n "cancel"}}
- class="btn-flat"
- />
- {{else}}
- <DButton
- @action={{fn this.destroyRecord item}}
- @icon="trash-can"
- class="btn-default btn-danger"
- />
- <DButton
- @action={{fn this.edit item}}
- @icon="pencil"
- class="btn-default"
- />
- {{#if item.isBlocked}}
- <DButton
- @action={{fn this.allow item}}
- @icon="check"
- @label="admin.logs.screened_ips.actions.do_nothing"
- class="btn-default"
- />
- {{else}}
- <DButton
- @action={{fn this.block item}}
- @icon="ban"
- @label="admin.logs.screened_ips.actions.block"
- class="btn-default"
- />
- {{/if}}
- {{/if}}
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else}}
- {{i18n "search.no_results"}}
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
+ {{i18n "search.no_results"}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/logs/screened-urls.gjs b/app/assets/javascripts/admin/addon/templates/logs/screened-urls.gjs
index 241dacfd966..8ef705ade15 100644
--- a/app/assets/javascripts/admin/addon/templates/logs/screened-urls.gjs
+++ b/app/assets/javascripts/admin/addon/templates/logs/screened-urls.gjs
@@ -1,52 +1,65 @@
-<DPageSubheader
- @descriptionLabel={{i18n
- "admin.config.staff_action_logs.sub_pages.screened_urls.header_description"
- }}
-/>
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import { i18n } from "discourse-i18n";
-<DButton
- @action={{this.exportScreenedUrlList}}
- @title="admin.export_csv.button_title.screened_url"
- @icon="download"
- @label="admin.export_csv.button_text"
- class="btn-default"
-/>
-<br />
+export default RouteTemplate(
+ <template>
+ <DPageSubheader
+ @descriptionLabel={{i18n
+ "admin.config.staff_action_logs.sub_pages.screened_urls.header_description"
+ }}
+ />
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.model.length}}
- <table class="screened-urls grid">
- <thead>
- <th class="first domain">{{i18n "admin.logs.screened_urls.domain"}}</th>
- <th class="action">{{i18n "admin.logs.action"}}</th>
- <th class="match_count">{{i18n "admin.logs.match_count"}}</th>
- <th class="last_match_at">{{i18n "admin.logs.last_match_at"}}</th>
- <th class="created_at">{{i18n "admin.logs.created_at"}}</th>
- </thead>
- <tbody>
- {{#each this.model as |url|}}
- <tr class="admin-list-item">
- <td class="col first domain">
- <div
- class="overflow-ellipsis"
- title={{url.domain}}
- >{{url.domain}}</div>
- </td>
- <td class="col action">{{url.actionName}}</td>
- <td class="col match_count"><div class="label">{{i18n
- "admin.logs.match_count"
- }}</div>{{url.match_count}}</td>
- <td class="col last_match_at"><div class="label">{{i18n
- "admin.logs.last_match_at"
- }}</div>{{age-with-tooltip url.last_match_at}}</td>
- <td class="col created_at"><div class="label">{{i18n
- "admin.logs.created_at"
- }}</div>{{age-with-tooltip url.created_at}}</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else}}
- {{i18n "search.no_results"}}
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <DButton
+ @action={{@controller.exportScreenedUrlList}}
+ @title="admin.export_csv.button_title.screened_url"
+ @icon="download"
+ @label="admin.export_csv.button_text"
+ class="btn-default"
+ />
+ <br />
+
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.model.length}}
+ <table class="screened-urls grid">
+ <thead>
+ <th class="first domain">{{i18n
+ "admin.logs.screened_urls.domain"
+ }}</th>
+ <th class="action">{{i18n "admin.logs.action"}}</th>
+ <th class="match_count">{{i18n "admin.logs.match_count"}}</th>
+ <th class="last_match_at">{{i18n "admin.logs.last_match_at"}}</th>
+ <th class="created_at">{{i18n "admin.logs.created_at"}}</th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |url|}}
+ <tr class="admin-list-item">
+ <td class="col first domain">
+ <div
+ class="overflow-ellipsis"
+ title={{url.domain}}
+ >{{url.domain}}</div>
+ </td>
+ <td class="col action">{{url.actionName}}</td>
+ <td class="col match_count"><div class="label">{{i18n
+ "admin.logs.match_count"
+ }}</div>{{url.match_count}}</td>
+ <td class="col last_match_at"><div class="label">{{i18n
+ "admin.logs.last_match_at"
+ }}</div>{{ageWithTooltip url.last_match_at}}</td>
+ <td class="col created_at"><div class="label">{{i18n
+ "admin.logs.created_at"
+ }}</div>{{ageWithTooltip url.created_at}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
+ {{i18n "search.no_results"}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.gjs b/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.gjs
index 689e4e37644..37be65eb366 100644
--- a/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.gjs
+++ b/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.gjs
@@ -1,180 +1,207 @@
-<div class="staff-action-logs-controls">
- {{#if this.filtersExists}}
- <div class="staff-action-logs-filters">
- <a
- href
- {{on "click" this.clearAllFilters}}
- class="clear-filters filter btn"
- >
- <span class="label">{{i18n
- "admin.logs.staff_actions.clear_filters"
- }}</span>
- </a>
- {{#if this.actionFilter}}
- <a
- href
- {{on "click" (fn this.clearFilter "actionFilter")}}
- class="filter btn"
- >
- <span class="label">{{i18n "admin.logs.action"}}</span>:
- {{this.actionFilter}}
- {{d-icon "circle-xmark"}}
- </a>
- {{/if}}
- {{#if this.filters.acting_user}}
- <a
- href
- {{on "click" (fn this.clearFilter "acting_user")}}
- class="filter btn"
- >
- <span class="label">{{i18n
- "admin.logs.staff_actions.staff_user"
- }}</span>:
- {{this.filters.acting_user}}
- {{d-icon "circle-xmark"}}
- </a>
- {{/if}}
- {{#if this.filters.target_user}}
- <a
- href
- {{on "click" (fn this.clearFilter "target_user")}}
- class="filter btn"
- >
- <span class="label">{{i18n
- "admin.logs.staff_actions.target_user"
- }}</span>:
- {{this.filters.target_user}}
- {{d-icon "circle-xmark"}}
- </a>
- {{/if}}
- {{#if this.filters.subject}}
- <a
- href
- {{on "click" (fn this.clearFilter "subject")}}
- class="filter btn"
- >
- <span class="label">{{i18n
- "admin.logs.staff_actions.subject"
- }}</span>:
- {{this.filters.subject}}
- {{d-icon "circle-xmark"}}
- </a>
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import LoadMore from "discourse/components/load-more";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import StaffActions from "admin/components/staff-actions";
+import ComboBox from "select-kit/components/combo-box";
+
+export default RouteTemplate(
+ <template>
+ <div class="staff-action-logs-controls">
+ {{#if @controller.filtersExists}}
+ <div class="staff-action-logs-filters">
+ <a
+ href
+ {{on "click" @controller.clearAllFilters}}
+ class="clear-filters filter btn"
+ >
+ <span class="label">{{i18n
+ "admin.logs.staff_actions.clear_filters"
+ }}</span>
+ </a>
+ {{#if @controller.actionFilter}}
+ <a
+ href
+ {{on "click" (fn @controller.clearFilter "actionFilter")}}
+ class="filter btn"
+ >
+ <span class="label">{{i18n "admin.logs.action"}}</span>:
+ {{@controller.actionFilter}}
+ {{icon "circle-xmark"}}
+ </a>
+ {{/if}}
+ {{#if @controller.filters.acting_user}}
+ <a
+ href
+ {{on "click" (fn @controller.clearFilter "acting_user")}}
+ class="filter btn"
+ >
+ <span class="label">{{i18n
+ "admin.logs.staff_actions.staff_user"
+ }}</span>:
+ {{@controller.filters.acting_user}}
+ {{icon "circle-xmark"}}
+ </a>
+ {{/if}}
+ {{#if @controller.filters.target_user}}
+ <a
+ href
+ {{on "click" (fn @controller.clearFilter "target_user")}}
+ class="filter btn"
+ >
+ <span class="label">{{i18n
+ "admin.logs.staff_actions.target_user"
+ }}</span>:
+ {{@controller.filters.target_user}}
+ {{icon "circle-xmark"}}
+ </a>
+ {{/if}}
+ {{#if @controller.filters.subject}}
+ <a
+ href
+ {{on "click" (fn @controller.clearFilter "subject")}}
+ class="filter btn"
+ >
+ <span class="label">{{i18n
+ "admin.logs.staff_actions.subject"
+ }}</span>:
+ {{@controller.filters.subject}}
+ {{icon "circle-xmark"}}
+ </a>
+ {{/if}}
+ </div>
+ {{else}}
+ {{i18n "admin.logs.staff_actions.filter"}}
+ <ComboBox
+ @content={{@controller.userHistoryActions}}
+ @value={{@controller.filterActionId}}
+ @onChange={{@controller.filterActionIdChanged}}
+ @options={{hash none="admin.logs.staff_actions.all"}}
+ @id="staff-action-logs-action-filter"
+ />
{{/if}}
- </div>
- {{else}}
- {{i18n "admin.logs.staff_actions.filter"}}
- <ComboBox
- @content={{this.userHistoryActions}}
- @value={{this.filterActionId}}
- @onChange={{action "filterActionIdChanged"}}
- @options={{hash none="admin.logs.staff_actions.all"}}
- @id="staff-action-logs-action-filter"
- />
- {{/if}}
- <DButton
- @action={{this.exportStaffActionLogs}}
- @label="admin.export_csv.button_text"
- @icon="download"
- class="btn-default"
- />
-</div>
+ <DButton
+ @action={{@controller.exportStaffActionLogs}}
+ @label="admin.export_csv.button_text"
+ @icon="download"
+ class="btn-default"
+ />
+ </div>
-<div class="clearfix"></div>
+ <div class="clearfix"></div>
-<StaffActions>
- <LoadMore @selector=".staff-logs tr" @action={{action "loadMore"}}>
- {{#if this.model.content}}
- <table class="table staff-logs grid">
- <thead>
- <th>{{i18n "admin.logs.staff_actions.staff_user"}}</th>
- <th>{{i18n "admin.logs.action"}}</th>
- <th>{{i18n "admin.logs.staff_actions.subject"}}</th>
- <th>{{i18n "admin.logs.staff_actions.when"}}</th>
- <th>{{i18n "admin.logs.staff_actions.details"}}</th>
- <th>{{i18n "admin.logs.staff_actions.context"}}</th>
- </thead>
- <tbody>
- {{#each this.model.content as |item|}}
- <tr class="admin-list-item" data-user-history-id={{item.id}}>
- <td class="staff-users">
- <div class="staff-user">
- {{#if item.acting_user}}
- <LinkTo @route="adminUser" @model={{item.acting_user}}>
- {{avatar item.acting_user imageSize="tiny"}}
- {{item.acting_user.username}}
- </LinkTo>
- {{else}}
- <span
- class="deleted-user"
- title={{i18n "admin.user.deleted"}}
- >
- {{d-icon "trash-can"}}
- </span>
- {{/if}}
- </div>
- </td>
- <td class="col value action">
- <a
- href
- {{on "click" (fn this.filterByAction item)}}
- >{{item.actionName}}</a>
- </td>
- <td class="col value subject">
- <div class="subject">
- {{#if item.target_user}}
- <LinkTo
- @route="adminUser"
- @model={{item.target_user}}
- >{{avatar item.target_user imageSize="tiny"}}</LinkTo>
- <a
- href
- {{on
- "click"
- (fn this.filterByTargetUser item.target_user)
- }}
- >{{item.target_user.username}}</a>
- {{/if}}
- {{#if item.subject}}
- <a
- href
- {{on "click" (fn this.filterBySubject item.subject)}}
- title={{item.subject}}
- >{{item.subject}}</a>
- {{/if}}
- </div>
- </td>
- <td class="col value created-at">{{age-with-tooltip
- item.created_at
- }}</td>
- <td class="col value details">
- <div>
- {{html-safe item.formattedDetails}}
- {{#if item.useCustomModalForDetails}}
- <a
- href
- {{on "click" (fn this.showCustomDetailsModal item)}}
- >{{d-icon "circle-info"}}
- {{i18n "admin.logs.staff_actions.show"}}</a>
- {{/if}}
- {{#if item.useModalForDetails}}
+ <StaffActions>
+ <LoadMore @selector=".staff-logs tr" @action={{@controller.loadMore}}>
+ {{#if @controller.model.content}}
+ <table class="table staff-logs grid">
+ <thead>
+ <th>{{i18n "admin.logs.staff_actions.staff_user"}}</th>
+ <th>{{i18n "admin.logs.action"}}</th>
+ <th>{{i18n "admin.logs.staff_actions.subject"}}</th>
+ <th>{{i18n "admin.logs.staff_actions.when"}}</th>
+ <th>{{i18n "admin.logs.staff_actions.details"}}</th>
+ <th>{{i18n "admin.logs.staff_actions.context"}}</th>
+ </thead>
+ <tbody>
+ {{#each @controller.model.content as |item|}}
+ <tr class="admin-list-item" data-user-history-id={{item.id}}>
+ <td class="staff-users">
+ <div class="staff-user">
+ {{#if item.acting_user}}
+ <LinkTo @route="adminUser" @model={{item.acting_user}}>
+ {{avatar item.acting_user imageSize="tiny"}}
+ {{item.acting_user.username}}
+ </LinkTo>
+ {{else}}
+ <span
+ class="deleted-user"
+ title={{i18n "admin.user.deleted"}}
+ >
+ {{icon "trash-can"}}
+ </span>
+ {{/if}}
+ </div>
+ </td>
+ <td class="col value action">
<a
href
- {{on "click" (fn this.showDetailsModal item)}}
- >{{d-icon "circle-info"}}
- {{i18n "admin.logs.staff_actions.show"}}</a>
- {{/if}}
- </div>
- </td>
- <td class="col value context">{{item.context}}</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else if this.model.loadingMore}}
- <ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
- {{else}}
- {{i18n "search.no_results"}}
- {{/if}}
- </LoadMore>
-</StaffActions>
\ No newline at end of file
+ {{on "click" (fn @controller.filterByAction item)}}
+ >{{item.actionName}}</a>
+ </td>
+ <td class="col value subject">
+ <div class="subject">
+ {{#if item.target_user}}
+ <LinkTo
+ @route="adminUser"
+ @model={{item.target_user}}
+ >{{avatar item.target_user imageSize="tiny"}}</LinkTo>
+ <a
+ href
+ {{on
+ "click"
+ (fn @controller.filterByTargetUser item.target_user)
+ }}
+ >{{item.target_user.username}}</a>
+ {{/if}}
+ {{#if item.subject}}
+ <a
+ href
+ {{on
+ "click"
+ (fn @controller.filterBySubject item.subject)
+ }}
+ title={{item.subject}}
+ >{{item.subject}}</a>
+ {{/if}}
+ </div>
+ </td>
+ <td class="col value created-at">{{ageWithTooltip
+ item.created_at
+ }}</td>
+ <td class="col value details">
+ <div>
+ {{htmlSafe item.formattedDetails}}
+ {{#if item.useCustomModalForDetails}}
+ <a
+ href
+ {{on
+ "click"
+ (fn @controller.showCustomDetailsModal item)
+ }}
+ >{{icon "circle-info"}}
+ {{i18n "admin.logs.staff_actions.show"}}</a>
+ {{/if}}
+ {{#if item.useModalForDetails}}
+ <a
+ href
+ {{on "click" (fn @controller.showDetailsModal item)}}
+ >{{icon "circle-info"}}
+ {{i18n "admin.logs.staff_actions.show"}}</a>
+ {{/if}}
+ </div>
+ </td>
+ <td class="col value context">{{item.context}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{else if @controller.model.loadingMore}}
+ <ConditionalLoadingSpinner
+ @condition={{@controller.model.loadingMore}}
+ />
+ {{else}}
+ {{i18n "search.no_results"}}
+ {{/if}}
+ </LoadMore>
+ </StaffActions>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/permalinks-edit.gjs b/app/assets/javascripts/admin/addon/templates/permalinks-edit.gjs
index f74b91cf898..fb94505c083 100644
--- a/app/assets/javascripts/admin/addon/templates/permalinks-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/permalinks-edit.gjs
@@ -1 +1,6 @@
-<AdminPermalinkForm @permalink={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminPermalinkForm from "admin/components/admin-permalink-form";
+
+export default RouteTemplate(
+ <template><AdminPermalinkForm @permalink={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/permalinks-index.gjs b/app/assets/javascripts/admin/addon/templates/permalinks-index.gjs
index c08c48adea2..409ae609159 100644
--- a/app/assets/javascripts/admin/addon/templates/permalinks-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/permalinks-index.gjs
@@ -1,114 +1,134 @@
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.hasPermalinks}}
- <div class="d-admin-filter">
- <div class="admin-filter__input-container permalink-search">
- <TextField
- @value={{this.filter}}
- @placeholderKey="admin.permalink.form.filter"
- @autocorrect="off"
- @autocapitalize="off"
- class="admin-filter__input"
- />
- </div>
- </div>
- {{/if}}
-
- <div class="permalink-results">
- {{#if this.model.length}}
- <table class="d-admin-table permalinks">
- <thead>
- <th>{{i18n "admin.permalink.url"}}</th>
- <th>{{i18n "admin.permalink.destination"}}</th>
- </thead>
- <tbody>
- {{#each this.model as |pl|}}
- <tr
- class={{concat-class
- "admin-permalink-item d-admin-row__content"
- pl.key
- }}
- >
- <td class="d-admin-row__overview">
- <FlatButton
- @title="admin.permalink.copy_to_clipboard"
- @icon="far-clipboard"
- @action={{fn this.copyUrl pl}}
- />
- <span
- id="admin-permalink-{{pl.id}}"
- class="admin-permalink-item__url"
- title={{pl.url}}
- >{{pl.url}}</span>
- </td>
- <td class="d-admin-row__detail destination">
- {{#if pl.topic_id}}
- <a href={{pl.topic_url}}>{{pl.topic_title}}</a>
- {{/if}}
- {{#if pl.post_id}}
- <a href={{pl.post_url}}>{{pl.post_topic_title}}
- #{{pl.post_number}}</a>
- {{/if}}
- {{#if pl.category_id}}
- {{category-link pl.category}}
- {{/if}}
- {{#if pl.tag_id}}
- <a href={{pl.tag_url}}>{{pl.tag_name}}</a>
- {{/if}}
- {{#if pl.external_url}}
- {{#if pl.linkIsExternal}}
- {{d-icon "up-right-from-square"}}
- {{/if}}
- <a href={{pl.external_url}}>{{pl.external_url}}</a>
- {{/if}}
- {{#if pl.user_id}}
- <a href={{pl.user_url}}>{{pl.username}}</a>
- {{/if}}
- </td>
- <td class="d-admin-row__controls">
- <div class="d-admin-row__controls-options">
- <DButton
- class="btn-default btn-small admin-permalink-item__edit"
- @route="adminPermalinks.edit"
- @routeModels={{pl}}
- @label="admin.config_areas.permalinks.edit"
- />
+import { fn } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DropdownMenu from "discourse/components/dropdown-menu";
+import FlatButton from "discourse/components/flat-button";
+import TextField from "discourse/components/text-field";
+import categoryLink from "discourse/helpers/category-link";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
+import DMenu from "float-kit/components/d-menu";
- <DMenu
- @identifier="permalink-menu"
- @title={{i18n "admin.permalink.more_options"}}
- @icon="ellipsis-vertical"
- @onRegisterApi={{this.onRegisterApi}}
- >
- <:content>
- <DropdownMenu as |dropdown|>
- <dropdown.item>
- <DButton
- @action={{fn this.destroyRecord pl}}
- @icon="trash-can"
- class="btn-transparent btn-danger admin-permalink-item__delete"
- @label="admin.config_areas.permalinks.delete"
- />
- </dropdown.item>
- </DropdownMenu>
- </:content>
- </DMenu>
- </div>
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{else}}
- {{#if this.filter}}
- <p class="permalink-results__no-result">{{i18n "search.no_results"}}</p>
- {{else}}
- <AdminConfigAreaEmptyList
- @ctaLabel="admin.permalink.add"
- @ctaRoute="adminPermalinks.new"
- @ctaClass="admin-permalinks__add-permalink"
- @emptyLabel="admin.permalink.no_permalinks"
- />
+export default RouteTemplate(
+ <template>
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.hasPermalinks}}
+ <div class="d-admin-filter">
+ <div class="admin-filter__input-container permalink-search">
+ <TextField
+ @value={{@controller.filter}}
+ @placeholderKey="admin.permalink.form.filter"
+ @autocorrect="off"
+ @autocapitalize="off"
+ class="admin-filter__input"
+ />
+ </div>
+ </div>
{{/if}}
- {{/if}}
- </div>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+
+ <div class="permalink-results">
+ {{#if @controller.model.length}}
+ <table class="d-admin-table permalinks">
+ <thead>
+ <th>{{i18n "admin.permalink.url"}}</th>
+ <th>{{i18n "admin.permalink.destination"}}</th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |pl|}}
+ <tr
+ class={{concatClass
+ "admin-permalink-item d-admin-row__content"
+ pl.key
+ }}
+ >
+ <td class="d-admin-row__overview">
+ <FlatButton
+ @title="admin.permalink.copy_to_clipboard"
+ @icon="far-clipboard"
+ @action={{fn @controller.copyUrl pl}}
+ />
+ <span
+ id="admin-permalink-{{pl.id}}"
+ class="admin-permalink-item__url"
+ title={{pl.url}}
+ >{{pl.url}}</span>
+ </td>
+ <td class="d-admin-row__detail destination">
+ {{#if pl.topic_id}}
+ <a href={{pl.topic_url}}>{{pl.topic_title}}</a>
+ {{/if}}
+ {{#if pl.post_id}}
+ <a href={{pl.post_url}}>{{pl.post_topic_title}}
+ #{{pl.post_number}}</a>
+ {{/if}}
+ {{#if pl.category_id}}
+ {{categoryLink pl.category}}
+ {{/if}}
+ {{#if pl.tag_id}}
+ <a href={{pl.tag_url}}>{{pl.tag_name}}</a>
+ {{/if}}
+ {{#if pl.external_url}}
+ {{#if pl.linkIsExternal}}
+ {{icon "up-right-from-square"}}
+ {{/if}}
+ <a href={{pl.external_url}}>{{pl.external_url}}</a>
+ {{/if}}
+ {{#if pl.user_id}}
+ <a href={{pl.user_url}}>{{pl.username}}</a>
+ {{/if}}
+ </td>
+ <td class="d-admin-row__controls">
+ <div class="d-admin-row__controls-options">
+ <DButton
+ class="btn-default btn-small admin-permalink-item__edit"
+ @route="adminPermalinks.edit"
+ @routeModels={{pl}}
+ @label="admin.config_areas.permalinks.edit"
+ />
+
+ <DMenu
+ @identifier="permalink-menu"
+ @title={{i18n "admin.permalink.more_options"}}
+ @icon="ellipsis-vertical"
+ @onRegisterApi={{@controller.onRegisterApi}}
+ >
+ <:content>
+ <DropdownMenu as |dropdown|>
+ <dropdown.item>
+ <DButton
+ @action={{fn @controller.destroyRecord pl}}
+ @icon="trash-can"
+ class="btn-transparent btn-danger admin-permalink-item__delete"
+ @label="admin.config_areas.permalinks.delete"
+ />
+ </dropdown.item>
+ </DropdownMenu>
+ </:content>
+ </DMenu>
+ </div>
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
+ {{#if @controller.filter}}
+ <p class="permalink-results__no-result">{{i18n
+ "search.no_results"
+ }}</p>
+ {{else}}
+ <AdminConfigAreaEmptyList
+ @ctaLabel="admin.permalink.add"
+ @ctaRoute="adminPermalinks.new"
+ @ctaClass="admin-permalinks__add-permalink"
+ @emptyLabel="admin.permalink.no_permalinks"
+ />
+ {{/if}}
+ {{/if}}
+ </div>
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/permalinks-new.gjs b/app/assets/javascripts/admin/addon/templates/permalinks-new.gjs
index 824a49fedef..e480f384f5b 100644
--- a/app/assets/javascripts/admin/addon/templates/permalinks-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/permalinks-new.gjs
@@ -1 +1,4 @@
-<AdminPermalinkForm />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminPermalinkForm from "admin/components/admin-permalink-form";
+
+export default RouteTemplate(<template><AdminPermalinkForm /></template>);
diff --git a/app/assets/javascripts/admin/addon/templates/permalinks-settings.gjs b/app/assets/javascripts/admin/addon/templates/permalinks-settings.gjs
index b55616ab720..3b9cd47cf1c 100644
--- a/app/assets/javascripts/admin/addon/templates/permalinks-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/permalinks-settings.gjs
@@ -1,6 +1,13 @@
-<AdminAreaSettings
- @area="permalinks"
- @path="/admin/config/permalinks/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
-/>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <AdminAreaSettings
+ @area="permalinks"
+ @path="/admin/config/permalinks/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/permalinks.gjs b/app/assets/javascripts/admin/addon/templates/permalinks.gjs
index cc8210e0d4b..cd56bbf37cb 100644
--- a/app/assets/javascripts/admin/addon/templates/permalinks.gjs
+++ b/app/assets/javascripts/admin/addon/templates/permalinks.gjs
@@ -1,38 +1,48 @@
-<div class="admin-permalinks admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.permalinks.title"}}
- @descriptionLabel={{i18n "admin.config.permalinks.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/20930"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/config/permalinks"
- @label={{i18n "admin.config.permalinks.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @route="adminPermalinks.new"
- @title="admin.permalink.add"
- @label="admin.permalink.add"
- class="admin-permalinks__header-add-permalink"
- />
- </:actions>
- <:tabs>
- <NavItem
- @route="adminPermalinks.settings"
- @label="admin.permalink.nav.settings"
- class="admin-permalinks-tabs__settings"
- />
- <NavItem
- @route="adminPermalinks.index"
- @label="admin.permalink.nav.permalinks"
- class="admin-permalins-permalinks"
- />
- </:tabs>
- </DPageHeader>
- <div class="admin-container admin-config-page__main-area">
- {{outlet}}
- </div>
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
+
+export default RouteTemplate(
+ <template>
+ <div class="admin-permalinks admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.permalinks.title"}}
+ @descriptionLabel={{i18n "admin.config.permalinks.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/20930"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/config/permalinks"
+ @label={{i18n "admin.config.permalinks.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @route="adminPermalinks.new"
+ @title="admin.permalink.add"
+ @label="admin.permalink.add"
+ class="admin-permalinks__header-add-permalink"
+ />
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="adminPermalinks.settings"
+ @label="admin.permalink.nav.settings"
+ class="admin-permalinks-tabs__settings"
+ />
+ <NavItem
+ @route="adminPermalinks.index"
+ @label="admin.permalink.nav.permalinks"
+ class="admin-permalins-permalinks"
+ />
+ </:tabs>
+ </DPageHeader>
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/plugins-index.gjs b/app/assets/javascripts/admin/addon/templates/plugins-index.gjs
index 46f441f8355..a48660cb231 100644
--- a/app/assets/javascripts/admin/addon/templates/plugins-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/plugins-index.gjs
@@ -1,58 +1,72 @@
-<div class="admin-plugins-list-container">
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import AdminPluginsList from "admin/components/admin-plugins-list";
- <DPageHeader
- @titleLabel={{i18n "admin.config.plugins.title"}}
- @descriptionLabel={{i18n "admin.config.plugins.header_description"}}
- @learnMoreUrl="https://www.discourse.org/plugins"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/plugins"
- @label={{i18n "admin.plugins.title"}}
- />
- </:breadcrumbs>
- <:tabs>
- <NavItem @route="adminPlugins.index" @label="admin.plugins.title" />
- {{#each this.adminRoutes as |route|}}
- {{#if route.use_new_show_route}}
- <NavItem
- @route={{route.full_location}}
- @label={{route.label}}
- @routeParam={{route.location}}
- @class="admin-plugin-tab-nav-item"
- data-plugin-nav-tab-id={{route.plugin_id}}
- />
- {{else}}
- <NavItem
- @route={{route.full_location}}
- @label={{route.label}}
- @class="admin-plugin-tab-nav-item"
- data-plugin-nav-tab-id={{route.plugin_id}}
+export default RouteTemplate(
+ <template>
+ <div class="admin-plugins-list-container">
+
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.plugins.title"}}
+ @descriptionLabel={{i18n "admin.config.plugins.header_description"}}
+ @learnMoreUrl="https://www.discourse.org/plugins"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/plugins"
+ @label={{i18n "admin.plugins.title"}}
/>
- {{/if}}
- {{/each}}
- </:tabs>
- </DPageHeader>
+ </:breadcrumbs>
+ <:tabs>
+ <NavItem @route="adminPlugins.index" @label="admin.plugins.title" />
+ {{#each @controller.adminRoutes as |route|}}
+ {{#if route.use_new_show_route}}
+ <NavItem
+ @route={{route.full_location}}
+ @label={{route.label}}
+ @routeParam={{route.location}}
+ @class="admin-plugin-tab-nav-item"
+ data-plugin-nav-tab-id={{route.plugin_id}}
+ />
+ {{else}}
+ <NavItem
+ @route={{route.full_location}}
+ @label={{route.label}}
+ @class="admin-plugin-tab-nav-item"
+ data-plugin-nav-tab-id={{route.plugin_id}}
+ />
+ {{/if}}
+ {{/each}}
+ </:tabs>
+ </DPageHeader>
- <div class="alert alert-info -top-margin admin-plugins-howto">
- {{dIcon "circle-info"}}
- <a href="https://meta.discourse.org/t/install-a-plugin/19157">
- {{i18n "admin.plugins.howto"}}
- </a>
- </div>
+ <div class="alert alert-info -top-margin admin-plugins-howto">
+ {{icon "circle-info"}}
+ <a href="https://meta.discourse.org/t/install-a-plugin/19157">
+ {{i18n "admin.plugins.howto"}}
+ </a>
+ </div>
- {{#if this.model.length}}
- <AdminPluginsList @plugins={{this.model}} />
- {{else}}
- <p>{{i18n "admin.plugins.none_installed"}}</p>
- {{/if}}
+ {{#if @controller.model.length}}
+ <AdminPluginsList @plugins={{@controller.model}} />
+ {{else}}
+ <p>{{i18n "admin.plugins.none_installed"}}</p>
+ {{/if}}
- <span>
- <PluginOutlet
- @name="admin-below-plugins-index"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
-</div>
\ No newline at end of file
+ <span>
+ <PluginOutlet
+ @name="admin-below-plugins-index"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/plugins-show-settings.gjs b/app/assets/javascripts/admin/addon/templates/plugins-show-settings.gjs
index 2d047ee229d..1afb4ec4aa9 100644
--- a/app/assets/javascripts/admin/addon/templates/plugins-show-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/plugins-show-settings.gjs
@@ -1,10 +1,17 @@
-<div
- class="content-body admin-plugin-config-area__settings admin-detail pull-left"
->
- <AdminAreaSettings
- @plugin={{@model.plugin.id}}
- @path="/admin/plugins/{{@model.plugin.name}}/settings"
- @filter={{this.filter}}
- @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
- />
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminAreaSettings from "admin/components/admin-area-settings";
+
+export default RouteTemplate(
+ <template>
+ <div
+ class="content-body admin-plugin-config-area__settings admin-detail pull-left"
+ >
+ <AdminAreaSettings
+ @plugin={{@model.plugin.id}}
+ @path="/admin/plugins/{{@model.plugin.name}}/settings"
+ @filter={{@controller.filter}}
+ @adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
+ />
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/plugins-show.gjs b/app/assets/javascripts/admin/addon/templates/plugins-show.gjs
index f679f36873d..892ba64e15c 100644
--- a/app/assets/javascripts/admin/addon/templates/plugins-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/plugins-show.gjs
@@ -1,3 +1,10 @@
-<AdminPluginConfigPage @plugin={{this.model}}>
- {{outlet}}
-</AdminPluginConfigPage>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import AdminPluginConfigPage from "admin/components/admin-plugin-config-page";
+
+export default RouteTemplate(
+ <template>
+ <AdminPluginConfigPage @plugin={{@controller.model}}>
+ {{outlet}}
+ </AdminPluginConfigPage>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/plugins.gjs b/app/assets/javascripts/admin/addon/templates/plugins.gjs
index fcde674f5ff..65f23c99d71 100644
--- a/app/assets/javascripts/admin/addon/templates/plugins.gjs
+++ b/app/assets/javascripts/admin/addon/templates/plugins.gjs
@@ -1,43 +1,54 @@
-{{#if this.showTopNav}}
- <div class="d-page-header">
- <DBreadcrumbsContainer />
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/plugins"
- @label={{i18n "admin.config.plugins.title"}}
- />
- <div class="d-nav-submenu">
- <HorizontalOverflowNav class="main-nav nav plugin-nav">
- <NavItem @route="adminPlugins.index" @label="admin.plugins.title" />
- {{#each this.adminRoutes as |route|}}
- {{#if route.use_new_show_route}}
- <NavItem
- @route={{route.full_location}}
- @label={{route.label}}
- @routeParam={{route.location}}
- @class="admin-plugin-tab-nav-item"
- data-plugin-nav-tab-id={{route.plugin_id}}
- />
- {{else}}
- <NavItem
- @route={{route.full_location}}
- @label={{route.label}}
- @class="admin-plugin-tab-nav-item"
- data-plugin-nav-tab-id={{route.plugin_id}}
- />
- {{/if}}
- {{/each}}
- </HorizontalOverflowNav>
- </div>
- </div>
-{{/if}}
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsContainer from "discourse/components/d-breadcrumbs-container";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import HorizontalOverflowNav from "discourse/components/horizontal-overflow-nav";
+import NavItem from "discourse/components/nav-item";
+import { i18n } from "discourse-i18n";
-<div class="admin-config-page -no-header">
- {{#each this.brokenAdminRoutes as |route|}}
- <div class="alert alert-error">
- {{i18n "admin.plugins.broken_route" name=(i18n route.label)}}
- </div>
- {{/each}}
+export default RouteTemplate(
+ <template>
+ {{#if @controller.showTopNav}}
+ <div class="d-page-header">
+ <DBreadcrumbsContainer />
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/plugins"
+ @label={{i18n "admin.config.plugins.title"}}
+ />
+ <div class="d-nav-submenu">
+ <HorizontalOverflowNav class="main-nav nav plugin-nav">
+ <NavItem @route="adminPlugins.index" @label="admin.plugins.title" />
+ {{#each @controller.adminRoutes as |route|}}
+ {{#if route.use_new_show_route}}
+ <NavItem
+ @route={{route.full_location}}
+ @label={{route.label}}
+ @routeParam={{route.location}}
+ @class="admin-plugin-tab-nav-item"
+ data-plugin-nav-tab-id={{route.plugin_id}}
+ />
+ {{else}}
+ <NavItem
+ @route={{route.full_location}}
+ @label={{route.label}}
+ @class="admin-plugin-tab-nav-item"
+ data-plugin-nav-tab-id={{route.plugin_id}}
+ />
+ {{/if}}
+ {{/each}}
+ </HorizontalOverflowNav>
+ </div>
+ </div>
+ {{/if}}
- {{outlet}}
-</div>
\ No newline at end of file
+ <div class="admin-config-page -no-header">
+ {{#each @controller.brokenAdminRoutes as |route|}}
+ <div class="alert alert-error">
+ {{i18n "admin.plugins.broken_route" name=(i18n route.label)}}
+ </div>
+ {{/each}}
+
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/reports-index.gjs b/app/assets/javascripts/admin/addon/templates/reports-index.gjs
index 6f2764ca959..c3560345db5 100644
--- a/app/assets/javascripts/admin/addon/templates/reports-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/reports-index.gjs
@@ -1,20 +1,30 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.reports.title"}}
- @descriptionLabel={{i18n "admin.config.reports.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/-/240233"
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin.config.reports"
- @label={{i18n "admin.config.reports.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
+import AdminReports from "admin/components/admin-reports";
-<div class="admin-container admin-config-page__main-area">
- <div class="admin-config-area__full-width">
- <AdminReports />
- </div>
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.reports.title"}}
+ @descriptionLabel={{i18n "admin.config.reports.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/-/240233"
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin.config.reports"
+ @label={{i18n "admin.config.reports.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ <div class="admin-config-area__full-width">
+ <AdminReports />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/reports-show.gjs b/app/assets/javascripts/admin/addon/templates/reports-show.gjs
index 4ac65d8b479..dbf5b1273ab 100644
--- a/app/assets/javascripts/admin/addon/templates/reports-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/reports-show.gjs
@@ -1,13 +1,22 @@
-<BackButton @route="adminReports" @label="admin.reports.back" />
-<div class="admin-container admin-config-page__main-area">
- <div class="admin-config-area">
- <AdminReport
- @dataSourceName={{this.model.type}}
- @filters={{this.model}}
- @reportOptions={{this.reportOptions}}
- @showFilteringUI={{true}}
- @showDescriptionInTooltip={{false}}
- @onRefresh={{route-action "onParamsChange"}}
- />
- </div>
-</div>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import BackButton from "discourse/components/back-button";
+import routeAction from "discourse/helpers/route-action";
+import AdminReport from "admin/components/admin-report";
+
+export default RouteTemplate(
+ <template>
+ <BackButton @route="adminReports" @label="admin.reports.back" />
+ <div class="admin-container admin-config-page__main-area">
+ <div class="admin-config-area">
+ <AdminReport
+ @dataSourceName={{@controller.model.type}}
+ @filters={{@controller.model}}
+ @reportOptions={{@controller.reportOptions}}
+ @showFilteringUI={{true}}
+ @showDescriptionInTooltip={{false}}
+ @onRefresh={{routeAction "onParamsChange"}}
+ />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/search-index.gjs b/app/assets/javascripts/admin/addon/templates/search-index.gjs
index 0f6b1c23da5..23568d91329 100644
--- a/app/assets/javascripts/admin/addon/templates/search-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/search-index.gjs
@@ -1,19 +1,31 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.search_everything.title"}}
- @descriptionLabel={{i18n "admin.config.search_everything.header_description"}}
- @shouldDisplay={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/search"
- @label={{i18n "admin.config.search_everything.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
+import AdminSearch from "admin/components/admin-search";
-<div class="admin-container admin-config-page__main-area">
- <div class="admin-config-area__full-width">
- <AdminSearch @initialFilter={{this.filter}} />
- </div>
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.search_everything.title"}}
+ @descriptionLabel={{i18n
+ "admin.config.search_everything.header_description"
+ }}
+ @shouldDisplay={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/search"
+ @label={{i18n "admin.config.search_everything.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ <div class="admin-config-area__full-width">
+ <AdminSearch @initialFilter={{@controller.filter}} />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/search-logs-index.gjs b/app/assets/javascripts/admin/addon/templates/search-logs-index.gjs
index 0e6cb93f91c..6dcd4b30106 100644
--- a/app/assets/javascripts/admin/addon/templates/search-logs-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/search-logs-index.gjs
@@ -1,48 +1,67 @@
-<div class="admin-title">
- <PeriodChooser @period={{this.period}} @onChange={{fn (mut this.period)}} />
- <ComboBox
- @content={{this.searchTypeOptions}}
- @value={{this.searchType}}
- @onChange={{fn (mut this.searchType)}}
- class="search-logs-filter"
- />
-</div>
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import PeriodChooser from "select-kit/components/period-chooser";
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.model.length}}
+export default RouteTemplate(
+ <template>
+ <div class="admin-title">
+ <PeriodChooser
+ @period={{@controller.period}}
+ @onChange={{fn (mut @controller.period)}}
+ />
+ <ComboBox
+ @content={{@controller.searchTypeOptions}}
+ @value={{@controller.searchType}}
+ @onChange={{fn (mut @controller.searchType)}}
+ class="search-logs-filter"
+ />
+ </div>
- <table class="search-logs-list grid">
- <thead>
- <th class="col heading term">{{i18n "admin.logs.search_logs.term"}}</th>
- <th class="col heading">{{i18n "admin.logs.search_logs.searches"}}</th>
- <th class="col heading">{{i18n
- "admin.logs.search_logs.click_through_rate"
- }}</th>
- </thead>
- <tbody>
- {{#each this.model as |item|}}
- <tr class="admin-list-item">
- <td class="col term">
- <LinkTo
- @route="adminSearchLogs.term"
- @query={{hash term=item.term period=this.period}}
- class="test"
- >
- {{item.term}}
- </LinkTo>
- </td>
- <td class="col"><div class="label">{{i18n
- "admin.logs.search_logs.searches"
- }}</div>{{item.searches}}</td>
- <td class="col"><div class="label">{{i18n
- "admin.logs.search_logs.click_through_rate"
- }}</div>{{item.ctr}}%</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.model.length}}
- {{else}}
- {{i18n "search.no_results"}}
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <table class="search-logs-list grid">
+ <thead>
+ <th class="col heading term">{{i18n
+ "admin.logs.search_logs.term"
+ }}</th>
+ <th class="col heading">{{i18n
+ "admin.logs.search_logs.searches"
+ }}</th>
+ <th class="col heading">{{i18n
+ "admin.logs.search_logs.click_through_rate"
+ }}</th>
+ </thead>
+ <tbody>
+ {{#each @controller.model as |item|}}
+ <tr class="admin-list-item">
+ <td class="col term">
+ <LinkTo
+ @route="adminSearchLogs.term"
+ @query={{hash term=item.term [email protected]}}
+ class="test"
+ >
+ {{item.term}}
+ </LinkTo>
+ </td>
+ <td class="col"><div class="label">{{i18n
+ "admin.logs.search_logs.searches"
+ }}</div>{{item.searches}}</td>
+ <td class="col"><div class="label">{{i18n
+ "admin.logs.search_logs.click_through_rate"
+ }}</div>{{item.ctr}}%</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+
+ {{else}}
+ {{i18n "search.no_results"}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/search-logs-term.gjs b/app/assets/javascripts/admin/addon/templates/search-logs-term.gjs
index 1a647e60cf5..95c80fbd130 100644
--- a/app/assets/javascripts/admin/addon/templates/search-logs-term.gjs
+++ b/app/assets/javascripts/admin/addon/templates/search-logs-term.gjs
@@ -1,82 +1,108 @@
-<div class="admin-title">
- <PeriodChooser @period={{this.period}} @onChange={{fn (mut this.period)}} />
- <ComboBox
- @content={{this.searchTypeOptions}}
- @value={{this.searchType}}
- @onChange={{fn (mut this.searchType)}}
- class="search-logs-filter"
- />
-</div>
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import HighlightSearch from "discourse/components/highlight-search";
+import TopicStatus from "discourse/components/topic-status";
+import avatar from "discourse/helpers/avatar";
+import categoryLink from "discourse/helpers/category-link";
+import discourseTag from "discourse/helpers/discourse-tag";
+import formatAge from "discourse/helpers/format-age";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import Chart from "admin/components/chart";
+import ComboBox from "select-kit/components/combo-box";
+import PeriodChooser from "select-kit/components/period-chooser";
-<h2>
- <LinkTo
- @route="full-page-search"
- @query={{hash q=this.term}}
- >{{this.term}}</LinkTo>
-</h2>
+export default RouteTemplate(
+ <template>
+ <div class="admin-title">
+ <PeriodChooser
+ @period={{@controller.period}}
+ @onChange={{fn (mut @controller.period)}}
+ />
+ <ComboBox
+ @content={{@controller.searchTypeOptions}}
+ @value={{@controller.searchType}}
+ @onChange={{fn (mut @controller.searchType)}}
+ class="search-logs-filter"
+ />
+ </div>
-<ConditionalLoadingSpinner @condition={{this.refreshing}}>
- <Chart @chartConfig={{this.chartConfig}} />
+ <h2>
+ <LinkTo
+ @route="full-page-search"
+ @query={{hash [email protected]}}
+ >{{@controller.term}}</LinkTo>
+ </h2>
- <br /><br />
- <h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2>
- <br />
+ <ConditionalLoadingSpinner @condition={{@controller.refreshing}}>
+ <Chart @chartConfig={{@controller.chartConfig}} />
- <div class="header-search-results">
- {{#each this.model.search_result.posts as |result|}}
- <div class="fps-result">
- <div class="author">
- <a href={{result.userPath}} data-user-card={{result.username}}>
- {{avatar result imageSize="large"}}
- </a>
- </div>
+ <br /><br />
+ <h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2>
+ <br />
- <div class="fps-topic">
- <div class="topic">
- <a href={{result.url}} class="search-link">
- <TopicStatus @topic={{result.topic}} @disableActions={{true}} />
- <span class="topic-title">
- {{#if result.useTopicTitleHeadline}}
- {{html-safe result.topicTitleHeadline}}
- {{else}}
- <HighlightSearch @highlight={{this.q}}>
- {{html-safe result.topic.fancyTitle}}
- </HighlightSearch>
- {{/if}}
- </span>
- </a>
-
- <div class="search-category">
- {{#if result.topic.category.parentCategory}}
- {{category-link result.topic.category.parentCategory}}
- {{/if}}
- {{category-link result.topic.category hideParent=true}}
- {{#each result.topic.tags as |tag|}}
- {{discourse-tag tag}}
- {{/each}}
+ <div class="header-search-results">
+ {{#each @controller.model.search_result.posts as |result|}}
+ <div class="fps-result">
+ <div class="author">
+ <a href={{result.userPath}} data-user-card={{result.username}}>
+ {{avatar result imageSize="large"}}
+ </a>
</div>
- </div>
- <div class="blurb container">
- <span class="date">
- {{format-age result.created_at}}
- {{#if result.blurb}}
- -
- {{/if}}
- </span>
+ <div class="fps-topic">
+ <div class="topic">
+ <a href={{result.url}} class="search-link">
+ <TopicStatus
+ @topic={{result.topic}}
+ @disableActions={{true}}
+ />
+ <span class="topic-title">
+ {{#if result.useTopicTitleHeadline}}
+ {{htmlSafe result.topicTitleHeadline}}
+ {{else}}
+ <HighlightSearch @highlight={{@controller.q}}>
+ {{htmlSafe result.topic.fancyTitle}}
+ </HighlightSearch>
+ {{/if}}
+ </span>
+ </a>
+
+ <div class="search-category">
+ {{#if result.topic.category.parentCategory}}
+ {{categoryLink result.topic.category.parentCategory}}
+ {{/if}}
+ {{categoryLink result.topic.category hideParent=true}}
+ {{#each result.topic.tags as |tag|}}
+ {{discourseTag tag}}
+ {{/each}}
+ </div>
+ </div>
- {{#if result.blurb}}
- {{#if this.siteSettings.use_pg_headlines_for_excerpt}}
- {{html-safe result.blurb}}
- {{else}}
- <HighlightSearch @highlight={{this.highlightQuery}}>
- {{html-safe result.blurb}}
- </HighlightSearch>
- {{/if}}
- {{/if}}
+ <div class="blurb container">
+ <span class="date">
+ {{formatAge result.created_at}}
+ {{#if result.blurb}}
+ -
+ {{/if}}
+ </span>
+
+ {{#if result.blurb}}
+ {{#if @controller.siteSettings.use_pg_headlines_for_excerpt}}
+ {{htmlSafe result.blurb}}
+ {{else}}
+ <HighlightSearch @highlight={{@controller.highlightQuery}}>
+ {{htmlSafe result.blurb}}
+ </HighlightSearch>
+ {{/if}}
+ {{/if}}
+ </div>
+ </div>
</div>
- </div>
+ {{/each}}
</div>
- {{/each}}
- </div>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/section-account.gjs b/app/assets/javascripts/admin/addon/templates/section-account.gjs
index 994ed11a00c..4f27e875269 100644
--- a/app/assets/javascripts/admin/addon/templates/section-account.gjs
+++ b/app/assets/javascripts/admin/addon/templates/section-account.gjs
@@ -1,27 +1,38 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config_sections.account.title"}}
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/section/account"
- @label={{i18n "admin.config_sections.account.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
+import AdminSectionLandingItem from "admin/components/admin-section-landing-item";
+import AdminSectionLandingWrapper from "admin/components/admin-section-landing-wrapper";
-<AdminSectionLandingWrapper>
- <AdminSectionLandingItem
- @icon="box-archive"
- @titleLabel="admin.config.backups.title"
- @descriptionLabel="admin.config.backups.header_description"
- @titleRoute="admin.backups"
- />
- <AdminSectionLandingItem
- @icon="gift"
- @titleLabel="admin.config.whats_new.title"
- @descriptionLabel="admin.config.whats_new.header_description"
- @titleRoute="admin.whatsNew"
- />
-</AdminSectionLandingWrapper>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config_sections.account.title"}}
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/section/account"
+ @label={{i18n "admin.config_sections.account.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <AdminSectionLandingWrapper>
+ <AdminSectionLandingItem
+ @icon="box-archive"
+ @titleLabel="admin.config.backups.title"
+ @descriptionLabel="admin.config.backups.header_description"
+ @titleRoute="admin.backups"
+ />
+ <AdminSectionLandingItem
+ @icon="gift"
+ @titleLabel="admin.config.whats_new.title"
+ @descriptionLabel="admin.config.whats_new.header_description"
+ @titleRoute="admin.whatsNew"
+ />
+ </AdminSectionLandingWrapper>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/site-settings-category.gjs b/app/assets/javascripts/admin/addon/templates/site-settings-category.gjs
index f43d4a526c2..e13bcc872e3 100644
--- a/app/assets/javascripts/admin/addon/templates/site-settings-category.gjs
+++ b/app/assets/javascripts/admin/addon/templates/site-settings-category.gjs
@@ -1,19 +1,28 @@
-{{#if this.filteredContent}}
- <section class="form-horizontal settings">
- {{#each this.filteredContent as |setting|}}
- <SiteSetting
- @setting={{setting}}
- @afterSave={{route-action "refreshAll"}}
- />
- {{/each}}
- {{#if this.category.hasMore}}
- <p class="warning">{{i18n
- "admin.site_settings.more_site_setting_results"
- count=this.category.maxResults
- }}</p>
+import RouteTemplate from "ember-route-template";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+import SiteSetting from "admin/components/site-setting";
+
+export default RouteTemplate(
+ <template>
+ {{#if @controller.filteredContent}}
+ <section class="form-horizontal settings">
+ {{#each @controller.filteredContent as |setting|}}
+ <SiteSetting
+ @setting={{setting}}
+ @afterSave={{routeAction "refreshAll"}}
+ />
+ {{/each}}
+ {{#if @controller.category.hasMore}}
+ <p class="warning">{{i18n
+ "admin.site_settings.more_site_setting_results"
+ }}</p>
+ {{/if}}
+ </section>
+ {{else}}
+ <br />
+ {{i18n "admin.site_settings.no_results"}}
{{/if}}
- </section>
-{{else}}
- <br />
- {{i18n "admin.site_settings.no_results"}}
-{{/if}}
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/site-settings.gjs b/app/assets/javascripts/admin/addon/templates/site-settings.gjs
index f405a8748ff..e5b83ed3048 100644
--- a/app/assets/javascripts/admin/addon/templates/site-settings.gjs
+++ b/app/assets/javascripts/admin/addon/templates/site-settings.gjs
@@ -1,51 +1,63 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.site_settings.title"}}
- @descriptionLabel={{i18n "admin.config.site_settings.header_description"}}
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/site_settings"
- @label={{i18n "admin.config.site_settings.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import concatClass from "discourse/helpers/concat-class";
+import { i18n } from "discourse-i18n";
+import AdminSiteSettingsFilterControls from "admin/components/admin-site-settings-filter-controls";
+
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.site_settings.title"}}
+ @descriptionLabel={{i18n "admin.config.site_settings.header_description"}}
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/site_settings"
+ @label={{i18n "admin.config.site_settings.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
-<AdminSiteSettingsFilterControls
- @initialFilter={{this.filter}}
- @onChangeFilter={{this.filterChanged}}
- @showMenu={{true}}
- @onToggleMenu={{this.toggleMenu}}
-/>
+ <AdminSiteSettingsFilterControls
+ @initialFilter={{@controller.filter}}
+ @onChangeFilter={{@controller.filterChanged}}
+ @showMenu={{true}}
+ @onToggleMenu={{@controller.toggleMenu}}
+ />
-<div class="admin-nav admin-site-settings-category-nav pull-left">
- <ul class="nav nav-stacked">
- {{#each this.visibleSiteSettings as |category|}}
- <li
- class={{concat-class
- "admin-site-settings-category-nav__item"
- category.nameKey
- }}
- >
- <LinkTo
- @route="adminSiteSettingsCategory"
- @model={{category.nameKey}}
- class={{category.nameKey}}
- title={{category.name}}
- >
- {{category.name}}
- {{#if category.count}}
- <span class="count">({{category.count}})</span>
- {{/if}}
- </LinkTo>
- </li>
- {{/each}}
- </ul>
-</div>
+ <div class="admin-nav admin-site-settings-category-nav pull-left">
+ <ul class="nav nav-stacked">
+ {{#each @controller.visibleSiteSettings as |category|}}
+ <li
+ class={{concatClass
+ "admin-site-settings-category-nav__item"
+ category.nameKey
+ }}
+ >
+ <LinkTo
+ @route="adminSiteSettingsCategory"
+ @model={{category.nameKey}}
+ class={{category.nameKey}}
+ title={{category.name}}
+ >
+ {{category.name}}
+ {{#if category.count}}
+ <span class="count">({{category.count}})</span>
+ {{/if}}
+ </LinkTo>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
-<div class="admin-detail pull-left mobile-closed">
- {{outlet}}
-</div>
+ <div class="admin-detail pull-left mobile-closed">
+ {{outlet}}
+ </div>
-<div class="clearfix"></div>
\ No newline at end of file
+ <div class="clearfix"></div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/site-text-edit.gjs b/app/assets/javascripts/admin/addon/templates/site-text-edit.gjs
index c37e2d4d199..48ee7c2a887 100644
--- a/app/assets/javascripts/admin/addon/templates/site-text-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/site-text-edit.gjs
@@ -1,62 +1,78 @@
-<div class="edit-site-text">
- <div class="title">
- <h3>{{this.siteText.id}}</h3>
- </div>
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import ExpandingTextArea from "discourse/components/expanding-text-area";
+import SaveControls from "discourse/components/save-controls";
+import icon from "discourse/helpers/d-icon";
+import withEventValue from "discourse/helpers/with-event-value";
+import { i18n } from "discourse-i18n";
- <div class="title">
- <h4>{{i18n "admin.site_text.locale"}} {{this.localeFullName}}</h4>
- </div>
+export default RouteTemplate(
+ <template>
+ <div class="edit-site-text">
+ <div class="title">
+ <h3>{{@controller.siteText.id}}</h3>
+ </div>
- {{#if this.isOutdated}}
- <div class="outdated">
- <h4>{{i18n "admin.site_text.outdated.title"}}</h4>
- <p>{{i18n "admin.site_text.outdated.description"}}</p>
- <h5>{{i18n "admin.site_text.outdated.old_default"}}</h5>
- <p>{{this.siteText.old_default}}</p>
- <h5>{{i18n "admin.site_text.outdated.new_default"}}</h5>
- <p>{{this.siteText.new_default}}</p>
- <DButton
- @action={{this.dismissOutdated}}
- @label="admin.site_text.outdated.dismiss"
- class="btn-default"
- />
- </div>
- {{/if}}
+ <div class="title">
+ <h4>{{i18n "admin.site_text.locale"}}
+ {{@controller.localeFullName}}</h4>
+ </div>
- <ExpandingTextArea
- {{on "input" (with-event-value (fn (mut this.buffered.value)))}}
- value={{this.buffered.value}}
- rows="1"
- class="site-text-value"
- />
-
- {{#if this.siteText.has_interpolation_keys}}
- <div class="desc">{{i18n "admin.site_text.interpolation_keys"}}
- {{this.interpolationKeys}}
- </div>
- {{/if}}
+ {{#if @controller.isOutdated}}
+ <div class="outdated">
+ <h4>{{i18n "admin.site_text.outdated.title"}}</h4>
+ <p>{{i18n "admin.site_text.outdated.description"}}</p>
+ <h5>{{i18n "admin.site_text.outdated.old_default"}}</h5>
+ <p>{{@controller.siteText.old_default}}</p>
+ <h5>{{i18n "admin.site_text.outdated.new_default"}}</h5>
+ <p>{{@controller.siteText.new_default}}</p>
+ <DButton
+ @action={{@controller.dismissOutdated}}
+ @label="admin.site_text.outdated.dismiss"
+ class="btn-default"
+ />
+ </div>
+ {{/if}}
- <SaveControls
- @model={{this.siteText}}
- @action={{action "saveChanges"}}
- @saved={{this.saved}}
- @saveDisabled={{this.saveDisabled}}
- >
- {{#if this.siteText.can_revert}}
- <DButton
- @action={{this.revertChanges}}
- @label="admin.site_text.revert"
- class="revert-site-text"
+ <ExpandingTextArea
+ {{on "input" (withEventValue (fn (mut @controller.buffered.value)))}}
+ value={{@controller.buffered.value}}
+ rows="1"
+ class="site-text-value"
/>
- {{/if}}
- </SaveControls>
- <LinkTo
- @route="adminSiteText.index"
- @query={{hash locale=this.locale}}
- class="go-back"
- >
- {{d-icon "arrow-left"}}
- {{i18n "admin.site_text.go_back"}}
- </LinkTo>
-</div>
\ No newline at end of file
+ {{#if @controller.siteText.has_interpolation_keys}}
+ <div class="desc">{{i18n "admin.site_text.interpolation_keys"}}
+ {{@controller.interpolationKeys}}
+ </div>
+ {{/if}}
+
+ <SaveControls
+ @model={{@controller.siteText}}
+ @action={{@controller.saveChanges}}
+ @saved={{@controller.saved}}
+ @saveDisabled={{@controller.saveDisabled}}
+ >
+ {{#if @controller.siteText.can_revert}}
+ <DButton
+ @action={{@controller.revertChanges}}
+ @label="admin.site_text.revert"
+ class="revert-site-text"
+ />
+ {{/if}}
+ </SaveControls>
+
+ <LinkTo
+ @route="adminSiteText.index"
+ @query={{hash [email protected]}}
+ class="go-back"
+ >
+ {{icon "arrow-left"}}
+ {{i18n "admin.site_text.go_back"}}
+ </LinkTo>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/site-text-index.gjs b/app/assets/javascripts/admin/addon/templates/site-text-index.gjs
index d0ed4a5bb88..2513edfbd3f 100644
--- a/app/assets/javascripts/admin/addon/templates/site-text-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/site-text-index.gjs
@@ -1,96 +1,110 @@
-<div class="search-area">
- <TextField
- @value={{this.q}}
- @placeholderKey="admin.site_text.search"
- @autofocus="true"
- @key-up={{this.search}}
- class="no-blur site-text-search"
- />
+import { hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
+import SiteTextSummary from "admin/components/site-text-summary";
+import ComboBox from "select-kit/components/combo-box";
- <div class="reseed">
- <DButton
- @action={{this.showReseedModal}}
- @label="admin.reseed.action.label"
- @title="admin.reseed.action.title"
- @icon="arrows-rotate"
- class="btn-default"
- />
- </div>
-
- <p class="filter-options">
- <div class="locale">
- <label>{{i18n "admin.site_text.locale"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.availableLocales}}
- @value={{this.resolvedLocale}}
- @onChange={{this.updateLocale}}
- @options={{hash filterable=true}}
- class="locale-search"
+export default RouteTemplate(
+ <template>
+ <div class="search-area">
+ <TextField
+ @value={{@controller.q}}
+ @placeholderKey="admin.site_text.search"
+ @autofocus="true"
+ @key-up={{@controller.search}}
+ class="no-blur site-text-search"
/>
- </div>
- <label class="checkbox-label">
- <input
- id="toggle-overridden"
- type="checkbox"
- checked={{this.resolvedOverridden}}
- {{on "click" this.toggleOverridden}}
- />
- {{i18n "admin.site_text.show_overriden"}}
- </label>
+ <div class="reseed">
+ <DButton
+ @action={{@controller.showReseedModal}}
+ @label="admin.reseed.action.label"
+ @title="admin.reseed.action.title"
+ @icon="arrows-rotate"
+ class="btn-default"
+ />
+ </div>
- <label class="checkbox-label">
- <input
- id="toggle-outdated"
- type="checkbox"
- checked={{this.resolvedOutdated}}
- {{on "click" this.toggleOutdated}}
- />
- {{i18n "admin.site_text.show_outdated"}}
- </label>
+ <p class="filter-options">
+ <div class="locale">
+ <label>{{i18n "admin.site_text.locale"}}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.availableLocales}}
+ @value={{@controller.resolvedLocale}}
+ @onChange={{@controller.updateLocale}}
+ @options={{hash filterable=true}}
+ class="locale-search"
+ />
+ </div>
- <label class="checkbox-label">
- <input
- id="toggle-only-locale"
- type="checkbox"
- checked={{this.resolvedOnlySelectedLocale}}
- {{on "click" this.toggleOnlySelectedLocale}}
- />
- {{i18n "admin.site_text.only_show_selected_locale"}}
- </label>
+ <label class="checkbox-label">
+ <input
+ id="toggle-overridden"
+ type="checkbox"
+ checked={{@controller.resolvedOverridden}}
+ {{on "click" @controller.toggleOverridden}}
+ />
+ {{i18n "admin.site_text.show_overriden"}}
+ </label>
- {{#if this.showUntranslated}}
- <label class="checkbox-label">
- <input
- id="toggle-untranslated"
- type="checkbox"
- checked={{this.resolvedUntranslated}}
- {{on "click" this.toggleUntranslated}}
- />
- {{i18n "admin.site_text.show_untranslated"}}
- </label>
- {{/if}}
- </p>
-</div>
+ <label class="checkbox-label">
+ <input
+ id="toggle-outdated"
+ type="checkbox"
+ checked={{@controller.resolvedOutdated}}
+ {{on "click" @controller.toggleOutdated}}
+ />
+ {{i18n "admin.site_text.show_outdated"}}
+ </label>
+
+ <label class="checkbox-label">
+ <input
+ id="toggle-only-locale"
+ type="checkbox"
+ checked={{@controller.resolvedOnlySelectedLocale}}
+ {{on "click" @controller.toggleOnlySelectedLocale}}
+ />
+ {{i18n "admin.site_text.only_show_selected_locale"}}
+ </label>
-<ConditionalLoadingSpinner @condition={{this.searching}}>
- {{#if this.model.extras.recommended}}
- <p><b>{{i18n "admin.site_text.recommended"}}</b></p>
- {{/if}}
+ {{#if @controller.showUntranslated}}
+ <label class="checkbox-label">
+ <input
+ id="toggle-untranslated"
+ type="checkbox"
+ checked={{@controller.resolvedUntranslated}}
+ {{on "click" @controller.toggleUntranslated}}
+ />
+ {{i18n "admin.site_text.show_untranslated"}}
+ </label>
+ {{/if}}
+ </p>
+ </div>
- {{#each this.model as |siteText|}}
- <SiteTextSummary
- @siteText={{siteText}}
- @editAction={{this.edit}}
- @term={{this.q}}
- @searchRegex={{this.model.extras.regex}}
- />
- {{else}}
- {{i18n "admin.site_text.no_results"}}
- {{/each}}
+ <ConditionalLoadingSpinner @condition={{@controller.searching}}>
+ {{#if @controller.model.extras.recommended}}
+ <p><b>{{i18n "admin.site_text.recommended"}}</b></p>
+ {{/if}}
+
+ {{#each @controller.model as |siteText|}}
+ <SiteTextSummary
+ @siteText={{siteText}}
+ @editAction={{@controller.edit}}
+ @term={{@controller.q}}
+ @searchRegex={{@controller.model.extras.regex}}
+ />
+ {{else}}
+ {{i18n "admin.site_text.no_results"}}
+ {{/each}}
- {{#if this.model.extras.has_more}}
- <p class="warning">{{i18n "admin.site_text.more_than_50_results"}}</p>
- {{/if}}
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ {{#if @controller.model.extras.has_more}}
+ <p class="warning">{{i18n "admin.site_text.more_than_50_results"}}</p>
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/site-text.gjs b/app/assets/javascripts/admin/addon/templates/site-text.gjs
index b56542332c9..f01444f5e1d 100644
--- a/app/assets/javascripts/admin/addon/templates/site-text.gjs
+++ b/app/assets/javascripts/admin/addon/templates/site-text.gjs
@@ -1,17 +1,26 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.site_texts.title"}}
- @descriptionLabel={{i18n "admin.config.site_texts.header_description"}}
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/site_texts"
- @label={{i18n "admin.config.site_texts.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
-<div class="row site-texts">
- {{outlet}}
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.site_texts.title"}}
+ @descriptionLabel={{i18n "admin.config.site_texts.header_description"}}
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/site_texts"
+ @label={{i18n "admin.config.site_texts.title"}}
+ />
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <div class="row site-texts">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-badges.gjs b/app/assets/javascripts/admin/addon/templates/user-badges.gjs
index 1c6bb0071dc..633b36d91f9 100644
--- a/app/assets/javascripts/admin/addon/templates/user-badges.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-badges.gjs
@@ -1,116 +1,136 @@
-<div class="admin-controls">
- <nav>
- <ul class="nav nav-pills">
- <li><LinkTo @route="adminUser" @model={{this.user}}>{{d-icon
- "caret-left"
- }}
- &nbsp;{{this.user.username}}</LinkTo></li>
- </ul>
- </nav>
-</div>
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import UserBadge from "discourse/components/user-badge";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+
+export default RouteTemplate(
+ <template>
+ <div class="admin-controls">
+ <nav>
+ <ul class="nav nav-pills">
+ <li><LinkTo @route="adminUser" @model={{@controller.user}}>{{icon
+ "caret-left"
+ }}
+ &nbsp;{{@controller.user.username}}</LinkTo></li>
+ </ul>
+ </nav>
+ </div>
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- <div class="admin-container user-badges">
- <h2>{{i18n "admin.badges.grant_badge"}}</h2>
- <br />
- {{#if this.noAvailableBadges}}
- <p>{{i18n "admin.badges.no_badges"}}</p>
- {{else}}
- <PluginOutlet
- @name="badge-granter-form"
- @outletArgs={{hash
- availableBadges=this.availableBadges
- userBadges=this.userBadges
- user=this.user
- }}
- >
- <form class="form-horizontal">
- <div class="control-group">
- <label>{{i18n "admin.badges.badge"}}</label>
- <ComboBox
- @value={{this.selectedBadgeId}}
- @content={{this.availableBadges}}
- @onChange={{fn (mut this.selectedBadgeId)}}
- @options={{hash filterable=true}}
- />
- </div>
- <div class="control-group">
- <label>{{i18n "admin.badges.reason"}}</label>
- <Input @type="text" @value={{this.badgeReason}} /><br /><small
- >{{i18n "admin.badges.reason_help"}}</small>
- </div>
- <DButton
- @action={{this.performGrantBadge}}
- @label="admin.badges.grant"
- type="submit"
- class="btn-primary"
- />
- </form>
- </PluginOutlet>
- {{/if}}
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ <div class="admin-container user-badges">
+ <h2>{{i18n "admin.badges.grant_badge"}}</h2>
+ <br />
+ {{#if @controller.noAvailableBadges}}
+ <p>{{i18n "admin.badges.no_badges"}}</p>
+ {{else}}
+ <PluginOutlet
+ @name="badge-granter-form"
+ @outletArgs={{hash
+ }}
+ >
+ <form class="form-horizontal">
+ <div class="control-group">
+ <label>{{i18n "admin.badges.badge"}}</label>
+ <ComboBox
+ @value={{@controller.selectedBadgeId}}
+ @content={{@controller.availableBadges}}
+ @onChange={{fn (mut @controller.selectedBadgeId)}}
+ @options={{hash filterable=true}}
+ />
+ </div>
+ <div class="control-group">
+ <label>{{i18n "admin.badges.reason"}}</label>
+ <Input @type="text" @value={{@controller.badgeReason}} /><br
+ /><small>{{i18n "admin.badges.reason_help"}}</small>
+ </div>
+ <DButton
+ @action={{@controller.performGrantBadge}}
+ @label="admin.badges.grant"
+ type="submit"
+ class="btn-primary"
+ />
+ </form>
+ </PluginOutlet>
+ {{/if}}
- <PluginOutlet
- @name="badge-granter-table"
- @outletArgs={{hash
- groupedBadges=this.groupedBadges
- revokeBadge=this.revokeBadge
- expandGroup=this.expandGroup
- }}
- >
- <table id="user-badges">
- <tbody>
- <tr>
- <th>{{i18n "admin.badges.badge"}}</th>
- <th>{{i18n "admin.badges.granted_by"}}</th>
- <th class="reason">{{i18n "admin.badges.reason"}}</th>
- <th>{{i18n "admin.badges.granted_at"}}</th>
- <th></th>
- </tr>
- {{#each this.groupedBadges as |userBadge|}}
- <tr>
- <td><UserBadge
- @badge={{userBadge.badge}}
- @count={{userBadge.count}}
- /></td>
- <td>
- <LinkTo @route="adminUser" @model={{userBadge.granted_by}}>
- {{avatar userBadge.granted_by imageSize="tiny"}}
- {{userBadge.granted_by.username}}
- </LinkTo>
- </td>
- <td class="reason">
- {{#if userBadge.postUrl}}
- <a href={{userBadge.postUrl}}>{{userBadge.topic_title}}</a>
- {{/if}}
- </td>
- <td>{{age-with-tooltip userBadge.granted_at}}</td>
- <td>
- {{#if userBadge.grouped}}
- <DButton
- @action={{fn this.expandGroup userBadge}}
- @label="admin.badges.expand"
- />
- {{else}}
- <DButton
- @action={{fn this.revokeBadge userBadge}}
- @label="admin.badges.revoke"
- class="btn-danger"
- />
- {{/if}}
- </td>
- </tr>
- {{else}}
- <tr>
- <td colspan="5">
- <p>{{i18n
- "admin.badges.no_user_badges"
- name=this.user.username
- }}</p>
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- </PluginOutlet>
- </div>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <PluginOutlet
+ @name="badge-granter-table"
+ @outletArgs={{hash
+ }}
+ >
+ <table id="user-badges">
+ <tbody>
+ <tr>
+ <th>{{i18n "admin.badges.badge"}}</th>
+ <th>{{i18n "admin.badges.granted_by"}}</th>
+ <th class="reason">{{i18n "admin.badges.reason"}}</th>
+ <th>{{i18n "admin.badges.granted_at"}}</th>
+ <th></th>
+ </tr>
+ {{#each @controller.groupedBadges as |userBadge|}}
+ <tr>
+ <td><UserBadge
+ @badge={{userBadge.badge}}
+ @count={{userBadge.count}}
+ /></td>
+ <td>
+ <LinkTo @route="adminUser" @model={{userBadge.granted_by}}>
+ {{avatar userBadge.granted_by imageSize="tiny"}}
+ {{userBadge.granted_by.username}}
+ </LinkTo>
+ </td>
+ <td class="reason">
+ {{#if userBadge.postUrl}}
+ <a
+ href={{userBadge.postUrl}}
+ >{{userBadge.topic_title}}</a>
+ {{/if}}
+ </td>
+ <td>{{ageWithTooltip userBadge.granted_at}}</td>
+ <td>
+ {{#if userBadge.grouped}}
+ <DButton
+ @action={{fn @controller.expandGroup userBadge}}
+ @label="admin.badges.expand"
+ />
+ {{else}}
+ <DButton
+ @action={{fn @controller.revokeBadge userBadge}}
+ @label="admin.badges.revoke"
+ class="btn-danger"
+ />
+ {{/if}}
+ </td>
+ </tr>
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <p>{{i18n
+ "admin.badges.no_user_badges"
+ }}</p>
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </PluginOutlet>
+ </div>
+ </ConditionalLoadingSpinner>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-fields-edit.gjs b/app/assets/javascripts/admin/addon/templates/user-fields-edit.gjs
index c8bee5f6e12..25d529bcae0 100644
--- a/app/assets/javascripts/admin/addon/templates/user-fields-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-fields-edit.gjs
@@ -1,8 +1,19 @@
-<BackButton @route="adminUserFields.index" @label="admin.user_fields.back" />
-<div class="admin-config-area user-field">
- <div class="admin-config-area__primary-content">
- <div class="admin-config-area-card">
- <AdminUserFieldsForm @userField={{this.model}} />
+import RouteTemplate from "ember-route-template";
+import BackButton from "discourse/components/back-button";
+import AdminUserFieldsForm from "admin/components/admin-user-fields-form";
+
+export default RouteTemplate(
+ <template>
+ <BackButton
+ @route="adminUserFields.index"
+ @label="admin.user_fields.back"
+ />
+ <div class="admin-config-area user-field">
+ <div class="admin-config-area__primary-content">
+ <div class="admin-config-area-card">
+ <AdminUserFieldsForm @userField={{@controller.model}} />
+ </div>
+ </div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-fields-index.gjs b/app/assets/javascripts/admin/addon/templates/user-fields-index.gjs
index e9c497001f6..b9f86d6ce69 100644
--- a/app/assets/javascripts/admin/addon/templates/user-fields-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-fields-index.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::UserFieldsList @userFields={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import UserFieldsList from "admin/components/admin-config-areas/user-fields-list";
+
+export default RouteTemplate(
+ <template><UserFieldsList @userFields={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-fields-new.gjs b/app/assets/javascripts/admin/addon/templates/user-fields-new.gjs
index c8bee5f6e12..25d529bcae0 100644
--- a/app/assets/javascripts/admin/addon/templates/user-fields-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-fields-new.gjs
@@ -1,8 +1,19 @@
-<BackButton @route="adminUserFields.index" @label="admin.user_fields.back" />
-<div class="admin-config-area user-field">
- <div class="admin-config-area__primary-content">
- <div class="admin-config-area-card">
- <AdminUserFieldsForm @userField={{this.model}} />
+import RouteTemplate from "ember-route-template";
+import BackButton from "discourse/components/back-button";
+import AdminUserFieldsForm from "admin/components/admin-user-fields-form";
+
+export default RouteTemplate(
+ <template>
+ <BackButton
+ @route="adminUserFields.index"
+ @label="admin.user_fields.back"
+ />
+ <div class="admin-config-area user-field">
+ <div class="admin-config-area__primary-content">
+ <div class="admin-config-area-card">
+ <AdminUserFieldsForm @userField={{@controller.model}} />
+ </div>
+ </div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-fields.gjs b/app/assets/javascripts/admin/addon/templates/user-fields.gjs
index 91a60b33e8c..85d28367a8d 100644
--- a/app/assets/javascripts/admin/addon/templates/user-fields.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-fields.gjs
@@ -1,28 +1,37 @@
-<div class="admin-user_fields admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.user_fields.title"}}
- @descriptionLabel={{i18n "admin.config.user_fields.header_description"}}
- @hideTabs={{true}}
- @learnMoreUrl="https://meta.discourse.org/t/creating-and-configuring-custom-user-fields/113192"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/config/user-fields"
- @label={{i18n "admin.config.user_fields.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @route="adminUserFields.new"
- @label="admin.user_fields.add"
- />
- </:actions>
- </DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
- <div class="admin-config-page__main-area">
- <div class="user-fields">
- {{outlet}}
+export default RouteTemplate(
+ <template>
+ <div class="admin-user_fields admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.user_fields.title"}}
+ @descriptionLabel={{i18n "admin.config.user_fields.header_description"}}
+ @hideTabs={{true}}
+ @learnMoreUrl="https://meta.discourse.org/t/creating-and-configuring-custom-user-fields/113192"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/config/user-fields"
+ @label={{i18n "admin.config.user_fields.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @route="adminUserFields.new"
+ @label="admin.user_fields.add"
+ />
+ </:actions>
+ </DPageHeader>
+
+ <div class="admin-config-page__main-area">
+ <div class="user-fields">
+ {{outlet}}
+ </div>
+ </div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-index.gjs b/app/assets/javascripts/admin/addon/templates/user-index.gjs
index d061b41689e..add1151e730 100644
--- a/app/assets/javascripts/admin/addon/templates/user-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-index.gjs
@@ -1,934 +1,1003 @@
-<section class="details {{unless this.model.active 'not-activated'}}">
- <div class="user-controls">
- {{#if this.model.canViewProfile}}
- <LinkTo @route="user" @model={{this.model}} class="btn btn-default">
- {{d-icon "user"}}
- {{i18n "admin.user.show_public_profile"}}
- </LinkTo>
- {{/if}}
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import avatar from "discourse/helpers/avatar";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
+import formatDuration from "discourse/helpers/format-duration";
+import htmlSafe from "discourse/helpers/html-safe";
+import i18nYesNo from "discourse/helpers/i18n-yes-no";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+import AdminEditableField from "admin/components/admin-editable-field";
+import AdminUserExportsTable from "admin/components/admin-user-exports-table";
+import IpLookup from "admin/components/ip-lookup";
+import ComboBox from "select-kit/components/combo-box";
+import GroupChooser from "select-kit/components/group-chooser";
+import and from "truth-helpers/helpers/and";
+import gt from "truth-helpers/helpers/gt";
+
+export default RouteTemplate(
+ <template>
+ <section
+ class="details {{unless @controller.model.active 'not-activated'}}"
+ >
+ <div class="user-controls">
+ {{#if @controller.model.canViewProfile}}
+ <LinkTo
+ @route="user"
+ @model={{@controller.model}}
+ class="btn btn-default"
+ >
+ {{icon "user"}}
+ {{i18n "admin.user.show_public_profile"}}
+ </LinkTo>
+ {{/if}}
- {{#if this.model.can_view_action_logs}}
- <DButton
- @action={{fn this.viewActionLogs this.model.username}}
- @icon="far-rectangle-list"
- @label="admin.user.action_logs"
- class="btn-default"
- />
- {{/if}}
- {{#if this.model.active}}
- {{#if this.currentUser.admin}}
- <DButton
- @action={{this.logOut}}
- @icon="power-off"
- @label="admin.user.log_out"
- class="btn-default"
- />
- {{/if}}
- {{/if}}
- <PluginOutlet
- @name="admin-user-controls-after"
- @outletArgs={{hash model=this.model}}
- />
- </div>
-
- <div class="display-row username">
- <AdminEditableField
- @name="user.username.title"
- @value={{this.model.username}}
- @action={{action "saveUsername"}}
- @editing={{this.editingUsername}}
- />
- </div>
-
- <div class="display-row name">
- <AdminEditableField
- @name="user.name.title"
- @value={{this.model.name}}
- @action={{action "saveName"}}
- @editing={{this.editingName}}
- />
- </div>
-
- <PluginOutlet
- @name="admin-user-below-names"
- @outletArgs={{hash user=this.model}}
- />
-
- {{#if this.canCheckEmails}}
- <div class="display-row email">
- <div class="field">{{i18n "user.email.primary"}}</div>
- <div class="value">
- {{#unless this.model.active}}
- <div class="controls">{{i18n "admin.users.not_verified"}}</div>
- {{/unless}}
- {{#if this.model.email}}
- <a href="mailto:{{this.model.email}}">{{this.model.email}}</a>
- {{else}}
+ {{#if @controller.model.can_view_action_logs}}
<DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @icon="envelope"
- @label="admin.users.check_email.text"
- @title="admin.users.check_email.title"
+ @action={{fn @controller.viewActionLogs @controller.model.username}}
+ @icon="far-rectangle-list"
+ @label="admin.user.action_logs"
class="btn-default"
/>
{{/if}}
- </div>
- <div class="controls">
- {{#if this.siteSettings.auth_overrides_email}}
- {{i18n "user.email.auth_override_instructions"}}
- {{else if this.model.email}}
- {{html-safe
- (i18n "admin.user.visit_profile" url=this.preferencesPath)
- }}
- {{/if}}
- </div>
- </div>
-
- <div class="display-row secondary-emails">
- <div class="field">{{i18n "user.email.secondary"}}</div>
-
- <div class="value">
- {{#if this.model.email}}
- {{#if this.model.secondary_emails}}
- <ul>
- {{#each this.model.secondary_emails as |email|}}
- <li><a href="mailto:{{email}}">{{email}}</a></li>
- {{/each}}
- </ul>
- {{else}}
- {{i18n "user.email.no_secondary"}}
+ {{#if @controller.model.active}}
+ {{#if @controller.currentUser.admin}}
+ <DButton
+ @action={{@controller.logOut}}
+ @icon="power-off"
+ @label="admin.user.log_out"
+ class="btn-default"
+ />
{{/if}}
- {{else}}
- <DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @icon="envelope"
- @label="admin.users.check_email.text"
- @title="admin.users.check_email.title"
- class="btn-default"
- />
{{/if}}
+ <PluginOutlet
+ @name="admin-user-controls-after"
+ @outletArgs={{hash [email protected]}}
+ />
</div>
- <div class="controls">
- {{#if this.model.email}}
- {{#if this.model.secondary_emails}}
- {{#if this.siteSettings.auth_overrides_email}}
- {{i18n "user.email.auth_override_instructions"}}
+ <div class="display-row username">
+ <AdminEditableField
+ @name="user.username.title"
+ @value={{@controller.model.username}}
+ @action={{@controller.saveUsername}}
+ @editing={{@controller.editingUsername}}
+ />
+ </div>
+
+ <div class="display-row name">
+ <AdminEditableField
+ @name="user.name.title"
+ @value={{@controller.model.name}}
+ @action={{@controller.saveName}}
+ @editing={{@controller.editingName}}
+ />
+ </div>
+
+ <PluginOutlet
+ @name="admin-user-below-names"
+ @outletArgs={{hash [email protected]}}
+ />
+
+ {{#if @controller.canCheckEmails}}
+ <div class="display-row email">
+ <div class="field">{{i18n "user.email.primary"}}</div>
+ <div class="value">
+ {{#unless @controller.model.active}}
+ <div class="controls">{{i18n "admin.users.not_verified"}}</div>
+ {{/unless}}
+ {{#if @controller.model.email}}
+ <a
+ href="mailto:{{@controller.model.email}}"
+ >{{@controller.model.email}}</a>
{{else}}
- {{html-safe
- (i18n "admin.user.visit_profile" url=this.preferencesPath)
+ <DButton
+ @action={{fn (routeAction "checkEmail") @controller.model}}
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ @title="admin.users.check_email.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+ <div class="controls">
+ {{#if @controller.siteSettings.auth_overrides_email}}
+ {{i18n "user.email.auth_override_instructions"}}
+ {{else if @controller.model.email}}
+ {{htmlSafe
+ (i18n
+ "admin.user.visit_profile" [email protected]
+ )
}}
{{/if}}
+ </div>
+ </div>
+
+ <div class="display-row secondary-emails">
+ <div class="field">{{i18n "user.email.secondary"}}</div>
+
+ <div class="value">
+ {{#if @controller.model.email}}
+ {{#if @controller.model.secondary_emails}}
+ <ul>
+ {{#each @controller.model.secondary_emails as |email|}}
+ <li><a href="mailto:{{email}}">{{email}}</a></li>
+ {{/each}}
+ </ul>
+ {{else}}
+ {{i18n "user.email.no_secondary"}}
+ {{/if}}
+ {{else}}
+ <DButton
+ @action={{fn (routeAction "checkEmail") @controller.model}}
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ @title="admin.users.check_email.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+
+ <div class="controls">
+ {{#if @controller.model.email}}
+ {{#if @controller.model.secondary_emails}}
+ {{#if @controller.siteSettings.auth_overrides_email}}
+ {{i18n "user.email.auth_override_instructions"}}
+ {{else}}
+ {{htmlSafe
+ (i18n
+ "admin.user.visit_profile" [email protected]
+ )
+ }}
+ {{/if}}
+ {{/if}}
+ {{/if}}
+ </div>
+ </div>
+
+ <div class="display-row bounce-score">
+ <div class="field"><a href={{@controller.model.bounceLink}}>{{i18n
+ "admin.user.bounce_score"
+ }}</a></div>
+ <div class="value">{{@controller.model.bounceScore}}</div>
+ <div class="controls">
+ {{#if @controller.model.canResetBounceScore}}
+ <DButton
+ @action={{@controller.resetBounceScore}}
+ @label="admin.user.reset_bounce_score.label"
+ @title="admin.user.reset_bounce_score.title"
+ class="btn-default"
+ />
+ {{/if}}
+ {{@controller.model.bounceScoreExplanation}}
+ </div>
+ </div>
+
+ <div class="display-row associations">
+ <div class="field">{{i18n "user.associated_accounts.title"}}</div>
+ <div class="value">
+ {{#if @controller.associatedAccountsLoaded}}
+ {{@controller.associatedAccounts}}
+ {{else}}
+ <DButton
+ @action={{fn (routeAction "checkEmail") @controller.model}}
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ @title="admin.users.check_email.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+ {{#if
+ (and @controller.currentUser.admin @controller.associatedAccounts)
+ }}
+ <div class="controls">
+ <DButton
+ @action={{@controller.deleteAssociatedAccounts}}
+ @icon="trash-can"
+ @label="admin.users.delete_associated_accounts.text"
+ @title="admin.users.delete_associated_accounts.title"
+ class="btn-danger"
+ />
+ </div>
{{/if}}
- {{/if}}
- </div>
- </div>
-
- <div class="display-row bounce-score">
- <div class="field"><a href={{this.model.bounceLink}}>{{i18n
- "admin.user.bounce_score"
- }}</a></div>
- <div class="value">{{this.model.bounceScore}}</div>
- <div class="controls">
- {{#if this.model.canResetBounceScore}}
- <DButton
- @action={{this.resetBounceScore}}
- @label="admin.user.reset_bounce_score.label"
- @title="admin.user.reset_bounce_score.title"
- class="btn-default"
- />
- {{/if}}
- {{this.model.bounceScoreExplanation}}
+ </div>
+ {{/if}}
+
+ <div class="display-row">
+ <div class="field">{{i18n "user.avatar.title"}}</div>
+ <div class="value">{{avatar @controller.model imageSize="large"}}</div>
+ <div class="controls">
+ {{htmlSafe
+ (i18n "admin.user.visit_profile" [email protected])
+ }}
+ </div>
</div>
- </div>
-
- <div class="display-row associations">
- <div class="field">{{i18n "user.associated_accounts.title"}}</div>
- <div class="value">
- {{#if this.associatedAccountsLoaded}}
- {{this.associatedAccounts}}
- {{else}}
- <DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @icon="envelope"
- @label="admin.users.check_email.text"
- @title="admin.users.check_email.title"
- class="btn-default"
- />
- {{/if}}
+
+ <div class="display-row">
+ <AdminEditableField
+ @name="user.title.title"
+ @value={{@controller.model.title}}
+ @action={{@controller.saveTitle}}
+ @editing={{@controller.editingTitle}}
+ />
</div>
- {{#if (and this.currentUser.admin this.associatedAccounts)}}
+
+ <div class="display-row last-ip">
+ <div class="field">{{i18n "user.ip_address.title"}}</div>
+ <div class="value">{{@controller.model.ip_address}}</div>
<div class="controls">
- <DButton
- @action={{this.deleteAssociatedAccounts}}
- @icon="trash-can"
- @label="admin.users.delete_associated_accounts.text"
- @title="admin.users.delete_associated_accounts.title"
- class="btn-danger"
- />
+ {{#if @controller.currentUser.staff}}
+ {{#if @controller.model.ip_address}}
+ <IpLookup
+ @ip={{@controller.model.ip_address}}
+ @userId={{@controller.model.id}}
+ />
+ {{/if}}
+ {{/if}}
</div>
- {{/if}}
- </div>
- {{/if}}
-
- <div class="display-row">
- <div class="field">{{i18n "user.avatar.title"}}</div>
- <div class="value">{{avatar this.model imageSize="large"}}</div>
- <div class="controls">
- {{html-safe (i18n "admin.user.visit_profile" url=this.preferencesPath)}}
- </div>
- </div>
-
- <div class="display-row">
- <AdminEditableField
- @name="user.title.title"
- @value={{this.model.title}}
- @action={{action "saveTitle"}}
- @editing={{this.editingTitle}}
- />
- </div>
-
- <div class="display-row last-ip">
- <div class="field">{{i18n "user.ip_address.title"}}</div>
- <div class="value">{{this.model.ip_address}}</div>
- <div class="controls">
- {{#if this.currentUser.staff}}
- {{#if this.model.ip_address}}
- <IpLookup @ip={{this.model.ip_address}} @userId={{this.model.id}} />
- {{/if}}
- {{/if}}
- </div>
- </div>
-
- <div class="display-row registration-ip">
- <div class="field">{{i18n "user.registration_ip_address.title"}}</div>
- <div class="value">{{this.model.registration_ip_address}}</div>
- <div class="controls">
- {{#if this.currentUser.staff}}
- {{#if this.model.registration_ip_address}}
- <IpLookup
- @ip={{this.model.registration_ip_address}}
- @userId={{this.model.id}}
- />
- {{/if}}
- {{/if}}
- </div>
- </div>
-
- {{#if this.showBadges}}
- <div class="display-row">
- <div class="field">{{i18n "admin.badges.title"}}</div>
- <div class="value">
- {{i18n "badges.badge_count" count=this.model.badge_count}}
</div>
- <div class="controls">
- <LinkTo
- @route="adminUser.badges"
- @model={{this.model}}
- class="btn btn-default"
- >
- {{d-icon "certificate"}}
- {{i18n "admin.badges.edit_badges"}}
- </LinkTo>
+
+ <div class="display-row registration-ip">
+ <div class="field">{{i18n "user.registration_ip_address.title"}}</div>
+ <div class="value">{{@controller.model.registration_ip_address}}</div>
+ <div class="controls">
+ {{#if @controller.currentUser.staff}}
+ {{#if @controller.model.registration_ip_address}}
+ <IpLookup
+ @ip={{@controller.model.registration_ip_address}}
+ @userId={{@controller.model.id}}
+ />
+ {{/if}}
+ {{/if}}
+ </div>
</div>
- </div>
- {{/if}}
-
- <div class="display-row second-factor">
- <div class="field">{{i18n "user.second_factor.title"}}</div>
- <div class="value">
- {{#if this.model.second_factor_enabled}}
- {{i18n "yes_value"}}
- {{else}}
- {{i18n "no_value"}}
- {{/if}}
- </div>
- <div class="controls">
- {{#if this.canDisableSecondFactor}}
- <DButton
- @action={{this.disableSecondFactor}}
- @icon="unlock-keyhole"
- @label="user.second_factor.disable"
- class="btn-default disable-second-factor"
- />
+
+ {{#if @controller.showBadges}}
+ <div class="display-row">
+ <div class="field">{{i18n "admin.badges.title"}}</div>
+ <div class="value">
+ {{i18n "badges.badge_count" [email protected]_count}}
+ </div>
+ <div class="controls">
+ <LinkTo
+ @route="adminUser.badges"
+ @model={{@controller.model}}
+ class="btn btn-default"
+ >
+ {{icon "certificate"}}
+ {{i18n "admin.badges.edit_badges"}}
+ </LinkTo>
+ </div>
+ </div>
{{/if}}
- </div>
- </div>
-</section>
-{{#if this.userFields}}
- <section class="details">
- {{#each this.userFields as |uf|}}
- <div class="display-row">
- <div class="field">{{uf.name}}</div>
+ <div class="display-row second-factor">
+ <div class="field">{{i18n "user.second_factor.title"}}</div>
<div class="value">
- {{#if uf.value}}
- {{uf.value}}
+ {{#if @controller.model.second_factor_enabled}}
+ {{i18n "yes_value"}}
{{else}}
- &mdash;
+ {{i18n "no_value"}}
{{/if}}
</div>
- </div>
- {{/each}}
- </section>
-{{/if}}
-
-<span>
- <PluginOutlet
- @name="admin-user-details"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
-
-<section class="details">
- <h1>{{i18n "admin.user.permissions"}}</h1>
-
- {{#if this.siteSettings.must_approve_users}}
- <div class="display-row">
- <div class="field">{{i18n "admin.users.approved"}}</div>
- <div class="value">
- {{#if this.model.approved}}
- {{i18n "admin.user.approved_by"}}
- <LinkTo @route="adminUser" @model={{this.model.approvedBy}}>
- {{avatar this.model.approvedBy imageSize="small"}}
- </LinkTo>
- <LinkTo @route="adminUser" @model={{this.model.approvedBy}}>
- {{this.model.approvedBy.username}}
- </LinkTo>
- {{else}}
- {{i18n "no_value"}}
- {{/if}}
- </div>
- <div class="controls">
- {{#if this.model.approved}}
- {{i18n "admin.user.approve_success"}}
- {{else}}
- {{#if this.model.can_approve}}
+ <div class="controls">
+ {{#if @controller.canDisableSecondFactor}}
<DButton
- @action={{this.approve}}
- @icon="check"
- @label="admin.user.approve"
- class="btn-default"
+ @action={{@controller.disableSecondFactor}}
+ @icon="unlock-keyhole"
+ @label="user.second_factor.disable"
+ class="btn-default disable-second-factor"
/>
{{/if}}
- {{/if}}
- </div>
- </div>
- {{/if}}
-
- <div class="display-row">
- <div class="field">{{i18n "admin.users.active"}}</div>
- <div class="value">{{i18n-yes-no this.model.active}}</div>
- <div class="controls">
- {{#if this.model.active}}
- {{#if this.model.can_deactivate}}
- <DButton
- @action={{this.deactivate}}
- @label="admin.user.deactivate_account"
- class="btn-default"
- />
- {{i18n "admin.user.deactivate_explanation"}}
- {{/if}}
- {{else}}
- {{#if this.model.can_send_activation_email}}
- <DButton
- @action={{this.sendActivationEmail}}
- @icon="envelope"
- @label="admin.user.send_activation_email"
- class="btn-default"
- />
- {{/if}}
- {{#if this.model.can_activate}}
- <DButton
- @action={{this.activate}}
- @icon="check"
- @label="admin.user.activate"
- class="btn-default"
- />
- {{/if}}
- {{/if}}
- </div>
- </div>
-
- <div class="display-row">
- <div class="field">{{i18n "admin.user.staged"}}</div>
- <div class="value">{{i18n-yes-no this.model.staged}}</div>
- <div class="controls">{{i18n "admin.user.staged_explanation"}}</div>
- </div>
-
- {{#if this.currentUser.admin}}
- <div class="display-row">
- <div class="field">{{i18n "admin.api.active_keys"}}</div>
- <div class="value">
- {{this.model.api_key_count}}
- </div>
- <div class="controls">
- <DButton
- @href="/admin/api/keys"
- @label="admin.api.manage_keys"
- class="btn-default"
- />
+ </div>
</div>
- </div>
- {{/if}}
-
- <div class="display-row">
- <div class="field">{{i18n "admin.user.admin"}}</div>
- <div class="value">{{i18n-yes-no this.model.admin}}</div>
- <div class="controls">
- {{#if this.model.can_revoke_admin}}
- <DButton
- @action={{this.revokeAdmin}}
- @icon="shield-halved"
- @label="admin.user.revoke_admin"
- class="btn-default"
- />
- {{/if}}
- {{#if this.model.can_grant_admin}}
- <DButton
- @action={{this.grantAdmin}}
- @icon="shield-halved"
- @label="admin.user.grant_admin"
- class="btn-default grant-admin"
- />
- {{/if}}
- </div>
- </div>
-
- <div class="display-row">
- <div class="field">{{i18n "admin.user.moderator"}}</div>
- <div class="value">{{i18n-yes-no this.model.moderator}}</div>
- <div class="controls">
- {{#if this.model.can_revoke_moderation}}
- <DButton
- @action={{this.revokeModeration}}
- @icon="shield-halved"
- @label="admin.user.revoke_moderation"
- class="btn-default"
- />
- {{/if}}
- {{#if this.model.can_grant_moderation}}
- <DButton
- @action={{this.grantModeration}}
- @icon="shield-halved"
- @label="admin.user.grant_moderation"
- class="btn-default"
- />
- {{/if}}
- </div>
- </div>
-
- <div class="display-row">
- <div class="field">{{i18n "trust_level"}}</div>
- <div class="value">
- <ComboBox
- @content={{this.site.trustLevels}}
- @nameProperty="detailedName"
- @value={{this.model.trustLevel.id}}
- @onChange={{fn (mut this.model.trust_level)}}
+ </section>
+
+ {{#if @controller.userFields}}
+ <section class="details">
+ {{#each @controller.userFields as |uf|}}
+ <div class="display-row">
+ <div class="field">{{uf.name}}</div>
+ <div class="value">
+ {{#if uf.value}}
+ {{uf.value}}
+ {{else}}
+ &mdash;
+ {{/if}}
+ </div>
+ </div>
+ {{/each}}
+ </section>
+ {{/if}}
+
+ <span>
+ <PluginOutlet
+ @name="admin-user-details"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
+ </span>
- {{#if this.model.dirty}}
- <div>
- <DButton
- @action={{this.saveTrustLevel}}
- @icon="check"
- class="ok no-text"
- />
- <DButton
- @action={{this.restoreTrustLevel}}
- @icon="xmark"
- class="cancel no-text"
- />
+ <section class="details">
+ <h1>{{i18n "admin.user.permissions"}}</h1>
+
+ {{#if @controller.siteSettings.must_approve_users}}
+ <div class="display-row">
+ <div class="field">{{i18n "admin.users.approved"}}</div>
+ <div class="value">
+ {{#if @controller.model.approved}}
+ {{i18n "admin.user.approved_by"}}
+ <LinkTo
+ @route="adminUser"
+ @model={{@controller.model.approvedBy}}
+ >
+ {{avatar @controller.model.approvedBy imageSize="small"}}
+ </LinkTo>
+ <LinkTo
+ @route="adminUser"
+ @model={{@controller.model.approvedBy}}
+ >
+ {{@controller.model.approvedBy.username}}
+ </LinkTo>
+ {{else}}
+ {{i18n "no_value"}}
+ {{/if}}
+ </div>
+ <div class="controls">
+ {{#if @controller.model.approved}}
+ {{i18n "admin.user.approve_success"}}
+ {{else}}
+ {{#if @controller.model.can_approve}}
+ <DButton
+ @action={{@controller.approve}}
+ @icon="check"
+ @label="admin.user.approve"
+ class="btn-default"
+ />
+ {{/if}}
+ {{/if}}
+ </div>
</div>
{{/if}}
- </div>
- <div class="controls">
- {{#if this.model.canLockTrustLevel}}
- {{#if this.hasLockedTrustLevel}}
- {{d-icon "lock" title="admin.user.trust_level_locked_tip"}}
- <DButton
- @action={{fn this.lockTrustLevel false}}
- @label="admin.user.unlock_trust_level"
- class="btn-default"
- />
- {{else}}
- {{d-icon "unlock" title="admin.user.trust_level_unlocked_tip"}}
- <DButton
- @action={{fn this.lockTrustLevel true}}
- @label="admin.user.lock_trust_level"
- class="btn-default"
- />
- {{/if}}
- {{/if}}
- {{#if this.model.tl3Requirements}}
- <LinkTo
- @route="adminUser.tl3Requirements"
- @model={{this.model}}
- class="btn btn-default"
- >
- {{i18n "admin.user.trust_level_3_requirements"}}
- </LinkTo>
- {{/if}}
- </div>
- </div>
-
- <div
- class="user-suspended display-row
- {{if this.model.suspended 'highlight-danger'}}"
- >
- <div class="field">{{i18n "admin.user.suspended"}}</div>
- <div class="value">
- {{i18n-yes-no this.model.suspended}}
- {{#if this.model.suspended}}
- {{#unless this.model.suspendedForever}}
- {{i18n
- "admin.user.suspended_until"
- until=this.model.suspendedTillDate
- }}
- {{/unless}}
- {{/if}}
- </div>
- <div class="controls">
- {{#if this.model.suspended}}
- <DButton
- @action={{this.unsuspend}}
- @icon="ban"
- @label="admin.user.unsuspend"
- class="btn-danger unsuspend-user"
- />
- {{i18n "admin.user.suspended_explanation"}}
- {{else}}
- {{#if this.model.canSuspend}}
- <DButton
- @action={{this.showSuspendModal}}
- @icon="ban"
- @label="admin.user.suspend"
- class="btn-danger suspend-user"
- />
- {{i18n "admin.user.suspended_explanation"}}
- {{/if}}
- {{/if}}
- </div>
- </div>
-
- {{#if this.model.suspended}}
- <div class="display-row highlight-danger suspension-info">
- <div class="field">{{i18n "admin.user.suspended_by"}}</div>
- <div class="value">
- <LinkTo @route="adminUser" @model={{this.model.suspendedBy}}>
- {{avatar this.model.suspendedBy imageSize="tiny"}}
- </LinkTo>
- <LinkTo @route="adminUser" @model={{this.model.suspendedBy}}>
- {{this.model.suspendedBy.username}}
- </LinkTo>
+
+ <div class="display-row">
+ <div class="field">{{i18n "admin.users.active"}}</div>
+ <div class="value">{{i18nYesNo @controller.model.active}}</div>
+ <div class="controls">
+ {{#if @controller.model.active}}
+ {{#if @controller.model.can_deactivate}}
+ <DButton
+ @action={{@controller.deactivate}}
+ @label="admin.user.deactivate_account"
+ class="btn-default"
+ />
+ {{i18n "admin.user.deactivate_explanation"}}
+ {{/if}}
+ {{else}}
+ {{#if @controller.model.can_send_activation_email}}
+ <DButton
+ @action={{@controller.sendActivationEmail}}
+ @icon="envelope"
+ @label="admin.user.send_activation_email"
+ class="btn-default"
+ />
+ {{/if}}
+ {{#if @controller.model.can_activate}}
+ <DButton
+ @action={{@controller.activate}}
+ @icon="check"
+ @label="admin.user.activate"
+ class="btn-default"
+ />
+ {{/if}}
+ {{/if}}
+ </div>
</div>
- <div class="controls">
- <strong>{{i18n "admin.user.suspend_reason"}}</strong>:
- <div class="full-reason">{{this.model.full_suspend_reason}}</div>
+
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.staged"}}</div>
+ <div class="value">{{i18nYesNo @controller.model.staged}}</div>
+ <div class="controls">{{i18n "admin.user.staged_explanation"}}</div>
</div>
- </div>
- {{/if}}
-
- <div class="display-row {{if this.model.silenced 'highlight-danger'}}">
- <div class="field">{{i18n "admin.user.silenced"}}</div>
- <div class="value">
- {{i18n-yes-no this.model.silenced}}
- {{#if this.model.silenced}}
- {{#unless this.model.silencedForever}}
- {{i18n
- "admin.user.suspended_until"
- until=this.model.silencedTillDate
- }}
- {{/unless}}
+
+ {{#if @controller.currentUser.admin}}
+ <div class="display-row">
+ <div class="field">{{i18n "admin.api.active_keys"}}</div>
+ <div class="value">
+ {{@controller.model.api_key_count}}
+ </div>
+ <div class="controls">
+ <DButton
+ @href="/admin/api/keys"
+ @label="admin.api.manage_keys"
+ class="btn-default"
+ />
+ </div>
+ </div>
{{/if}}
- </div>
- <div class="controls">
- <ConditionalLoadingSpinner
- @size="small"
- @condition={{this.model.silencingUser}}
- >
- {{#if this.model.silenced}}
- <DButton
- @action={{this.unsilence}}
- @icon="microphone-slash"
- @label="admin.user.unsilence"
- class="btn-danger unsilence-user"
- />
- {{i18n "admin.user.silence_explanation"}}
- {{else}}
- {{#if this.model.canSilence}}
+
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.admin"}}</div>
+ <div class="value">{{i18nYesNo @controller.model.admin}}</div>
+ <div class="controls">
+ {{#if @controller.model.can_revoke_admin}}
<DButton
- @action={{this.showSilenceModal}}
- @icon="microphone-slash"
- @label="admin.user.silence"
- class="btn-danger silence-user"
+ @action={{@controller.revokeAdmin}}
+ @icon="shield-halved"
+ @label="admin.user.revoke_admin"
+ class="btn-default"
/>
- {{i18n "admin.user.silence_explanation"}}
{{/if}}
- {{/if}}
- </ConditionalLoadingSpinner>
- </div>
- </div>
-
- {{#if this.model.silenced}}
- <div class="display-row highlight-danger silence-info">
- <div class="field">{{i18n "admin.user.silenced_by"}}</div>
- <div class="value">
- <LinkTo @route="adminUser" @model={{this.model.silencedBy}}>
- {{avatar this.model.silencedBy imageSize="tiny"}}
- </LinkTo>
- <LinkTo @route="adminUser" @model={{this.model.silencedBy}}>
- {{this.model.silencedBy.username}}
- </LinkTo>
- </div>
- <div class="controls">
- <b>{{i18n "admin.user.silence_reason"}}</b>:
- <div class="full-reason">{{html-safe this.model.silence_reason}}</div>
+ {{#if @controller.model.can_grant_admin}}
+ <DButton
+ @action={{@controller.grantAdmin}}
+ @icon="shield-halved"
+ @label="admin.user.grant_admin"
+ class="btn-default grant-admin"
+ />
+ {{/if}}
+ </div>
</div>
- </div>
- {{/if}}
- {{#if this.model.tl3_requirements.penalty_counts.total}}
- <div class="display-row clear-penalty-history">
- <div class="field">{{i18n "admin.user.penalty_count"}}</div>
- <div
- class="value"
- >{{this.model.tl3_requirements.penalty_counts.total}}</div>
- {{#if this.currentUser.admin}}
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.moderator"}}</div>
+ <div class="value">{{i18nYesNo @controller.model.moderator}}</div>
<div class="controls">
- <DButton
- @label="admin.user.clear_penalty_history.title"
- @icon="xmark"
- @action={{this.clearPenaltyHistory}}
- class="btn-default"
- />
- {{i18n "admin.user.clear_penalty_history.description"}}
+ {{#if @controller.model.can_revoke_moderation}}
+ <DButton
+ @action={{@controller.revokeModeration}}
+ @icon="shield-halved"
+ @label="admin.user.revoke_moderation"
+ class="btn-default"
+ />
+ {{/if}}
+ {{#if @controller.model.can_grant_moderation}}
+ <DButton
+ @action={{@controller.grantModeration}}
+ @icon="shield-halved"
+ @label="admin.user.grant_moderation"
+ class="btn-default"
+ />
+ {{/if}}
</div>
- {{/if}}
- </div>
- {{/if}}
-
-</section>
-
-{{#if this.currentUser.admin}}
- <section class="details">
- <h1>{{i18n "admin.groups.title"}}</h1>
- <div class="display-row">
- <div class="field">{{i18n "admin.groups.automatic"}}</div>
- <div class="value">{{html-safe this.automaticGroups}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.groups.custom"}}</div>
- <div class="value">
- <GroupChooser
- @content={{this.availableGroups}}
- @value={{this.customGroupIdsBuffer}}
- @labelProperty="name"
- @onChange={{fn (mut this.customGroupIdsBuffer)}}
- />
</div>
- {{#if this.customGroupsDirty}}
- <div class="controls">
- <DButton @icon="check" @action={{this.saveCustomGroups}} class="ok" />
- <DButton
- @icon="xmark"
- @action={{this.resetCustomGroups}}
- class="cancel"
- />
- </div>
- {{/if}}
- </div>
- {{#if this.model.customGroups}}
+
<div class="display-row">
- <div class="field">{{i18n "admin.groups.primary"}}</div>
+ <div class="field">{{i18n "trust_level"}}</div>
<div class="value">
<ComboBox
- @content={{this.model.customGroups}}
- @value={{this.model.primary_group_id}}
- @onChange={{fn (mut this.model.primary_group_id)}}
- @options={{hash none="admin.groups.no_primary"}}
+ @content={{@controller.site.trustLevels}}
+ @nameProperty="detailedName"
+ @value={{@controller.model.trustLevel.id}}
+ @onChange={{fn (mut @controller.model.trust_level)}}
/>
+
+ {{#if @controller.model.dirty}}
+ <div>
+ <DButton
+ @action={{@controller.saveTrustLevel}}
+ @icon="check"
+ class="ok no-text"
+ />
+ <DButton
+ @action={{@controller.restoreTrustLevel}}
+ @icon="xmark"
+ class="cancel no-text"
+ />
+ </div>
+ {{/if}}
</div>
- {{#if this.primaryGroupDirty}}
- <div class="controls">
- <DButton
- @icon="check"
- @action={{this.savePrimaryGroup}}
- class="ok"
- />
+ <div class="controls">
+ {{#if @controller.model.canLockTrustLevel}}
+ {{#if @controller.hasLockedTrustLevel}}
+ {{icon "lock" title="admin.user.trust_level_locked_tip"}}
+ <DButton
+ @action={{fn @controller.lockTrustLevel false}}
+ @label="admin.user.unlock_trust_level"
+ class="btn-default"
+ />
+ {{else}}
+ {{icon "unlock" title="admin.user.trust_level_unlocked_tip"}}
+ <DButton
+ @action={{fn @controller.lockTrustLevel true}}
+ @label="admin.user.lock_trust_level"
+ class="btn-default"
+ />
+ {{/if}}
+ {{/if}}
+ {{#if @controller.model.tl3Requirements}}
+ <LinkTo
+ @route="adminUser.tl3Requirements"
+ @model={{@controller.model}}
+ class="btn btn-default"
+ >
+ {{i18n "admin.user.trust_level_3_requirements"}}
+ </LinkTo>
+ {{/if}}
+ </div>
+ </div>
+
+ <div
+ class="user-suspended display-row
+ {{if @controller.model.suspended 'highlight-danger'}}"
+ >
+ <div class="field">{{i18n "admin.user.suspended"}}</div>
+ <div class="value">
+ {{i18nYesNo @controller.model.suspended}}
+ {{#if @controller.model.suspended}}
+ {{#unless @controller.model.suspendedForever}}
+ {{i18n
+ "admin.user.suspended_until"
+ }}
+ {{/unless}}
+ {{/if}}
+ </div>
+ <div class="controls">
+ {{#if @controller.model.suspended}}
<DButton
- @icon="xmark"
- @action={{this.resetPrimaryGroup}}
- class="cancel"
+ @action={{@controller.unsuspend}}
+ @icon="ban"
+ @label="admin.user.unsuspend"
+ class="btn-danger unsuspend-user"
/>
- </div>
- {{/if}}
+ {{i18n "admin.user.suspended_explanation"}}
+ {{else}}
+ {{#if @controller.model.canSuspend}}
+ <DButton
+ @action={{@controller.showSuspendModal}}
+ @icon="ban"
+ @label="admin.user.suspend"
+ class="btn-danger suspend-user"
+ />
+ {{i18n "admin.user.suspended_explanation"}}
+ {{/if}}
+ {{/if}}
+ </div>
</div>
- {{/if}}
- </section>
-{{/if}}
-
-<section class="details">
- <h1>{{i18n "admin.user.activity"}}</h1>
-
- <div class="display-row">
- <div class="field">{{i18n "created"}}</div>
- <div class="value">{{format-date
- this.model.created_at
- leaveAgo="true"
- }}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.users.last_emailed"}}</div>
- <div class="value">{{format-date this.model.last_emailed_at}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "last_seen"}}</div>
- <div class="value">{{format-date
- this.model.last_seen_at
- leaveAgo="true"
- }}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.like_count"}}</div>
- <div class="value">{{this.model.like_given_count}}
- /
- {{this.model.like_count}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.topics_entered"}}</div>
- <div class="value">{{this.model.topics_entered}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.post_count"}}</div>
- <div class="value">{{this.model.post_count}}</div>
- <div class="controls">
- {{#if this.model.can_delete_all_posts}}
- {{#if this.model.post_count}}
- <DButton
- @action={{this.showDeletePostsConfirmation}}
- @icon="trash-can"
- @label="admin.user.delete_posts.button"
- class="btn-danger"
- />
- {{/if}}
- {{else}}
- {{this.deleteAllPostsExplanation}}
+
+ {{#if @controller.model.suspended}}
+ <div class="display-row highlight-danger suspension-info">
+ <div class="field">{{i18n "admin.user.suspended_by"}}</div>
+ <div class="value">
+ <LinkTo @route="adminUser" @model={{@controller.model.suspendedBy}}>
+ {{avatar @controller.model.suspendedBy imageSize="tiny"}}
+ </LinkTo>
+ <LinkTo @route="adminUser" @model={{@controller.model.suspendedBy}}>
+ {{@controller.model.suspendedBy.username}}
+ </LinkTo>
+ </div>
+ <div class="controls">
+ <strong>{{i18n "admin.user.suspend_reason"}}</strong>:
+ <div
+ class="full-reason"
+ >{{@controller.model.full_suspend_reason}}</div>
+ </div>
+ </div>
{{/if}}
- </div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.posts_read_count"}}</div>
- <div class="value">{{this.model.posts_read_count}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.warnings_received_count"}}</div>
- <div class="value">{{this.model.warnings_received_count}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.flags_given_received_count"}}</div>
- <div class="value">
- {{this.model.flags_given_count}}
- /
- {{this.model.flags_received_count}}
- </div>
- <div class="controls">
- {{#if this.model.flags_received_count}}
- <LinkTo
- @route="review"
- @query={{hash
- username=this.model.username
- type="ReviewableFlaggedPost"
- status="all"
- }}
- class="btn"
- >
- {{i18n "admin.user.show_flags_received"}}
- </LinkTo>
+
+ <div
+ class="display-row {{if @controller.model.silenced 'highlight-danger'}}"
+ >
+ <div class="field">{{i18n "admin.user.silenced"}}</div>
+ <div class="value">
+ {{i18nYesNo @controller.model.silenced}}
+ {{#if @controller.model.silenced}}
+ {{#unless @controller.model.silencedForever}}
+ {{i18n
+ "admin.user.suspended_until"
+ }}
+ {{/unless}}
+ {{/if}}
+ </div>
+ <div class="controls">
+ <ConditionalLoadingSpinner
+ @size="small"
+ @condition={{@controller.model.silencingUser}}
+ >
+ {{#if @controller.model.silenced}}
+ <DButton
+ @action={{@controller.unsilence}}
+ @icon="microphone-slash"
+ @label="admin.user.unsilence"
+ class="btn-danger unsilence-user"
+ />
+ {{i18n "admin.user.silence_explanation"}}
+ {{else}}
+ {{#if @controller.model.canSilence}}
+ <DButton
+ @action={{@controller.showSilenceModal}}
+ @icon="microphone-slash"
+ @label="admin.user.silence"
+ class="btn-danger silence-user"
+ />
+ {{i18n "admin.user.silence_explanation"}}
+ {{/if}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </div>
+ </div>
+
+ {{#if @controller.model.silenced}}
+ <div class="display-row highlight-danger silence-info">
+ <div class="field">{{i18n "admin.user.silenced_by"}}</div>
+ <div class="value">
+ <LinkTo @route="adminUser" @model={{@controller.model.silencedBy}}>
+ {{avatar @controller.model.silencedBy imageSize="tiny"}}
+ </LinkTo>
+ <LinkTo @route="adminUser" @model={{@controller.model.silencedBy}}>
+ {{@controller.model.silencedBy.username}}
+ </LinkTo>
+ </div>
+ <div class="controls">
+ <b>{{i18n "admin.user.silence_reason"}}</b>:
+ <div class="full-reason">{{htmlSafe
+ @controller.model.silence_reason
+ }}</div>
+ </div>
+ </div>
{{/if}}
- </div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.private_topics_count"}}</div>
- <div class="value">{{this.model.private_topics_count}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "admin.user.time_read"}}</div>
- <div class="value">{{format-duration this.model.time_read}}</div>
- </div>
- <div class="display-row">
- <div class="field">{{i18n "user.invited.days_visited"}}</div>
- <div class="value">{{html-safe this.model.days_visited}}</div>
- </div>
- <div class="display-row post-edits-count">
- <div class="field">{{i18n "admin.user.post_edits_count"}}</div>
- <div class="value">
- {{if (gt this.model.post_edits_count 0) this.model.post_edits_count "0"}}
- </div>
- <div class="controls">
- {{#if (gt this.model.post_edits_count 0)}}
- <LinkTo
- @route="adminReports.show"
- @model="post_edits"
- @query={{hash filters=this.postEditsByEditorFilter}}
- class="btn btn-icon"
- >
- {{d-icon "far-eye"}}
- {{i18n "admin.user.view_edits"}}
- </LinkTo>
+
+ {{#if @controller.model.tl3_requirements.penalty_counts.total}}
+ <div class="display-row clear-penalty-history">
+ <div class="field">{{i18n "admin.user.penalty_count"}}</div>
+ <div
+ class="value"
+ >{{@controller.model.tl3_requirements.penalty_counts.total}}</div>
+ {{#if @controller.currentUser.admin}}
+ <div class="controls">
+ <DButton
+ @label="admin.user.clear_penalty_history.title"
+ @icon="xmark"
+ @action={{@controller.clearPenaltyHistory}}
+ class="btn-default"
+ />
+ {{i18n "admin.user.clear_penalty_history.description"}}
+ </div>
+ {{/if}}
+ </div>
{{/if}}
- </div>
- </div>
-</section>
-{{#if this.model.single_sign_on_record}}
- <section class="details">
- <h1>{{i18n "admin.user.discourse_connect.title"}}</h1>
+ </section>
- {{#let this.model.single_sign_on_record as |sso|}}
- <div class="display-row">
- <div class="field">{{i18n
- "admin.user.discourse_connect.external_id"
- }}</div>
- <div class="value">{{sso.external_id}}</div>
- {{#if this.model.can_delete_sso_record}}
- <div class="controls">
- <DButton
- @action={{this.deleteSSORecord}}
- @icon="trash-can"
- @label="admin.user.discourse_connect.delete_sso_record"
- class="btn-danger"
+ {{#if @controller.currentUser.admin}}
+ <section class="details">
+ <h1>{{i18n "admin.groups.title"}}</h1>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.groups.automatic"}}</div>
+ <div class="value">{{htmlSafe @controller.automaticGroups}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.groups.custom"}}</div>
+ <div class="value">
+ <GroupChooser
+ @content={{@controller.availableGroups}}
+ @value={{@controller.customGroupIdsBuffer}}
+ @labelProperty="name"
+ @onChange={{fn (mut @controller.customGroupIdsBuffer)}}
/>
</div>
+ {{#if @controller.customGroupsDirty}}
+ <div class="controls">
+ <DButton
+ @icon="check"
+ @action={{@controller.saveCustomGroups}}
+ class="ok"
+ />
+ <DButton
+ @icon="xmark"
+ @action={{@controller.resetCustomGroups}}
+ class="cancel"
+ />
+ </div>
+ {{/if}}
+ </div>
+ {{#if @controller.model.customGroups}}
+ <div class="display-row">
+ <div class="field">{{i18n "admin.groups.primary"}}</div>
+ <div class="value">
+ <ComboBox
+ @content={{@controller.model.customGroups}}
+ @value={{@controller.model.primary_group_id}}
+ @onChange={{fn (mut @controller.model.primary_group_id)}}
+ @options={{hash none="admin.groups.no_primary"}}
+ />
+ </div>
+ {{#if @controller.primaryGroupDirty}}
+ <div class="controls">
+ <DButton
+ @icon="check"
+ @action={{@controller.savePrimaryGroup}}
+ class="ok"
+ />
+ <DButton
+ @icon="xmark"
+ @action={{@controller.resetPrimaryGroup}}
+ class="cancel"
+ />
+ </div>
+ {{/if}}
+ </div>
{{/if}}
+ </section>
+ {{/if}}
+
+ <section class="details">
+ <h1>{{i18n "admin.user.activity"}}</h1>
+
+ <div class="display-row">
+ <div class="field">{{i18n "created"}}</div>
+ <div class="value">{{formatDate
+ @controller.model.created_at
+ leaveAgo="true"
+ }}</div>
</div>
<div class="display-row">
- <div class="field">{{i18n
- "admin.user.discourse_connect.external_username"
+ <div class="field">{{i18n "admin.users.last_emailed"}}</div>
+ <div class="value">{{formatDate
+ @controller.model.last_emailed_at
}}</div>
- <div class="value">{{sso.external_username}}</div>
</div>
<div class="display-row">
- <div class="field">{{i18n
- "admin.user.discourse_connect.external_name"
+ <div class="field">{{i18n "last_seen"}}</div>
+ <div class="value">{{formatDate
+ @controller.model.last_seen_at
+ leaveAgo="true"
}}</div>
- <div class="value">{{sso.external_name}}</div>
</div>
- {{#if this.canAdminCheckEmails}}
- <div class="display-row">
- <div class="field">{{i18n
- "admin.user.discourse_connect.external_email"
- }}</div>
- {{#if this.ssoExternalEmail}}
- <div class="value">{{this.ssoExternalEmail}}</div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.like_count"}}</div>
+ <div class="value">{{@controller.model.like_given_count}}
+ /
+ {{@controller.model.like_count}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.topics_entered"}}</div>
+ <div class="value">{{@controller.model.topics_entered}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.post_count"}}</div>
+ <div class="value">{{@controller.model.post_count}}</div>
+ <div class="controls">
+ {{#if @controller.model.can_delete_all_posts}}
+ {{#if @controller.model.post_count}}
+ <DButton
+ @action={{@controller.showDeletePostsConfirmation}}
+ @icon="trash-can"
+ @label="admin.user.delete_posts.button"
+ class="btn-danger"
+ />
+ {{/if}}
{{else}}
- <DButton
- @action={{fn this.checkSsoEmail this.model}}
- @icon="envelope"
- @label="admin.users.check_email.text"
- @title="admin.users.check_email.title"
- class="btn-default"
- />
+ {{@controller.deleteAllPostsExplanation}}
{{/if}}
</div>
- {{/if}}
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.posts_read_count"}}</div>
+ <div class="value">{{@controller.model.posts_read_count}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.warnings_received_count"}}</div>
+ <div class="value">{{@controller.model.warnings_received_count}}</div>
+ </div>
<div class="display-row">
<div class="field">{{i18n
- "admin.user.discourse_connect.external_avatar_url"
+ "admin.user.flags_given_received_count"
}}</div>
- <div class="value">{{sso.external_avatar_url}}</div>
+ <div class="value">
+ {{@controller.model.flags_given_count}}
+ /
+ {{@controller.model.flags_received_count}}
+ </div>
+ <div class="controls">
+ {{#if @controller.model.flags_received_count}}
+ <LinkTo
+ @route="review"
+ @query={{hash
+ type="ReviewableFlaggedPost"
+ status="all"
+ }}
+ class="btn"
+ >
+ {{i18n "admin.user.show_flags_received"}}
+ </LinkTo>
+ {{/if}}
+ </div>
</div>
- {{#if this.canAdminCheckEmails}}
- <div class="display-row">
- <div class="field">{{i18n
- "admin.user.discourse_connect.last_payload"
- }}</div>
- {{#if this.ssoLastPayload}}
- <div class="value">
- {{#each this.ssoPayload as |line|}}
- {{line}}<br />
- {{/each}}
- </div>
- {{else}}
- <DButton
- @action={{fn this.checkSsoPayload this.model}}
- @icon="far-rectangle-list"
- @label="admin.users.check_sso.text"
- @title="admin.users.check_sso.title"
- class="btn-default"
- />
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.private_topics_count"}}</div>
+ <div class="value">{{@controller.model.private_topics_count}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "admin.user.time_read"}}</div>
+ <div class="value">{{formatDuration @controller.model.time_read}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n "user.invited.days_visited"}}</div>
+ <div class="value">{{htmlSafe @controller.model.days_visited}}</div>
+ </div>
+ <div class="display-row post-edits-count">
+ <div class="field">{{i18n "admin.user.post_edits_count"}}</div>
+ <div class="value">
+ {{if
+ (gt @controller.model.post_edits_count 0)
+ @controller.model.post_edits_count
+ "0"
+ }}
+ </div>
+ <div class="controls">
+ {{#if (gt @controller.model.post_edits_count 0)}}
+ <LinkTo
+ @route="adminReports.show"
+ @model="post_edits"
+ @query={{hash [email protected]}}
+ class="btn btn-icon"
+ >
+ {{icon "far-eye"}}
+ {{i18n "admin.user.view_edits"}}
+ </LinkTo>
{{/if}}
</div>
- {{/if}}
- {{/let}}
- </section>
-{{/if}}
-
-{{#if this.currentUser.admin}}
- <AdminUserExportsTable @model={{this.model}} />
-{{/if}}
-
-<span>
- <PluginOutlet
- @name="after-user-details"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
-
-<section>
- <hr />
- <div class="pull-right">
- {{#if this.model.active}}
- {{#if this.model.can_impersonate}}
- <DButton
- @action={{this.impersonate}}
- @icon="crosshairs"
- @label="admin.impersonate.title"
- @title="admin.impersonate.help"
- class="btn-danger btn-impersonate"
- />
- {{/if}}
+ </div>
+ </section>
+
+ {{#if @controller.model.single_sign_on_record}}
+ <section class="details">
+ <h1>{{i18n "admin.user.discourse_connect.title"}}</h1>
+
+ {{#let @controller.model.single_sign_on_record as |sso|}}
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.external_id"
+ }}</div>
+ <div class="value">{{sso.external_id}}</div>
+ {{#if @controller.model.can_delete_sso_record}}
+ <div class="controls">
+ <DButton
+ @action={{@controller.deleteSSORecord}}
+ @icon="trash-can"
+ @label="admin.user.discourse_connect.delete_sso_record"
+ class="btn-danger"
+ />
+ </div>
+ {{/if}}
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.external_username"
+ }}</div>
+ <div class="value">{{sso.external_username}}</div>
+ </div>
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.external_name"
+ }}</div>
+ <div class="value">{{sso.external_name}}</div>
+ </div>
+ {{#if @controller.canAdminCheckEmails}}
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.external_email"
+ }}</div>
+ {{#if @controller.ssoExternalEmail}}
+ <div class="value">{{@controller.ssoExternalEmail}}</div>
+ {{else}}
+ <DButton
+ @action={{fn @controller.checkSsoEmail @controller.model}}
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ @title="admin.users.check_email.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+ {{/if}}
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.external_avatar_url"
+ }}</div>
+ <div class="value">{{sso.external_avatar_url}}</div>
+ </div>
+ {{#if @controller.canAdminCheckEmails}}
+ <div class="display-row">
+ <div class="field">{{i18n
+ "admin.user.discourse_connect.last_payload"
+ }}</div>
+ {{#if @controller.ssoLastPayload}}
+ <div class="value">
+ {{#each @controller.ssoPayload as |line|}}
+ {{line}}<br />
+ {{/each}}
+ </div>
+ {{else}}
+ <DButton
+ @action={{fn @controller.checkSsoPayload @controller.model}}
+ @icon="far-rectangle-list"
+ @label="admin.users.check_sso.text"
+ @title="admin.users.check_sso.title"
+ class="btn-default"
+ />
+ {{/if}}
+ </div>
+ {{/if}}
+ {{/let}}
+ </section>
{{/if}}
- {{#if this.model.can_be_anonymized}}
- <DButton
- @label="admin.user.anonymize"
- @icon="triangle-exclamation"
- @action={{this.anonymize}}
- class="btn-danger btn-anonymize"
- />
+ {{#if @controller.currentUser.admin}}
+ <AdminUserExportsTable @model={{@controller.model}} />
{{/if}}
- {{#if this.model.canBeDeleted}}
- <DButton
- @label="admin.user.delete"
- @icon="trash-can"
- @action={{this.destroyUser}}
- class="btn-danger btn-user-delete"
+ <span>
+ <PluginOutlet
+ @name="after-user-details"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
- {{/if}}
+ </span>
- {{#if this.model.can_be_merged}}
- <DButton
- @label="admin.user.merge.button"
- @icon="left-right"
- @action={{this.promptTargetUser}}
- class="btn-danger btn-user-merge"
- />
- {{/if}}
- </div>
+ <section>
+ <hr />
+ <div class="pull-right">
+ {{#if @controller.model.active}}
+ {{#if @controller.model.can_impersonate}}
+ <DButton
+ @action={{@controller.impersonate}}
+ @icon="crosshairs"
+ @label="admin.impersonate.title"
+ @title="admin.impersonate.help"
+ class="btn-danger btn-impersonate"
+ />
+ {{/if}}
+ {{/if}}
+
+ {{#if @controller.model.can_be_anonymized}}
+ <DButton
+ @label="admin.user.anonymize"
+ @icon="triangle-exclamation"
+ @action={{@controller.anonymize}}
+ class="btn-danger btn-anonymize"
+ />
+ {{/if}}
+
+ {{#if @controller.model.canBeDeleted}}
+ <DButton
+ @label="admin.user.delete"
+ @icon="trash-can"
+ @action={{@controller.destroyUser}}
+ class="btn-danger btn-user-delete"
+ />
+ {{/if}}
+
+ {{#if @controller.model.can_be_merged}}
+ <DButton
+ @label="admin.user.merge.button"
+ @icon="left-right"
+ @action={{@controller.promptTargetUser}}
+ class="btn-danger btn-user-merge"
+ />
+ {{/if}}
+ </div>
+
+ {{#if @controller.deleteExplanation}}
+ <div class="clearfix"></div>
+ <br />
+ <div class="pull-right">
+ {{icon "triangle-exclamation"}}
+ {{@controller.deleteExplanation}}
+ </div>
+ {{/if}}
+ </section>
- {{#if this.deleteExplanation}}
<div class="clearfix"></div>
- <br />
- <div class="pull-right">
- {{d-icon "triangle-exclamation"}}
- {{this.deleteExplanation}}
- </div>
- {{/if}}
-</section>
-
-<div class="clearfix"></div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user-tl3-requirements.gjs b/app/assets/javascripts/admin/addon/templates/user-tl3-requirements.gjs
index 21ae2d26d95..a5feaa01fa6 100644
--- a/app/assets/javascripts/admin/addon/templates/user-tl3-requirements.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user-tl3-requirements.gjs
@@ -1,189 +1,233 @@
-<div class="admin-controls">
- <nav>
- <ul class="nav nav-pills">
- <li><LinkTo @route="adminUser" @model={{this.model}}>{{d-icon
- "caret-left"
- }}
- &nbsp;{{this.model.username}}</LinkTo></li>
- <li><LinkTo @route="adminUsersList.show" @model="member">{{i18n
- "admin.user.trust_level_2_users"
- }}</LinkTo></li>
- </ul>
- </nav>
-</div>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import checkIcon from "admin/helpers/check-icon";
-<div class="admin-container tl3-requirements">
- <h2>{{this.model.username}}
- -
- {{i18n "admin.user.tl3_requirements.title"}}</h2>
- <br />
- <p>{{i18n
- "admin.user.tl3_requirements.table_title"
- count=this.model.tl3Requirements.time_period
- }}</p>
+export default RouteTemplate(
+ <template>
+ <div class="admin-controls">
+ <nav>
+ <ul class="nav nav-pills">
+ <li><LinkTo @route="adminUser" @model={{@controller.model}}>{{icon
+ "caret-left"
+ }}
+ &nbsp;{{@controller.model.username}}</LinkTo></li>
+ <li><LinkTo @route="adminUsersList.show" @model="member">{{i18n
+ "admin.user.trust_level_2_users"
+ }}</LinkTo></li>
+ </ul>
+ </nav>
+ </div>
- <table class="table" style="width: auto;">
- <thead>
- <tr>
- <th></th>
- <th></th>
- <th>{{i18n "admin.user.tl3_requirements.value_heading"}}</th>
- <th>{{i18n "admin.user.tl3_requirements.requirement_heading"}}</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.topics_replied_to"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.topics_replied_to}}</td>
- <td>{{#if this.model.tl3Requirements.capped_topics_replied_to}}&ge;
- {{/if}}{{this.model.tl3Requirements.num_topics_replied_to}}</td>
- <td>{{this.model.tl3Requirements.min_topics_replied_to}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.topics_viewed"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.topics_viewed}}</td>
- <td>{{this.model.tl3Requirements.topics_viewed}}</td>
- <td>{{this.model.tl3Requirements.min_topics_viewed}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.topics_viewed_all_time"}}</th>
- <td>{{check-icon
- this.model.tl3Requirements.met.topics_viewed_all_time
- }}</td>
- <td>{{this.model.tl3Requirements.topics_viewed_all_time}}</td>
- <td>{{this.model.tl3Requirements.min_topics_viewed_all_time}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.posts_read"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.posts_read}}</td>
- <td>{{this.model.tl3Requirements.posts_read}}</td>
- <td>{{this.model.tl3Requirements.min_posts_read}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.posts_read_days"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.days_visited}}</td>
- <td>
- {{this.model.tl3Requirements.days_visited_percent}}% ({{this.model.tl3Requirements.days_visited}}
- /
- {{this.model.tl3Requirements.time_period}}
- {{i18n "admin.user.tl3_requirements.days"}})
- </td>
- <td>{{this.model.tl3Requirements.min_days_visited_percent}}%</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.posts_read_all_time"}}</th>
- <td>{{check-icon
- this.model.tl3Requirements.met.posts_read_all_time
- }}</td>
- <td>{{this.model.tl3Requirements.posts_read_all_time}}</td>
- <td>{{this.model.tl3Requirements.min_posts_read_all_time}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.flagged_posts"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.flagged_posts}}</td>
- <td>{{this.model.tl3Requirements.num_flagged_posts}}</td>
- <td>{{i18n
- "max_of_count"
- count=this.model.tl3Requirements.max_flagged_posts
- }}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.flagged_by_users"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.flagged_by_users}}</td>
- <td>{{this.model.tl3Requirements.num_flagged_by_users}}</td>
- <td>{{i18n
- "max_of_count"
- count=this.model.tl3Requirements.max_flagged_by_users
- }}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.likes_given"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.likes_given}}</td>
- <td>{{this.model.tl3Requirements.num_likes_given}}</td>
- <td>{{this.model.tl3Requirements.min_likes_given}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.likes_received"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.likes_received}}</td>
- <td>{{this.model.tl3Requirements.num_likes_received}}</td>
- <td>{{this.model.tl3Requirements.min_likes_received}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.likes_received_days"}}</th>
- <td>{{check-icon
- this.model.tl3Requirements.met.likes_received_days
- }}</td>
- <td>{{this.model.tl3Requirements.num_likes_received_days}}</td>
- <td>{{this.model.tl3Requirements.min_likes_received_days}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.likes_received_users"}}</th>
- <td>{{check-icon
- this.model.tl3Requirements.met.likes_received_users
- }}</td>
- <td>{{this.model.tl3Requirements.num_likes_received_users}}</td>
- <td>{{this.model.tl3Requirements.min_likes_received_users}}</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.silenced"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.silenced}}</td>
- <td>{{this.model.tl3Requirements.penalty_counts.silenced}}</td>
- <td>0</td>
- </tr>
- <tr>
- <th>{{i18n "admin.user.tl3_requirements.suspended"}}</th>
- <td>{{check-icon this.model.tl3Requirements.met.suspended}}</td>
- <td>{{this.model.tl3Requirements.penalty_counts.suspended}}</td>
- <td>0</td>
- </tr>
- </tbody>
- </table>
+ <div class="admin-container tl3-requirements">
+ <h2>{{@controller.model.username}}
+ -
+ {{i18n "admin.user.tl3_requirements.title"}}</h2>
+ <br />
+ <p>{{i18n
+ "admin.user.tl3_requirements.table_title"
+ }}</p>
- <br />
- <p>
- {{#if this.model.istl3}}
- {{#if this.model.tl3Requirements.requirements_lost}}
- {{! tl implicitly not locked }}
- {{#if this.model.tl3Requirements.on_grace_period}}
- {{d-icon "xmark"}}
- {{i18n "admin.user.tl3_requirements.on_grace_period"}}
- {{else}}
- {{! not on grace period }}
- {{d-icon "xmark"}}
- {{i18n "admin.user.tl3_requirements.does_not_qualify"}}
- {{i18n "admin.user.tl3_requirements.will_be_demoted"}}
- {{/if}}
- {{else}}
- {{! requirements not lost - remains tl3 }}
- {{#if this.model.tl3Requirements.trust_level_locked}}
- {{d-icon "lock"}}
- {{i18n "admin.user.tl3_requirements.locked_will_not_be_demoted"}}
- {{else}}
- {{! tl not locked }}
- {{d-icon "check"}}
- {{i18n "admin.user.tl3_requirements.qualifies"}}
- {{#if this.model.tl3Requirements.on_grace_period}}
- {{i18n "admin.user.tl3_requirements.on_grace_period"}}
+ <table class="table" style="width: auto;">
+ <thead>
+ <tr>
+ <th></th>
+ <th></th>
+ <th>{{i18n "admin.user.tl3_requirements.value_heading"}}</th>
+ <th>{{i18n "admin.user.tl3_requirements.requirement_heading"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.topics_replied_to"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.topics_replied_to
+ }}</td>
+ <td>{{#if
+ @controller.model.tl3Requirements.capped_topics_replied_to
+ }}&ge;
+ {{/if}}{{@controller.model.tl3Requirements.num_topics_replied_to}}</td>
+ <td>{{@controller.model.tl3Requirements.min_topics_replied_to}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.topics_viewed"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.topics_viewed
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.topics_viewed}}</td>
+ <td>{{@controller.model.tl3Requirements.min_topics_viewed}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n
+ "admin.user.tl3_requirements.topics_viewed_all_time"
+ }}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.topics_viewed_all_time
+ }}</td>
+ <td
+ >{{@controller.model.tl3Requirements.topics_viewed_all_time}}</td>
+ <td
+ >{{@controller.model.tl3Requirements.min_topics_viewed_all_time}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.posts_read"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.posts_read
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.posts_read}}</td>
+ <td>{{@controller.model.tl3Requirements.min_posts_read}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.posts_read_days"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.days_visited
+ }}</td>
+ <td>
+ {{@controller.model.tl3Requirements.days_visited_percent}}% ({{@controller.model.tl3Requirements.days_visited}}
+ /
+ {{@controller.model.tl3Requirements.time_period}}
+ {{i18n "admin.user.tl3_requirements.days"}})
+ </td>
+ <td
+ >{{@controller.model.tl3Requirements.min_days_visited_percent}}%</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.posts_read_all_time"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.posts_read_all_time
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.posts_read_all_time}}</td>
+ <td
+ >{{@controller.model.tl3Requirements.min_posts_read_all_time}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.flagged_posts"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.flagged_posts
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.num_flagged_posts}}</td>
+ <td>{{i18n
+ "max_of_count"
+ [email protected]_flagged_posts
+ }}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.flagged_by_users"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.flagged_by_users
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.num_flagged_by_users}}</td>
+ <td>{{i18n
+ "max_of_count"
+ [email protected]_flagged_by_users
+ }}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.likes_given"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.likes_given
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.num_likes_given}}</td>
+ <td>{{@controller.model.tl3Requirements.min_likes_given}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.likes_received"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.likes_received
+ }}</td>
+ <td>{{@controller.model.tl3Requirements.num_likes_received}}</td>
+ <td>{{@controller.model.tl3Requirements.min_likes_received}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.likes_received_days"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.likes_received_days
+ }}</td>
+ <td
+ >{{@controller.model.tl3Requirements.num_likes_received_days}}</td>
+ <td
+ >{{@controller.model.tl3Requirements.min_likes_received_days}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.likes_received_users"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.likes_received_users
+ }}</td>
+ <td
+ >{{@controller.model.tl3Requirements.num_likes_received_users}}</td>
+ <td
+ >{{@controller.model.tl3Requirements.min_likes_received_users}}</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.silenced"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.silenced
+ }}</td>
+ <td
+ >{{@controller.model.tl3Requirements.penalty_counts.silenced}}</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <th>{{i18n "admin.user.tl3_requirements.suspended"}}</th>
+ <td>{{checkIcon
+ @controller.model.tl3Requirements.met.suspended
+ }}</td>
+ <td
+ >{{@controller.model.tl3Requirements.penalty_counts.suspended}}</td>
+ <td>0</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <br />
+ <p>
+ {{#if @controller.model.istl3}}
+ {{#if @controller.model.tl3Requirements.requirements_lost}}
+ {{! tl implicitly not locked }}
+ {{#if @controller.model.tl3Requirements.on_grace_period}}
+ {{icon "xmark"}}
+ {{i18n "admin.user.tl3_requirements.on_grace_period"}}
+ {{else}}
+ {{! not on grace period }}
+ {{icon "xmark"}}
+ {{i18n "admin.user.tl3_requirements.does_not_qualify"}}
+ {{i18n "admin.user.tl3_requirements.will_be_demoted"}}
+ {{/if}}
+ {{else}}
+ {{! requirements not lost - remains tl3 }}
+ {{#if @controller.model.tl3Requirements.trust_level_locked}}
+ {{icon "lock"}}
+ {{i18n "admin.user.tl3_requirements.locked_will_not_be_demoted"}}
+ {{else}}
+ {{! tl not locked }}
+ {{icon "check"}}
+ {{i18n "admin.user.tl3_requirements.qualifies"}}
+ {{#if @controller.model.tl3Requirements.on_grace_period}}
+ {{i18n "admin.user.tl3_requirements.on_grace_period"}}
+ {{/if}}
+ {{/if}}
{{/if}}
- {{/if}}
- {{/if}}
- {{else}}
- {{! is not tl3 }}
- {{#if this.model.tl3Requirements.requirements_met}}
- {{! met & not tl3 - will be promoted}}
- {{d-icon "check"}}
- {{i18n "admin.user.tl3_requirements.qualifies"}}
- {{i18n "admin.user.tl3_requirements.will_be_promoted"}}
- {{else}}
- {{! requirements not met - remains regular }}
- {{#if this.model.tl3Requirements.trust_level_locked}}
- {{d-icon "lock"}}
- {{i18n "admin.user.tl3_requirements.locked_will_not_be_promoted"}}
{{else}}
- {{d-icon "xmark"}}
- {{i18n "admin.user.tl3_requirements.does_not_qualify"}}
+ {{! is not tl3 }}
+ {{#if @controller.model.tl3Requirements.requirements_met}}
+ {{! met & not tl3 - will be promoted}}
+ {{icon "check"}}
+ {{i18n "admin.user.tl3_requirements.qualifies"}}
+ {{i18n "admin.user.tl3_requirements.will_be_promoted"}}
+ {{else}}
+ {{! requirements not met - remains regular }}
+ {{#if @controller.model.tl3Requirements.trust_level_locked}}
+ {{icon "lock"}}
+ {{i18n "admin.user.tl3_requirements.locked_will_not_be_promoted"}}
+ {{else}}
+ {{icon "xmark"}}
+ {{i18n "admin.user.tl3_requirements.does_not_qualify"}}
+ {{/if}}
+ {{/if}}
{{/if}}
- {{/if}}
- {{/if}}
- </p>
-</div>
\ No newline at end of file
+ </p>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/user.gjs b/app/assets/javascripts/admin/addon/templates/user.gjs
index 04df95f2d26..0ef72128992 100644
--- a/app/assets/javascripts/admin/addon/templates/user.gjs
+++ b/app/assets/javascripts/admin/addon/templates/user.gjs
@@ -1 +1,7 @@
-<section>{{outlet}}</section>
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+
+export default RouteTemplate(
+ <template>
+ <section>{{outlet}}</section>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/users-list-show.gjs b/app/assets/javascripts/admin/addon/templates/users-list-show.gjs
index f47a6bf503d..c2d9fbb4e7f 100644
--- a/app/assets/javascripts/admin/addon/templates/users-list-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/users-list-show.gjs
@@ -1,395 +1,437 @@
-<DPageSubheader @titleLabel={{this.title}}>
- <:actions as |actions|>
- {{#if this.canCheckEmails}}
- {{#if this.showEmails}}
- <actions.Default
- @action={{this.toggleEmailVisibility}}
- @label="admin.users.hide_emails"
- class="admin-users__subheader-hide-emails"
- />
- {{else}}
- <actions.Default
- @action={{this.toggleEmailVisibility}}
- @label="admin.users.show_emails"
- class="admin-users__subheader-show-emails"
- />
- {{/if}}
- {{/if}}
- </:actions>
-</DPageSubheader>
+import { concat, fn, get, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DPageSubheader from "discourse/components/d-page-subheader";
+import DropdownMenu from "discourse/components/dropdown-menu";
+import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import ResponsiveTable from "discourse/components/responsive-table";
+import TableHeaderToggle from "discourse/components/table-header-toggle";
+import avatar from "discourse/helpers/avatar";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
+import formatDuration from "discourse/helpers/format-duration";
+import htmlSafe from "discourse/helpers/html-safe";
+import i18nYesNo from "discourse/helpers/i18n-yes-no";
+import number from "discourse/helpers/number";
+import rawDate from "discourse/helpers/raw-date";
+import { i18n } from "discourse-i18n";
+import DMenu from "float-kit/components/d-menu";
+import DTooltip from "float-kit/components/d-tooltip";
+import eq from "truth-helpers/helpers/eq";
+import not from "truth-helpers/helpers/not";
+import or from "truth-helpers/helpers/or";
-<PluginOutlet @name="admin-users-list-show-before" />
+export default RouteTemplate(
+ <template>
+ <DPageSubheader @titleLabel={{@controller.title}}>
+ <:actions as |actions|>
+ {{#if @controller.canCheckEmails}}
+ {{#if @controller.showEmails}}
+ <actions.Default
+ @action={{@controller.toggleEmailVisibility}}
+ @label="admin.users.hide_emails"
+ class="admin-users__subheader-hide-emails"
+ />
+ {{else}}
+ <actions.Default
+ @action={{@controller.toggleEmailVisibility}}
+ @label="admin.users.show_emails"
+ class="admin-users__subheader-show-emails"
+ />
+ {{/if}}
+ {{/if}}
+ </:actions>
+ </DPageSubheader>
-<div class="d-admin-filter admin-users-list__controls">
- <div class="admin-filter__input-container admin-users-list__search">
- <input
- class="admin-filter__input"
- type="text"
- dir="auto"
- placeholder={{this.searchHint}}
- title={{this.searchHint}}
- {{on "input" this.onListFilterChange}}
- />
- </div>
- {{#if this.displayBulkActions}}
- <div class="bulk-actions-dropdown">
- <DMenu @autofocus={{true}} @identifier="bulk-select-admin-users-dropdown">
- <:trigger>
- <span class="d-button-label">
- {{i18n "admin.users.bulk_actions.title"}}
- </span>
- {{dIcon "angle-down"}}
- </:trigger>
+ <PluginOutlet @name="admin-users-list-show-before" />
- <:content>
- <DropdownMenu as |dropdown|>
- <dropdown.item>
- <DButton
- @translatedLabel={{i18n
- "admin.users.bulk_actions.delete.label"
- }}
- @icon="trash-can"
- @action={{this.openBulkDeleteConfirmation}}
- class="bulk-delete btn-danger"
- />
- </dropdown.item>
- </DropdownMenu>
- </:content>
- </DMenu>
+ <div class="d-admin-filter admin-users-list__controls">
+ <div class="admin-filter__input-container admin-users-list__search">
+ <input
+ class="admin-filter__input"
+ type="text"
+ dir="auto"
+ placeholder={{@controller.searchHint}}
+ title={{@controller.searchHint}}
+ {{on "input" @controller.onListFilterChange}}
+ />
+ </div>
+ {{#if @controller.displayBulkActions}}
+ <div class="bulk-actions-dropdown">
+ <DMenu
+ @autofocus={{true}}
+ @identifier="bulk-select-admin-users-dropdown"
+ >
+ <:trigger>
+ <span class="d-button-label">
+ {{i18n "admin.users.bulk_actions.title"}}
+ </span>
+ {{icon "angle-down"}}
+ </:trigger>
+
+ <:content>
+ <DropdownMenu as |dropdown|>
+ <dropdown.item>
+ <DButton
+ @translatedLabel={{i18n
+ "admin.users.bulk_actions.delete.label"
+ }}
+ @icon="trash-can"
+ @action={{@controller.openBulkDeleteConfirmation}}
+ class="bulk-delete btn-danger"
+ />
+ </dropdown.item>
+ </DropdownMenu>
+ </:content>
+ </DMenu>
+ </div>
+ {{/if}}
</div>
- {{/if}}
-</div>
-<LoadMore
- @selector=".directory-table .directory-table__cell"
- @action={{action "loadMore"}}
- class="users-list-container"
->
- {{#if this.users}}
- <ResponsiveTable
- @className={{concat-class "users-list" this.query}}
- @ariaLabel={{this.title}}
- @style={{html-safe
- (concat
- "grid-template-columns: minmax(min-content, 2fr) repeat("
- (html-safe this.columnCount)
- ", minmax(min-content, 1fr))"
- )
- }}
+ <LoadMore
+ @selector=".directory-table .directory-table__cell"
+ @action={{@controller.loadMore}}
+ class="users-list-container"
>
- <:header>
- <div class="directory-table__column-header-wrapper">
- <DButton
- class="btn-flat bulk-select"
- @icon="list-check"
- @action={{this.toggleBulkSelect}}
- />
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="username"
- @labelKey="username"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- class="directory-table__column-header--username"
- />
- </div>
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="email"
- @labelKey="email"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- class={{if
- this.showEmails
- "directory-table__column-header--email"
- "hidden"
+ {{#if @controller.users}}
+ <ResponsiveTable
+ @className={{concatClass "users-list" @controller.query}}
+ @ariaLabel={{@controller.title}}
+ @style={{htmlSafe
+ (concat
+ "grid-template-columns: minmax(min-content, 2fr) repeat("
+ (htmlSafe @controller.columnCount)
+ ", minmax(min-content, 1fr))"
+ )
}}
- />
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="last_emailed"
- @labelKey="admin.users.last_emailed"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="seen"
- @labelKey="last_seen"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- {{#unless this.showSilenceReason}}
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="topics_viewed"
- @labelKey="admin.user.topics_entered"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- {{/unless}}
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="posts_read"
- @labelKey="admin.user.posts_read_count"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="read_time"
- @labelKey="admin.user.time_read"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="created"
- @labelKey="created"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- />
- {{#if this.showSilenceReason}}
- <TableHeaderToggle
- @onToggle={{this.updateOrder}}
- @field="silence_reason"
- @labelKey="admin.users.silence_reason"
- @order={{this.order}}
- @asc={{this.asc}}
- @automatic={{true}}
- class="directory-table__column-header--silence-reason"
- />
- {{/if}}
- <PluginOutlet
- @name="admin-users-list-thead-after"
- @outletArgs={{hash order=this.order asc=this.asc}}
- />
+ >
+ <:header>
+ <div class="directory-table__column-header-wrapper">
+ <DButton
+ class="btn-flat bulk-select"
+ @icon="list-check"
+ @action={{@controller.toggleBulkSelect}}
+ />
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="username"
+ @labelKey="username"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ class="directory-table__column-header--username"
+ />
+ </div>
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="email"
+ @labelKey="email"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ class={{if
+ @controller.showEmails
+ "directory-table__column-header--email"
+ "hidden"
+ }}
+ />
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="last_emailed"
+ @labelKey="admin.users.last_emailed"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="seen"
+ @labelKey="last_seen"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ {{#unless @controller.showSilenceReason}}
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="topics_viewed"
+ @labelKey="admin.user.topics_entered"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ {{/unless}}
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="posts_read"
+ @labelKey="admin.user.posts_read_count"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="read_time"
+ @labelKey="admin.user.time_read"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="created"
+ @labelKey="created"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ />
+ {{#if @controller.showSilenceReason}}
+ <TableHeaderToggle
+ @onToggle={{@controller.updateOrder}}
+ @field="silence_reason"
+ @labelKey="admin.users.silence_reason"
+ @order={{@controller.order}}
+ @asc={{@controller.asc}}
+ @automatic={{true}}
+ class="directory-table__column-header--silence-reason"
+ />
+ {{/if}}
+ <PluginOutlet
+ @name="admin-users-list-thead-after"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
- {{#if this.siteSettings.must_approve_users}}
- <div class="directory-table__column-header">{{i18n
- "admin.users.approved"
- }}</div>
- {{/if}}
- <div class="directory-table__column-header">&nbsp;</div>
+ {{#if @controller.siteSettings.must_approve_users}}
+ <div class="directory-table__column-header">{{i18n
+ "admin.users.approved"
+ }}</div>
+ {{/if}}
+ <div class="directory-table__column-header">&nbsp;</div>
- </:header>
+ </:header>
- <:body>
- {{#each this.users as |user|}}
- <div
- class="user
- {{user.selected}}
- {{unless user.active 'not-activated'}}
- directory-table__row"
- data-user-id={{user.id}}
- >
- <div class="directory-table__cell username">
- {{#if this.bulkSelect}}
- {{#if user.can_be_deleted}}
- <input
- type="checkbox"
- class="directory-table__cell-bulk-select"
- checked={{eq (get this.bulkSelectedUsersMap user.id) 1}}
- data-user-id={{user.id}}
- {{on "click" (fn this.bulkSelectItemToggle user.id)}}
- />
- {{else}}
- <DTooltip
- @identifier="bulk-delete-unavailable-reason"
- @placement="bottom-start"
- >
- <:trigger>
+ <:body>
+ {{#each @controller.users as |user|}}
+ <div
+ class="user
+ {{user.selected}}
+ {{unless user.active 'not-activated'}}
+ directory-table__row"
+ data-user-id={{user.id}}
+ >
+ <div class="directory-table__cell username">
+ {{#if @controller.bulkSelect}}
+ {{#if user.can_be_deleted}}
<input
type="checkbox"
class="directory-table__cell-bulk-select"
- disabled={{true}}
- />
- </:trigger>
- <:content>
- {{#if user.admin}}
- {{i18n
- "admin.users.bulk_actions.admin_cant_be_deleted"
+ checked={{eq
+ (get @controller.bulkSelectedUsersMap user.id)
+ 1
}}
- {{else}}
- {{i18n
- "admin.users.bulk_actions.too_many_or_old_posts"
+ data-user-id={{user.id}}
+ {{on
+ "click"
+ (fn @controller.bulkSelectItemToggle user.id)
}}
- {{/if}}
- </:content>
- </DTooltip>
+ />
+ {{else}}
+ <DTooltip
+ @identifier="bulk-delete-unavailable-reason"
+ @placement="bottom-start"
+ >
+ <:trigger>
+ <input
+ type="checkbox"
+ class="directory-table__cell-bulk-select"
+ disabled={{true}}
+ />
+ </:trigger>
+ <:content>
+ {{#if user.admin}}
+ {{i18n
+ "admin.users.bulk_actions.admin_cant_be_deleted"
+ }}
+ {{else}}
+ {{i18n
+ "admin.users.bulk_actions.too_many_or_old_posts"
+ }}
+ {{/if}}
+ </:content>
+ </DTooltip>
+ {{/if}}
+ {{/if}}
+ <a
+ class="avatar"
+ href={{user.path}}
+ data-user-card={{user.username}}
+ >
+ {{avatar user imageSize="small"}}
+ </a>
+ <LinkTo @route="adminUser" @model={{user}}>
+ {{user.username}}
+ </LinkTo>
+ {{#if user.staged}}
+ {{icon "far-envelope" title="user.staged"}}
+ {{/if}}
+ </div>
+ <div
+ class="directory-table__cell email
+ {{if @controller.showEmails '' 'hidden'}}"
+ >
+ <span class="directory-table__value">
+ {{~user.email~}}
+ </span>
+ </div>
+
+ {{#if user.last_emailed_at}}
+ <div
+ class="directory-table__cell last-emailed"
+ title={{rawDate user.last_emailed_at}}
+ >
+ <span class="directory-table__label">
+ <span>{{i18n "admin.users.last_emailed"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{formatDuration user.last_emailed_age}}
+ </span>
+ </div>
+ {{else}}
+ <div class="directory-table__cell last-emailed">
+ <span class="directory-table__label">
+ <span>{{i18n "admin.users.last_emailed"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{formatDuration user.last_emailed_age}}
+ </span>
+ </div>
{{/if}}
- {{/if}}
- <a
- class="avatar"
- href={{user.path}}
- data-user-card={{user.username}}
- >
- {{avatar user imageSize="small"}}
- </a>
- <LinkTo @route="adminUser" @model={{user}}>
- {{user.username}}
- </LinkTo>
- {{#if user.staged}}
- {{d-icon "far-envelope" title="user.staged"}}
- {{/if}}
- </div>
- <div
- class="directory-table__cell email
- {{if this.showEmails '' 'hidden'}}"
- >
- <span class="directory-table__value">
- {{~user.email~}}
- </span>
- </div>
- {{#if user.last_emailed_at}}
- <div
- class="directory-table__cell last-emailed"
- title={{raw-date user.last_emailed_at}}
- >
- <span class="directory-table__label">
- <span>{{i18n "admin.users.last_emailed"}}</span>
- </span>
- <span class="directory-table__value">
- {{format-duration user.last_emailed_age}}
- </span>
- </div>
- {{else}}
- <div class="directory-table__cell last-emailed">
- <span class="directory-table__label">
- <span>{{i18n "admin.users.last_emailed"}}</span>
- </span>
- <span class="directory-table__value">
- {{format-duration user.last_emailed_age}}
- </span>
- </div>
- {{/if}}
+ <div
+ class="directory-table__cell last-seen"
+ title={{rawDate user.last_seen_at}}
+ >
+ <span class="directory-table__label">
+ <span>{{i18n "last_seen"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{formatDuration user.last_seen_age}}
+ </span>
+ </div>
- <div
- class="directory-table__cell last-seen"
- title={{raw-date user.last_seen_at}}
- >
- <span class="directory-table__label">
- <span>{{i18n "last_seen"}}</span>
- </span>
- <span class="directory-table__value">
- {{format-duration user.last_seen_age}}
- </span>
- </div>
+ {{#unless @controller.showSilenceReason}}
+ <div class="directory-table__cell topics-entered">
+ <span class="directory-table__label">
+ <span>{{i18n "admin.user.topics_entered"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{number user.topics_entered}}
+ </span>
+ </div>
+ {{/unless}}
+ <div class="directory-table__cell posts-read">
+ <span class="directory-table__label">
+ <span>{{i18n "admin.user.posts_read_count"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{number user.posts_read_count}}
+ </span>
+ </div>
+ <div class="directory-table__cell time-read">
+ <span class="directory-table__label">
+ <span>{{i18n "admin.user.time_read"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{formatDuration user.time_read}}
+ </span>
+ </div>
+ <div
+ class="directory-table__cell created"
+ title={{rawDate user.created_at}}
+ >
+ <span class="directory-table__label">
+ <span>{{i18n "created"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{formatDuration user.created_at_age}}
+ </span>
+ </div>
- {{#unless this.showSilenceReason}}
- <div class="directory-table__cell topics-entered">
- <span class="directory-table__label">
- <span>{{i18n "admin.user.topics_entered"}}</span>
- </span>
- <span class="directory-table__value">
- {{number user.topics_entered}}
- </span>
- </div>
- {{/unless}}
- <div class="directory-table__cell posts-read">
- <span class="directory-table__label">
- <span>{{i18n "admin.user.posts_read_count"}}</span>
- </span>
- <span class="directory-table__value">
- {{number user.posts_read_count}}
- </span>
- </div>
- <div class="directory-table__cell time-read">
- <span class="directory-table__label">
- <span>{{i18n "admin.user.time_read"}}</span>
- </span>
- <span class="directory-table__value">
- {{format-duration user.time_read}}
- </span>
- </div>
- <div
- class="directory-table__cell created"
- title={{raw-date user.created_at}}
- >
- <span class="directory-table__label">
- <span>{{i18n "created"}}</span>
- </span>
- <span class="directory-table__value">
- {{format-duration user.created_at_age}}
- </span>
- </div>
+ {{#if @controller.showSilenceReason}}
+ <div
+ class="directory-table__cell silence_reason"
+ title={{@controller.stripHtml user.silence_reason}}
+ >
+ <span class="directory-table__label">
+ <span>{{i18n "admin.users.silence_reason"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{htmlSafe user.silence_reason}}
+ </span>
+ </div>
+ {{/if}}
- {{#if this.showSilenceReason}}
- <div
- class="directory-table__cell silence_reason"
- title={{this.stripHtml user.silence_reason}}
- >
- <span class="directory-table__label">
- <span>{{i18n "admin.users.silence_reason"}}</span>
- </span>
- <span class="directory-table__value">
- {{html-safe user.silence_reason}}
- </span>
- </div>
- {{/if}}
+ <PluginOutlet
+ @name="admin-users-list-td-after"
+ @outletArgs={{hash user=user [email protected]}}
+ />
- <PluginOutlet
- @name="admin-users-list-td-after"
- @outletArgs={{hash user=user query=this.query}}
- />
+ {{#if @controller.siteSettings.must_approve_users}}
+ <div class="directory-table__cell">
+ <span class="directory-table__label">
+ <span>{{i18n "admin.users.approved"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{i18nYesNo user.approved}}
+ </span>
+ </div>
+ {{/if}}
- {{#if this.siteSettings.must_approve_users}}
- <div class="directory-table__cell">
- <span class="directory-table__label">
- <span>{{i18n "admin.users.approved"}}</span>
- </span>
- <span class="directory-table__value">
- {{i18n-yes-no user.approved}}
- </span>
+ <div
+ class={{concatClass
+ "directory-table__cell"
+ "user-role"
+ (if
+ (not
+ (or
+ user.admin user.moderator user.second_factor_enabled
+ )
+ )
+ "--empty"
+ )
+ }}
+ >
+ <span class="directory-table__label">
+ <span>{{i18n "admin.users.status"}}</span>
+ </span>
+ <span class="directory-table__value">
+ {{#if user.admin}}
+ {{icon "shield-halved" title="admin.title"}}
+ {{/if}}
+ {{#if user.moderator}}
+ {{icon "shield-halved" title="admin.moderator"}}
+ {{/if}}
+ {{#if user.second_factor_enabled}}
+ {{icon "lock" title="admin.user.second_factor_enabled"}}
+ {{/if}}
+ </span>
+ <PluginOutlet
+ @name="admin-users-list-icon"
+ @connectorTagName="div"
+ @outletArgs={{hash user=user [email protected]}}
+ />
+ </div>
</div>
- {{/if}}
-
- <div
- class={{concat-class
- "directory-table__cell"
- "user-role"
- (if
- (not
- (or user.admin user.moderator user.second_factor_enabled)
- )
- "--empty"
- )
- }}
- >
- <span class="directory-table__label">
- <span>{{i18n "admin.users.status"}}</span>
- </span>
- <span class="directory-table__value">
- {{#if user.admin}}
- {{d-icon "shield-halved" title="admin.title"}}
- {{/if}}
- {{#if user.moderator}}
- {{d-icon "shield-halved" title="admin.moderator"}}
- {{/if}}
- {{#if user.second_factor_enabled}}
- {{d-icon "lock" title="admin.user.second_factor_enabled"}}
- {{/if}}
- </span>
- <PluginOutlet
- @name="admin-users-list-icon"
- @connectorTagName="div"
- @outletArgs={{hash user=user query=this.query}}
- />
- </div>
- </div>
- {{/each}}
- </:body>
- </ResponsiveTable>
- {{else if (not this.refreshing)}}
- <p>{{i18n "search.no_results"}}</p>
- {{/if}}
- <ConditionalLoadingSpinner @condition={{this.refreshing}} />
-</LoadMore>
\ No newline at end of file
+ {{/each}}
+ </:body>
+ </ResponsiveTable>
+ {{else if (not @controller.refreshing)}}
+ <p>{{i18n "search.no_results"}}</p>
+ {{/if}}
+ <ConditionalLoadingSpinner @condition={{@controller.refreshing}} />
+ </LoadMore>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/users-list.gjs b/app/assets/javascripts/admin/addon/templates/users-list.gjs
index db840449fcd..7c15e4dd294 100644
--- a/app/assets/javascripts/admin/addon/templates/users-list.gjs
+++ b/app/assets/javascripts/admin/addon/templates/users-list.gjs
@@ -1,83 +1,94 @@
-<div class="admin-users admin-config-page">
- <DPageHeader
- @titleLabel={{i18n "admin.config.users.title"}}
- @descriptionLabel={{i18n "admin.config.users.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/accessing-a-user-s-admin-page/311859"
- >
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/users/list"
- @label={{i18n "admin.config.users.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- {{#if this.currentUser.can_invite_to_forum}}
- <actions.Primary
- @action={{route-action "sendInvites"}}
- @title="admin.invite.button_title"
- @label="admin.invite.button_text"
- class="admin-users__header-send-invites"
- />
- {{/if}}
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import NavItem from "discourse/components/nav-item";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
- {{#if this.currentUser.admin}}
- <actions.Primary
- @action={{route-action "exportUsers"}}
- @title="admin.export_csv.button_title.user"
- @label="admin.export_csv.button_text"
- class="admin-users__header-export-users"
- />
- {{/if}}
- </:actions>
- <:tabs>
- <NavItem
- @route="adminUsersList.show"
- @routeParam="active"
- @label="admin.users.nav.active"
- class="admin-users-tabs__active"
- />
- <NavItem
- @route="adminUsersList.show"
- @routeParam="new"
- @label="admin.users.nav.new"
- class="admin-users-tabs__new"
- />
- <NavItem
- @route="adminUsersList.show"
- @routeParam="staff"
- @label="admin.users.nav.staff"
- class="admin-users-tabs__staff"
- />
- <NavItem
- @route="adminUsersList.show"
- @routeParam="suspended"
- @label="admin.users.nav.suspended"
- class="admin-users-tabs__suspended"
- />
- <NavItem
- @route="adminUsersList.show"
- @routeParam="silenced"
- @label="admin.users.nav.silenced"
- class="admin-users-tabs__silenced"
- />
- <NavItem
- @route="adminUsersList.show"
- @routeParam="staged"
- @label="admin.users.nav.staged"
- class="admin-users-tabs__staged"
- />
- <NavItem
- @route="groups"
- @label="groups.index.title"
- class="admin-users-tabs__groups"
- />
- </:tabs>
- </DPageHeader>
- <div class="admin-container admin-config-page__main-area">
- </div>
-</div>
+export default RouteTemplate(
+ <template>
+ <div class="admin-users admin-config-page">
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.users.title"}}
+ @descriptionLabel={{i18n "admin.config.users.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/accessing-a-user-s-admin-page/311859"
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/users/list"
+ @label={{i18n "admin.config.users.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ {{#if @controller.currentUser.can_invite_to_forum}}
+ <actions.Primary
+ @action={{routeAction "sendInvites"}}
+ @title="admin.invite.button_title"
+ @label="admin.invite.button_text"
+ class="admin-users__header-send-invites"
+ />
+ {{/if}}
-<div class="admin-container admin-config-page__main-area">
- {{outlet}}
-</div>
\ No newline at end of file
+ {{#if @controller.currentUser.admin}}
+ <actions.Primary
+ @action={{routeAction "exportUsers"}}
+ @title="admin.export_csv.button_title.user"
+ @label="admin.export_csv.button_text"
+ class="admin-users__header-export-users"
+ />
+ {{/if}}
+ </:actions>
+ <:tabs>
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="active"
+ @label="admin.users.nav.active"
+ class="admin-users-tabs__active"
+ />
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="new"
+ @label="admin.users.nav.new"
+ class="admin-users-tabs__new"
+ />
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="staff"
+ @label="admin.users.nav.staff"
+ class="admin-users-tabs__staff"
+ />
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="suspended"
+ @label="admin.users.nav.suspended"
+ class="admin-users-tabs__suspended"
+ />
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="silenced"
+ @label="admin.users.nav.silenced"
+ class="admin-users-tabs__silenced"
+ />
+ <NavItem
+ @route="adminUsersList.show"
+ @routeParam="staged"
+ @label="admin.users.nav.staged"
+ class="admin-users-tabs__staged"
+ />
+ <NavItem
+ @route="groups"
+ @label="groups.index.title"
+ class="admin-users-tabs__groups"
+ />
+ </:tabs>
+ </DPageHeader>
+ <div class="admin-container admin-config-page__main-area">
+ </div>
+ </div>
+
+ <div class="admin-container admin-config-page__main-area">
+ {{outlet}}
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/watched-words-action.gjs b/app/assets/javascripts/admin/addon/templates/watched-words-action.gjs
index 5b6f8227c70..0d1397723ec 100644
--- a/app/assets/javascripts/admin/addon/templates/watched-words-action.gjs
+++ b/app/assets/javascripts/admin/addon/templates/watched-words-action.gjs
@@ -1,76 +1,92 @@
-{{#if this.regexpError}}
- <div class="alert alert-error">{{this.regexpError}}</div>
-{{/if}}
+import { Input } from "@ember/component";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import basePath from "discourse/helpers/base-path";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import AdminWatchedWord from "admin/components/admin-watched-word";
+import WatchedWordForm from "admin/components/watched-word-form";
+import WatchedWordUploader from "admin/components/watched-word-uploader";
-<div class="watched-word-controls">
- <DButton
- @href={{this.downloadLink}}
- @icon="download"
- @label="admin.watched_words.download"
- class="btn-default download-link"
- />
+export default RouteTemplate(
+ <template>
+ {{#if @controller.regexpError}}
+ <div class="alert alert-error">{{@controller.regexpError}}</div>
+ {{/if}}
- <WatchedWordUploader
- @uploading={{this.uploading}}
- @actionKey={{this.actionNameKey}}
- @done={{this.uploadComplete}}
- />
+ <div class="watched-word-controls">
+ <DButton
+ @href={{@controller.downloadLink}}
+ @icon="download"
+ @label="admin.watched_words.download"
+ class="btn-default download-link"
+ />
- <DButton
- @label="admin.watched_words.test.button_label"
- @icon="far-eye"
- @action={{this.test}}
- class="btn-default watched-word-test"
- />
+ <WatchedWordUploader
+ @uploading={{@controller.uploading}}
+ @actionKey={{@controller.actionNameKey}}
+ @done={{@controller.uploadComplete}}
+ />
- <DButton
- @label="admin.watched_words.clear_all"
- @icon="trash-can"
- @action={{this.clearAll}}
- class="btn-danger clear-all"
- />
-</div>
+ <DButton
+ @label="admin.watched_words.test.button_label"
+ @icon="far-eye"
+ @action={{@controller.test}}
+ class="btn-default watched-word-test"
+ />
-<p class="about">{{this.actionDescription}}</p>
+ <DButton
+ @label="admin.watched_words.clear_all"
+ @icon="trash-can"
+ @action={{@controller.clearAll}}
+ class="btn-danger clear-all"
+ />
+ </div>
-{{#if this.siteSettings.watched_words_regular_expressions}}
- <p>
- {{html-safe
- (i18n "admin.watched_words.regex_warning" basePath=(base-path))
- }}
- </p>
-{{/if}}
+ <p class="about">{{@controller.actionDescription}}</p>
-<WatchedWordForm
- @actionKey={{this.actionNameKey}}
- @action={{this.recordAdded}}
- @filteredContent={{this.currentAction.words}}
-/>
+ {{#if @controller.siteSettings.watched_words_regular_expressions}}
+ <p>
+ {{htmlSafe
+ (i18n "admin.watched_words.regex_warning" basePath=(basePath))
+ }}
+ </p>
+ {{/if}}
-{{#if this.currentAction.words}}
- <label class="show-words-checkbox">
- <Input
- @type="checkbox"
- @checked={{this.adminWatchedWords.showWords}}
- disabled={{this.adminWatchedWords.disableShowWords}}
+ <WatchedWordForm
+ @actionKey={{@controller.actionNameKey}}
+ @action={{@controller.recordAdded}}
+ @filteredContent={{@controller.currentAction.words}}
/>
- {{i18n
- "admin.watched_words.show_words"
- count=this.currentAction.words.length
- }}
- </label>
-{{/if}}
-{{#if this.showWordsList}}
- <div class="watched-words-list watched-words-{{this.actionNameKey}}">
- {{#each this.currentAction.words as |word|}}
- <div class="watched-word-box">
- <AdminWatchedWord
- @actionKey={{this.actionNameKey}}
- @word={{word}}
- @action={{this.recordRemoved}}
+ {{#if @controller.currentAction.words}}
+ <label class="show-words-checkbox">
+ <Input
+ @type="checkbox"
+ @checked={{@controller.adminWatchedWords.showWords}}
+ disabled={{@controller.adminWatchedWords.disableShowWords}}
/>
+ {{i18n
+ "admin.watched_words.show_words"
+ }}
+ </label>
+ {{/if}}
+
+ {{#if @controller.showWordsList}}
+ <div
+ class="watched-words-list watched-words-{{@controller.actionNameKey}}"
+ >
+ {{#each @controller.currentAction.words as |word|}}
+ <div class="watched-word-box">
+ <AdminWatchedWord
+ @actionKey={{@controller.actionNameKey}}
+ @word={{word}}
+ @action={{@controller.recordRemoved}}
+ />
+ </div>
+ {{/each}}
</div>
- {{/each}}
- </div>
-{{/if}}
\ No newline at end of file
+ {{/if}}
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/watched-words.gjs b/app/assets/javascripts/admin/addon/templates/watched-words.gjs
index 172f492ada7..68cf42549f6 100644
--- a/app/assets/javascripts/admin/addon/templates/watched-words.gjs
+++ b/app/assets/javascripts/admin/addon/templates/watched-words.gjs
@@ -1,54 +1,73 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.watched_words.title"}}
- @descriptionLabel={{i18n "admin.config.watched_words.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/t/241735"
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/customize/watched_words"
- @label={{i18n "admin.config.watched_words.title"}}
- />
- </:breadcrumbs>
-</DPageHeader>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DButton from "discourse/components/d-button";
+import DPageHeader from "discourse/components/d-page-header";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
-<div class="admin-contents">
- <div class="admin-controls">
- <div class="controls">
- <div class="inline-form">
- <DButton @action={{this.toggleMenu}} @icon="bars" class="menu-toggle" />
- <TextField
- @value={{this.filter}}
- @placeholderKey="admin.watched_words.search"
- class="no-blur"
- />
- <DButton
- @action={{this.clearFilter}}
- @label="admin.watched_words.clear_filter"
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.watched_words.title"}}
+ @descriptionLabel={{i18n "admin.config.watched_words.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/241735"
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/customize/watched_words"
+ @label={{i18n "admin.config.watched_words.title"}}
/>
+ </:breadcrumbs>
+ </DPageHeader>
+
+ <div class="admin-contents">
+ <div class="admin-controls">
+ <div class="controls">
+ <div class="inline-form">
+ <DButton
+ @action={{@controller.toggleMenu}}
+ @icon="bars"
+ class="menu-toggle"
+ />
+ <TextField
+ @value={{@controller.filter}}
+ @placeholderKey="admin.watched_words.search"
+ class="no-blur"
+ />
+ <DButton
+ @action={{@controller.clearFilter}}
+ @label="admin.watched_words.clear_filter"
+ />
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div class="admin-nav pull-left">
- <ul class="nav nav-stacked">
- {{#each this.model as |action|}}
- <li class={{action.nameKey}}>
- <LinkTo @route="adminWatchedWords.action" @model={{action.nameKey}}>
- {{action.name}}
- {{#if action.words}}<span
- class="count"
- >({{action.words.length}})</span>{{/if}}
- </LinkTo>
- </li>
- {{/each}}
- </ul>
- </div>
+ <div class="admin-nav pull-left">
+ <ul class="nav nav-stacked">
+ {{#each @controller.model as |watchedWordAction|}}
+ <li class={{watchedWordAction.nameKey}}>
+ <LinkTo
+ @route="adminWatchedWords.action"
+ @model={{watchedWordAction.nameKey}}
+ >
+ {{watchedWordAction.name}}
+ {{#if watchedWordAction.words}}<span
+ class="count"
+ >({{watchedWordAction.words.length}})</span>{{/if}}
+ </LinkTo>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
- <div class="admin-detail pull-left mobile-closed watched-words-detail">
- {{outlet}}
- </div>
+ <div class="admin-detail pull-left mobile-closed watched-words-detail">
+ {{outlet}}
+ </div>
- <div class="clearfix"></div>
-</div>
\ No newline at end of file
+ <div class="clearfix"></div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-edit.gjs b/app/assets/javascripts/admin/addon/templates/web-hooks-edit.gjs
index f2a8602e3b3..c416c335fe3 100644
--- a/app/assets/javascripts/admin/addon/templates/web-hooks-edit.gjs
+++ b/app/assets/javascripts/admin/addon/templates/web-hooks-edit.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::WebhooksForm @webhook={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import WebhooksForm from "admin/components/admin-config-areas/webhooks-form";
+
+export default RouteTemplate(
+ <template><WebhooksForm @webhook={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-index.gjs b/app/assets/javascripts/admin/addon/templates/web-hooks-index.gjs
index a6307232c8a..8d0e80737ba 100644
--- a/app/assets/javascripts/admin/addon/templates/web-hooks-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/web-hooks-index.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::WebhooksList @webhooks={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import WebhooksList from "admin/components/admin-config-areas/webhooks-list";
+
+export default RouteTemplate(
+ <template><WebhooksList @webhooks={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-new.gjs b/app/assets/javascripts/admin/addon/templates/web-hooks-new.gjs
index f2a8602e3b3..c416c335fe3 100644
--- a/app/assets/javascripts/admin/addon/templates/web-hooks-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/web-hooks-new.gjs
@@ -1 +1,6 @@
-<AdminConfigAreas::WebhooksForm @webhook={{this.model}} />
\ No newline at end of file
+import RouteTemplate from "ember-route-template";
+import WebhooksForm from "admin/components/admin-config-areas/webhooks-form";
+
+export default RouteTemplate(
+ <template><WebhooksForm @webhook={{@controller.model}} /></template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-show.gjs b/app/assets/javascripts/admin/addon/templates/web-hooks-show.gjs
index d92f3e8236d..7c5920d28c7 100644
--- a/app/assets/javascripts/admin/addon/templates/web-hooks-show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/web-hooks-show.gjs
@@ -1,34 +1,48 @@
-<LinkTo @route="adminWebHooks" class="go-back">
- {{d-icon "arrow-left"}}
- {{i18n "admin.web_hooks.back"}}
-</LinkTo>
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import WebhookEvents from "admin/components/webhook-events";
-<div class="admin-webhooks__summary">
- <h1>
- {{this.model.payload_url}}
+export default RouteTemplate(
+ <template>
+ <LinkTo @route="adminWebHooks" class="go-back">
+ {{icon "arrow-left"}}
+ {{i18n "admin.web_hooks.back"}}
+ </LinkTo>
- <DButton
- @action={{this.edit}}
- @icon="far-pen-to-square"
- @title="admin.web_hooks.edit"
- class="no-text admin-webhooks__edit-button"
- />
+ <div class="admin-webhooks__summary">
+ <h1>
+ {{@controller.model.payload_url}}
- <DButton
- @action={{this.destroyWebhook}}
- @icon="xmark"
- @title="delete"
- class="destroy btn-danger admin-webhooks__delete-button"
- />
- </h1>
+ <DButton
+ @action={{@controller.edit}}
+ @icon="far-pen-to-square"
+ @title="admin.web_hooks.edit"
+ class="no-text admin-webhooks__edit-button"
+ />
- <div>
- <span class="admin-webhooks__description-label">
- {{i18n "admin.web_hooks.description_label"}}:
- </span>
+ <DButton
+ @action={{@controller.destroyWebhook}}
+ @icon="xmark"
+ @title="delete"
+ class="destroy btn-danger admin-webhooks__delete-button"
+ />
+ </h1>
- {{this.model.description}}
- </div>
-</div>
+ <div>
+ <span class="admin-webhooks__description-label">
+ {{i18n "admin.web_hooks.description_label"}}:
+ </span>
-<WebhookEvents @webhookId={{this.model.id}} @status={{this.status}} />
\ No newline at end of file
+ {{@controller.model.description}}
+ </div>
+ </div>
+
+ <WebhookEvents
+ @webhookId={{@controller.model.id}}
+ @status={{@controller.status}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/admin/addon/templates/whats-new.gjs b/app/assets/javascripts/admin/addon/templates/whats-new.gjs
index 0f2a3260de1..1de290ec071 100644
--- a/app/assets/javascripts/admin/addon/templates/whats-new.gjs
+++ b/app/assets/javascripts/admin/addon/templates/whats-new.gjs
@@ -1,26 +1,38 @@
-<DPageHeader
- @titleLabel={{i18n "admin.config.whats_new.title"}}
- @descriptionLabel={{i18n "admin.config.whats_new.header_description"}}
- @learnMoreUrl="https://meta.discourse.org/tags/c/announcements/67/release-notes"
- @hideTabs={{true}}
->
- <:breadcrumbs>
- <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
- <DBreadcrumbsItem
- @path="/admin/whats-new"
- @label={{i18n "admin.config.whats_new.title"}}
- />
- </:breadcrumbs>
- <:actions as |actions|>
- <actions.Primary
- @label="admin.new_features.check_for_updates"
- @action={{this.checkForUpdates}}
- />
- </:actions>
-</DPageHeader>
+import RouteTemplate from "ember-route-template";
+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
+import DPageHeader from "discourse/components/d-page-header";
+import { i18n } from "discourse-i18n";
+import DashboardNewFeatures from "admin/components/dashboard-new-features";
-<div class="admin-container admin-config-page__main-area">
- <div class="admin-config-area">
- <DashboardNewFeatures @onCheckForFeatures={{this.bindCheckFeatures}} />
- </div>
-</div>
\ No newline at end of file
+export default RouteTemplate(
+ <template>
+ <DPageHeader
+ @titleLabel={{i18n "admin.config.whats_new.title"}}
+ @descriptionLabel={{i18n "admin.config.whats_new.header_description"}}
+ @learnMoreUrl="https://meta.discourse.org/tags/c/announcements/67/release-notes"
+ @hideTabs={{true}}
+ >
+ <:breadcrumbs>
+ <DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
+ <DBreadcrumbsItem
+ @path="/admin/whats-new"
+ @label={{i18n "admin.config.whats_new.title"}}
+ />
+ </:breadcrumbs>
+ <:actions as |actions|>
+ <actions.Primary
+ @label="admin.new_features.check_for_updates"
+ @action={{@controller.checkForUpdates}}
+ />
+ </:actions>
+ </DPageHeader>
+
+ <div class="admin-container admin-config-page__main-area">
+ <div class="admin-config-area">
+ <DashboardNewFeatures
+ @onCheckForFeatures={{@controller.bindCheckFeatures}}
+ />
+ </div>
+ </div>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs
index 709f40e1374..dfa37569ac5 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs
@@ -344,10 +344,6 @@ export default class Item extends Component {
class="badge-notification new-topic"
></span></span>
{{~/if~}}
- <PluginOutlet
- @name="topic-list-after-badges"
- @outletArgs={{hash topic=@topic}}
- />
{{~#if this.expandPinned~}}
<TopicExcerpt @topic={{@topic}} />
{{~/if~}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs
index 62080f864af..0c801ab318f 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/item/topic-cell.gjs
@@ -93,10 +93,6 @@ export default class TopicCell extends Component {
@url={{@topic.lastUnreadUrl}}
/>
{{~/if~}}
- <PluginOutlet
- @name="topic-list-after-badges"
- @outletArgs={{hash topic=@topic}}
- />
</PluginOutlet>
</span>
diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-plugin-config-area-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/admin-plugin-config-area-test.gjs
index fae6caff69b..2c8d957efc5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/admin-plugin-config-area-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-plugin-config-area-test.gjs
@@ -1,9 +1,9 @@
import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { registerAdminPluginConfigNav } from "discourse/lib/admin-plugin-config-nav";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
+import AdminPluginConfigArea from "admin/components/admin-plugin-config-area";
import AdminPlugin from "admin/models/admin-plugin";
module("Integration | Component | admin-plugin-config-area", function (hooks) {
@@ -23,11 +23,13 @@ module("Integration | Component | admin-plugin-config-area", function (hooks) {
getOwner(this).lookup("service:admin-plugin-nav-manager").currentPlugin =
new AdminPlugin({ id: "discourse-test-plugin" });
- await render(hbs`
- <AdminPluginConfigArea>
- Test content
- </AdminPluginConfigArea>
- `);
+ await render(
+ <template>
+ <AdminPluginConfigArea>
+ Test content
+ </AdminPluginConfigArea>
+ </template>
+ );
assert
.dom(".admin-plugin-inner-sidebar-nav__item")
diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-plugins-list-item-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
index 1e4619eabb7..d2782d7a02d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-plugins-list-item-test.gjs
@@ -1,8 +1,8 @@
import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
+import AdminPluginsListItem from "admin/components/admin-plugins-list-item";
module("Integration | Component | admin-plugins-list-item", function (hooks) {
setupRenderingTest(hooks);
@@ -23,11 +23,15 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
}
test("settings link route", async function (assert) {
+ const self = this;
+
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert
.dom(".admin-plugins-list__settings a")
@@ -37,7 +41,9 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
);
this.plugin.adminRoute.use_new_show_route = true;
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert
.dom(".admin-plugins-list__settings a")
@@ -45,30 +51,42 @@ module("Integration | Component | admin-plugins-list-item", function (hooks) {
});
test("settings link show or hide", async function (assert) {
+ const self = this;
+
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert.dom(".admin-plugins-list__settings a").exists();
this.plugin.hasSettings = false;
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert.dom(".admin-plugins-list__settings a").doesNotExist();
});
test("settings link disabled if only the enabled setting exists", async function (assert) {
+ const self = this;
+
this.currentUser.admin = true;
const store = getOwner(this).lookup("service:store");
this.plugin = store.createRecord("admin-plugin", pluginAttrs());
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert.dom(".admin-plugins-list__settings a.disabled").doesNotExist();
this.plugin.hasOnlyEnabledSetting = true;
- await render(hbs`<AdminPluginsListItem @plugin={{this.plugin}} />`);
+ await render(
+ <template><AdminPluginsListItem @plugin={{self.plugin}} /></template>
+ );
assert.dom(".admin-plugins-list__settings a.disabled").exists();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.gjs
index 6f1d35664ee..db689a9020d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.gjs
@@ -1,15 +1,20 @@
import { click, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
+import AdminReport from "admin/components/admin-report";
module("Integration | Component | admin-report", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
await render(
- hbs`<AdminReport @dataSourceName="signups" @showDescriptionInTooltip={{false}} />`
+ <template>
+ <AdminReport
+ @dataSourceName="signups"
+ @showDescriptionInTooltip={{false}}
+ />
+ </template>
);
assert.dom(".admin-report.signups").exists();
@@ -50,6 +55,8 @@ module("Integration | Component | admin-report", function (hooks) {
});
test("options", async function (assert) {
+ const self = this;
+
this.set("options", {
table: {
perPage: 4,
@@ -58,7 +65,12 @@ module("Integration | Component | admin-report", function (hooks) {
});
await render(
- hbs`<AdminReport @dataSourceName="signups" @reportOptions={{this.options}} />`
+ <template>
+ <AdminReport
+ @dataSourceName="signups"
+ @reportOptions={{self.options}}
+ />
+ </template>
);
assert.dom(".pagination").exists("paginates the results");
@@ -71,7 +83,9 @@ module("Integration | Component | admin-report", function (hooks) {
test("switch modes", async function (assert) {
await render(
- hbs`<AdminReport @dataSourceName="signups" @showFilteringUI={{true}} />`
+ <template>
+ <AdminReport @dataSourceName="signups" @showFilteringUI={{true}} />
+ </template>
);
await click(".mode-btn.chart");
@@ -81,19 +95,23 @@ module("Integration | Component | admin-report", function (hooks) {
});
test("timeout", async function (assert) {
- await render(hbs`<AdminReport @dataSourceName="signups_timeout" />`);
+ await render(
+ <template><AdminReport @dataSourceName="signups_timeout" /></template>
+ );
assert.dom(".alert-error.timeout").exists("displays a timeout error");
});
test("no data", async function (assert) {
- await render(hbs`<AdminReport @dataSourceName="posts" />`);
+ await render(<template><AdminReport @dataSourceName="posts" /></template>);
assert.dom(".no-data").exists("displays a no data alert");
});
test("exception", async function (assert) {
- await render(hbs`<AdminReport @dataSourceName="signups_exception" />`);
+ await render(
+ <template><AdminReport @dataSourceName="signups_exception" /></template>
+ );
assert.dom(".alert-error.exception").exists("displays an error");
});
@@ -109,7 +127,11 @@ module("Integration | Component | admin-report", function (hooks) {
})
);
- await render(hbs`<AdminReport @dataSourceName="signups_rate_limited" />`);
+ await render(
+ <template>
+ <AdminReport @dataSourceName="signups_rate_limited" />
+ </template>
+ );
assert
.dom(".alert-error.rate-limited")
@@ -117,7 +139,9 @@ module("Integration | Component | admin-report", function (hooks) {
});
test("post edits", async function (assert) {
- await render(hbs`<AdminReport @dataSourceName="post_edits" />`);
+ await render(
+ <template><AdminReport @dataSourceName="post_edits" /></template>
+ );
assert
.dom(".admin-report.post-edits")
@@ -125,7 +149,9 @@ module("Integration | Component | admin-report", function (hooks) {
});
test("not found", async function (assert) {
- await render(hbs`<AdminReport @dataSourceName="not_found" />`);
+ await render(
+ <template><AdminReport @dataSourceName="not_found" /></template>
+ );
assert.dom(".alert-error.not-found").exists("displays a not found error");
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/compact-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/compact-list-test.gjs
index 74053b75881..61c9b0699f1 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/compact-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/compact-list-test.gjs
@@ -1,14 +1,16 @@
import EmberObject from "@ember/object";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import SiteSetting from "admin/components/site-setting";
module("Integration | Component | compact-list site-setting", function (hooks) {
setupRenderingTest(hooks);
test("mandatory values", async function (assert) {
+ const self = this;
+
this.set(
"setting",
EmberObject.create({
@@ -28,7 +30,9 @@ module("Integration | Component | compact-list site-setting", function (hooks) {
})
);
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
const subject = selectKit(".list-setting");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/emoji-uploader-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/emoji-uploader-test.gjs
index 787ae73d02b..f8516d2b498 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/emoji-uploader-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/emoji-uploader-test.gjs
@@ -1,10 +1,10 @@
import { fillIn, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
import { createFile } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import EmojiUploader from "admin/components/emoji-uploader";
let requestNumber;
@@ -38,13 +38,17 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("uses the selected group for the upload", async function (assert) {
- await render(hbs`
- <EmojiUploader
- @id="emoji-uploader"
- @emojiGroups={{this.emojiGroups}}
- @done={{this.doneUpload}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <EmojiUploader
+ @id="emoji-uploader"
+ @emojiGroups={{self.emojiGroups}}
+ @done={{self.doneUpload}}
+ />
+ </template>
+ );
const done = assert.async();
await selectKit("#emoji-group-selector").expand();
@@ -62,13 +66,17 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("does not clear the selected group between multiple uploads", async function (assert) {
- await render(hbs`
- <EmojiUploader
- @id="emoji-uploader"
- @emojiGroups={{this.emojiGroups}}
- @done={{this.doneUpload}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <EmojiUploader
+ @id="emoji-uploader"
+ @emojiGroups={{self.emojiGroups}}
+ @done={{self.doneUpload}}
+ />
+ </template>
+ );
const done = assert.async();
await selectKit("#emoji-group-selector").expand();
@@ -93,13 +101,17 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("clears the name after the first upload to avoid duplicate names", async function (assert) {
- await render(hbs`
- <EmojiUploader
- @id="emoji-uploader"
- @emojiGroups={{this.emojiGroups}}
- @done={{this.doneUpload}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <EmojiUploader
+ @id="emoji-uploader"
+ @emojiGroups={{self.emojiGroups}}
+ @done={{self.doneUpload}}
+ />
+ </template>
+ );
const done = assert.async();
await selectKit("#emoji-group-selector").expand();
@@ -128,14 +140,18 @@ module("Integration | Component | emoji-uploader", function (hooks) {
});
test("sets the created_by field with username", async function (assert) {
- await render(hbs`
- <EmojiUploader
- @id="emoji-uploader"
- @emojiGroups={{this.emojiGroups}}
- @createdBy={{this.createdBy}}
- @done={{this.doneUpload}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <EmojiUploader
+ @id="emoji-uploader"
+ @emojiGroups={{self.emojiGroups}}
+ @createdBy={{self.createdBy}}
+ @done={{self.doneUpload}}
+ />
+ </template>
+ );
const done = assert.async();
diff --git a/app/assets/javascripts/discourse/tests/integration/components/file-size-input-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/file-size-input-test.gjs
index 2706debdb95..909c1cf4b7f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/file-size-input-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/file-size-input-test.gjs
@@ -1,27 +1,31 @@
import { click, fillIn, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import FileSizeInput from "admin/components/file-size-input";
module("Integration | Component | file-size-input", function (hooks) {
setupRenderingTest(hooks);
test("file size unit selector kb", async function (assert) {
+ const self = this;
+
this.set("value", 1023);
this.set("max", 4096);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
- await render(hbs`
- <FileSizeInput
- @sizeValueKB={{readonly this.value}}
- class="file-size-input-test"
- @onChangeSize={{this.onChangeSize}}
- @setValidationMessage={{this.setValidationMessage}}
- @max=4096
- />
- `);
+ await render(
+ <template>
+ <FileSizeInput
+ @sizeValueKB={{readonly self.value}}
+ class="file-size-input-test"
+ @onChangeSize={{self.onChangeSize}}
+ @setValidationMessage={{self.setValidationMessage}}
+ @max="4096"
+ />
+ </template>
+ );
assert.dom(".file-size-input").hasValue("1023", "value is present");
assert.strictEqual(
@@ -32,19 +36,23 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit is mb when the starting value is 1mb or more", async function (assert) {
+ const self = this;
+
this.set("value", 1024);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
- await render(hbs`
- <FileSizeInput
- @sizeValueKB={{readonly this.value}}
- class="file-size-input-test"
- @onChangeSize={{this.onChangeSize}}
- @setValidationMessage={{this.setValidationMessage}}
- @max=4096
- />
- `);
+ await render(
+ <template>
+ <FileSizeInput
+ @sizeValueKB={{readonly self.value}}
+ class="file-size-input-test"
+ @onChangeSize={{self.onChangeSize}}
+ @setValidationMessage={{self.setValidationMessage}}
+ @max="4096"
+ />
+ </template>
+ );
assert.dom(".file-size-input").hasValue("1", "value is present");
assert.strictEqual(
@@ -55,19 +63,23 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit is gb when the starting value is 1gb or more", async function (assert) {
+ const self = this;
+
this.set("value", 1024 * 1024);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
- await render(hbs`
- <FileSizeInput
- @sizeValueKB={{readonly this.value}}
- class="file-size-input-test"
- @onChangeSize={{this.onChangeSize}}
- @setValidationMessage={{this.setValidationMessage}}
- @max=4096
- />
- `);
+ await render(
+ <template>
+ <FileSizeInput
+ @sizeValueKB={{readonly self.value}}
+ class="file-size-input-test"
+ @onChangeSize={{self.onChangeSize}}
+ @setValidationMessage={{self.setValidationMessage}}
+ @max="4096"
+ />
+ </template>
+ );
assert.dom(".file-size-input").hasValue("1", "value is present");
assert.strictEqual(
@@ -78,20 +90,24 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size unit selector", async function (assert) {
+ const self = this;
+
this.set("value", 4096);
this.set("max", 8192);
this.set("onChangeSize", () => {});
this.set("setValidationMessage", () => {});
- await render(hbs`
- <FileSizeInput
- @sizeValueKB={{readonly this.value}}
- class="file-size-input-test"
- @onChangeSize={{this.onChangeSize}}
- @setValidationMessage={{this.setValidationMessage}}
- @max=4096
- />
- `);
+ await render(
+ <template>
+ <FileSizeInput
+ @sizeValueKB={{readonly self.value}}
+ class="file-size-input-test"
+ @onChangeSize={{self.onChangeSize}}
+ @setValidationMessage={{self.setValidationMessage}}
+ @max="4096"
+ />
+ </template>
+ );
await click(".file-size-unit-selector");
@@ -138,6 +154,8 @@ module("Integration | Component | file-size-input", function (hooks) {
});
test("file size input error message", async function (assert) {
+ const self = this;
+
this.set("value", 4096);
this.set("max", 8192);
this.set("min", 2048);
@@ -148,16 +166,18 @@ module("Integration | Component | file-size-input", function (hooks) {
};
this.set("setValidationMessage", setValidationMessage);
- await render(hbs`
- <FileSizeInput
- @sizeValueKB={{readonly this.value}}
- class="file-size-input-test"
- @onChangeSize={{this.onChangeSize}}
- @setValidationMessage={{this.setValidationMessage}}
- @max={{this.max}}
- @min={{this.min}}
- />
- `);
+ await render(
+ <template>
+ <FileSizeInput
+ @sizeValueKB={{readonly self.value}}
+ class="file-size-input-test"
+ @onChangeSize={{self.onChangeSize}}
+ @setValidationMessage={{self.setValidationMessage}}
+ @max={{self.max}}
+ @min={{self.min}}
+ />
+ </template>
+ );
await fillIn(".file-size-input", 12);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.gjs
index 9f7d879ef81..7e4b9e851cf 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.gjs
@@ -1,14 +1,16 @@
import EmberObject from "@ember/object";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import SiteSetting from "admin/components/site-setting";
module("Integration | Component | group-list site-setting", function (hooks) {
setupRenderingTest(hooks);
test("default", async function (assert) {
+ const self = this;
+
this.site.groups = [
{
id: 1,
@@ -38,7 +40,9 @@ module("Integration | Component | group-list site-setting", function (hooks) {
})
);
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
const subject = selectKit(".list-setting");
@@ -59,6 +63,8 @@ module("Integration | Component | group-list site-setting", function (hooks) {
});
test("mandatory values", async function (assert) {
+ const self = this;
+
this.site.groups = [
{
id: 1,
@@ -89,7 +95,9 @@ module("Integration | Component | group-list site-setting", function (hooks) {
})
);
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
const subject = selectKit(".list-setting");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.gjs
index 75569eb696c..85a94d9a868 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.gjs
@@ -1,21 +1,25 @@
import { blur, click, fillIn, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { i18n } from "discourse-i18n";
+import SecretValueList from "admin/components/secret-value-list";
module("Integration | Component | secret-value-list", function (hooks) {
setupRenderingTest(hooks);
test("adding a value", async function (assert) {
+ const self = this;
+
this.set("setValidationMessage", () => {});
- await render(hbs`
- <SecretValueList
- @values={{this.values}}
- @setValidationMessage={{this.setValidationMessage}}
- />
- `);
+ await render(
+ <template>
+ <SecretValueList
+ @values={{self.values}}
+ @setValidationMessage={{self.setValidationMessage}}
+ />
+ </template>
+ );
this.set("values", "firstKey|FirstValue\nsecondKey|secondValue");
@@ -56,17 +60,21 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("adding an invalid value", async function (assert) {
+ const self = this;
+
let setValidationMessage = (message) => {
this.set("message", message);
};
this.set("setValidationMessage", setValidationMessage);
- await render(hbs`
- <SecretValueList
- @values={{this.values}}
- @setValidationMessage={{this.setValidationMessage}}
- />
- `);
+ await render(
+ <template>
+ <SecretValueList
+ @values={{self.values}}
+ @setValidationMessage={{self.setValidationMessage}}
+ />
+ </template>
+ );
await fillIn(".new-value-input.key", "someString");
await fillIn(".new-value-input.secret", "keyWithAPipe|Hidden");
@@ -90,14 +98,18 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("changing a value", async function (assert) {
+ const self = this;
+
this.set("setValidationMessage", () => {});
- await render(hbs`
- <SecretValueList
- @values={{this.values}}
- @setValidationMessage={{this.setValidationMessage}}
- />
- `);
+ await render(
+ <template>
+ <SecretValueList
+ @values={{self.values}}
+ @setValidationMessage={{self.setValidationMessage}}
+ />
+ </template>
+ );
this.set("values", "firstKey|FirstValue\nsecondKey|secondValue");
@@ -128,14 +140,18 @@ module("Integration | Component | secret-value-list", function (hooks) {
});
test("removing a value", async function (assert) {
+ const self = this;
+
this.set("setValidationMessage", () => {});
- await render(hbs`
- <SecretValueList
- @values={{this.values}}
- @setValidationMessage={{this.setValidationMessage}}
- />
- `);
+ await render(
+ <template>
+ <SecretValueList
+ @values={{self.values}}
+ @setValidationMessage={{self.setValidationMessage}}
+ />
+ </template>
+ );
this.set("values", "firstKey|FirstValue\nsecondKey|secondValue");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.gjs
index 2a5f65053fb..6da38cc65ac 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.gjs
@@ -5,17 +5,19 @@ import {
render,
triggerKeyEvent,
} from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
+import SimpleList from "admin/components/simple-list";
module("Integration | Component | simple-list", function (hooks) {
setupRenderingTest(hooks);
test("adding a value", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
- await render(hbs`<SimpleList @values={{this.values}} />`);
+ await render(<template><SimpleList @values={{self.values}} /></template>);
assert
.dom(".add-value-btn[disabled]")
@@ -41,11 +43,19 @@ module("Integration | Component | simple-list", function (hooks) {
});
test("adding a value when list is predefined", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
this.set("choices", ["vinkas", "osama", "kris"]);
await render(
- hbs`<SimpleList @values={{this.values}} @allowAny={{false}} @choices={{this.choices}}/>`
+ <template>
+ <SimpleList
+ @values={{self.values}}
+ @allowAny={{false}}
+ @choices={{self.choices}}
+ />
+ </template>
);
await click(".add-value-input summary");
@@ -58,6 +68,8 @@ module("Integration | Component | simple-list", function (hooks) {
});
test("changing a value", async function (assert) {
+ const self = this;
+
const done = assert.async();
this.set("values", "vinkas\nosama");
@@ -67,7 +79,9 @@ module("Integration | Component | simple-list", function (hooks) {
});
await render(
- hbs`<SimpleList @values={{this.values}} @onChange={{this.onChange}} />`
+ <template>
+ <SimpleList @values={{self.values}} @onChange={{self.onChange}} />
+ </template>
);
await fillIn(".values .value[data-index='1'] .value-input", "jarek");
@@ -77,9 +91,11 @@ module("Integration | Component | simple-list", function (hooks) {
});
test("removing a value", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
- await render(hbs`<SimpleList @values={{this.values}} />`);
+ await render(<template><SimpleList @values={{self.values}} /></template>);
await click(".values .value[data-index='0'] .remove-value-btn");
@@ -93,10 +109,14 @@ module("Integration | Component | simple-list", function (hooks) {
});
test("delimiter support", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas|osama");
await render(
- hbs`<SimpleList @values={{this.values}} @inputDelimiter="|" />`
+ <template>
+ <SimpleList @values={{self.values}} @inputDelimiter="|" />
+ </template>
);
await fillIn(".add-value-input", "eviltrout");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.gjs
index 4ae31976899..1aecd495a4c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/site-setting-test.gjs
@@ -1,28 +1,34 @@
import EmberObject from "@ember/object";
import { click, fillIn, render, typeIn } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, skip, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
+import SiteSetting from "admin/components/site-setting";
module("Integration | Component | site-setting", function (hooks) {
setupRenderingTest(hooks);
test("displays host-list setting value", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "blocked_onebox_domains",
value: "a.com|b.com",
type: "host_list",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert.dom(".formatted-selection").hasText("a.com, b.com");
});
test("Error response with html_message is rendered as HTML", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "test_setting",
value: "",
@@ -35,7 +41,9 @@ module("Integration | Component | site-setting", function (hooks) {
return response(422, { html_message: true, errors: [message] });
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".setting input", "value");
await click(".setting .d-icon-check");
@@ -43,6 +51,8 @@ module("Integration | Component | site-setting", function (hooks) {
});
test("Error response without html_message is not rendered as HTML", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "test_setting",
value: "",
@@ -55,7 +65,9 @@ module("Integration | Component | site-setting", function (hooks) {
return response(422, { errors: [message] });
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".setting input", "value");
await click(".setting .d-icon-check");
@@ -63,13 +75,17 @@ module("Integration | Component | site-setting", function (hooks) {
});
test("displays file types list setting", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "theme_authorized_extensions",
value: "jpg|jpeg|png",
type: "file_types_list",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert.dom(".formatted-selection").hasText("jpg, jpeg, png");
@@ -88,25 +104,33 @@ module("Integration | Component | site-setting", function (hooks) {
// Skipping for now because ember-test-helpers doesn't check for defaultPrevented when firing that event chain
skip("prevents decimal in integer setting input", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "suggested_topics_unread_max_days_old",
value: "",
type: "integer",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await typeIn(".input-setting-integer", "90,5", { delay: 1000 });
assert.dom(".input-setting-integer").hasValue("905");
});
test("does not consider an integer setting overridden if the value is the same as the default", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "suggested_topics_unread_max_days_old",
value: "99",
default: "99",
type: "integer",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".input-setting-integer", "90");
assert.dom(".input-setting-integer").hasValue("90");
await fillIn(".input-setting-integer", "99");
@@ -122,6 +146,8 @@ module(
setupRenderingTest(hooks);
test("shows the reset button when the value has been changed from the default", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "2048",
@@ -131,11 +157,15 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert.dom(".setting-controls__undo").exists("reset button is shown");
});
test("doesn't show the reset button when the value is the same as the default", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1024",
@@ -145,13 +175,17 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert
.dom(".setting-controls__undo")
.doesNotExist("reset button is not shown");
});
test("shows validation error when the value exceeds the max limit", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1024",
@@ -161,7 +195,9 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".file-size-input", "5000");
assert.dom(".validation-error").hasText(
@@ -176,6 +212,8 @@ module(
});
test("shows validation error when the value is below the min limit", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1000",
@@ -185,7 +223,9 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".file-size-input", "100");
assert.dom(".validation-error").hasText(
@@ -200,6 +240,8 @@ module(
});
test("cancelling pending changes resets the value and removes validation error", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1000",
@@ -209,7 +251,9 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".file-size-input", "100");
assert.dom(".validation-error").hasNoClass("hidden");
@@ -222,6 +266,8 @@ module(
});
test("resetting to the default value changes the content of input field", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1000",
@@ -231,7 +277,9 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert
.dom(".file-size-input")
.hasValue("1000", "the input field contains the custom value");
@@ -251,6 +299,8 @@ module(
});
test("resetting to the default value changes the content of checkbox field", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "test_setting",
value: "true",
@@ -258,7 +308,9 @@ module(
type: "bool",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
assert
.dom("input[type=checkbox]")
.isChecked("the checkbox contains the custom value");
@@ -278,6 +330,8 @@ module(
});
test("clearing the input field keeps the cancel button and the validation error shown", async function (assert) {
+ const self = this;
+
this.set("setting", {
setting: "max_image_size_kb",
value: "1000",
@@ -287,7 +341,9 @@ module(
type: "file_size_restriction",
});
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
await fillIn(".file-size-input", "100");
assert.dom(".validation-error").hasNoClass("hidden");
@@ -325,6 +381,8 @@ module(
];
test("base_font sets body-font-X classNames on each field choice", async function (assert) {
+ const self = this;
+
this.set(
"setting",
EmberObject.create({
@@ -344,7 +402,9 @@ module(
})
);
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
const fontSelector = selectKit(".font-selector");
await fontSelector.expand();
@@ -358,6 +418,8 @@ module(
});
test("heading_font sets heading-font-X classNames on each field choice", async function (assert) {
+ const self = this;
+
this.set(
"setting",
EmberObject.create({
@@ -377,7 +439,9 @@ module(
})
);
- await render(hbs`<SiteSetting @setting={{this.setting}} />`);
+ await render(
+ <template><SiteSetting @setting={{self.setting}} /></template>
+ );
const fontSelector = selectKit(".font-selector");
await fontSelector.expand();
diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.gjs
index 3a73c907cf5..8a0bf925514 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.gjs
@@ -1,33 +1,39 @@
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { i18n } from "discourse-i18n";
+import ThemesListItem from "admin/components/themes-list-item";
import Theme from "admin/models/theme";
module("Integration | Component | themes-list-item", function (hooks) {
setupRenderingTest(hooks);
test("default theme", async function (assert) {
+ const self = this;
+
this.set("theme", Theme.create({ name: "Test", default: true }));
- await render(hbs`<ThemesListItem @theme={{this.theme}} />`);
+ await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
assert.dom(".d-icon-check").exists("shows default theme icon");
});
test("pending updates", async function (assert) {
+ const self = this;
+
this.set(
"theme",
Theme.create({ name: "Test", remote_theme: { commits_behind: 6 } })
);
- await render(hbs`<ThemesListItem @theme={{this.theme}} />`);
+ await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
assert.dom(".d-icon-arrows-rotate").exists("shows pending update icon");
});
test("broken theme", async function (assert) {
+ const self = this;
+
this.set(
"theme",
Theme.create({
@@ -36,12 +42,14 @@ module("Integration | Component | themes-list-item", function (hooks) {
})
);
- await render(hbs`<ThemesListItem @theme={{this.theme}} />`);
+ await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
assert.dom(".d-icon-circle-exclamation").exists("shows broken theme icon");
});
test("with children", async function (assert) {
+ const self = this;
+
this.childrenList = [1, 2, 3, 4, 5].map((num) =>
Theme.create({ name: `Child ${num}`, component: true })
);
@@ -55,7 +63,7 @@ module("Integration | Component | themes-list-item", function (hooks) {
})
);
- await render(hbs`<ThemesListItem @theme={{this.theme}} />`);
+ await render(<template><ThemesListItem @theme={{self.theme}} /></template>);
assert.deepEqual(
document
diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.gjs
index b308fc83f33..138898d2203 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.gjs
@@ -1,10 +1,11 @@
+import { array } from "@ember/helper";
import { fillIn, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
+import ThemesList from "admin/components/themes-list";
import Theme, { COMPONENTS, THEMES } from "admin/models/theme";
function createThemes(itemsCount, customAttributesCallback) {
@@ -21,6 +22,8 @@ module("Integration | Component | themes-list", function (hooks) {
setupRenderingTest(hooks);
test("current tab is themes", async function (assert) {
+ const self = this;
+
this.themes = createThemes(5);
this.components = createThemes(5, (n) => {
return {
@@ -37,7 +40,13 @@ module("Integration | Component | themes-list", function (hooks) {
});
await render(
- hbs`<ThemesList @themes={{this.themes}} @components={{this.components}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{self.themes}}
+ @components={{self.components}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
assert.dom(".themes-tab").hasClass("active", "themes tab is active");
@@ -95,6 +104,8 @@ module("Integration | Component | themes-list", function (hooks) {
});
test("current tab is components", async function (assert) {
+ const self = this;
+
this.themes = createThemes(5);
this.components = createThemes(5, (n) => {
return {
@@ -111,7 +122,13 @@ module("Integration | Component | themes-list", function (hooks) {
});
await render(
- hbs`<ThemesList @themes={{this.themes}} @components={{this.components}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{self.themes}}
+ @components={{self.components}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
assert
@@ -142,6 +159,8 @@ module("Integration | Component | themes-list", function (hooks) {
});
test("themes search is not visible when there are less than 10 themes", async function (assert) {
+ const self = this;
+
const themes = createThemes(9);
this.setProperties({
themes,
@@ -149,7 +168,13 @@ module("Integration | Component | themes-list", function (hooks) {
});
await render(
- hbs`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{self.themes}}
+ @components={{(array)}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
assert
@@ -158,6 +183,8 @@ module("Integration | Component | themes-list", function (hooks) {
});
test("themes search keeps themes whose names include the search term", async function (assert) {
+ const self = this;
+
const themes = ["osama", "OsAmaa", "osAMA 1234"]
.map((name) => Theme.create({ name: `Theme ${name}` }))
.concat(createThemes(7));
@@ -167,7 +194,13 @@ module("Integration | Component | themes-list", function (hooks) {
});
await render(
- hbs`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{self.themes}}
+ @components={{(array)}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
assert.dom(".themes-list-search__input").exists();
@@ -182,6 +215,8 @@ module("Integration | Component | themes-list", function (hooks) {
});
test("themes filter", async function (assert) {
+ const self = this;
+
const themes = [
Theme.create({ name: "Theme enabled 1", user_selectable: true }),
Theme.create({ name: "Theme enabled 2", user_selectable: true }),
@@ -220,7 +255,13 @@ module("Integration | Component | themes-list", function (hooks) {
}
await render(
- hbs`<ThemesList @themes={{this.themes}} @components={{(array)}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{self.themes}}
+ @components={{(array)}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
assert.dom(".themes-list-filter__input").exists();
@@ -251,6 +292,8 @@ module("Integration | Component | themes-list", function (hooks) {
});
test("components filter", async function (assert) {
+ const self = this;
+
const components = [
Theme.create({
name: "Component used 1",
@@ -304,7 +347,13 @@ module("Integration | Component | themes-list", function (hooks) {
});
await render(
- hbs`<ThemesList @themes={{(array)}} @components={{this.components}} @currentTab={{this.currentTab}} />`
+ <template>
+ <ThemesList
+ @themes={{(array)}}
+ @components={{self.components}}
+ @currentTab={{self.currentTab}}
+ />
+ </template>
);
function componentNames() {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.gjs
index 0e831e4a2bc..b2901b56535 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.gjs
@@ -1,16 +1,18 @@
import { blur, click, fillIn, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import ValueList from "admin/components/value-list";
module("Integration | Component | value-list", function (hooks) {
setupRenderingTest(hooks);
test("adding a value", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
- await render(hbs`<ValueList @values={{this.values}} />`);
+ await render(<template><ValueList @values={{self.values}} /></template>);
await selectKit().expand();
await selectKit().fillInFilter("eviltrout");
@@ -28,9 +30,11 @@ module("Integration | Component | value-list", function (hooks) {
});
test("changing a value", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
- await render(hbs`<ValueList @values={{this.values}} />`);
+ await render(<template><ValueList @values={{self.values}} /></template>);
await fillIn(".values .value[data-index='1'] .value-input", "jarek");
await blur(".values .value[data-index='1'] .value-input");
@@ -40,9 +44,11 @@ module("Integration | Component | value-list", function (hooks) {
});
test("removing a value", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas\nosama");
- await render(hbs`<ValueList @values={{this.values}} />`);
+ await render(<template><ValueList @values={{self.values}} /></template>);
await click(".values .value[data-index='0'] .remove-value-btn");
@@ -60,13 +66,17 @@ module("Integration | Component | value-list", function (hooks) {
});
test("selecting a value", async function (assert) {
+ const self = this;
+
this.setProperties({
values: "vinkas\nosama",
choices: ["maja", "michael"],
});
await render(
- hbs`<ValueList @values={{this.values}} @choices={{this.choices}} />`
+ <template>
+ <ValueList @values={{self.values}} @choices={{self.choices}} />
+ </template>
);
await selectKit().expand();
@@ -84,9 +94,15 @@ module("Integration | Component | value-list", function (hooks) {
});
test("array support", async function (assert) {
+ const self = this;
+
this.set("values", ["vinkas", "osama"]);
- await render(hbs`<ValueList @values={{this.values}} @inputType="array" />`);
+ await render(
+ <template>
+ <ValueList @values={{self.values}} @inputType="array" />
+ </template>
+ );
this.set("values", ["vinkas", "osama"]);
@@ -106,10 +122,14 @@ module("Integration | Component | value-list", function (hooks) {
});
test("delimiter support", async function (assert) {
+ const self = this;
+
this.set("values", "vinkas|osama");
await render(
- hbs`<ValueList @values={{this.values}} @inputDelimiter="|" />`
+ <template>
+ <ValueList @values={{self.values}} @inputDelimiter="|" />
+ </template>
);
await selectKit().expand();
diff --git a/app/assets/javascripts/discourse/tests/integration/components/watched-word-uploader-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/watched-word-uploader-test.gjs
index d78525ef5e7..6df413342a5 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/watched-word-uploader-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/watched-word-uploader-test.gjs
@@ -1,12 +1,12 @@
import { getOwner } from "@ember/owner";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import sinon from "sinon";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
import { createFile } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
+import WatchedWordUploader from "admin/components/watched-word-uploader";
module("Integration | Component | watched-word-uploader", function (hooks) {
setupRenderingTest(hooks);
@@ -18,6 +18,8 @@ module("Integration | Component | watched-word-uploader", function (hooks) {
});
test("sets the proper action key on uploads", async function (assert) {
+ const self = this;
+
const dialog = getOwner(this).lookup("service:dialog");
sinon.stub(dialog, "alert");
@@ -39,12 +41,14 @@ module("Integration | Component | watched-word-uploader", function (hooks) {
done();
});
- await render(hbs`
- <WatchedWordUploader
- @actionKey={{this.actionNameKey}}
- @done={{this.doneUpload}}
- />
- `);
+ await render(
+ <template>
+ <WatchedWordUploader
+ @actionKey={{self.actionNameKey}}
+ @done={{self.doneUpload}}
+ />
+ </template>
+ );
const words = createFile("watched-words.txt");
await this.container