Skip to content

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

DEV: [gjs-codemod] convert second batch of files to gjs

David Taylora017f566a84a
diff --git a/app/assets/javascripts/discourse/app/components/badge-title.gjs b/app/assets/javascripts/discourse/app/components/badge-title.gjs
index d32f25ccefc..70122486b52 100644
--- a/app/assets/javascripts/discourse/app/components/badge-title.gjs
+++ b/app/assets/javascripts/discourse/app/components/badge-title.gjs
@@ -1,9 +1,12 @@
import Component from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import { ajax } from "discourse/lib/ajax";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
@tagName("")
export default class BadgeTitle extends Component {
@@ -56,43 +59,47 @@ export default class BadgeTitle extends Component {
_findBadgeByTitle(badges, title) {
return (badges || []).findBy("badge.name", title);
}
-}
-<div class="badge-title">
- <form class="form-horizontal">
+ <template>
+ <div class="badge-title">
+ <form class="form-horizontal">
- <h3>{{i18n "badges.select_badge_for_title"}}</h3>
+ <h3>{{i18n "badges.select_badge_for_title"}}</h3>
- <div class="control-group">
- <div class="controls">
- <ComboBox
- @value={{this._selectedUserBadgeId}}
- @nameProperty="badge.name"
- @content={{this.selectableUserBadges}}
- @onChange={{fn (mut this._selectedUserBadgeId)}}
- />
- </div>
- </div>
+ <div class="control-group">
+ <div class="controls">
+ <ComboBox
+ @value={{this._selectedUserBadgeId}}
+ @nameProperty="badge.name"
+ @content={{this.selectableUserBadges}}
+ @onChange={{fn (mut this._selectedUserBadgeId)}}
+ />
+ </div>
+ </div>
- <div class="control-group">
- <div class="controls">
- <DButton
- @action={{this.saveBadgeTitle}}
- @disabled={{this._isSaving}}
- @label={{if this._isSaving "saving" "save"}}
- class="btn-primary"
- />
- {{#if this.closeAction}}
- <DButton
- @action={{this.closeAction}}
- @label="close"
- class="btn-default close-btn"
- />
- {{/if}}
- {{#if this._isSaved}}
- <span role="status" class="badge-title__saved">{{i18n "saved"}}</span>
- {{/if}}
- </div>
+ <div class="control-group">
+ <div class="controls">
+ <DButton
+ @action={{this.saveBadgeTitle}}
+ @disabled={{this._isSaving}}
+ @label={{if this._isSaving "saving" "save"}}
+ class="btn-primary"
+ />
+ {{#if this.closeAction}}
+ <DButton
+ @action={{this.closeAction}}
+ @label="close"
+ class="btn-default close-btn"
+ />
+ {{/if}}
+ {{#if this._isSaved}}
+ <span role="status" class="badge-title__saved">{{i18n
+ "saved"
+ }}</span>
+ {{/if}}
+ </div>
+ </div>
+ </form>
</div>
- </form>
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs b/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
index f31e65f430c..ce9aa28027a 100644
--- a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
+++ b/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
@@ -1,10 +1,28 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { dependentKeyCompat } from "@ember/object/compat";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
import { Promise } from "rsvp";
+import { and } from "truth-helpers";
+import BookmarkActionsDropdown from "discourse/components/bookmark-actions-dropdown";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import FlatButton from "discourse/components/flat-button";
+import LoadMore from "discourse/components/load-more";
import BookmarkModal from "discourse/components/modal/bookmark";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TopicStatus from "discourse/components/topic-status";
+import avatar from "discourse/helpers/avatar";
+import categoryLink from "discourse/helpers/category-link";
+import icon from "discourse/helpers/d-icon";
+import discourseTags from "discourse/helpers/discourse-tags";
+import formatDate from "discourse/helpers/format-date";
+import htmlSafe from "discourse/helpers/html-safe";
+import raw from "discourse/helpers/raw";
+import topicLink from "discourse/helpers/topic-link";
import { ajax } from "discourse/lib/ajax";
import { BookmarkFormData } from "discourse/lib/bookmark-form-data";
import {
@@ -12,6 +30,7 @@ import {
shouldOpenInNewTab,
} from "discourse/lib/click-track";
import { i18n } from "discourse-i18n";
+import BulkSelectBookmarksDropdown from "select-kit/components/bulk-select-bookmarks-dropdown";
@classNames("bookmark-list-wrapper")
export default class BookmarkList extends Component {
@@ -182,215 +201,217 @@ export default class BookmarkList extends Component {
this._toggleSelection(target, bookmark, this.lastChecked && e.shiftKey);
});
}
-}
-<ConditionalLoadingSpinner @condition={{this.loading}}>
- <LoadMore
- @selector=".bookmark-list .bookmark-list-item"
- @action={{this.loadMore}}
- >
- <table class="topic-list bookmark-list">
- <thead class="topic-list-header">
- {{#if this.site.desktopView}}
- <PluginOutlet @name="bookmark-list-table-header">
- {{#if this.bulkSelectEnabled}}
- <th class="bulk-select topic-list-data">
- <FlatButton
- @action={{this.toggleBulkSelect}}
- @class="bulk-select"
- @icon="list-check"
- @title="bookmarks.bulk.toggle"
- />
- </th>
- {{/if}}
- <th class="topic-list-data">
+ <template>
+ <ConditionalLoadingSpinner @condition={{this.loading}}>
+ <LoadMore
+ @selector=".bookmark-list .bookmark-list-item"
+ @action={{this.loadMore}}
+ >
+ <table class="topic-list bookmark-list">
+ <thead class="topic-list-header">
+ {{#if this.site.desktopView}}
+ <PluginOutlet @name="bookmark-list-table-header">
+ {{#if this.bulkSelectEnabled}}
+ <th class="bulk-select topic-list-data">
+ <FlatButton
+ @action={{this.toggleBulkSelect}}
+ @class="bulk-select"
+ @icon="list-check"
+ @title="bookmarks.bulk.toggle"
+ />
+ </th>
+ {{/if}}
+ <th class="topic-list-data">
- {{#if this.bulkSelectEnabled}}
- <span class="bulk-select-topics">
- {{~#if this.canDoBulkActions}}
- <div class="bulk-select-bookmarks-dropdown">
- <span class="bulk-select-bookmark-dropdown__count">
- {{i18n
- "bookmarks.bulk.selected_count"
- count=this.selectedCount
- }}
- </span>
- <BulkSelectBookmarksDropdown
- @bulkSelectHelper={{this.bulkSelectHelper}}
- />
- </div>
+ {{#if this.bulkSelectEnabled}}
+ <span class="bulk-select-topics">
+ {{~#if this.canDoBulkActions}}
+ <div class="bulk-select-bookmarks-dropdown">
+ <span class="bulk-select-bookmark-dropdown__count">
+ {{i18n
+ "bookmarks.bulk.selected_count"
+ count=this.selectedCount
+ }}
+ </span>
+ <BulkSelectBookmarksDropdown
+ @bulkSelectHelper={{this.bulkSelectHelper}}
+ />
+ </div>
+ {{/if~}}
+ <DButton
+ @action={{this.selectAll}}
+ class="btn btn-default bulk-select-all"
+ @label="bookmarks.bulk.select_all"
+ />
+ <DButton
+ @action={{this.clearAll}}
+ class="btn btn-default bulk-clear-all"
+ @label="bookmarks.bulk.clear_all"
+ />
+ </span>
+ {{else}}
+ <FlatButton
+ @action={{this.toggleBulkSelect}}
+ @class="bulk-select"
+ @icon="list-check"
+ @title="bookmarks.bulk.toggle"
+ />
+ {{i18n "topic.title"}}
{{/if~}}
- <DButton
- @action={{this.selectAll}}
- class="btn btn-default bulk-select-all"
- @label="bookmarks.bulk.select_all"
- />
- <DButton
- @action={{this.clearAll}}
- class="btn btn-default bulk-clear-all"
- @label="bookmarks.bulk.clear_all"
- />
- </span>
- {{else}}
- <FlatButton
- @action={{this.toggleBulkSelect}}
- @class="bulk-select"
- @icon="list-check"
- @title="bookmarks.bulk.toggle"
- />
- {{i18n "topic.title"}}
- {{/if~}}
- </th>
- <th class="topic-list-data">&nbsp;</th>
- <th class="post-metadata topic-list-data">{{i18n
- "post.bookmarks.updated"
- }}</th>
- <th class="post-metadata topic-list-data">{{i18n "activity"}}</th>
- <th>&nbsp;</th>
- </PluginOutlet>
- {{/if}}
- </thead>
- <tbody class="topic-list-body">
- {{#each this.content as |bookmark|}}
- <tr class="topic-list-item bookmark-list-item">
- {{#if this.bulkSelectEnabled}}
- <td class="bulk-select bookmark-list-data">
- <label for="bulk-select-{{bookmark.id}}">
- <input
- type="checkbox"
- class="bulk-select"
- id="bulk-select-{{bookmark.id}}"
- data-id={{bookmark.id}}
- />
- </label>
- </td>
+ </th>
+ <th class="topic-list-data">&nbsp;</th>
+ <th class="post-metadata topic-list-data">{{i18n
+ "post.bookmarks.updated"
+ }}</th>
+ <th class="post-metadata topic-list-data">{{i18n
+ "activity"
+ }}</th>
+ <th>&nbsp;</th>
+ </PluginOutlet>
{{/if}}
- <td class="main-link topic-list-data">
- <PluginOutlet
- @name="bookmark-list-before-link"
- @outletArgs={{hash bookmark=bookmark}}
- />
+ </thead>
+ <tbody class="topic-list-body">
+ {{#each this.content as |bookmark|}}
+ <tr class="topic-list-item bookmark-list-item">
+ {{#if this.bulkSelectEnabled}}
+ <td class="bulk-select bookmark-list-data">
+ <label for="bulk-select-{{bookmark.id}}">
+ <input
+ type="checkbox"
+ class="bulk-select"
+ id="bulk-select-{{bookmark.id}}"
+ data-id={{bookmark.id}}
+ />
+ </label>
+ </td>
+ {{/if}}
+ <td class="main-link topic-list-data">
+ <PluginOutlet
+ @name="bookmark-list-before-link"
+ @outletArgs={{hash bookmark=bookmark}}
+ />
- <span class="link-top-line">
- <div class="bookmark-metadata">
- {{#if bookmark.reminder_at}}
- <span
- class="bookmark-metadata-item bookmark-reminder
- {{if
- bookmark.reminderAtExpired
- 'bookmark-expired-reminder'
- }}"
- >
- {{d-icon "far-clock"}}{{bookmark.formattedReminder}}
- </span>
- {{/if}}
- {{#if bookmark.name}}
- <span class="bookmark-metadata-item">
- {{d-icon "circle-info"}}<span>{{bookmark.name}}</span>
- </span>
- {{/if}}
- </div>
- <div class="bookmark-status-with-link">
- {{#if bookmark.pinned}}
- {{d-icon "thumbtack" class="bookmark-pinned"}}
- {{/if}}
+ <span class="link-top-line">
+ <div class="bookmark-metadata">
+ {{#if bookmark.reminder_at}}
+ <span
+ class="bookmark-metadata-item bookmark-reminder
+ {{if
+ bookmark.reminderAtExpired
+ 'bookmark-expired-reminder'
+ }}"
+ >
+ {{icon "far-clock"}}{{bookmark.formattedReminder}}
+ </span>
+ {{/if}}
+ {{#if bookmark.name}}
+ <span class="bookmark-metadata-item">
+ {{icon "circle-info"}}<span>{{bookmark.name}}</span>
+ </span>
+ {{/if}}
+ </div>
+ <div class="bookmark-status-with-link">
+ {{#if bookmark.pinned}}
+ {{icon "thumbtack" class="bookmark-pinned"}}
+ {{/if}}
+ {{#if bookmark.bookmarkableTopicAlike}}
+ <TopicStatus @topic={{bookmark.topicStatus}} />
+ {{topicLink bookmark.topicForList}}
+ {{else}}
+ <a
+ href={{bookmark.bookmarkable_url}}
+ role="heading"
+ aria-level="2"
+ class="title"
+ >
+ {{bookmark.fancy_title}}
+ </a>
+ {{/if}}
+ </div>
+ </span>
{{#if bookmark.bookmarkableTopicAlike}}
- <TopicStatus @topic={{bookmark.topicStatus}} />
- {{topic-link bookmark.topicForList}}
- {{else}}
+ <div class="link-bottom-line">
+ {{categoryLink bookmark.category}}
+ {{discourseTags
+ bookmark
+ mode="list"
+ tagsForUser=this.tagsForUser
+ }}
+ </div>
+ {{/if}}
+ {{#if
+ (and
+ this.site.mobileView
+ bookmark.excerpt
+ bookmark.user.avatar_template
+ )
+ }}
<a
- href={{bookmark.bookmarkable_url}}
- role="heading"
- aria-level="2"
- class="title"
- data-topic-id="${topic.id}"
+ href={{bookmark.bookmarkableUser.path}}
+ data-user-card={{bookmark.user.username}}
+ class="avatar"
>
- {{bookmark.fancy_title}}
+ {{avatar
+ bookmark.bookmarkableUser
+ avatarTemplatePath="avatar_template"
+ usernamePath="username"
+ namePath="name"
+ imageSize="small"
+ }}
</a>
{{/if}}
- </div>
- </span>
- {{#if bookmark.bookmarkableTopicAlike}}
- <div class="link-bottom-line">
- {{category-link bookmark.category}}
- {{discourse-tags
- bookmark
- mode="list"
- tagsForUser=this.tagsForUser
- }}
- </div>
- {{/if}}
- {{#if
- (and
- this.site.mobileView
- bookmark.excerpt
- bookmark.user.avatar_template
- )
- }}
- <a
- href={{bookmark.bookmarkableUser.path}}
- data-user-card={{bookmark.user.username}}
- class="avatar"
- >
- {{avatar
- bookmark.bookmarkableUser
- avatarTemplatePath="avatar_template"
- usernamePath="username"
- namePath="name"
- imageSize="small"
- }}
- </a>
- {{/if}}
- {{! template-lint-disable no-invalid-interactive }}
- <p
- class="post-excerpt"
- {{on "click" this.screenExcerptForExternalLink}}
- >{{html-safe bookmark.excerpt}}</p>
- </td>
- {{#if this.site.desktopView}}
- <td class="author-avatar topic-list-data">
- {{#if bookmark.user.avatar_template}}
- <a
- href={{bookmark.user.path}}
- data-user-card={{bookmark.user.username}}
- class="avatar"
- >
- {{avatar
- bookmark.user
- avatarTemplatePath="avatar_template"
- usernamePath="username"
- namePath="name"
- imageSize="small"
- }}
- </a>
+ {{! template-lint-disable no-invalid-interactive }}
+ <p
+ class="post-excerpt"
+ {{on "click" this.screenExcerptForExternalLink}}
+ >{{htmlSafe bookmark.excerpt}}</p>
+ </td>
+ {{#if this.site.desktopView}}
+ <td class="author-avatar topic-list-data">
+ {{#if bookmark.user.avatar_template}}
+ <a
+ href={{bookmark.user.path}}
+ data-user-card={{bookmark.user.username}}
+ class="avatar"
+ >
+ {{avatar
+ bookmark.user
+ avatarTemplatePath="avatar_template"
+ usernamePath="username"
+ namePath="name"
+ imageSize="small"
+ }}
+ </a>
+ {{/if}}
+ </td>
+ <td
+ class="post-metadata topic-list-data updated-at"
+ >{{formatDate bookmark.updated_at format="tiny"}}</td>
+ {{raw
+ "list/activity-column"
+ topic=bookmark
+ class="num post-metadata"
+ tagName="td"
+ }}
{{/if}}
- </td>
- <td class="post-metadata topic-list-data updated-at">{{format-date
- bookmark.updated_at
- format="tiny"
- }}</td>
- {{raw
- "list/activity-column"
- topic=bookmark
- class="num post-metadata"
- tagName="td"
- }}
- {{/if}}
- <td class="topic-list-data">
- <BookmarkActionsDropdown
- @bookmark={{bookmark}}
- @removeBookmark={{action "removeBookmark"}}
- @editBookmark={{action "editBookmark"}}
- @clearBookmarkReminder={{action "clearBookmarkReminder"}}
- @togglePinBookmark={{action "togglePinBookmark"}}
- />
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- <ConditionalLoadingSpinner @condition={{this.loadingMore}} />
- </LoadMore>
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <td class="topic-list-data">
+ <BookmarkActionsDropdown
+ @bookmark={{bookmark}}
+ @removeBookmark={{this.removeBookmark}}
+ @editBookmark={{this.editBookmark}}
+ @clearBookmarkReminder={{this.clearBookmarkReminder}}
+ @togglePinBookmark={{this.togglePinBookmark}}
+ />
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ <ConditionalLoadingSpinner @condition={{this.loadingMore}} />
+ </LoadMore>
+ </ConditionalLoadingSpinner>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/bread-crumbs.gjs b/app/assets/javascripts/discourse/app/components/bread-crumbs.gjs
index 18b7adfdb9a..8d629cad0b0 100644
--- a/app/assets/javascripts/discourse/app/components/bread-crumbs.gjs
+++ b/app/assets/javascripts/discourse/app/components/bread-crumbs.gjs
@@ -1,10 +1,16 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { filter } from "@ember/object/computed";
import { classNameBindings, tagName } from "@ember-decorators/component";
+// A breadcrumb including category drop downs
+import PluginOutlet from "discourse/components/plugin-outlet";
+import categoryVariables from "discourse/helpers/category-variables";
import discourseComputed from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
+import CategoryDrop from "select-kit/components/category-drop";
+import TagDrop from "select-kit/components/tag-drop";
+import TagsIntersectionChooser from "select-kit/components/tags-intersection-chooser";
-// A breadcrumb including category drop downs
@tagName("ol")
@classNameBindings("hidden:hidden", ":category-breadcrumb")
export default class BreadCrumbs extends Component {
@@ -123,77 +129,82 @@ export default class BreadCrumbs extends Component {
(c) => c.get("parentCategory") === firstCategory
);
}
-}
-<PluginOutlet
- @name="bread-crumbs-left"
- @connectorTagName="li"
- @outletArgs={{hash
- tagId=this.tag.id
- additionalTags=this.additionalTags
- noSubcategories=this.noSubcategories
- showTagsSection=this.showTagsSection
- currentCategory=this.category
- categoryBreadcrumbs=this.categoryBreadcrumbs
- editingCategory=this.editingCategory
- editingCategoryTab=this.editingCategoryTab
- }}
-/>
-
-{{#each this.categoryBreadcrumbs as |breadcrumb|}}
- {{#if breadcrumb.hasOptions}}
- <li
- style={{if breadcrumb.category (category-variables breadcrumb.category)}}
- >
- <CategoryDrop
- @category={{breadcrumb.category}}
- @categories={{breadcrumb.options}}
- @tagId={{this.tag.id}}
- @editingCategory={{this.editingCategory}}
- @editingCategoryTab={{this.editingCategoryTab}}
- @options={{hash
- parentCategory=breadcrumb.parentCategory
- subCategory=breadcrumb.isSubcategory
- noSubcategories=breadcrumb.noSubcategories
- autoFilterable=true
- }}
- />
- </li>
- {{/if}}
-{{/each}}
-
-{{#if this.showTagsSection}}
- {{#if this.additionalTags}}
- <li>
- <TagsIntersectionChooser
- @currentCategory={{this.category}}
- @mainTag={{this.tag.id}}
- @additionalTags={{this.additionalTags}}
- @options={{hash categoryId=this.category.id}}
- />
- </li>
- {{else}}
- <li>
- <TagDrop
- @currentCategory={{this.category}}
- @noSubcategories={{this.noSubcategories}}
- @tagId={{this.tag.id}}
- />
- </li>
- {{/if}}
-{{/if}}
-
-<PluginOutlet
- @name="bread-crumbs-right"
- @connectorTagName="li"
- @outletArgs={{hash
- tagId=this.tag.id
- additionalTags=this.additionalTags
- noSubcategories=this.noSubcategories
- showTagsSection=this.showTagsSection
- currentCategory=this.category
- categoryBreadcrumbs=this.categoryBreadcrumbs
- editingCategory=this.editingCategory
- editingCategoryTab=this.editingCategoryTab
- }}
-/>
\ No newline at end of file
+ <template>
+ <PluginOutlet
+ @name="bread-crumbs-left"
+ @connectorTagName="li"
+ @outletArgs={{hash
+ tagId=this.tag.id
+ additionalTags=this.additionalTags
+ noSubcategories=this.noSubcategories
+ showTagsSection=this.showTagsSection
+ currentCategory=this.category
+ categoryBreadcrumbs=this.categoryBreadcrumbs
+ editingCategory=this.editingCategory
+ editingCategoryTab=this.editingCategoryTab
+ }}
+ />
+
+ {{#each this.categoryBreadcrumbs as |breadcrumb|}}
+ {{#if breadcrumb.hasOptions}}
+ <li
+ style={{if
+ breadcrumb.category
+ (categoryVariables breadcrumb.category)
+ }}
+ >
+ <CategoryDrop
+ @category={{breadcrumb.category}}
+ @categories={{breadcrumb.options}}
+ @tagId={{this.tag.id}}
+ @editingCategory={{this.editingCategory}}
+ @editingCategoryTab={{this.editingCategoryTab}}
+ @options={{hash
+ parentCategory=breadcrumb.parentCategory
+ subCategory=breadcrumb.isSubcategory
+ noSubcategories=breadcrumb.noSubcategories
+ autoFilterable=true
+ }}
+ />
+ </li>
+ {{/if}}
+ {{/each}}
+
+ {{#if this.showTagsSection}}
+ {{#if this.additionalTags}}
+ <li>
+ <TagsIntersectionChooser
+ @currentCategory={{this.category}}
+ @mainTag={{this.tag.id}}
+ @additionalTags={{this.additionalTags}}
+ @options={{hash categoryId=this.category.id}}
+ />
+ </li>
+ {{else}}
+ <li>
+ <TagDrop
+ @currentCategory={{this.category}}
+ @noSubcategories={{this.noSubcategories}}
+ @tagId={{this.tag.id}}
+ />
+ </li>
+ {{/if}}
+ {{/if}}
+
+ <PluginOutlet
+ @name="bread-crumbs-right"
+ @connectorTagName="li"
+ @outletArgs={{hash
+ tagId=this.tag.id
+ additionalTags=this.additionalTags
+ noSubcategories=this.noSubcategories
+ showTagsSection=this.showTagsSection
+ currentCategory=this.category
+ categoryBreadcrumbs=this.categoryBreadcrumbs
+ editingCategory=this.editingCategory
+ editingCategoryTab=this.editingCategoryTab
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/bulk-actions/append-tags.gjs b/app/assets/javascripts/discourse/app/components/bulk-actions/append-tags.gjs
index ab426c69f64..78b7dbf6bc8 100644
--- a/app/assets/javascripts/discourse/app/components/bulk-actions/append-tags.gjs
+++ b/app/assets/javascripts/discourse/app/components/bulk-actions/append-tags.gjs
@@ -1,17 +1,24 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
+import { not } from "truth-helpers";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
export default class AppendTags extends Component {
@tracked tags = [];
-}
-<p>{{i18n "topics.bulk.choose_append_tags"}}</p>
+ <template>
+ <p>{{i18n "topics.bulk.choose_append_tags"}}</p>
-<p><TagChooser @tags={{this.tags}} @categoryId={{@categoryId}} /></p>
+ <p><TagChooser @tags={{this.tags}} @categoryId={{@categoryId}} /></p>
-<DButton
- @action={{fn @performAndRefresh (hash type="append_tags" tags=this.tags)}}
- @disabled={{not this.tags}}
- @label="topics.bulk.append_tags"
- class="topic-bulk-actions__append-tags"
-/>
\ No newline at end of file
+ <DButton
+ @action={{fn @performAndRefresh (hash type="append_tags" tags=this.tags)}}
+ @disabled={{not this.tags}}
+ @label="topics.bulk.append_tags"
+ class="topic-bulk-actions__append-tags"
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/bulk-actions/change-category.gjs b/app/assets/javascripts/discourse/app/components/bulk-actions/change-category.gjs
index 0cb7ddeea5a..cf30c39055d 100644
--- a/app/assets/javascripts/discourse/app/components/bulk-actions/change-category.gjs
+++ b/app/assets/javascripts/discourse/app/components/bulk-actions/change-category.gjs
@@ -1,5 +1,10 @@
import Component from "@glimmer/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
export default class ChangeCategory extends Component {
categoryId = 0;
@@ -14,20 +19,22 @@ export default class ChangeCategory extends Component {
(t) => t.set("category_id", this.categoryId)
);
}
-}
-<p>{{i18n "topics.bulk.choose_new_category"}}</p>
+ <template>
+ <p>{{i18n "topics.bulk.choose_new_category"}}</p>
-<p>
- <CategoryChooser
- @value={{this.categoryId}}
- @onChange={{fn (mut this.categoryId)}}
- />
-</p>
+ <p>
+ <CategoryChooser
+ @value={{this.categoryId}}
+ @onChange={{fn (mut this.categoryId)}}
+ />
+ </p>
-<ConditionalLoadingSpinner @condition={{@loading}}>
- <DButton
- @action={{this.changeCategory}}
- @label="topics.bulk.change_category"
- />
-</ConditionalLoadingSpinner>
\ No newline at end of file
+ <ConditionalLoadingSpinner @condition={{@loading}}>
+ <DButton
+ @action={{this.changeCategory}}
+ @label="topics.bulk.change_category"
+ />
+ </ConditionalLoadingSpinner>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/bulk-actions/change-tags.gjs b/app/assets/javascripts/discourse/app/components/bulk-actions/change-tags.gjs
index e3716f37672..03d3cead369 100644
--- a/app/assets/javascripts/discourse/app/components/bulk-actions/change-tags.gjs
+++ b/app/assets/javascripts/discourse/app/components/bulk-actions/change-tags.gjs
@@ -1,16 +1,23 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
+import { not } from "truth-helpers";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
export default class ChangeTags extends Component {
@tracked tags = [];
-}
-<p>{{i18n "topics.bulk.choose_new_tags"}}</p>
+ <template>
+ <p>{{i18n "topics.bulk.choose_new_tags"}}</p>
-<p><TagChooser @tags={{this.tags}} @categoryId={{@categoryId}} /></p>
+ <p><TagChooser @tags={{this.tags}} @categoryId={{@categoryId}} /></p>
-<DButton
- @action={{fn @performAndRefresh (hash type="change_tags" tags=this.tags)}}
- @disabled={{not this.tags}}
- @label="topics.bulk.change_tags"
-/>
\ No newline at end of file
+ <DButton
+ @action={{fn @performAndRefresh (hash type="change_tags" tags=this.tags)}}
+ @disabled={{not this.tags}}
+ @label="topics.bulk.change_tags"
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/composer-action-title.gjs b/app/assets/javascripts/discourse/app/components/composer-action-title.gjs
index 83dc9429304..e41b4042812 100644
--- a/app/assets/javascripts/discourse/app/components/composer-action-title.gjs
+++ b/app/assets/javascripts/discourse/app/components/composer-action-title.gjs
@@ -1,4 +1,5 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { alias } from "@ember/object/computed";
import { htmlSafe } from "@ember/template";
import { classNames } from "@ember-decorators/component";
@@ -14,6 +15,7 @@ import {
REPLY,
} from "discourse/models/composer";
import { i18n } from "discourse-i18n";
+import ComposerActions from "select-kit/components/composer-actions";
const TITLES = {
[PRIVATE_MESSAGE]: "topic.private_message",
@@ -92,21 +94,23 @@ export default class ComposerActionTitle extends Component {
)}</a>`;
return htmlSafe(`${avatar}${htmlLink}`);
}
-}
-<ComposerActions
- @composerModel={{this.model}}
- @replyOptions={{this.model.replyOptions}}
- @canWhisper={{this.canWhisper}}
- @action={{this.model.action}}
- @tabindex={{this.tabindex}}
- @topic={{this.model.topic}}
- @post={{this.model.post}}
- @whisper={{this.model.whisper}}
- @noBump={{this.model.noBump}}
- @options={{hash mobilePlacementStrategy="fixed"}}
-/>
+ <template>
+ <ComposerActions
+ @composerModel={{this.model}}
+ @replyOptions={{this.model.replyOptions}}
+ @canWhisper={{this.canWhisper}}
+ @action={{this.model.action}}
+ @tabindex={{this.tabindex}}
+ @topic={{this.model.topic}}
+ @post={{this.model.post}}
+ @whisper={{this.model.whisper}}
+ @noBump={{this.model.noBump}}
+ @options={{hash mobilePlacementStrategy="fixed"}}
+ />
-<span class="action-title" role="heading" aria-level="1">
- {{this.actionTitle}}
-</span>
\ No newline at end of file
+ <span class="action-title" role="heading" aria-level="1">
+ {{this.actionTitle}}
+ </span>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/composer-container.gjs b/app/assets/javascripts/discourse/app/components/composer-container.gjs
index 3cc9438cc7f..a644a17eaca 100644
--- a/app/assets/javascripts/discourse/app/components/composer-container.gjs
+++ b/app/assets/javascripts/discourse/app/components/composer-container.gjs
@@ -1,424 +1,453 @@
import Component from "@glimmer/component";
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { service } from "@ember/service";
+import { and, or } from "truth-helpers";
+import ComposerActionTitle from "discourse/components/composer-action-title";
+import ComposerBody from "discourse/components/composer-body";
+import ComposerEditor from "discourse/components/composer-editor";
+import ComposerFullscreenPrompt from "discourse/components/composer-fullscreen-prompt";
+import ComposerMessages from "discourse/components/composer-messages";
+import ComposerSaveButton from "discourse/components/composer-save-button";
+import ComposerTitle from "discourse/components/composer-title";
+import ComposerToggles from "discourse/components/composer-toggles";
+import ComposerUserSelector from "discourse/components/composer-user-selector";
+import DButton from "discourse/components/d-button";
+import LinkToInput from "discourse/components/link-to-input";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PopupInputTip from "discourse/components/popup-input-tip";
+import TextField from "discourse/components/text-field";
+import avatar from "discourse/helpers/avatar";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
+import htmlClass from "discourse/helpers/html-class";
+import htmlSafe from "discourse/helpers/html-safe";
+import loadingSpinner from "discourse/helpers/loading-spinner";
+import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
+import MiniTagChooser from "select-kit/components/mini-tag-chooser";
export default class ComposerContainer extends Component {
@service composer;
@service site;
-}
-<ComposerBody
- @composer={{this.composer.model}}
- @showPreview={{this.composer.isPreviewVisible}}
- @openIfDraft={{this.composer.openIfDraft}}
- @typed={{this.composer.typed}}
- @cancelled={{this.composer.cancelled}}
- @save={{this.composer.saveAction}}
->
- <div class="grippie"></div>
- {{#if this.composer.visible}}
- {{html-class (if this.composer.isPreviewVisible "composer-has-preview")}}
- <ComposerMessages
+ <template>
+ <ComposerBody
@composer={{this.composer.model}}
- @messageCount={{this.composer.messageCount}}
- @addLinkLookup={{this.composer.addLinkLookup}}
- />
-
- {{#if this.composer.showFullScreenPrompt}}
- <ComposerFullscreenPrompt
- @removeFullScreenExitPrompt={{this.composer.removeFullScreenExitPrompt}}
- />
- {{/if}}
-
- {{#if this.composer.model.viewOpenOrFullscreen}}
- <div
- role="dialog"
- aria-label={{this.composer.ariaLabel}}
- class="reply-area
- {{if this.composer.canEditTags 'with-tags' 'without-tags'}}
- {{if
- this.composer.hasFormTemplate
- 'with-form-template'
- 'without-form-template'
- }}
- {{if
- this.composer.model.showCategoryChooser
- 'with-category'
- 'without-category'
- }}"
- >
- <span class="composer-open-plugin-outlet-container">
- <PluginOutlet
- @name="composer-open"
- @connectorTagName="div"
- @outletArgs={{hash model=this.composer.model}}
+ @showPreview={{this.composer.isPreviewVisible}}
+ @openIfDraft={{this.composer.openIfDraft}}
+ @typed={{this.composer.typed}}
+ @cancelled={{this.composer.cancelled}}
+ @save={{this.composer.saveAction}}
+ >
+ <div class="grippie"></div>
+ {{#if this.composer.visible}}
+ {{htmlClass (if this.composer.isPreviewVisible "composer-has-preview")}}
+ <ComposerMessages
+ @composer={{this.composer.model}}
+ @messageCount={{this.composer.messageCount}}
+ @addLinkLookup={{this.composer.addLinkLookup}}
+ />
+
+ {{#if this.composer.showFullScreenPrompt}}
+ <ComposerFullscreenPrompt
+ @removeFullScreenExitPrompt={{this.composer.removeFullScreenExitPrompt}}
/>
- </span>
-
- <div class="reply-to">
- {{#unless this.composer.model.viewFullscreen}}
- <div class="reply-details">
- <ComposerActionTitle
- @model={{this.composer.model}}
- @canWhisper={{this.composer.canWhisper}}
- />
+ {{/if}}
+ {{#if this.composer.model.viewOpenOrFullscreen}}
+ <div
+ role="dialog"
+ aria-label={{this.composer.ariaLabel}}
+ class="reply-area
+ {{if this.composer.canEditTags 'with-tags' 'without-tags'}}
+ {{if
+ this.composer.hasFormTemplate
+ 'with-form-template'
+ 'without-form-template'
+ }}
+ {{if
+ this.composer.model.showCategoryChooser
+ 'with-category'
+ 'without-category'
+ }}"
+ >
+ <span class="composer-open-plugin-outlet-container">
<PluginOutlet
- @name="composer-action-after"
+ @name="composer-open"
+ @connectorTagName="div"
@outletArgs={{hash model=this.composer.model}}
/>
+ </span>
- {{#if this.site.desktopView}}
- {{#if this.composer.model.unlistTopic}}
- <span class="unlist">({{i18n "composer.unlist"}})</span>
- {{/if}}
- {{#if this.composer.isWhispering}}
- {{#if this.composer.model.noBump}}
- <span class="no-bump">{{d-icon "anchor"}}</span>
- {{/if}}
- {{/if}}
- {{/if}}
+ <div class="reply-to">
+ {{#unless this.composer.model.viewFullscreen}}
+ <div class="reply-details">
+ <ComposerActionTitle
+ @model={{this.composer.model}}
+ @canWhisper={{this.composer.canWhisper}}
+ />
- {{#if this.composer.canEdit}}
- <LinkToInput
- @onClick={{this.composer.displayEditReason}}
- @showInput={{this.composer.showEditReason}}
- @icon="circle-info"
- class="display-edit-reason"
- >
- <TextField
- @value={{this.composer.editReason}}
- @id="edit-reason"
- @maxlength="255"
- @placeholderKey="composer.edit_reason_placeholder"
+ <PluginOutlet
+ @name="composer-action-after"
+ @outletArgs={{hash model=this.composer.model}}
/>
- </LinkToInput>
- {{/if}}
- </div>
- {{/unless}}
- <PluginOutlet
- @name="before-composer-controls"
- @outletArgs={{hash model=this.composer.model}}
- />
+ {{#if this.site.desktopView}}
+ {{#if this.composer.model.unlistTopic}}
+ <span class="unlist">({{i18n "composer.unlist"}})</span>
+ {{/if}}
+ {{#if this.composer.isWhispering}}
+ {{#if this.composer.model.noBump}}
+ <span class="no-bump">{{icon "anchor"}}</span>
+ {{/if}}
+ {{/if}}
+ {{/if}}
- <ComposerToggles
- @composeState={{this.composer.model.composeState}}
- @showToolbar={{this.composer.showToolbar}}
- @toggleComposer={{this.composer.toggle}}
- @toggleToolbar={{this.composer.toggleToolbar}}
- @toggleFullscreen={{this.composer.fullscreenComposer}}
- @disableTextarea={{this.composer.disableTextarea}}
- />
- </div>
-
- <ComposerEditor>
- <div class="composer-fields">
- <PluginOutlet
- @name="before-composer-fields"
- @outletArgs={{hash model=this.composer.model}}
- />
- {{#unless this.composer.model.viewFullscreen}}
- {{#if this.composer.model.canEditTitle}}
- {{#if this.composer.model.creatingPrivateMessage}}
- <div class="user-selector">
- <ComposerUserSelector
- @topicId={{this.composer.topicModel.id}}
- @recipients={{this.composer.model.targetRecipients}}
- @hasGroups={{this.composer.model.hasTargetGroups}}
- @focusTarget={{this.composer.focusTarget}}
- class={{concat-class
- "users-input"
- (if this.composer.showWarning "can-warn")
- }}
- />
- {{#if this.composer.showWarning}}
- <label class="add-warning">
- <Input
- @type="checkbox"
- @checked={{this.composer.model.isWarning}}
+ {{#if this.composer.canEdit}}
+ <LinkToInput
+ @onClick={{this.composer.displayEditReason}}
+ @showInput={{this.composer.showEditReason}}
+ @icon="circle-info"
+ class="display-edit-reason"
+ >
+ <TextField
+ @value={{this.composer.editReason}}
+ @id="edit-reason"
+ @maxlength="255"
+ @placeholderKey="composer.edit_reason_placeholder"
+ />
+ </LinkToInput>
+ {{/if}}
+ </div>
+ {{/unless}}
+
+ <PluginOutlet
+ @name="before-composer-controls"
+ @outletArgs={{hash model=this.composer.model}}
+ />
+
+ <ComposerToggles
+ @composeState={{this.composer.model.composeState}}
+ @showToolbar={{this.composer.showToolbar}}
+ @toggleComposer={{this.composer.toggle}}
+ @toggleToolbar={{this.composer.toggleToolbar}}
+ @toggleFullscreen={{this.composer.fullscreenComposer}}
+ @disableTextarea={{this.composer.disableTextarea}}
+ />
+ </div>
+
+ <ComposerEditor>
+ <div class="composer-fields">
+ <PluginOutlet
+ @name="before-composer-fields"
+ @outletArgs={{hash model=this.composer.model}}
+ />
+ {{#unless this.composer.model.viewFullscreen}}
+ {{#if this.composer.model.canEditTitle}}
+ {{#if this.composer.model.creatingPrivateMessage}}
+ <div class="user-selector">
+ <ComposerUserSelector
+ @topicId={{this.composer.topicModel.id}}
+ @recipients={{this.composer.model.targetRecipients}}
+ @hasGroups={{this.composer.model.hasTargetGroups}}
+ @focusTarget={{this.composer.focusTarget}}
+ class={{concatClass
+ "users-input"
+ (if this.composer.showWarning "can-warn")
+ }}
/>
- <span>{{i18n "composer.add_warning"}}</span>
- </label>
+ {{#if this.composer.showWarning}}
+ <label class="add-warning">
+ <Input
+ @type="checkbox"
+ @checked={{this.composer.model.isWarning}}
+ />
+ <span>{{i18n "composer.add_warning"}}</span>
+ </label>
+ {{/if}}
+ </div>
{{/if}}
- </div>
- {{/if}}
- <div
- class="title-and-category
- {{if this.composer.isPreviewVisible 'with-preview'}}"
- >
- <ComposerTitle
- @composer={{this.composer.model}}
- @lastValidatedAt={{this.composer.lastValidatedAt}}
- @focusTarget={{this.composer.focusTarget}}
- />
-
- {{#if this.composer.model.showCategoryChooser}}
- <div class="category-input">
- <CategoryChooser
- @value={{this.composer.model.categoryId}}
- @onChange={{this.composer.updateCategory}}
- @options={{hash
- disabled=this.composer.disableCategoryChooser
- scopedCategoryId=this.composer.scopedCategoryId
- prioritizedCategoryId=this.composer.prioritizedCategoryId
- }}
+ <div
+ class="title-and-category
+ {{if this.composer.isPreviewVisible 'with-preview'}}"
+ >
+ <ComposerTitle
+ @composer={{this.composer.model}}
+ @lastValidatedAt={{this.composer.lastValidatedAt}}
+ @focusTarget={{this.composer.focusTarget}}
/>
- <PluginOutlet
- @name="after-composer-category-input"
- @outletArgs={{hash composer=this.composer.model}}
- />
- <PopupInputTip
- @validation={{this.composer.categoryValidation}}
- />
- </div>
- {{/if}}
- {{#if this.composer.canEditTags}}
- <div class="tags-input">
- <MiniTagChooser
- @value={{this.composer.model.tags}}
- @onChange={{fn (mut this.composer.model.tags)}}
- @options={{hash
+ {{#if this.composer.model.showCategoryChooser}}
+ <div class="category-input">
+ <CategoryChooser
+ @value={{this.composer.model.categoryId}}
+ @onChange={{this.composer.updateCategory}}
+ @options={{hash
+ disabled=this.composer.disableCategoryChooser
+ scopedCategoryId=this.composer.scopedCategoryId
+ prioritizedCategoryId=this.composer.prioritizedCategoryId
+ }}
+ />
+ <PluginOutlet
+ @name="after-composer-category-input"
+ @outletArgs={{hash composer=this.composer.model}}
+ />
+ <PopupInputTip
+ @validation={{this.composer.categoryValidation}}
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.composer.canEditTags}}
+ <div class="tags-input">
+ <MiniTagChooser
+ @value={{this.composer.model.tags}}
+ @onChange={{fn (mut this.composer.model.tags)}}
+ @options={{hash
+ disabled=this.composer.disableTagsChooser
+ categoryId=this.composer.model.categoryId
+ minimum=this.composer.model.minimumRequiredTags
+ }}
+ />
+ <PluginOutlet
+ @name="after-composer-tag-input"
+ @outletArgs={{hash composer=this.composer.model}}
+ />
+ <PopupInputTip
+ @validation={{this.composer.tagValidation}}
+ />
+ </div>
+ {{/if}}
+
+ <PluginOutlet
+ @name="after-title-and-category"
+ @outletArgs={{hash
+ model=this.composer.model
+ tagValidation=this.composer.tagValidation
+ canEditTags=this.composer.canEditTags
disabled=this.composer.disableTagsChooser
- categoryId=this.composer.model.categoryId
- minimum=this.composer.model.minimumRequiredTags
}}
/>
- <PluginOutlet
- @name="after-composer-tag-input"
- @outletArgs={{hash composer=this.composer.model}}
- />
- <PopupInputTip
- @validation={{this.composer.tagValidation}}
- />
</div>
{{/if}}
- <PluginOutlet
- @name="after-title-and-category"
- @outletArgs={{hash
- model=this.composer.model
- tagValidation=this.composer.tagValidation
- canEditTags=this.composer.canEditTags
- disabled=this.composer.disableTagsChooser
- }}
- />
- </div>
- {{/if}}
+ <span>
+ <PluginOutlet
+ @name="composer-fields"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ model=this.composer.model
+ showPreview=this.composer.isPreviewVisible
+ }}
+ />
+ </span>
+ {{/unless}}
+ </div>
+ </ComposerEditor>
+
+ <span>
+ <PluginOutlet
+ @name="composer-after-composer-editor"
+ @outletArgs={{hash model=this.composer.model}}
+ />
+ </span>
+ <div class="submit-panel">
<span>
<PluginOutlet
- @name="composer-fields"
+ @name="composer-fields-below"
@connectorTagName="div"
- @outletArgs={{hash
- model=this.composer.model
- showPreview=this.composer.isPreviewVisible
- }}
+ @outletArgs={{hash model=this.composer.model}}
/>
</span>
- {{/unless}}
- </div>
- </ComposerEditor>
- <span>
- <PluginOutlet
- @name="composer-after-composer-editor"
- @outletArgs={{hash model=this.composer.model}}
- />
- </span>
-
- <div class="submit-panel">
- <span>
- <PluginOutlet
- @name="composer-fields-below"
- @connectorTagName="div"
- @outletArgs={{hash model=this.composer.model}}
- />
- </span>
-
- <div class="save-or-cancel">
- <ComposerSaveButton
- @action={{this.composer.saveAction}}
- @icon={{this.composer.saveIcon}}
- @label={{this.composer.saveLabel}}
- @forwardEvent={{true}}
- @disableSubmit={{this.composer.disableSubmit}}
- />
-
- {{#if this.site.mobileView}}
- <DButton
- @action={{this.composer.cancel}}
- class="cancel btn-transparent"
- @icon={{if this.composer.canEdit "xmark" "trash-can"}}
- @preventFocus={{true}}
- @title="close"
- />
- {{else}}
- <DButton
- @action={{this.composer.cancel}}
- class="cancel btn-transparent"
- @preventFocus={{true}}
- @title="close"
- @label="close"
- />
- {{/if}}
+ <div class="save-or-cancel">
+ <ComposerSaveButton
+ @action={{this.composer.saveAction}}
+ @icon={{this.composer.saveIcon}}
+ @label={{this.composer.saveLabel}}
+ @forwardEvent={{true}}
+ @disableSubmit={{this.composer.disableSubmit}}
+ />
- {{#if this.site.mobileView}}
- {{#if this.composer.whisperOrUnlistTopic}}
- <span class="whisper">
- {{d-icon "far-eye-slash"}}
- </span>
- {{/if}}
+ {{#if this.site.mobileView}}
+ <DButton
+ @action={{this.composer.cancel}}
+ class="cancel btn-transparent"
+ @icon={{if this.composer.canEdit "xmark" "trash-can"}}
+ @preventFocus={{true}}
+ @title="close"
+ />
+ {{else}}
+ <DButton
+ @action={{this.composer.cancel}}
+ class="cancel btn-transparent"
+ @preventFocus={{true}}
+ @title="close"
+ @label="close"
+ />
+ {{/if}}
- {{#if this.composer.model.noBump}}
- <span class="no-bump">{{d-icon "anchor"}}</span>
- {{/if}}
- {{/if}}
+ {{#if this.site.mobileView}}
+ {{#if this.composer.whisperOrUnlistTopic}}
+ <span class="whisper">
+ {{icon "far-eye-slash"}}
+ </span>
+ {{/if}}
- <span>
- <PluginOutlet
- @name="composer-after-save-or-cancel"
- @outletArgs={{hash model=this.composer.model}}
- />
- </span>
- </div>
+ {{#if this.composer.model.noBump}}
+ <span class="no-bump">{{icon "anchor"}}</span>
+ {{/if}}
+ {{/if}}
- {{#if this.site.mobileView}}
- <span>
- <PluginOutlet
- @name="composer-mobile-buttons-bottom"
- @outletArgs={{hash model=this.composer.model}}
- />
- </span>
+ <span>
+ <PluginOutlet
+ @name="composer-after-save-or-cancel"
+ @outletArgs={{hash model=this.composer.model}}
+ />
+ </span>
+ </div>
- {{#if this.composer.allowUpload}}
- <a
- id="mobile-file-upload"
- class="btn btn-default no-text mobile-file-upload
- {{if this.composer.isUploading 'hidden'}}"
- aria-label={{i18n "composer.upload_title"}}
- >
- {{d-icon this.composer.uploadIcon}}
- </a>
- {{/if}}
+ {{#if this.site.mobileView}}
+ <span>
+ <PluginOutlet
+ @name="composer-mobile-buttons-bottom"
+ @outletArgs={{hash model=this.composer.model}}
+ />
+ </span>
- {{#if this.composer.allowPreview}}
- <a
- href
- class="btn btn-default no-text mobile-preview"
- title={{i18n "composer.show_preview"}}
- {{on "click" this.composer.togglePreview}}
- aria-label={{i18n "composer.show_preview"}}
- >
- {{d-icon "desktop"}}
- </a>
- {{/if}}
+ {{#if this.composer.allowUpload}}
+ <a
+ id="mobile-file-upload"
+ class="btn btn-default no-text mobile-file-upload
+ {{if this.composer.isUploading 'hidden'}}"
+ aria-label={{i18n "composer.upload_title"}}
+ >
+ {{icon this.composer.uploadIcon}}
+ </a>
+ {{/if}}
- {{#if this.composer.isPreviewVisible}}
- <DButton
- @action={{this.composer.togglePreview}}
- @title="composer.hide_preview"
- @ariaLabel="composer.hide_preview"
- @icon="pencil"
- class="hide-preview"
- />
- {{/if}}
- {{/if}}
-
- {{#if
- (or this.composer.isUploading this.composer.isProcessingUpload)
- }}
- <div id="file-uploading">
- {{#if this.composer.isProcessingUpload}}
- {{loading-spinner size="small"}}<span>{{i18n
- "upload_selector.processing"
- }}</span>
- {{else}}
- {{loading-spinner size="small"}}<span>{{i18n
- "upload_selector.uploading"
- }}
- {{this.composer.uploadProgress}}%</span>
+ {{#if this.composer.allowPreview}}
+ <a
+ href
+ class="btn btn-default no-text mobile-preview"
+ title={{i18n "composer.show_preview"}}
+ {{on "click" this.composer.togglePreview}}
+ aria-label={{i18n "composer.show_preview"}}
+ >
+ {{icon "desktop"}}
+ </a>
+ {{/if}}
+
+ {{#if this.composer.isPreviewVisible}}
+ <DButton
+ @action={{this.composer.togglePreview}}
+ @title="composer.hide_preview"
+ @ariaLabel="composer.hide_preview"
+ @icon="pencil"
+ class="hide-preview"
+ />
+ {{/if}}
{{/if}}
- {{#if this.composer.isCancellable}}
- <a
- href
- id="cancel-file-upload"
- {{on "click" this.composer.cancelUpload}}
- >{{d-icon "xmark"}}</a>
+ {{#if
+ (or this.composer.isUploading this.composer.isProcessingUpload)
+ }}
+ <div id="file-uploading">
+ {{#if this.composer.isProcessingUpload}}
+ {{loadingSpinner size="small"}}<span>{{i18n
+ "upload_selector.processing"
+ }}</span>
+ {{else}}
+ {{loadingSpinner size="small"}}<span>{{i18n
+ "upload_selector.uploading"
+ }}
+ {{this.composer.uploadProgress}}%</span>
+ {{/if}}
+
+ {{#if this.composer.isCancellable}}
+ <a
+ href
+ id="cancel-file-upload"
+ {{on "click" this.composer.cancelUpload}}
+ >{{icon "xmark"}}</a>
+ {{/if}}
+ </div>
{{/if}}
- </div>
- {{/if}}
- <div
- class={{if this.composer.isUploading "hidden"}}
- id="draft-status"
- >
- {{#if this.composer.model.draftStatus}}
- <span
- class="draft-error"
- title={{this.composer.model.draftStatus}}
+ <div
+ class={{if this.composer.isUploading "hidden"}}
+ id="draft-status"
>
- {{#if this.composer.model.draftConflictUser}}
- {{avatar
- this.composer.model.draftConflictUser
- imageSize="small"
- }}
- {{d-icon "user-pen"}}
- {{else}}
- {{d-icon "triangle-exclamation"}}
- {{/if}}
- {{#if this.site.desktopView}}
- {{this.composer.model.draftStatus}}
+ {{#if this.composer.model.draftStatus}}
+ <span
+ class="draft-error"
+ title={{this.composer.model.draftStatus}}
+ >
+ {{#if this.composer.model.draftConflictUser}}
+ {{avatar
+ this.composer.model.draftConflictUser
+ imageSize="small"
+ }}
+ {{icon "user-pen"}}
+ {{else}}
+ {{icon "triangle-exclamation"}}
+ {{/if}}
+ {{#if this.site.desktopView}}
+ {{this.composer.model.draftStatus}}
+ {{/if}}
+ </span>
{{/if}}
- </span>
+ </div>
+
+ {{#if (and this.composer.allowPreview this.site.desktopView)}}
+ <DButton
+ @action={{this.composer.togglePreview}}
+ @translatedTitle={{this.composer.toggleText}}
+ @icon="angles-left"
+ class={{concatClass
+ "btn-transparent btn-mini-toggle toggle-preview"
+ (unless this.composer.isPreviewVisible "active")
+ }}
+ />
+ {{/if}}
+ </div>
+ </div>
+ {{else}}
+ <div class="saving-text">
+ {{#if this.composer.model.createdPost}}
+ {{i18n "composer.saved"}}
+ <a
+ href={{this.composer.createdPost.url}}
+ {{on "click" this.composer.viewNewReply}}
+ class="permalink"
+ >{{i18n "composer.view_new_post"}}</a>
+ {{else}}
+ {{i18n "composer.saving"}}
+ {{loadingSpinner size="small"}}
{{/if}}
</div>
- {{#if (and this.composer.allowPreview this.site.desktopView)}}
- <DButton
- @action={{this.composer.togglePreview}}
- @translatedTitle={{this.composer.toggleText}}
- @icon="angles-left"
- class={{concat-class
- "btn-transparent btn-mini-toggle toggle-preview"
- (unless this.composer.isPreviewVisible "active")
- }}
- />
- {{/if}}
- </div>
- </div>
- {{else}}
- <div class="saving-text">
- {{#if this.composer.model.createdPost}}
- {{i18n "composer.saved"}}
- <a
- href={{this.composer.createdPost.url}}
- {{on "click" this.composer.viewNewReply}}
- class="permalink"
- >{{i18n "composer.view_new_post"}}</a>
- {{else}}
- {{i18n "composer.saving"}}
- {{loading-spinner size="small"}}
- {{/if}}
- </div>
+ <div class="draft-text">
+ {{#if this.composer.model.topic}}
+ {{icon "share"}}
+ {{htmlSafe this.composer.draftTitle}}
+ {{else}}
+ {{i18n "composer.saved_draft"}}
+ {{/if}}
+ </div>
- <div class="draft-text">
- {{#if this.composer.model.topic}}
- {{d-icon "share"}}
- {{html-safe this.composer.draftTitle}}
- {{else}}
- {{i18n "composer.saved_draft"}}
+ <ComposerToggles
+ @composeState={{this.composer.model.composeState}}
+ @toggleFullscreen={{this.composer.openIfDraft}}
+ @toggleComposer={{this.composer.toggle}}
+ @toggleToolbar={{this.composer.toggleToolbar}}
+ />
{{/if}}
- </div>
-
- <ComposerToggles
- @composeState={{this.composer.model.composeState}}
- @toggleFullscreen={{this.composer.openIfDraft}}
- @toggleComposer={{this.composer.toggle}}
- @toggleToolbar={{this.composer.toggleToolbar}}
- />
- {{/if}}
- {{/if}}
-</ComposerBody>
\ No newline at end of file
+ {{/if}}
+ </ComposerBody>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/composer-editor.gjs b/app/assets/javascripts/discourse/app/components/composer-editor.gjs
index 0395d415ed6..9fab321a382 100644
--- a/app/assets/javascripts/discourse/app/components/composer-editor.gjs
+++ b/app/assets/javascripts/discourse/app/components/composer-editor.gjs
@@ -1,4 +1,5 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import EmberObject, { action, computed } from "@ember/object";
import { getOwner } from "@ember/owner";
import { schedule, throttle } from "@ember/runloop";
@@ -8,6 +9,10 @@ import { observes, on } from "@ember-decorators/object";
import { BasePlugin } from "@uppy/core";
import $ from "jquery";
import { resolveAllShortUrls } from "pretty-text/upload-short-url";
+import { gt } from "truth-helpers";
+import DEditor from "discourse/components/d-editor";
+import Wrapper from "discourse/components/form-template-field/wrapper";
+import PickFilesButton from "discourse/components/pick-files-button";
import { ajax } from "discourse/lib/ajax";
import { tinyAvatar } from "discourse/lib/avatar-utils";
import { setupComposerPosition } from "discourse/lib/composer/composer-position";
@@ -31,6 +36,7 @@ import UppyComposerUpload from "discourse/lib/uppy/composer-upload";
import { formatUsername } from "discourse/lib/utilities";
import Composer from "discourse/models/composer";
import { i18n } from "discourse-i18n";
+import FormTemplateChooser from "select-kit/components/form-template-chooser";
let uploadHandlers = [];
export function addComposerUploadHandler(extensions, method) {
@@ -953,63 +959,65 @@ export default class ComposerEditor extends Component {
showUploadModal() {
document.getElementById(this.fileUploadElementId).click();
}
-}
-
-{{#if this.showFormTemplateForm}}
- <div class="d-editor">
- <div class="d-editor-container">
- <div class="d-editor-textarea-column">
- {{yield}}
- {{#if (gt this.composer.formTemplateIds.length 1)}}
- <FormTemplateChooser
- @filteredIds={{this.composer.formTemplateIds}}
- @value={{this.selectedFormTemplateId}}
- @onChange={{this.updateSelectedFormTemplateId}}
- @options={{hash maximum=1}}
- class="composer-select-form-template"
- />
- {{/if}}
- <form id="form-template-form">
- <FormTemplateField::Wrapper
- @id={{this.selectedFormTemplateId}}
- @initialValues={{this.composer.formTemplateInitialValues}}
- @onSelectFormTemplate={{this.composer.onSelectFormTemplate}}
- />
- </form>
+ <template>
+ {{#if this.showFormTemplateForm}}
+ <div class="d-editor">
+ <div class="d-editor-container">
+ <div class="d-editor-textarea-column">
+ {{yield}}
+
+ {{#if (gt this.composer.formTemplateIds.length 1)}}
+ <FormTemplateChooser
+ @filteredIds={{this.composer.formTemplateIds}}
+ @value={{this.selectedFormTemplateId}}
+ @onChange={{this.updateSelectedFormTemplateId}}
+ @options={{hash maximum=1}}
+ class="composer-select-form-template"
+ />
+ {{/if}}
+ <form id="form-template-form">
+ <Wrapper
+ @id={{this.selectedFormTemplateId}}
+ @initialValues={{this.composer.formTemplateInitialValues}}
+ @onSelectFormTemplate={{this.composer.onSelectFormTemplate}}
+ />
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
-{{else}}
- <DEditor
- @value={{this.composer.model.reply}}
- @placeholder={{this.replyPlaceholder}}
- @previewUpdated={{action "previewUpdated"}}
- @markdownOptions={{this.markdownOptions}}
- @extraButtons={{action "extraButtons"}}
- @processPreview={{this.composer.isPreviewVisible}}
- @validation={{this.validation}}
- @loading={{this.composer.loading}}
- @forcePreview={{this.forcePreview}}
- @showLink={{this.showLink}}
- @composerEvents={{true}}
- @onPopupMenuAction={{this.composer.onPopupMenuAction}}
- @popupMenuOptions={{this.composer.popupMenuOptions}}
- @disabled={{this.composer.disableTextarea}}
- @outletArgs={{hash composer=this.composer.model editorType="composer"}}
- @topicId={{this.composer.model.topic.id}}
- @categoryId={{this.composer.model.category.id}}
- @onSetup={{this.setupEditor}}
- @disableSubmit={{this.composer.disableSubmit}}
- >
- {{yield}}
- </DEditor>
-{{/if}}
-
-{{#if this.composer.allowUpload}}
- <PickFilesButton
- @fileInputId={{this.fileUploadElementId}}
- @allowMultiple={{true}}
- name="file-uploader"
- />
-{{/if}}
\ No newline at end of file
+ {{else}}
+ <DEditor
+ @value={{this.composer.model.reply}}
+ @placeholder={{this.replyPlaceholder}}
+ @previewUpdated={{this.previewUpdated}}
+ @markdownOptions={{this.markdownOptions}}
+ @extraButtons={{this.extraButtons}}
+ @processPreview={{this.composer.isPreviewVisible}}
+ @validation={{this.validation}}
+ @loading={{this.composer.loading}}
+ @forcePreview={{this.forcePreview}}
+ @showLink={{this.showLink}}
+ @composerEvents={{true}}
+ @onPopupMenuAction={{this.composer.onPopupMenuAction}}
+ @popupMenuOptions={{this.composer.popupMenuOptions}}
+ @disabled={{this.composer.disableTextarea}}
+ @outletArgs={{hash composer=this.composer.model editorType="composer"}}
+ @topicId={{this.composer.model.topic.id}}
+ @categoryId={{this.composer.model.category.id}}
+ @onSetup={{this.setupEditor}}
+ @disableSubmit={{this.composer.disableSubmit}}
+ >
+ {{yield}}
+ </DEditor>
+ {{/if}}
+
+ {{#if this.composer.allowUpload}}
+ <PickFilesButton
+ @fileInputId={{this.fileUploadElementId}}
+ @allowMultiple={{true}}
+ name="file-uploader"
+ />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/composer-user-selector.gjs b/app/assets/javascripts/discourse/app/components/composer-user-selector.gjs
index 25d782f5ef4..7c40a8a2c8d 100644
--- a/app/assets/javascripts/discourse/app/components/composer-user-selector.gjs
+++ b/app/assets/javascripts/discourse/app/components/composer-user-selector.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 EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default class ComposerUserSelector extends Component {
_groups = [];
@@ -45,17 +47,19 @@ export default class ComposerUserSelector extends Component {
this._updateGroups(selected, newGroups);
this.set("recipients", selected.join(","));
}
-}
-<EmailGroupUserChooser
- @id="private-message-users"
- @value={{this.splitRecipients}}
- @onChange={{action "updateRecipients"}}
- @options={{hash
- topicId=this.topicId
- none="composer.users_placeholder"
- includeMessageableGroups=true
- allowEmails=this.currentUser.can_send_private_email_messages
- autoWrap=true
- }}
-/>
\ No newline at end of file
+ <template>
+ <EmailGroupUserChooser
+ @id="private-message-users"
+ @value={{this.splitRecipients}}
+ @onChange={{this.updateRecipients}}
+ @options={{hash
+ topicId=this.topicId
+ none="composer.users_placeholder"
+ includeMessageableGroups=true
+ allowEmails=this.currentUser.can_send_private_email_messages
+ autoWrap=true
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/d-editor.gjs b/app/assets/javascripts/discourse/app/components/d-editor.gjs
index da643f05eef..f56cf5e94f2 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-editor.gjs
@@ -1,17 +1,26 @@
import { tracked } from "@glimmer/tracking";
import Component from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import { schedule, scheduleOnce } from "@ember/runloop";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
-import { observes, on } from "@ember-decorators/object";
+import { observes, on as onEvent } from "@ember-decorators/object";
import { emojiSearch, isSkinTonableEmoji } from "pretty-text/emoji";
import { translations } from "pretty-text/emoji/data";
import { Promise } from "rsvp";
import TextareaEditor from "discourse/components/composer/textarea-editor";
+import ToggleSwitch from "discourse/components/composer/toggle-switch";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DecoratedHtml from "discourse/components/decorated-html";
import EmojiPickerDetached from "discourse/components/emoji-picker/detached";
import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PopupInputTip from "discourse/components/popup-input-tip";
+import htmlSafe from "discourse/helpers/html-safe";
import { SKIP } from "discourse/lib/autocomplete";
import Toolbar from "discourse/lib/composer/toolbar";
import discourseDebounce from "discourse/lib/debounce";
@@ -34,6 +43,7 @@ import {
} from "discourse/lib/user-status-on-autocomplete";
import virtualElementFromTextRange from "discourse/lib/virtual-element-from-text-range";
import { i18n } from "discourse-i18n";
+import ToolbarPopupMenuOptions from "select-kit/components/toolbar-popup-menu-options";
let _createCallbacks = [];
@@ -182,7 +192,7 @@ export default class DEditor extends Component {
}
}
- @on("willDestroyElement")
+ @onEvent("willDestroyElement")
_shutDown() {
this._previewMutationObserver?.disconnect();
@@ -699,98 +709,101 @@ export default class DEditor extends Component {
return observer;
}
-}
-<div class="d-editor-container">
- <div class="d-editor-textarea-column">
- {{yield}}
-
- <div
- class="d-editor-textarea-wrapper
- {{if this.disabled 'disabled'}}
- {{if this.isEditorFocused 'in-focus'}}"
- >
- <div class="d-editor-button-bar" role="toolbar">
- {{#if this.siteSettings.rich_editor}}
- <Composer::ToggleSwitch
- @preventFocus={{true}}
- @disabled={{@disableSubmit}}
- @state={{this.isRichEditorEnabled}}
- {{on "click" this.toggleRichEditor}}
- />
- {{/if}}
-
- {{#each this.toolbar.groups as |group|}}
- {{#each group.buttons as |b|}}
- {{#if (b.condition this)}}
- {{#if b.popupMenu}}
- <ToolbarPopupMenuOptions
- @content={{this.popupMenuOptions}}
- @onChange={{this.onPopupMenuAction}}
- @onOpen={{action b.action b}}
- @tabindex={{-1}}
- @onKeydown={{this.rovingButtonBar}}
- @options={{hash icon=b.icon focusAfterOnChange=false}}
- class={{b.className}}
- />
- {{else}}
- <DButton
- @action={{fn (action b.action) b}}
- @translatedTitle={{b.title}}
- @label={{b.label}}
- @icon={{b.icon}}
- @preventFocus={{b.preventFocus}}
- @onKeyDown={{this.rovingButtonBar}}
- tabindex={{b.tabindex}}
- class={{b.className}}
- />
- {{/if}}
+ <template>
+ <div class="d-editor-container">
+ <div class="d-editor-textarea-column">
+ {{yield}}
+
+ <div
+ class="d-editor-textarea-wrapper
+ {{if this.disabled 'disabled'}}
+ {{if this.isEditorFocused 'in-focus'}}"
+ >
+ <div class="d-editor-button-bar" role="toolbar">
+ {{#if this.siteSettings.rich_editor}}
+ <ToggleSwitch
+ @preventFocus={{true}}
+ @disabled={{@disableSubmit}}
+ @state={{this.isRichEditorEnabled}}
+ {{on "click" this.toggleRichEditor}}
+ />
{{/if}}
- {{/each}}
- {{/each}}
+
+ {{#each this.toolbar.groups as |group|}}
+ {{#each group.buttons as |b|}}
+ {{#if (b.condition this)}}
+ {{#if b.popupMenu}}
+ <ToolbarPopupMenuOptions
+ @content={{this.popupMenuOptions}}
+ @onChange={{this.onPopupMenuAction}}
+ @onOpen={{action b.action b}}
+ @tabindex={{-1}}
+ @onKeydown={{this.rovingButtonBar}}
+ @options={{hash icon=b.icon focusAfterOnChange=false}}
+ class={{b.className}}
+ />
+ {{else}}
+ <DButton
+ @action={{fn (action b.action) b}}
+ @translatedTitle={{b.title}}
+ @label={{b.label}}
+ @icon={{b.icon}}
+ @preventFocus={{b.preventFocus}}
+ @onKeyDown={{this.rovingButtonBar}}
+ tabindex={{b.tabindex}}
+ class={{b.className}}
+ />
+ {{/if}}
+ {{/if}}
+ {{/each}}
+ {{/each}}
+ </div>
+
+ <ConditionalLoadingSpinner @condition={{this.loading}} />
+ <this.editorComponent
+ @class="d-editor-input"
+ @onSetup={{this.setupEditor}}
+ @markdownOptions={{this.markdownOptions}}
+ @keymap={{this.keymap}}
+ @value={{this.value}}
+ @placeholder={{this.placeholderTranslated}}
+ @disabled={{this.disabled}}
+ @change={{this.onChange}}
+ @focusIn={{this.handleFocusIn}}
+ @focusOut={{this.handleFocusOut}}
+ @categoryId={{@categoryId}}
+ @topicId={{@topicId}}
+ @id={{this.textAreaId}}
+ />
+ <PopupInputTip @validation={{this.validation}} />
+ <PluginOutlet
+ @name="after-d-editor"
+ @connectorTagName="div"
+ @outletArgs={{this.outletArgs}}
+ />
+ </div>
</div>
- <ConditionalLoadingSpinner @condition={{this.loading}} />
- <this.editorComponent
- @class="d-editor-input"
- @onSetup={{this.setupEditor}}
- @markdownOptions={{this.markdownOptions}}
- @keymap={{this.keymap}}
- @value={{this.value}}
- @placeholder={{this.placeholderTranslated}}
- @disabled={{this.disabled}}
- @change={{this.onChange}}
- @focusIn={{this.handleFocusIn}}
- @focusOut={{this.handleFocusOut}}
- @categoryId={{@categoryId}}
- @topicId={{@topicId}}
- @id={{this.textAreaId}}
- />
- <PopupInputTip @validation={{this.validation}} />
- <PluginOutlet
- @name="after-d-editor"
- @connectorTagName="div"
- @outletArgs={{this.outletArgs}}
- />
+ {{! template-lint-disable no-invalid-interactive }}
+ <div
+ class="d-editor-preview-wrapper
+ {{if this.forcePreview 'force-preview'}}"
+ {{on "click" this.handlePreviewClick}}
+ >
+ <DecoratedHtml
+ @className="d-editor-preview"
+ @html={{htmlSafe this.preview}}
+ @decorate={{this.previewUpdated}}
+ />
+ <span class="d-editor-plugin">
+ <PluginOutlet
+ @name="editor-preview"
+ @connectorTagName="div"
+ @outletArgs={{this.outletArgs}}
+ />
+ </span>
+ </div>
</div>
- </div>
-
- {{! template-lint-disable no-invalid-interactive }}
- <div
- class="d-editor-preview-wrapper {{if this.forcePreview 'force-preview'}}"
- {{on "click" this.handlePreviewClick}}
- >
- <DecoratedHtml
- @className="d-editor-preview"
- @html={{html-safe this.preview}}
- @decorate={{this.previewUpdated}}
- />
- <span class="d-editor-plugin">
- <PluginOutlet
- @name="editor-preview"
- @connectorTagName="div"
- @outletArgs={{this.outletArgs}}
- />
- </span>
- </div>
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/d-navigation.gjs b/app/assets/javascripts/discourse/app/components/d-navigation.gjs
index a02826ffaf5..f3250d4203c 100644
--- a/app/assets/javascripts/discourse/app/components/d-navigation.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-navigation.gjs
@@ -1,16 +1,28 @@
import { tracked } from "@glimmer/tracking";
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { dependentKeyCompat } from "@ember/object/compat";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { tagName } from "@ember-decorators/component";
+import { and, gt } from "truth-helpers";
+import BreadCrumbs from "discourse/components/bread-crumbs";
+import BulkSelectToggle from "discourse/components/bulk-select-toggle";
+import CategoryNotificationsTracking from "discourse/components/category-notifications-tracking";
+import CreateTopicButton from "discourse/components/create-topic-button";
+import DButton from "discourse/components/d-button";
+import NavigationBar from "discourse/components/navigation-bar";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TagNotificationsTracking from "discourse/components/tag-notifications-tracking";
+import TopicDismissButtons from "discourse/components/topic-dismiss-buttons";
import { setting } from "discourse/lib/computed";
import discourseComputed from "discourse/lib/decorators";
import { filterTypeForMode } from "discourse/lib/filter-mode";
import { NotificationLevels } from "discourse/lib/notification-levels";
import { applyValueTransformer } from "discourse/lib/transformer";
import NavItem from "discourse/models/nav-item";
+import CategoriesAdminDropdown from "select-kit/components/categories-admin-dropdown";
@tagName("")
export default class DNavigation extends Component {
@@ -212,151 +224,153 @@ export default class DNavigation extends Component {
this.createTopic();
}
}
-}
-<BreadCrumbs
- @categories={{this.categories}}
- @category={{this.category}}
- @noSubcategories={{this.noSubcategories}}
- @tag={{this.tag}}
- @additionalTags={{this.additionalTags}}
-/>
-
-<PluginOutlet
- @name="after-breadcrumbs"
- @outletArgs={{hash
- categories=this.categories
- category=this.category
- tag=this.tag
- additionalTags=this.additionalTags
- }}
-/>
-
-{{#unless this.additionalTags}}
- {{! nav bar doesn't work with tag intersections }}
- <NavigationBar
- @navItems={{this.navItems}}
- @filterMode={{this.filterMode}}
- @category={{this.category}}
- @tag={{this.tag}}
- />
-{{/unless}}
-
-<div class="navigation-controls">
- {{#if this.showBulkSelectInNavControls}}
- <BulkSelectToggle @bulkSelectHelper={{@bulkSelectHelper}} />
- {{/if}}
-
- <TopicDismissButtons
- @position="top"
- @selectedTopics={{@bulkSelectHelper.selected}}
- @model={{@model}}
- @showResetNew={{@showResetNew}}
- @showDismissRead={{@showDismissRead}}
- @resetNew={{@resetNew}}
- @dismissRead={{@dismissRead}}
- />
-
- {{#if this.showCategoryAdmin}}
- {{#if this.fixedCategoryPositions}}
- <CategoriesAdminDropdown
- @onChange={{action "selectCategoryAdminDropdownAction"}}
- @options={{hash triggerOnChangeOnTab=false}}
+ <template>
+ <BreadCrumbs
+ @categories={{this.categories}}
+ @category={{this.category}}
+ @noSubcategories={{this.noSubcategories}}
+ @tag={{this.tag}}
+ @additionalTags={{this.additionalTags}}
+ />
+
+ <PluginOutlet
+ @name="after-breadcrumbs"
+ @outletArgs={{hash
+ categories=this.categories
+ category=this.category
+ tag=this.tag
+ additionalTags=this.additionalTags
+ }}
+ />
+
+ {{#unless this.additionalTags}}
+ {{! nav bar doesn't work with tag intersections }}
+ <NavigationBar
+ @navItems={{this.navItems}}
+ @filterMode={{this.filterMode}}
+ @category={{this.category}}
+ @tag={{this.tag}}
/>
- {{else}}
- <DButton
- @action={{this.createCategory}}
- @icon="plus"
- @label={{if
- this.site.mobileView
- "categories.category"
- "category.create"
+ {{/unless}}
+
+ <div class="navigation-controls">
+ {{#if this.showBulkSelectInNavControls}}
+ <BulkSelectToggle @bulkSelectHelper={{@bulkSelectHelper}} />
+ {{/if}}
+
+ <TopicDismissButtons
+ @position="top"
+ @selectedTopics={{@bulkSelectHelper.selected}}
+ @model={{@model}}
+ @showResetNew={{@showResetNew}}
+ @showDismissRead={{@showDismissRead}}
+ @resetNew={{@resetNew}}
+ @dismissRead={{@dismissRead}}
+ />
+
+ {{#if this.showCategoryAdmin}}
+ {{#if this.fixedCategoryPositions}}
+ <CategoriesAdminDropdown
+ @onChange={{this.selectCategoryAdminDropdownAction}}
+ @options={{hash triggerOnChangeOnTab=false}}
+ />
+ {{else}}
+ <DButton
+ @action={{this.createCategory}}
+ @icon="plus"
+ @label={{if
+ this.site.mobileView
+ "categories.category"
+ "category.create"
+ }}
+ class="btn-default"
+ id="create-category"
+ />
+ {{/if}}
+ {{/if}}
+
+ {{#if (and this.category this.showCategoryEdit)}}
+ <DButton
+ @action={{this.editCategory}}
+ @icon="wrench"
+ @title="category.edit_title"
+ class="btn-default edit-category"
+ />
+ {{/if}}
+
+ {{#if this.tag}}
+ {{#if this.showToggleInfo}}
+ <DButton
+ @icon={{if this.currentUser.staff "wrench" "circle-info"}}
+ @ariaLabel="tagging.info"
+ @action={{this.toggleInfo}}
+ id="show-tag-info"
+ class="btn-default"
+ />
+ {{/if}}
+ {{/if}}
+
+ <PluginOutlet
+ @name="before-create-topic-button"
+ @outletArgs={{hash
+ canCreateTopic=this.canCreateTopic
+ createTopicDisabled=this.createTopicDisabled
+ createTopicLabel=this.createTopicLabel
+ additionalTags=this.additionalTags
+ category=this.category
+ tag=this.tag
}}
- class="btn-default"
- id="create-category"
/>
- {{/if}}
- {{/if}}
-
- {{#if (and this.category this.showCategoryEdit)}}
- <DButton
- @action={{this.editCategory}}
- @icon="wrench"
- @title="category.edit_title"
- class="btn-default edit-category"
- />
- {{/if}}
-
- {{#if this.tag}}
- {{#if this.showToggleInfo}}
- <DButton
- @icon={{if this.currentUser.staff "wrench" "circle-info"}}
- @ariaLabel="tagging.info"
- @action={{this.toggleInfo}}
- id="show-tag-info"
- class="btn-default"
+
+ <CreateTopicButton
+ @canCreateTopic={{this.canCreateTopic}}
+ @action={{this.clickCreateTopicButton}}
+ @disabled={{this.createTopicButtonDisabled}}
+ @label={{this.createTopicLabel}}
+ @btnClass={{this.createTopicClass}}
+ @canCreateTopicOnTag={{this.canCreateTopicOnTag}}
+ @showDrafts={{if (gt this.draftCount 0) true false}}
/>
- {{/if}}
- {{/if}}
-
- <PluginOutlet
- @name="before-create-topic-button"
- @outletArgs={{hash
- canCreateTopic=this.canCreateTopic
- createTopicDisabled=this.createTopicDisabled
- createTopicLabel=this.createTopicLabel
- additionalTags=this.additionalTags
- category=this.category
- tag=this.tag
- }}
- />
-
- <CreateTopicButton
- @canCreateTopic={{this.canCreateTopic}}
- @action={{action "clickCreateTopicButton"}}
- @disabled={{this.createTopicButtonDisabled}}
- @label={{this.createTopicLabel}}
- @btnClass={{this.createTopicClass}}
- @canCreateTopicOnTag={{this.canCreateTopicOnTag}}
- @showDrafts={{if (gt this.draftCount 0) true false}}
- />
-
- <PluginOutlet
- @name="after-create-topic-button"
- @outletArgs={{hash
- canCreateTopic=this.canCreateTopic
- createTopicDisabled=this.createTopicDisabled
- createTopicLabel=this.createTopicLabel
- category=this.category
- tag=this.tag
- }}
- />
-
- {{#if this.category}}
- {{#unless this.tag}}
- {{! don't show category notification menu on tag pages }}
- {{#if this.showCategoryNotifications}}
- {{#unless this.category.deleted}}
- <CategoryNotificationsTracking
- @levelId={{this.categoryNotificationLevel}}
- @showFullTitle={{false}}
- @showCaret={{false}}
- @onChange={{this.changeCategoryNotificationLevel}}
- />
+
+ <PluginOutlet
+ @name="after-create-topic-button"
+ @outletArgs={{hash
+ canCreateTopic=this.canCreateTopic
+ createTopicDisabled=this.createTopicDisabled
+ createTopicLabel=this.createTopicLabel
+ category=this.category
+ tag=this.tag
+ }}
+ />
+
+ {{#if this.category}}
+ {{#unless this.tag}}
+ {{! don't show category notification menu on tag pages }}
+ {{#if this.showCategoryNotifications}}
+ {{#unless this.category.deleted}}
+ <CategoryNotificationsTracking
+ @levelId={{this.categoryNotificationLevel}}
+ @showFullTitle={{false}}
+ @showCaret={{false}}
+ @onChange={{this.changeCategoryNotificationLevel}}
+ />
+ {{/unless}}
+ {{/if}}
{{/unless}}
{{/if}}
- {{/unless}}
- {{/if}}
-
- {{#if this.tag}}
- {{#unless this.category}}
- {{! don't show tag notification menu on category pages }}
- {{#if this.showTagNotifications}}
- <TagNotificationsTracking
- @onChange={{this.changeTagNotificationLevel}}
- @levelId={{this.tagNotification.notification_level}}
- />
+
+ {{#if this.tag}}
+ {{#unless this.category}}
+ {{! don't show tag notification menu on category pages }}
+ {{#if this.showTagNotifications}}
+ <TagNotificationsTracking
+ @onChange={{this.changeTagNotificationLevel}}
+ @levelId={{this.tagNotification.notification_level}}
+ />
+ {{/if}}
+ {{/unless}}
{{/if}}
- {{/unless}}
- {{/if}}
-</div>
\ No newline at end of file
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/discovery/topics.gjs b/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
index 51ced9ab56b..da68ff16965 100644
--- a/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
+++ b/app/assets/javascripts/discourse/app/components/discovery/topics.gjs
@@ -1,11 +1,30 @@
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 { service } from "@ember/service";
+import { or } from "truth-helpers";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import CountI18n from "discourse/components/count-i18n";
+import DiscourseLinkedText from "discourse/components/discourse-linked-text";
+import DiscoveryTopicsList from "discourse/components/discovery-topics-list";
+import FooterMessage from "discourse/components/footer-message";
+import NewListHeaderControlsWrapper from "discourse/components/new-list-header-controls-wrapper";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TopPeriodButtons from "discourse/components/top-period-buttons";
+import TopicDismissButtons from "discourse/components/topic-dismiss-buttons";
+import TopicList from "discourse/components/topic-list";
+import List from "discourse/components/topic-list/list";
+import basePath from "discourse/helpers/base-path";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlSafe from "discourse/helpers/html-safe";
+import loadingSpinner from "discourse/helpers/loading-spinner";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { filterTypeForMode } from "discourse/lib/filter-mode";
import { userPath } from "discourse/lib/url";
import { i18n } from "discourse-i18n";
+import PeriodChooser from "select-kit/components/period-chooser";
export default class DiscoveryTopics extends Component {
@service router;
@@ -179,218 +198,221 @@ export default class DiscoveryTopics extends Component {
get expandAllPinned() {
return this.args.tag || this.args.category;
}
-}
-{{#if @model.canLoadMore}}
- {{hide-application-footer}}
-{{/if}}
-
-{{#if this.redirectedReason}}
- <div class="alert alert-info">{{this.redirectedReason}}</div>
-{{/if}}
-
-{{#if @model.sharedDrafts}}
- {{#if this.site.useGlimmerTopicList}}
- <TopicList::List
- @listTitle="shared_drafts.title"
- @top={{this.top}}
- @hideCategory="true"
- @category={{@category}}
- @topics={{@model.sharedDrafts}}
- @discoveryList={{true}}
- class="shared-drafts"
- />
- {{else}}
- <TopicList
- @listTitle="shared_drafts.title"
- @top={{this.top}}
- @hideCategory="true"
- @category={{@category}}
- @topics={{@model.sharedDrafts}}
- @discoveryList={{true}}
- class="shared-drafts"
- />
- {{/if}}
-{{/if}}
-
-<DiscoveryTopicsList
- @model={{@model}}
- @incomingCount={{this.topicTrackingState.incomingCount}}
- @bulkSelectHelper={{@bulkSelectHelper}}
- @class={{if this.footerEducation "--no-topics-education"}}
->
- {{#if this.top}}
- <div class="top-lists">
- <PeriodChooser
- @period={{@period}}
- @action={{@changePeriod}}
- @fullDay={{false}}
- />
- </div>
- {{else}}
- {{#if (or this.topicTrackingState.hasIncoming @model.loadingBefore)}}
- <div class="show-more {{if this.hasTopics 'has-topics'}}">
- <a
- tabindex="0"
- href
- {{on "click" this.showInserted}}
- class="alert alert-info clickable
- {{if @model.loadingBefore 'loading'}}"
- >
- <CountI18n
- @key="topic_count_"
- @suffix={{this.topicTrackingState.filter}}
- @count={{or
- @model.loadingBefore
- this.topicTrackingState.incomingCount
- }}
- />
- {{#if @model.loadingBefore}}
- {{loading-spinner size="small"}}
- {{/if}}
- </a>
- </div>
+ <template>
+ {{#if @model.canLoadMore}}
+ {{hideApplicationFooter}}
{{/if}}
- {{/if}}
-
- {{#if this.renderNewListHeaderControls}}
- <NewListHeaderControlsWrapper
- @current={{@model.params.subset}}
- @newRepliesCount={{this.newRepliesCount}}
- @newTopicsCount={{this.newTopicsCount}}
- @changeNewListSubset={{@changeNewListSubset}}
- />
- {{/if}}
-
- <span>
- <PluginOutlet
- @name="before-topic-list"
- @connectorTagName="div"
- @outletArgs={{hash category=@category tag=@tag}}
- />
- </span>
-
- {{#if this.hasTopics}}
- {{#if this.site.useGlimmerTopicList}}
- <TopicList::List
- @highlightLastVisited={{true}}
- @top={{this.top}}
- @hot={{this.hot}}
- @showTopicPostBadges={{this.showTopicPostBadges}}
- @showPosters={{true}}
- @canBulkSelect={{@canBulkSelect}}
- @bulkSelectHelper={{@bulkSelectHelper}}
- @changeSort={{@changeSort}}
- @hideCategory={{@model.hideCategory}}
- @order={{this.order}}
- @ascending={{this.ascending}}
- @expandGloballyPinned={{this.expandGloballyPinned}}
- @expandAllPinned={{this.expandAllPinned}}
- @category={{@category}}
- @topics={{@model.topics}}
- @discoveryList={{true}}
- @focusLastVisitedTopic={{true}}
- @showTopicsAndRepliesToggle={{this.showTopicsAndRepliesToggle}}
- @newListSubset={{@model.params.subset}}
- @changeNewListSubset={{@changeNewListSubset}}
- @newRepliesCount={{this.newRepliesCount}}
- @newTopicsCount={{this.newTopicsCount}}
- />
- {{else}}
- <TopicList
- @highlightLastVisited={{true}}
- @top={{this.top}}
- @hot={{this.hot}}
- @showTopicPostBadges={{this.showTopicPostBadges}}
- @showPosters={{true}}
- @canBulkSelect={{@canBulkSelect}}
- @bulkSelectHelper={{@bulkSelectHelper}}
- @changeSort={{@changeSort}}
- @hideCategory={{@model.hideCategory}}
- @order={{this.order}}
- @ascending={{this.ascending}}
- @expandGloballyPinned={{this.expandGloballyPinned}}
- @expandAllPinned={{this.expandAllPinned}}
- @category={{@category}}
- @topics={{@model.topics}}
- @discoveryList={{true}}
- @focusLastVisitedTopic={{true}}
- @showTopicsAndRepliesToggle={{this.showTopicsAndRepliesToggle}}
- @newListSubset={{@model.params.subset}}
- @changeNewListSubset={{@changeNewListSubset}}
- @newRepliesCount={{this.newRepliesCount}}
- @newTopicsCount={{this.newTopicsCount}}
- />
+
+ {{#if this.redirectedReason}}
+ <div class="alert alert-info">{{this.redirectedReason}}</div>
+ {{/if}}
+
+ {{#if @model.sharedDrafts}}
+ {{#if this.site.useGlimmerTopicList}}
+ <List
+ @listTitle="shared_drafts.title"
+ @top={{this.top}}
+ @hideCategory="true"
+ @category={{@category}}
+ @topics={{@model.sharedDrafts}}
+ @discoveryList={{true}}
+ class="shared-drafts"
+ />
+ {{else}}
+ <TopicList
+ @listTitle="shared_drafts.title"
+ @top={{this.top}}
+ @hideCategory="true"
+ @category={{@category}}
+ @topics={{@model.sharedDrafts}}
+ @discoveryList={{true}}
+ class="shared-drafts"
+ />
+ {{/if}}
{{/if}}
- {{/if}}
-
- <span class="after-topic-list-plugin-outlet-wrapper">
- <PluginOutlet
- @name="after-topic-list"
- @connectorTagName="div"
- @outletArgs={{hash
- category=@category
- tag=@tag
- }}
- />
- </span>
-</DiscoveryTopicsList>
-
-<footer class="topic-list-bottom">
- <ConditionalLoadingSpinner @condition={{@model.loadingMore}} />
- {{#if this.allLoaded}}
- <PluginOutlet
- @name="topic-list-bottom"
- @outletArgs={{hash
- category=@category
- tag=@tag
- allLoaded=this.allLoaded
- model=@model
- }}
+
+ <DiscoveryTopicsList
+ @model={{@model}}
+ @incomingCount={{this.topicTrackingState.incomingCount}}
+ @bulkSelectHelper={{@bulkSelectHelper}}
+ @class={{if this.footerEducation "--no-topics-education"}}
>
- <TopicDismissButtons
- @position="bottom"
- @selectedTopics={{@bulkSelectHelper.selected}}
- @model={{@model}}
- @showResetNew={{@showResetNew}}
- @showDismissRead={{@showDismissRead}}
- @resetNew={{@resetNew}}
- @dismissRead={{@dismissRead}}
- />
-
- <FooterMessage
- @education={{this.footerEducation}}
- @message={{this.footerMessage}}
- >
- {{#if @tag}}
- {{html-safe
- (i18n "topic.browse_all_tags_or_latest" basePath=(base-path))
- }}
- {{else if this.latest}}
- {{#if @category.canCreateTopic}}
- <DiscourseLinkedText
- @action={{fn
- this.composer.openNewTopic
- (hash category=@category)
- }}
- @text="topic.suggest_create_topic"
- />
- {{/if}}
- {{else if this.top}}
- {{html-safe
- (i18n
- "topic.browse_all_categories_latest_or_top" basePath=(base-path)
- )
- }}
- <TopPeriodButtons @period={{@period}} @action={{@changePeriod}} />
+ {{#if this.top}}
+ <div class="top-lists">
+ <PeriodChooser
+ @period={{@period}}
+ @action={{@changePeriod}}
+ @fullDay={{false}}
+ />
+ </div>
+ {{else}}
+ {{#if (or this.topicTrackingState.hasIncoming @model.loadingBefore)}}
+ <div class="show-more {{if this.hasTopics 'has-topics'}}">
+ <a
+ tabindex="0"
+ href
+ {{on "click" this.showInserted}}
+ class="alert alert-info clickable
+ {{if @model.loadingBefore 'loading'}}"
+ >
+ <CountI18n
+ @key="topic_count_"
+ @suffix={{this.topicTrackingState.filter}}
+ @count={{or
+ @model.loadingBefore
+ this.topicTrackingState.incomingCount
+ }}
+ />
+ {{#if @model.loadingBefore}}
+ {{loadingSpinner size="small"}}
+ {{/if}}
+ </a>
+ </div>
+ {{/if}}
+ {{/if}}
+
+ {{#if this.renderNewListHeaderControls}}
+ <NewListHeaderControlsWrapper
+ @current={{@model.params.subset}}
+ @newRepliesCount={{this.newRepliesCount}}
+ @newTopicsCount={{this.newTopicsCount}}
+ @changeNewListSubset={{@changeNewListSubset}}
+ />
+ {{/if}}
+
+ <span>
+ <PluginOutlet
+ @name="before-topic-list"
+ @connectorTagName="div"
+ @outletArgs={{hash category=@category tag=@tag}}
+ />
+ </span>
+
+ {{#if this.hasTopics}}
+ {{#if this.site.useGlimmerTopicList}}
+ <List
+ @highlightLastVisited={{true}}
+ @top={{this.top}}
+ @hot={{this.hot}}
+ @showTopicPostBadges={{this.showTopicPostBadges}}
+ @showPosters={{true}}
+ @canBulkSelect={{@canBulkSelect}}
+ @bulkSelectHelper={{@bulkSelectHelper}}
+ @changeSort={{@changeSort}}
+ @hideCategory={{@model.hideCategory}}
+ @order={{this.order}}
+ @ascending={{this.ascending}}
+ @expandGloballyPinned={{this.expandGloballyPinned}}
+ @expandAllPinned={{this.expandAllPinned}}
+ @category={{@category}}
+ @topics={{@model.topics}}
+ @discoveryList={{true}}
+ @focusLastVisitedTopic={{true}}
+ @showTopicsAndRepliesToggle={{this.showTopicsAndRepliesToggle}}
+ @newListSubset={{@model.params.subset}}
+ @changeNewListSubset={{@changeNewListSubset}}
+ @newRepliesCount={{this.newRepliesCount}}
+ @newTopicsCount={{this.newTopicsCount}}
+ />
{{else}}
- {{html-safe
- (i18n "topic.browse_all_categories_latest" basePath=(base-path))
- }}
+ <TopicList
+ @highlightLastVisited={{true}}
+ @top={{this.top}}
+ @hot={{this.hot}}
+ @showTopicPostBadges={{this.showTopicPostBadges}}
+ @showPosters={{true}}
+ @canBulkSelect={{@canBulkSelect}}
+ @bulkSelectHelper={{@bulkSelectHelper}}
+ @changeSort={{@changeSort}}
+ @hideCategory={{@model.hideCategory}}
+ @order={{this.order}}
+ @ascending={{this.ascending}}
+ @expandGloballyPinned={{this.expandGloballyPinned}}
+ @expandAllPinned={{this.expandAllPinned}}
+ @category={{@category}}
+ @topics={{@model.topics}}
+ @discoveryList={{true}}
+ @focusLastVisitedTopic={{true}}
+ @showTopicsAndRepliesToggle={{this.showTopicsAndRepliesToggle}}
+ @newListSubset={{@model.params.subset}}
+ @changeNewListSubset={{@changeNewListSubset}}
+ @newRepliesCount={{this.newRepliesCount}}
+ @newTopicsCount={{this.newTopicsCount}}
+ />
{{/if}}
- </FooterMessage>
- </PluginOutlet>
- {{/if}}
-</footer>
\ No newline at end of file
+ {{/if}}
+
+ <span class="after-topic-list-plugin-outlet-wrapper">
+ <PluginOutlet
+ @name="after-topic-list"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ category=@category
+ tag=@tag
+ }}
+ />
+ </span>
+ </DiscoveryTopicsList>
+
+ <footer class="topic-list-bottom">
+ <ConditionalLoadingSpinner @condition={{@model.loadingMore}} />
+ {{#if this.allLoaded}}
+ <PluginOutlet
+ @name="topic-list-bottom"
+ @outletArgs={{hash
+ category=@category
+ tag=@tag
+ allLoaded=this.allLoaded
+ model=@model
+ }}
+ >
+ <TopicDismissButtons
+ @position="bottom"
+ @selectedTopics={{@bulkSelectHelper.selected}}
+ @model={{@model}}
+ @showResetNew={{@showResetNew}}
+ @showDismissRead={{@showDismissRead}}
+ @resetNew={{@resetNew}}
+ @dismissRead={{@dismissRead}}
+ />
+
+ <FooterMessage
+ @education={{this.footerEducation}}
+ @message={{this.footerMessage}}
+ >
+ {{#if @tag}}
+ {{htmlSafe
+ (i18n "topic.browse_all_tags_or_latest" basePath=(basePath))
+ }}
+ {{else if this.latest}}
+ {{#if @category.canCreateTopic}}
+ <DiscourseLinkedText
+ @action={{fn
+ this.composer.openNewTopic
+ (hash category=@category)
+ }}
+ @text="topic.suggest_create_topic"
+ />
+ {{/if}}
+ {{else if this.top}}
+ {{htmlSafe
+ (i18n
+ "topic.browse_all_categories_latest_or_top"
+ basePath=(basePath)
+ )
+ }}
+ <TopPeriodButtons @period={{@period}} @action={{@changePeriod}} />
+ {{else}}
+ {{htmlSafe
+ (i18n "topic.browse_all_categories_latest" basePath=(basePath))
+ }}
+ {{/if}}
+ </FooterMessage>
+ </PluginOutlet>
+ {{/if}}
+ </footer>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/edit-category-security.gjs b/app/assets/javascripts/discourse/app/components/edit-category-security.gjs
index 097b19f4722..178da758d81 100644
--- a/app/assets/javascripts/discourse/app/components/edit-category-security.gjs
+++ b/app/assets/javascripts/discourse/app/components/edit-category-security.gjs
@@ -1,8 +1,13 @@
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { not } from "@ember/object/computed";
+import CategoryPermissionRow from "discourse/components/category-permission-row";
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
+import PluginOutlet from "discourse/components/plugin-outlet";
import discourseComputed from "discourse/lib/decorators";
import PermissionType from "discourse/models/permission-type";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
export default class EditCategorySecurity extends buildCategoryPanel(
"security"
@@ -54,70 +59,78 @@ export default class EditCategorySecurity extends buildCategoryPanel(
}
});
}
-}
-<section class="field">
- {{#if this.category.is_special}}
- {{#if this.category.isUncategorizedCategory}}
- <p class="warning">{{i18n "category.uncategorized_security_warning"}}</p>
- {{else}}
- <p class="warning">{{i18n "category.special_warning"}}</p>
- {{/if}}
- {{/if}}
+ <template>
+ <section class="field">
+ {{#if this.category.is_special}}
+ {{#if this.category.isUncategorizedCategory}}
+ <p class="warning">{{i18n
+ "category.uncategorized_security_warning"
+ }}</p>
+ {{else}}
+ <p class="warning">{{i18n "category.special_warning"}}</p>
+ {{/if}}
+ {{/if}}
- {{#unless this.category.is_special}}
- <div class="category-permissions-table">
- <div class="permission-row row-header">
- <span class="group-name">{{i18n "category.permissions.group"}}</span>
- <span class="options">
- <span class="cell">{{i18n "category.permissions.see"}}</span>
- <span class="cell">{{i18n "category.permissions.reply"}}</span>
- <span class="cell">{{i18n "category.permissions.create"}}</span>
- <span class="cell"></span>
- </span>
- </div>
- {{#each this.category.permissions as |p|}}
- <CategoryPermissionRow
- @groupName={{p.group_name}}
- @type={{p.permission_type}}
- @category={{this.category}}
- @everyonePermission={{this.everyonePermission}}
- @onChangeEveryonePermission={{action "onChangeEveryonePermission"}}
- />
- {{/each}}
+ {{#unless this.category.is_special}}
+ <div class="category-permissions-table">
+ <div class="permission-row row-header">
+ <span class="group-name">{{i18n
+ "category.permissions.group"
+ }}</span>
+ <span class="options">
+ <span class="cell">{{i18n "category.permissions.see"}}</span>
+ <span class="cell">{{i18n "category.permissions.reply"}}</span>
+ <span class="cell">{{i18n "category.permissions.create"}}</span>
+ <span class="cell"></span>
+ </span>
+ </div>
+ {{#each this.category.permissions as |p|}}
+ <CategoryPermissionRow
+ @groupName={{p.group_name}}
+ @type={{p.permission_type}}
+ @category={{this.category}}
+ @everyonePermission={{this.everyonePermission}}
+ @onChangeEveryonePermission={{this.onChangeEveryonePermission}}
+ />
+ {{/each}}
- {{#unless this.category.permissions}}
- <div class="permission-row row-empty">
- {{i18n "category.permissions.no_groups_selected"}}
- </div>
- {{/unless}}
+ {{#unless this.category.permissions}}
+ <div class="permission-row row-empty">
+ {{i18n "category.permissions.no_groups_selected"}}
+ </div>
+ {{/unless}}
- {{#if this.category.availableGroups}}
- <div class="add-group">
- <span class="group-name">
- <ComboBox
- @content={{this.category.availableGroups}}
- @onChange={{action "onSelectGroup"}}
- @value={{null}}
- @valueProperty={{null}}
- @nameProperty={{null}}
- @options={{hash none="category.security_add_group"}}
- class="available-groups"
- />
- </span>
+ {{#if this.category.availableGroups}}
+ <div class="add-group">
+ <span class="group-name">
+ <ComboBox
+ @content={{this.category.availableGroups}}
+ @onChange={{this.onSelectGroup}}
+ @value={{null}}
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @options={{hash none="category.security_add_group"}}
+ class="available-groups"
+ />
+ </span>
+ </div>
+ {{/if}}
</div>
- {{/if}}
- </div>
- {{#if this.everyoneGrantedFull}}
- <p class="warning">{{i18n "category.permissions.everyone_has_access"}}</p>
- {{/if}}
- {{/unless}}
-</section>
+ {{#if this.everyoneGrantedFull}}
+ <p class="warning">{{i18n
+ "category.permissions.everyone_has_access"
+ }}</p>
+ {{/if}}
+ {{/unless}}
+ </section>
-<section>
- <PluginOutlet
- @name="category-custom-security"
- @outletArgs={{hash category=this.category}}
- />
-</section>
\ No newline at end of file
+ <section>
+ <PluginOutlet
+ @name="category-custom-security"
+ @outletArgs={{hash category=this.category}}
+ />
+ </section>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/edit-category-settings.gjs b/app/assets/javascripts/discourse/app/components/edit-category-settings.gjs
index 7405d8d44b7..d55ec7c553c 100644
--- a/app/assets/javascripts/discourse/app/components/edit-category-settings.gjs
+++ b/app/assets/javascripts/discourse/app/components/edit-category-settings.gjs
@@ -1,11 +1,23 @@
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { and, empty } from "@ember/object/computed";
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import RelativeTimePicker from "discourse/components/relative-time-picker";
+import TextField from "discourse/components/text-field";
+import icon from "discourse/helpers/d-icon";
+import getUrl from "discourse/helpers/get-url";
+import htmlSafe from "discourse/helpers/html-safe";
+import withEventValue from "discourse/helpers/with-event-value";
import { setting } from "discourse/lib/computed";
import { SEARCH_PRIORITIES } from "discourse/lib/constants";
import discourseComputed from "discourse/lib/decorators";
import { applyMutableValueTransformer } from "discourse/lib/transformer";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import GroupChooser from "select-kit/components/group-chooser";
const categorySortCriteria = [];
export function addCategorySortCriteria(criteria) {
@@ -158,405 +170,412 @@ export default class EditCategorySettings extends buildCategoryPanel(
onCategoryModeratingGroupsChange(groupIds) {
this.set("category.moderating_group_ids", groupIds);
}
-}
-<section>
- {{#if this.showPositionInput}}
- <section class="field position-fields">
- <label for="category-position">
- {{i18n "category.position"}}
- </label>
- <input
- {{on "input" (with-event-value (fn (mut this.category.position)))}}
- value={{this.category.position}}
- type="number"
- min="0"
- id="category-position"
- class="position-input"
- />
- </section>
- {{/if}}
-
- {{#unless this.showPositionInput}}
- <section class="field position-disabled">
- {{html-safe
- (i18n
- "category.position_disabled"
- url=(get-url
- "/admin/site_settings/category/all_results?filter=fixed_category_positions"
- )
- )
- }}
- </section>
- {{/unless}}
-
- <section class="field num-featured-topics">
- <label for="category-number-featured-topics">
- {{#if this.category.parent_category_id}}
- {{i18n "category.subcategory_num_featured_topics"}}
- {{else}}
- {{i18n "category.num_featured_topics"}}
+ <template>
+ <section>
+ {{#if this.showPositionInput}}
+ <section class="field position-fields">
+ <label for="category-position">
+ {{i18n "category.position"}}
+ </label>
+ <input
+ {{on "input" (withEventValue (fn (mut this.category.position)))}}
+ value={{this.category.position}}
+ type="number"
+ min="0"
+ id="category-position"
+ class="position-input"
+ />
+ </section>
{{/if}}
- </label>
- <input
- {{on
- "input"
- (with-event-value (fn (mut this.category.num_featured_topics)))
- }}
- value={{this.category.num_featured_topics}}
- type="number"
- min="1"
- id="category-number-featured-topics"
- />
- </section>
-
- <section class="field search-priority">
- <label>
- {{i18n "category.search_priority.label"}}
- </label>
- <div class="controls">
- <ComboBox
- @valueProperty="value"
- @id="category-search-priority"
- @content={{this.searchPrioritiesOptions}}
- @value={{this.category.search_priority}}
- @onChange={{fn (mut this.category.search_priority)}}
- @options={{hash placementStrategy="absolute"}}
- />
- </div>
- </section>
-
- {{#if this.siteSettings.enable_badges}}
- <section class="field allow-badges">
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.category.allow_badges}} />
- {{i18n "category.allow_badges_label"}}
- </label>
- </section>
- {{/if}}
- {{#if this.siteSettings.topic_featured_link_enabled}}
- <section class="field topic-featured-link-allowed">
- <div class="allowed-topic-featured-link-category">
+ {{#unless this.showPositionInput}}
+ <section class="field position-disabled">
+ {{htmlSafe
+ (i18n
+ "category.position_disabled"
+ url=(getUrl
+ "/admin/site_settings/category/all_results?filter=fixed_category_positions"
+ )
+ )
+ }}
+ </section>
+ {{/unless}}
+
+ <section class="field num-featured-topics">
+ <label for="category-number-featured-topics">
+ {{#if this.category.parent_category_id}}
+ {{i18n "category.subcategory_num_featured_topics"}}
+ {{else}}
+ {{i18n "category.num_featured_topics"}}
+ {{/if}}
+ </label>
+ <input
+ {{on
+ "input"
+ (withEventValue (fn (mut this.category.num_featured_topics)))
+ }}
+ value={{this.category.num_featured_topics}}
+ type="number"
+ min="1"
+ id="category-number-featured-topics"
+ />
+ </section>
+
+ <section class="field search-priority">
+ <label>
+ {{i18n "category.search_priority.label"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @valueProperty="value"
+ @id="category-search-priority"
+ @content={{this.searchPrioritiesOptions}}
+ @value={{this.category.search_priority}}
+ @onChange={{fn (mut this.category.search_priority)}}
+ @options={{hash placementStrategy="absolute"}}
+ />
+ </div>
+ </section>
+
+ {{#if this.siteSettings.enable_badges}}
+ <section class="field allow-badges">
+ <label class="checkbox-label">
+ <Input @type="checkbox" @checked={{this.category.allow_badges}} />
+ {{i18n "category.allow_badges_label"}}
+ </label>
+ </section>
+ {{/if}}
+
+ {{#if this.siteSettings.topic_featured_link_enabled}}
+ <section class="field topic-featured-link-allowed">
+ <div class="allowed-topic-featured-link-category">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.topic_featured_link_allowed}}
+ />
+ {{i18n "category.topic_featured_link_allowed"}}
+ </label>
+ </div>
+ </section>
+ {{/if}}
+
+ <section class="field navigate-to-first-post-after-read">
<label class="checkbox-label">
<Input
@type="checkbox"
- @checked={{this.category.topic_featured_link_allowed}}
+ @checked={{this.category.navigate_to_first_post_after_read}}
/>
- {{i18n "category.topic_featured_link_allowed"}}
+ {{i18n "category.navigate_to_first_post_after_read"}}
</label>
- </div>
- </section>
- {{/if}}
+ </section>
- <section class="field navigate-to-first-post-after-read">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.navigate_to_first_post_after_read}}
- />
- {{i18n "category.navigate_to_first_post_after_read"}}
- </label>
- </section>
-
- <section class="field all-topics-wiki">
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.category.all_topics_wiki}} />
- {{i18n "category.all_topics_wiki"}}
- </label>
- </section>
-
- <section class="field allow-unlimited-owner-edits-on-first-post">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.allow_unlimited_owner_edits_on_first_post}}
- />
- {{i18n "category.allow_unlimited_owner_edits_on_first_post"}}
- </label>
- </section>
-</section>
-
-<section>
- <h3>{{i18n "category.settings_sections.moderation"}}</h3>
- {{#if this.siteSettings.enable_category_group_moderation}}
- <section class="field reviewable-by-group">
- <label>{{i18n "category.reviewable_by_group"}}</label>
- <GroupChooser
- @content={{this.site.groups}}
- @value={{this.category.moderating_group_ids}}
- @onChange={{this.onCategoryModeratingGroupsChange}}
- />
+ <section class="field all-topics-wiki">
+ <label class="checkbox-label">
+ <Input @type="checkbox" @checked={{this.category.all_topics_wiki}} />
+ {{i18n "category.all_topics_wiki"}}
+ </label>
+ </section>
+
+ <section class="field allow-unlimited-owner-edits-on-first-post">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.allow_unlimited_owner_edits_on_first_post}}
+ />
+ {{i18n "category.allow_unlimited_owner_edits_on_first_post"}}
+ </label>
+ </section>
</section>
- {{/if}}
- <section class="field require-topic-approval">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.category_setting.require_topic_approval}}
- />
- {{i18n "category.require_topic_approval"}}
- </label>
- </section>
-
- <section class="field require-reply-approval">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.category_setting.require_reply_approval}}
- />
- {{i18n "category.require_reply_approval"}}
- </label>
- </section>
-
- <section class="field default-slow-mode">
- <div class="control-group">
- <label for="category-default-slow-mode">
- {{i18n "category.default_slow_mode"}}
- </label>
- <div class="category-default-slow-mode-seconds">
- <RelativeTimePicker
- @id="category-default-slow-mode"
- @durationMinutes={{this.category.defaultSlowModeMinutes}}
- @onChange={{action "onDefaultSlowModeDurationChange"}}
- />
- </div>
- </div>
- </section>
-
- <section class="field auto-close">
- <div class="control-group">
- <label for="topic-auto-close">
- {{i18n "topic.auto_close.label"}}
- </label>
- <div class="category-topic-auto-close-hours">
- <RelativeTimePicker
- @id="topic-auto-close"
- @durationHours={{this.category.auto_close_hours}}
- @hiddenIntervals={{this.hiddenRelativeIntervals}}
- @onChange={{action "onAutoCloseDurationChange"}}
- />
- </div>
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.auto_close_based_on_last_post}}
- />
- {{i18n "topic.auto_close.based_on_last_post"}}
- </label>
- </div>
- </section>
-
- <section class="field num-auto-bump-daily">
- <label for="category-number-daily-bump">
- {{i18n "category.num_auto_bump_daily"}}
- </label>
- <input
- {{on
- "input"
- (with-event-value
- (fn (mut this.category.category_setting.num_auto_bump_daily))
- )
- }}
- value={{this.category.category_setting.num_auto_bump_daily}}
- type="number"
- min="0"
- id="category-number-daily-bump"
- />
- </section>
-
- <section class="field auto-bump-cooldown-days">
- <label for="category-auto-bump-cooldown-days">
- {{i18n "category.auto_bump_cooldown_days"}}
- </label>
- <input
- {{on
- "input"
- (with-event-value
- (fn (mut this.category.category_setting.auto_bump_cooldown_days))
- )
- }}
- value={{this.category.category_setting.auto_bump_cooldown_days}}
- type="number"
- min="0"
- id="category-auto-bump-cooldown-days"
- />
- </section>
-</section>
-
-<section>
- <h3>{{i18n "category.settings_sections.appearance"}}</h3>
-
- <section class="field default-view-field">
- <label>
- {{i18n "category.default_view"}}
- </label>
- <div class="controls">
- <ComboBox
- @valueProperty="value"
- @id="category-default-view"
- @content={{this.availableViews}}
- @value={{this.category.default_view}}
- @options={{hash placementStrategy="absolute"}}
- />
- </div>
- </section>
-
- <section class="field default-top-period-field">
- <label>
- {{i18n "category.default_top_period"}}
- </label>
- <div class="controls">
- <ComboBox
- @valueProperty="value"
- @id="category-default-period"
- @content={{this.availableTopPeriods}}
- @value={{this.category.default_top_period}}
- @options={{hash placementStrategy="absolute"}}
- />
- </div>
- </section>
-
- <section class="field sort-order">
- <label>
- {{i18n "category.sort_order"}}
- </label>
- <div class="controls">
- <ComboBox
- @valueProperty="value"
- @content={{this.availableSorts}}
- @value={{this.category.sort_order}}
- @options={{hash none="category.sort_options.default"}}
- @onChange={{fn (mut this.category.sort_order)}}
- />
- {{#unless this.isDefaultSortOrder}}
- <ComboBox
- @valueProperty="value"
- @content={{this.sortAscendingOptions}}
- @value={{this.sortAscendingOption}}
- @options={{hash
- none="category.sort_options.default"
- placementStrategy="absolute"
+ <section>
+ <h3>{{i18n "category.settings_sections.moderation"}}</h3>
+ {{#if this.siteSettings.enable_category_group_moderation}}
+ <section class="field reviewable-by-group">
+ <label>{{i18n "category.reviewable_by_group"}}</label>
+ <GroupChooser
+ @content={{this.site.groups}}
+ @value={{this.category.moderating_group_ids}}
+ @onChange={{this.onCategoryModeratingGroupsChange}}
+ />
+ </section>
+ {{/if}}
+
+ <section class="field require-topic-approval">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.category_setting.require_topic_approval}}
+ />
+ {{i18n "category.require_topic_approval"}}
+ </label>
+ </section>
+
+ <section class="field require-reply-approval">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.category_setting.require_reply_approval}}
+ />
+ {{i18n "category.require_reply_approval"}}
+ </label>
+ </section>
+
+ <section class="field default-slow-mode">
+ <div class="control-group">
+ <label for="category-default-slow-mode">
+ {{i18n "category.default_slow_mode"}}
+ </label>
+ <div class="category-default-slow-mode-seconds">
+ <RelativeTimePicker
+ @id="category-default-slow-mode"
+ @durationMinutes={{this.category.defaultSlowModeMinutes}}
+ @onChange={{this.onDefaultSlowModeDurationChange}}
+ />
+ </div>
+ </div>
+ </section>
+
+ <section class="field auto-close">
+ <div class="control-group">
+ <label for="topic-auto-close">
+ {{i18n "topic.auto_close.label"}}
+ </label>
+ <div class="category-topic-auto-close-hours">
+ <RelativeTimePicker
+ @id="topic-auto-close"
+ @durationHours={{this.category.auto_close_hours}}
+ @hiddenIntervals={{this.hiddenRelativeIntervals}}
+ @onChange={{this.onAutoCloseDurationChange}}
+ />
+ </div>
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.auto_close_based_on_last_post}}
+ />
+ {{i18n "topic.auto_close.based_on_last_post"}}
+ </label>
+ </div>
+ </section>
+
+ <section class="field num-auto-bump-daily">
+ <label for="category-number-daily-bump">
+ {{i18n "category.num_auto_bump_daily"}}
+ </label>
+ <input
+ {{on
+ "input"
+ (withEventValue
+ (fn (mut this.category.category_setting.num_auto_bump_daily))
+ )
}}
- @onChange={{fn (mut this.category.sort_ascending)}}
+ value={{this.category.category_setting.num_auto_bump_daily}}
+ type="number"
+ min="0"
+ id="category-number-daily-bump"
/>
- {{/unless}}
- </div>
- </section>
-
- <section class="field default-filter">
- <label>
- {{i18n "category.default_list_filter"}}
- </label>
- <div class="controls">
- <ComboBox
- @id="category-default-filter"
- @valueProperty="value"
- @content={{this.availableListFilters}}
- @value={{this.category.default_list_filter}}
- />
- </div>
- </section>
-
- {{#if this.isParentCategory}}
- <section class="field show-subcategory-list-field">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.show_subcategory_list}}
+ </section>
+
+ <section class="field auto-bump-cooldown-days">
+ <label for="category-auto-bump-cooldown-days">
+ {{i18n "category.auto_bump_cooldown_days"}}
+ </label>
+ <input
+ {{on
+ "input"
+ (withEventValue
+ (fn (mut this.category.category_setting.auto_bump_cooldown_days))
+ )
+ }}
+ value={{this.category.category_setting.auto_bump_cooldown_days}}
+ type="number"
+ min="0"
+ id="category-auto-bump-cooldown-days"
/>
- {{i18n "category.show_subcategory_list"}}
- </label>
+ </section>
</section>
- {{/if}}
-
- {{#if this.showSubcategoryListStyle}}
- <section class="field subcategory-list-style-field">
- <label>
- {{i18n "category.subcategory_list_style"}}
- </label>
- <ComboBox
- @valueProperty="value"
- @id="subcategory-list-style"
- @content={{this.availableSubcategoryListStyles}}
- @value={{this.category.subcategory_list_style}}
- @options={{hash placementStrategy="absolute"}}
- />
- </section>
- {{/if}}
-
- <section class="field category-read-only-banner">
- <label for="read-only-message">{{i18n "category.read_only_banner"}}</label>
- <TextField
- @valueProperty="value"
- @id="read-only-message"
- @value={{this.category.read_only_banner}}
- @options={{hash placementStrategy="absolute"}}
- />
- </section>
-</section>
-
-<section>
- <h3>{{i18n "category.settings_sections.email"}}</h3>
-
- {{#if this.emailInEnabled}}
- <section class="field category-email-in">
- <label for="category-email-in">
- {{d-icon "envelope"}}
- {{i18n "category.email_in"}}
- </label>
- <TextField
- @id="category-email-in"
- @value={{this.category.email_in}}
- class="email-in"
- />
- </section>
+ <section>
+ <h3>{{i18n "category.settings_sections.appearance"}}</h3>
+
+ <section class="field default-view-field">
+ <label>
+ {{i18n "category.default_view"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @valueProperty="value"
+ @id="category-default-view"
+ @content={{this.availableViews}}
+ @value={{this.category.default_view}}
+ @options={{hash placementStrategy="absolute"}}
+ />
+ </div>
+ </section>
+
+ <section class="field default-top-period-field">
+ <label>
+ {{i18n "category.default_top_period"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @valueProperty="value"
+ @id="category-default-period"
+ @content={{this.availableTopPeriods}}
+ @value={{this.category.default_top_period}}
+ @options={{hash placementStrategy="absolute"}}
+ />
+ </div>
+ </section>
+
+ <section class="field sort-order">
+ <label>
+ {{i18n "category.sort_order"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @valueProperty="value"
+ @content={{this.availableSorts}}
+ @value={{this.category.sort_order}}
+ @options={{hash none="category.sort_options.default"}}
+ @onChange={{fn (mut this.category.sort_order)}}
+ />
+ {{#unless this.isDefaultSortOrder}}
+ <ComboBox
+ @valueProperty="value"
+ @content={{this.sortAscendingOptions}}
+ @value={{this.sortAscendingOption}}
+ @options={{hash
+ none="category.sort_options.default"
+ placementStrategy="absolute"
+ }}
+ @onChange={{fn (mut this.category.sort_ascending)}}
+ />
+ {{/unless}}
+ </div>
+ </section>
+
+ <section class="field default-filter">
+ <label>
+ {{i18n "category.default_list_filter"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @id="category-default-filter"
+ @valueProperty="value"
+ @content={{this.availableListFilters}}
+ @value={{this.category.default_list_filter}}
+ />
+ </div>
+ </section>
+
+ {{#if this.isParentCategory}}
+ <section class="field show-subcategory-list-field">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.show_subcategory_list}}
+ />
+ {{i18n "category.show_subcategory_list"}}
+ </label>
+ </section>
+ {{/if}}
+
+ {{#if this.showSubcategoryListStyle}}
+ <section class="field subcategory-list-style-field">
+ <label>
+ {{i18n "category.subcategory_list_style"}}
+ </label>
+ <ComboBox
+ @valueProperty="value"
+ @id="subcategory-list-style"
+ @content={{this.availableSubcategoryListStyles}}
+ @value={{this.category.subcategory_list_style}}
+ @options={{hash placementStrategy="absolute"}}
+ />
+ </section>
+ {{/if}}
- <section class="field email-in-allow-strangers">
- <label class="checkbox-label">
- <Input
- @type="checkbox"
- @checked={{this.category.email_in_allow_strangers}}
+ <section class="field category-read-only-banner">
+ <label for="read-only-message">{{i18n
+ "category.read_only_banner"
+ }}</label>
+ <TextField
+ @valueProperty="value"
+ @id="read-only-message"
+ @value={{this.category.read_only_banner}}
+ @options={{hash placementStrategy="absolute"}}
/>
- {{i18n "category.email_in_allow_strangers"}}
- </label>
+ </section>
</section>
- <section class="field mailinglist-mirror">
- <label class="checkbox-label">
- <Input @type="checkbox" @checked={{this.category.mailinglist_mirror}} />
- {{i18n "category.mailinglist_mirror"}}
- </label>
+ <section>
+ <h3>{{i18n "category.settings_sections.email"}}</h3>
+
+ {{#if this.emailInEnabled}}
+ <section class="field category-email-in">
+ <label for="category-email-in">
+ {{icon "envelope"}}
+ {{i18n "category.email_in"}}
+ </label>
+ <TextField
+ @id="category-email-in"
+ @value={{this.category.email_in}}
+ class="email-in"
+ />
+
+ </section>
+
+ <section class="field email-in-allow-strangers">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.email_in_allow_strangers}}
+ />
+ {{i18n "category.email_in_allow_strangers"}}
+ </label>
+ </section>
+
+ <section class="field mailinglist-mirror">
+ <label class="checkbox-label">
+ <Input
+ @type="checkbox"
+ @checked={{this.category.mailinglist_mirror}}
+ />
+ {{i18n "category.mailinglist_mirror"}}
+ </label>
+ </section>
+
+ <span>
+ <PluginOutlet
+ @name="category-email-in"
+ @connectorTagName="div"
+ @outletArgs={{hash category=this.category}}
+ />
+ </span>
+ {{/if}}
+
+ {{#unless this.emailInEnabled}}
+ <section class="field email-in-disabled">
+ {{htmlSafe
+ (i18n
+ "category.email_in_disabled"
+ setting_url=(getUrl
+ "/admin/site_settings/category/all_results?filter=email_in"
+ )
+ )
+ }}
+ </section>
+ {{/unless}}
</section>
- <span>
+ <section>
<PluginOutlet
- @name="category-email-in"
- @connectorTagName="div"
+ @name="category-custom-settings"
@outletArgs={{hash category=this.category}}
/>
- </span>
- {{/if}}
-
- {{#unless this.emailInEnabled}}
- <section class="field email-in-disabled">
- {{html-safe
- (i18n
- "category.email_in_disabled"
- setting_url=(get-url
- "/admin/site_settings/category/all_results?filter=email_in"
- )
- )
- }}
</section>
- {{/unless}}
-</section>
-
-<section>
- <PluginOutlet
- @name="category-custom-settings"
- @outletArgs={{hash category=this.category}}
- />
-</section>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/edit-category-tags.gjs b/app/assets/javascripts/discourse/app/components/edit-category-tags.gjs
index 308ce016b4d..4064f1f5312 100644
--- a/app/assets/javascripts/discourse/app/components/edit-category-tags.gjs
+++ b/app/assets/javascripts/discourse/app/components/edit-category-tags.gjs
@@ -1,6 +1,14 @@
+import { Input } from "@ember/component";
+import { array, fn, hash } from "@ember/helper";
import { action, set } from "@ember/object";
import { and, empty } from "@ember/object/computed";
+import { LinkTo } from "@ember/routing";
+import DButton from "discourse/components/d-button";
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
+import TextField from "discourse/components/text-field";
+import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
+import TagGroupChooser from "select-kit/components/tag-group-chooser";
export default class EditCategoryTags extends buildCategoryPanel("tags") {
@empty("category.allowed_tags") allowedTagsEmpty;
@@ -26,90 +34,92 @@ export default class EditCategoryTags extends buildCategoryPanel("tags") {
deleteRequiredTagGroup(rtg) {
this.category.required_tag_groups.removeObject(rtg);
}
-}
-<section class="field minimum-required-tags">
- <label for="category-minimum-tags">
- {{i18n "category.minimum_required_tags"}}
- </label>
- <TextField
- @value={{this.category.minimum_required_tags}}
- @id="category-minimum-tags"
- @type="number"
- @min="0"
- />
-</section>
-<section class="field allowed-tags">
- <label>{{i18n "category.tags_allowed_tags"}}</label>
- <TagChooser
- @id="category-allowed-tags"
- @tags={{this.category.allowed_tags}}
- @everyTag={{true}}
- @excludeSynonyms={{true}}
- @unlimitedTagCount={{true}}
- @onChange={{fn (mut this.category.allowed_tags)}}
- @options={{hash filterPlaceholder="category.tags_placeholder"}}
- />
-</section>
+ <template>
+ <section class="field minimum-required-tags">
+ <label for="category-minimum-tags">
+ {{i18n "category.minimum_required_tags"}}
+ </label>
+ <TextField
+ @value={{this.category.minimum_required_tags}}
+ @id="category-minimum-tags"
+ @type="number"
+ @min="0"
+ />
+ </section>
+ <section class="field allowed-tags">
+ <label>{{i18n "category.tags_allowed_tags"}}</label>
+ <TagChooser
+ @id="category-allowed-tags"
+ @tags={{this.category.allowed_tags}}
+ @everyTag={{true}}
+ @excludeSynonyms={{true}}
+ @unlimitedTagCount={{true}}
+ @onChange={{fn (mut this.category.allowed_tags)}}
+ @options={{hash filterPlaceholder="category.tags_placeholder"}}
+ />
+ </section>
-<section class="field allowed-tag-groups">
- <label>{{i18n "category.tags_allowed_tag_groups"}}</label>
- <TagGroupChooser
- @id="category-allowed-tag-groups"
- @tagGroups={{this.category.allowed_tag_groups}}
- @onChange={{fn (mut this.category.allowed_tag_groups)}}
- />
- <LinkTo @route="tagGroups" class="manage-tag-groups">{{i18n
- "category.manage_tag_groups_link"
- }}</LinkTo>
-</section>
+ <section class="field allowed-tag-groups">
+ <label>{{i18n "category.tags_allowed_tag_groups"}}</label>
+ <TagGroupChooser
+ @id="category-allowed-tag-groups"
+ @tagGroups={{this.category.allowed_tag_groups}}
+ @onChange={{fn (mut this.category.allowed_tag_groups)}}
+ />
+ <LinkTo @route="tagGroups" class="manage-tag-groups">{{i18n
+ "category.manage_tag_groups_link"
+ }}</LinkTo>
+ </section>
-<section class="field allow-global-tags">
- <label>
- <Input
- @type="checkbox"
- @checked={{this.category.allow_global_tags}}
- id="allow_global_tags"
- disabled={{this.disableAllowGlobalTags}}
- />
- {{i18n "category.allow_global_tags_label"}}
- </label>
-</section>
+ <section class="field allow-global-tags">
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.category.allow_global_tags}}
+ id="allow_global_tags"
+ disabled={{this.disableAllowGlobalTags}}
+ />
+ {{i18n "category.allow_global_tags_label"}}
+ </label>
+ </section>
-<section class="field tags-tab-description">
- {{i18n "category.tags_tab_description"}}
-</section>
+ <section class="field tags-tab-description">
+ {{i18n "category.tags_tab_description"}}
+ </section>
-<section class="field required-tag-group-description">
- {{i18n "category.required_tag_group.description"}}
-</section>
+ <section class="field required-tag-group-description">
+ {{i18n "category.required_tag_group.description"}}
+ </section>
-<section class="field with-items">
- <section class="field-item required-tag-groups">
- {{#each this.category.required_tag_groups as |rtg|}}
- <div class="required-tag-group-row">
- <TextField @value={{rtg.min_count}} @type="number" @min="1" />
- <TagGroupChooser
- @tagGroups={{if rtg.name (array rtg.name) (array)}}
- @onChange={{action "onTagGroupChange" rtg}}
- @options={{hash
- maximum=1
- filterPlaceholder="category.required_tag_group.placeholder"
- }}
- />
+ <section class="field with-items">
+ <section class="field-item required-tag-groups">
+ {{#each this.category.required_tag_groups as |rtg|}}
+ <div class="required-tag-group-row">
+ <TextField @value={{rtg.min_count}} @type="number" @min="1" />
+ <TagGroupChooser
+ @tagGroups={{if rtg.name (array rtg.name) (array)}}
+ @onChange={{fn this.onTagGroupChange rtg}}
+ @options={{hash
+ maximum=1
+ filterPlaceholder="category.required_tag_group.placeholder"
+ }}
+ />
+ <DButton
+ @label="category.required_tag_group.delete"
+ @action={{fn this.deleteRequiredTagGroup rtg}}
+ @icon="trash-can"
+ class="delete-required-tag-group"
+ />
+ </div>
+ {{/each}}
<DButton
- @label="category.required_tag_group.delete"
- @action={{fn this.deleteRequiredTagGroup rtg}}
- @icon="trash-can"
- class="delete-required-tag-group"
+ @label="category.required_tag_group.add"
+ @action={{this.addRequiredTagGroup}}
+ @icon="plus"
+ class="btn-default add-required-tag-group"
/>
- </div>
- {{/each}}
- <DButton
- @label="category.required_tag_group.add"
- @action={{this.addRequiredTagGroup}}
- @icon="plus"
- class="btn-default add-required-tag-group"
- />
- </section>
-</section>
\ No newline at end of file
+ </section>
+ </section>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/edit-category-topic-template.gjs b/app/assets/javascripts/discourse/app/components/edit-category-topic-template.gjs
index dc26c252534..0e9bb89bb43 100644
--- a/app/assets/javascripts/discourse/app/components/edit-category-topic-template.gjs
+++ b/app/assets/javascripts/discourse/app/components/edit-category-topic-template.gjs
@@ -1,9 +1,16 @@
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
+import { LinkTo } from "@ember/routing";
import { schedule } from "@ember/runloop";
import { observes } from "@ember-decorators/object";
+import DEditor from "discourse/components/d-editor";
+import DToggleSwitch from "discourse/components/d-toggle-switch";
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
import discourseComputed from "discourse/lib/decorators";
+import { i18n } from "discourse-i18n";
+import FormTemplateChooser from "select-kit/components/form-template-chooser";
export default class EditCategoryTopicTemplate extends buildCategoryPanel(
"topic-template"
@@ -48,43 +55,47 @@ export default class EditCategoryTopicTemplate extends buildCategoryPanel(
);
}
}
-}
-{{#if this.siteSettings.experimental_form_templates}}
- <div class="control-group">
- <DToggleSwitch
- class="toggle-template-type"
- @state={{this.showFormTemplate}}
- @label={{this.templateTypeToggleLabel}}
- {{on "click" this.toggleTemplateType}}
- />
- </div>
+ <template>
+ {{#if this.siteSettings.experimental_form_templates}}
+ <div class="control-group">
+ <DToggleSwitch
+ class="toggle-template-type"
+ @state={{this.showFormTemplate}}
+ @label={{this.templateTypeToggleLabel}}
+ {{on "click" this.toggleTemplateType}}
+ />
+ </div>
- {{#if this.showFormTemplate}}
- <div class="control-group">
- <FormTemplateChooser
- @value={{this.category.form_template_ids}}
- @onChange={{fn (mut this.category.form_template_ids)}}
- class="select-category-template"
- />
+ {{#if this.showFormTemplate}}
+ <div class="control-group">
+ <FormTemplateChooser
+ @value={{this.category.form_template_ids}}
+ @onChange={{fn (mut this.category.form_template_ids)}}
+ class="select-category-template"
+ />
- <p class="select-category-template__info desc">
- {{#if this.currentUser.staff}}
- <LinkTo @route="adminCustomizeFormTemplates">
- {{i18n "admin.form_templates.edit_category.select_template_help"}}
- </LinkTo>
- {{/if}}
- </p>
- </div>
- {{else}}
- <DEditor
- @value={{this.category.topic_template}}
- @showLink={{this.showInsertLinkButton}}
- />
- {{/if}}
-{{else}}
- <DEditor
- @value={{this.category.topic_template}}
- @showLink={{this.showInsertLinkButton}}
- />
-{{/if}}
\ No newline at end of file
+ <p class="select-category-template__info desc">
+ {{#if this.currentUser.staff}}
+ <LinkTo @route="adminCustomizeFormTemplates">
+ {{i18n
+ "admin.form_templates.edit_category.select_template_help"
+ }}
+ </LinkTo>
+ {{/if}}
+ </p>
+ </div>
+ {{else}}
+ <DEditor
+ @value={{this.category.topic_template}}
+ @showLink={{this.showInsertLinkButton}}
+ />
+ {{/if}}
+ {{else}}
+ <DEditor
+ @value={{this.category.topic_template}}
+ @showLink={{this.showInsertLinkButton}}
+ />
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.gjs b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.gjs
index 52810bf3b90..88bfa71e66f 100644
--- a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.gjs
+++ b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.gjs
@@ -1,9 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import ItsATrap from "@discourse/itsatrap";
+import DSelect from "discourse/components/d-select";
import {
BUMP_TYPE,
CLOSE_AFTER_LAST_POST_STATUS_TYPE,
@@ -13,12 +15,17 @@ import {
OPEN_STATUS_TYPE,
PUBLISH_TO_CATEGORY_STATUS_TYPE,
} from "discourse/components/modal/edit-topic-timer";
+import RelativeTimePicker from "discourse/components/relative-time-picker";
+import TimeShortcutPicker from "discourse/components/time-shortcut-picker";
+import TopicTimerInfo from "discourse/components/topic-timer-info";
+import icon from "discourse/helpers/d-icon";
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
import {
TIME_SHORTCUT_TYPES,
timeShortcuts,
} from "discourse/lib/time-shortcut";
import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
import { FORMAT } from "select-kit/components/future-date-input-selector";
export default class EditTopicTimerForm extends Component {
@@ -177,76 +184,78 @@ export default class EditTopicTimerForm extends Component {
changeDuration(newDurationMins) {
this.args.topicTimer.duration_minutes = newDurationMins;
}
-}
-<form>
- <div class="control-group">
- <DSelect
- @value={{this.statusType}}
- class="timer-type"
- @onChange={{@onChangeStatusType}}
- as |select|
- >
- {{#each @timerTypes as |timer|}}
- <select.Option @value={{timer.id}}>{{timer.name}}</select.Option>
- {{/each}}
- </DSelect>
- </div>
-
- {{#if this.publishToCategory}}
- <div class="control-group">
- <label class="control-label">
- {{i18n "topic.topic_status_update.publish_to"}}
- </label>
- <CategoryChooser
- @value={{@topicTimer.category_id}}
- @onChange={{fn (mut @topicTimer.category_id)}}
- @options={{hash excludeCategoryId=this.excludeCategoryId}}
- />
- </div>
- {{/if}}
-
- {{#if this.showFutureDateInput}}
- <label class="control-label">
- {{i18n "topic.topic_status_update.when"}}
- </label>
- <TimeShortcutPicker
- @timeShortcuts={{this.timeOptions}}
- @prefilledDatetime={{@topicTimer.execute_at}}
- @onTimeSelected={{this.onTimeSelected}}
- @hiddenOptions={{this.hiddenTimeShortcutOptions}}
- @_itsatrap={{this._itsatrap}}
- />
- {{/if}}
-
- {{#if this.useDuration}}
- <div class="controls">
- <label class="control-label">
- {{i18n "topic.topic_status_update.duration"}}
- </label>
- <RelativeTimePicker
- @onChange={{this.changeDuration}}
- @durationMinutes={{@topicTimer.duration_minutes}}
- />
- </div>
- {{/if}}
-
- {{#if this.willCloseImmediately}}
- <div class="warning">
- {{d-icon "triangle-exclamation"}}
- {{this.willCloseI18n}}
- </div>
- {{/if}}
-
- {{#if this.showTopicTimerInfo}}
- <div class="alert alert-info modal-topic-timer-info">
- <TopicTimerInfo
- @statusType={{this.statusType}}
- @executeAt={{this.executeAt}}
- @basedOnLastPost={{@topicTimer.based_on_last_post}}
- @durationMinutes={{@topicTimer.duration_minutes}}
- @categoryId={{@topicTimer.category_id}}
- />
- </div>
- {{/if}}
-</form>
\ No newline at end of file
+ <template>
+ <form>
+ <div class="control-group">
+ <DSelect
+ @value={{this.statusType}}
+ class="timer-type"
+ @onChange={{@onChangeStatusType}}
+ as |select|
+ >
+ {{#each @timerTypes as |timer|}}
+ <select.Option @value={{timer.id}}>{{timer.name}}</select.Option>
+ {{/each}}
+ </DSelect>
+ </div>
+
+ {{#if this.publishToCategory}}
+ <div class="control-group">
+ <label class="control-label">
+ {{i18n "topic.topic_status_update.publish_to"}}
+ </label>
+ <CategoryChooser
+ @value={{@topicTimer.category_id}}
+ @onChange={{fn (mut @topicTimer.category_id)}}
+ @options={{hash excludeCategoryId=this.excludeCategoryId}}
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.showFutureDateInput}}
+ <label class="control-label">
+ {{i18n "topic.topic_status_update.when"}}
+ </label>
+ <TimeShortcutPicker
+ @timeShortcuts={{this.timeOptions}}
+ @prefilledDatetime={{@topicTimer.execute_at}}
+ @onTimeSelected={{this.onTimeSelected}}
+ @hiddenOptions={{this.hiddenTimeShortcutOptions}}
+ @_itsatrap={{this._itsatrap}}
+ />
+ {{/if}}
+
+ {{#if this.useDuration}}
+ <div class="controls">
+ <label class="control-label">
+ {{i18n "topic.topic_status_update.duration"}}
+ </label>
+ <RelativeTimePicker
+ @onChange={{this.changeDuration}}
+ @durationMinutes={{@topicTimer.duration_minutes}}
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.willCloseImmediately}}
+ <div class="warning">
+ {{icon "triangle-exclamation"}}
+ {{this.willCloseI18n}}
+ </div>
+ {{/if}}
+
+ {{#if this.showTopicTimerInfo}}
+ <div class="alert alert-info modal-topic-timer-info">
+ <TopicTimerInfo
+ @statusType={{this.statusType}}
+ @executeAt={{this.executeAt}}
+ @basedOnLastPost={{@topicTimer.based_on_last_post}}
+ @durationMinutes={{@topicTimer.duration_minutes}}
+ @categoryId={{@topicTimer.category_id}}
+ />
+ </div>
+ {{/if}}
+ </form>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/future-date-input.gjs b/app/assets/javascripts/discourse/app/components/future-date-input.gjs
index ee148230e10..b69d3d6192b 100644
--- a/app/assets/javascripts/discourse/app/components/future-date-input.gjs
+++ b/app/assets/javascripts/discourse/app/components/future-date-input.gjs
@@ -1,6 +1,11 @@
-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 { and, empty, equal } from "@ember/object/computed";
+import DatePickerFuture from "discourse/components/date-picker-future";
+import icon from "discourse/helpers/d-icon";
+import withEventValue from "discourse/helpers/with-event-value";
import discourseComputed from "discourse/lib/decorators";
import {
extendedDefaultTimeShortcuts,
@@ -10,7 +15,9 @@ import {
timeShortcuts,
} from "discourse/lib/time-shortcut";
import { i18n } from "discourse-i18n";
-import { FORMAT } from "select-kit/components/future-date-input-selector";
+import FutureDateInputSelector, {
+ FORMAT,
+} from "select-kit/components/future-date-input-selector";
export default class FutureDateInput extends Component {
selection = null;
@@ -123,47 +130,49 @@ export default class FutureDateInput extends Component {
}
});
}
-}
-<div class="future-date-input">
- {{#unless this.noRelativeOptions}}
- <div class="control-group">
- <label class={{this.labelClasses}}>
- {{#if this.displayLabelIcon}}{{d-icon
- this.displayLabelIcon
- }}{{/if}}{{this.displayLabel}}
- </label>
- <FutureDateInputSelector
- @value={{readonly this.selection}}
- @content={{this.shortcuts}}
- @clearable={{this.clearable}}
- @onChangeInput={{this.onChangeInput}}
- @onChange={{fn (mut this.selection)}}
- @options={{hash none="time_shortcut.select_timeframe"}}
- />
- </div>
- {{/unless}}
-
- {{#if this.displayDateAndTimePicker}}
- <div class="control-group future-date-input-date-picker">
- {{d-icon "calendar-days"}}
- <DatePickerFuture
- @value={{this._date}}
- @defaultDate={{this._date}}
- @onSelect={{action "onChangeDate"}}
- />
+ <template>
+ <div class="future-date-input">
+ {{#unless this.noRelativeOptions}}
+ <div class="control-group">
+ <label class={{this.labelClasses}}>
+ {{#if this.displayLabelIcon}}{{icon
+ this.displayLabelIcon
+ }}{{/if}}{{this.displayLabel}}
+ </label>
+ <FutureDateInputSelector
+ @value={{readonly this.selection}}
+ @content={{this.shortcuts}}
+ @clearable={{this.clearable}}
+ @onChangeInput={{this.onChangeInput}}
+ @onChange={{fn (mut this.selection)}}
+ @options={{hash none="time_shortcut.select_timeframe"}}
+ />
+ </div>
+ {{/unless}}
+
+ {{#if this.displayDateAndTimePicker}}
+ <div class="control-group future-date-input-date-picker">
+ {{icon "calendar-days"}}
+ <DatePickerFuture
+ @value={{this._date}}
+ @defaultDate={{this._date}}
+ @onSelect={{this.onChangeDate}}
+ />
+ </div>
+
+ <div class="control-group future-date-input-time-picker">
+ {{icon "far-clock"}}
+ <Input
+ placeholder="--:--"
+ @type="time"
+ class="time-input"
+ @value={{this._time}}
+ disabled={{this.timeInputDisabled}}
+ {{on "input" (withEventValue this.onChangeTime)}}
+ />
+ </div>
+ {{/if}}
</div>
-
- <div class="control-group future-date-input-time-picker">
- {{d-icon "far-clock"}}
- <Input
- placeholder="--:--"
- @type="time"
- class="time-input"
- @value={{this._time}}
- disabled={{this.timeInputDisabled}}
- {{on "input" (with-event-value this.onChangeTime)}}
- />
- </div>
- {{/if}}
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/group-flair-inputs.gjs b/app/assets/javascripts/discourse/app/components/group-flair-inputs.gjs
index d77353b96e7..86624be00c9 100644
--- a/app/assets/javascripts/discourse/app/components/group-flair-inputs.gjs
+++ b/app/assets/javascripts/discourse/app/components/group-flair-inputs.gjs
@@ -1,14 +1,21 @@
import Component from "@ember/component";
+import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { classNames } from "@ember-decorators/component";
import { observes, on } from "@ember-decorators/object";
import $ from "jquery";
+import { or } from "truth-helpers";
+import AvatarFlair from "discourse/components/avatar-flair";
+import RadioButton from "discourse/components/radio-button";
+import TextField from "discourse/components/text-field";
+import UppyImageUploader from "discourse/components/uppy-image-uploader";
import { ajax } from "discourse/lib/ajax";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import getURL from "discourse/lib/get-url";
import { convertIconClass } from "discourse/lib/icon-library";
import { i18n } from "discourse-i18n";
+import IconPicker from "select-kit/components/icon-picker";
@classNames("group-flair-inputs")
export default class GroupFlairInputs extends Component {
@@ -93,116 +100,118 @@ export default class GroupFlairInputs extends Component {
flair_upload_id: null,
});
}
-}
-<div class="control-group">
- <label class="control-label" for="flair_url">{{i18n
- "groups.flair_url"
- }}</label>
-
- <div class="radios">
- <label class="radio-label" for="avatar-flair-icon">
- <RadioButton
- @name="avatar-flair-icon"
- @id="avatar-flair-icon"
- @value="icon"
- @selection={{this.model.flair_type}}
- />
- {{i18n "groups.flair_type.icon"}}
- </label>
-
- <label class="radio-label" for="avatar-flair-image">
- <RadioButton
- @name="avatar-flair-image"
- @id="avatar-flair-image"
- @value="image"
- @selection={{this.model.flair_type}}
- />
- {{i18n "groups.flair_type.image"}}
- </label>
- </div>
-
- {{#if this.flairPreviewIcon}}
- <IconPicker
- @name="icon"
- @value={{this.model.flair_icon}}
- @options={{hash maximum=1}}
- @onChange={{fn (mut this.model.flair_icon)}}
- />
- {{else if this.flairPreviewImage}}
- <UppyImageUploader
- @imageUrl={{this.flairImageUrl}}
- @onUploadDone={{action "setFlairImage"}}
- @onUploadDeleted={{action "removeFlairImage"}}
- @type="group_flair"
- @id="group-flair-uploader"
- class="no-repeat contain-image"
- />
- <div class="control-instructions">
- {{i18n "groups.flair_upload_description"}}
+ <template>
+ <div class="control-group">
+ <label class="control-label" for="flair_url">{{i18n
+ "groups.flair_url"
+ }}</label>
+
+ <div class="radios">
+ <label class="radio-label" for="avatar-flair-icon">
+ <RadioButton
+ @name="avatar-flair-icon"
+ @id="avatar-flair-icon"
+ @value="icon"
+ @selection={{this.model.flair_type}}
+ />
+ {{i18n "groups.flair_type.icon"}}
+ </label>
+
+ <label class="radio-label" for="avatar-flair-image">
+ <RadioButton
+ @name="avatar-flair-image"
+ @id="avatar-flair-image"
+ @value="image"
+ @selection={{this.model.flair_type}}
+ />
+ {{i18n "groups.flair_type.image"}}
+ </label>
+ </div>
+
+ {{#if this.flairPreviewIcon}}
+ <IconPicker
+ @name="icon"
+ @value={{this.model.flair_icon}}
+ @options={{hash maximum=1}}
+ @onChange={{fn (mut this.model.flair_icon)}}
+ />
+ {{else if this.flairPreviewImage}}
+ <UppyImageUploader
+ @imageUrl={{this.flairImageUrl}}
+ @onUploadDone={{this.setFlairImage}}
+ @onUploadDeleted={{this.removeFlairImage}}
+ @type="group_flair"
+ @id="group-flair-uploader"
+ class="no-repeat contain-image"
+ />
+ <div class="control-instructions">
+ {{i18n "groups.flair_upload_description"}}
+ </div>
+ {{/if}}
</div>
- {{/if}}
-</div>
-
-<div class="control-group">
- <label class="control-label" for="flair_bg_color">{{i18n
- "groups.flair_bg_color"
- }}</label>
-
- <TextField
- @name="flair_bg_color"
- @value={{this.model.flair_bg_color}}
- @placeholderKey="groups.flair_bg_color_placeholder"
- class="group-flair-bg-color input-xxlarge"
- />
-</div>
-
-{{#if this.flairPreviewIcon}}
- <div class="control-group">
- <label class="control-label" for="flair_color">{{i18n
- "groups.flair_color"
- }}</label>
-
- <TextField
- @name="flair_color"
- @value={{this.model.flair_color}}
- @placeholderKey="groups.flair_color_placeholder"
- class="group-flair-color input-xxlarge"
- />
- </div>
-{{/if}}
-
-<div class="control-group">
- <label class="control-label">{{this.flairPreviewLabel}}</label>
-
- <div class="avatar-flair-preview">
- <div class="avatar-wrapper">
- <img
- width="45"
- height="45"
- src={{this.demoAvatarUrl}}
- class="avatar actor"
- alt=""
+
+ <div class="control-group">
+ <label class="control-label" for="flair_bg_color">{{i18n
+ "groups.flair_bg_color"
+ }}</label>
+
+ <TextField
+ @name="flair_bg_color"
+ @value={{this.model.flair_bg_color}}
+ @placeholderKey="groups.flair_bg_color_placeholder"
+ class="group-flair-bg-color input-xxlarge"
/>
</div>
- {{#if
- (or
- this.model.flair_icon
- this.flairImageUrl
- this.model.flairBackgroundHexColor
- )
- }}
- <AvatarFlair
- @flairName={{this.model.name}}
- @flairUrl={{if
- this.flairPreviewIcon
- this.model.flair_icon
- (if this.flairPreviewImage this.flairImageUrl "")
- }}
- @flairBgColor={{this.model.flairBackgroundHexColor}}
- @flairColor={{this.model.flairHexColor}}
- />
+ {{#if this.flairPreviewIcon}}
+ <div class="control-group">
+ <label class="control-label" for="flair_color">{{i18n
+ "groups.flair_color"
+ }}</label>
+
+ <TextField
+ @name="flair_color"
+ @value={{this.model.flair_color}}
+ @placeholderKey="groups.flair_color_placeholder"
+ class="group-flair-color input-xxlarge"
+ />
+ </div>
{{/if}}
- </div>
-</div>
\ No newline at end of file
+
+ <div class="control-group">
+ <label class="control-label">{{this.flairPreviewLabel}}</label>
+
+ <div class="avatar-flair-preview">
+ <div class="avatar-wrapper">
+ <img
+ width="45"
+ height="45"
+ src={{this.demoAvatarUrl}}
+ class="avatar actor"
+ alt
+ />
+ </div>
+
+ {{#if
+ (or
+ this.model.flair_icon
+ this.flairImageUrl
+ this.model.flairBackgroundHexColor
+ )
+ }}
+ <AvatarFlair
+ @flairName={{this.model.name}}
+ @flairUrl={{if
+ this.flairPreviewIcon
+ this.model.flair_icon
+ (if this.flairPreviewImage this.flairImageUrl "")
+ }}
+ @flairBgColor={{this.model.flairBackgroundHexColor}}
+ @flairColor={{this.model.flairHexColor}}
+ />
+ {{/if}}
+ </div>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/group-imap-email-settings.gjs b/app/assets/javascripts/discourse/app/components/group-imap-email-settings.gjs
index 06b0ed92d61..0f1d7fd549d 100644
--- a/app/assets/javascripts/discourse/app/components/group-imap-email-settings.gjs
+++ b/app/assets/javascripts/discourse/app/components/group-imap-email-settings.gjs
@@ -1,12 +1,22 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import EmberObject, { action } from "@ember/object";
+import { LinkTo } from "@ember/routing";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
-import { on } from "@ember-decorators/object";
+import { on as onEvent } from "@ember-decorators/object";
+import { or } from "truth-helpers";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import formatDate from "discourse/helpers/format-date";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse/lib/decorators";
import emailProviderDefaultSettings from "discourse/lib/email-provider-default-settings";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
@tagName("")
export default class GroupImapEmailSettings extends Component {
@@ -42,7 +52,7 @@ export default class GroupImapEmailSettings extends Component {
this.set("imapSettingsValid", false);
}
- @on("init")
+ @onEvent("init")
_fillForm() {
this.set(
"form",
@@ -88,128 +98,130 @@ export default class GroupImapEmailSettings extends Component {
.catch(popupAjaxError)
.finally(() => this.set("testingSettings", false));
}
-}
-<div class="group-imap-email-settings">
- <form class="groups-form form-horizontal groups-form-imap">
- <div>
+ <template>
+ <div class="group-imap-email-settings">
+ <form class="groups-form form-horizontal groups-form-imap">
+ <div>
+ <div class="control-group">
+ <label for="imap_server">{{i18n
+ "groups.manage.email.credentials.imap_server"
+ }}</label>
+ <Input
+ @type="text"
+ name="imap_server"
+ @value={{this.form.imap_server}}
+ tabindex="8"
+ {{on "change" this.resetSettingsValid}}
+ />
+ </div>
+
+ <label for="enable_ssl_imap" class="groups-form__enable-ssl">
+ <Input
+ @type="checkbox"
+ @checked={{this.form.imap_ssl}}
+ id="enable_ssl_imap"
+ tabindex="11"
+ {{on "change" this.resetSettingsValid}}
+ />
+ {{i18n "groups.manage.email.credentials.imap_ssl"}}
+ </label>
+ </div>
+
+ <div>
+ <div class="control-group">
+ <label for="imap_port">{{i18n
+ "groups.manage.email.credentials.imap_port"
+ }}</label>
+ <Input
+ @type="text"
+ name="imap_port"
+ @value={{this.form.imap_port}}
+ tabindex="9"
+ {{on "change" (fn this.resetSettingsValid this.form.imap_port)}}
+ />
+ </div>
+ </div>
+
+ <div>
+ <div class="control-group group-imap-mailboxes">
+ {{#if this.mailboxes}}
+ <label for="imap_mailbox_name">{{i18n
+ "groups.manage.email.mailboxes.synchronized"
+ }}</label>
+ <ComboBox
+ @name="imap_mailbox_name"
+ @id="imap_mailbox"
+ @value={{this.group.imap_mailbox_name}}
+ @valueProperty="value"
+ @content={{this.mailboxes}}
+ @tabindex="10"
+ @onChange={{fn (mut this.group.imap_mailbox_name)}}
+ @options={{hash none="groups.manage.email.mailboxes.disabled"}}
+ />
+ {{/if}}
+ </div>
+
+ </div>
+ </form>
+
<div class="control-group">
- <label for="imap_server">{{i18n
- "groups.manage.email.credentials.imap_server"
- }}</label>
- <Input
- @type="text"
- name="imap_server"
- @value={{this.form.imap_server}}
- tabindex="8"
- {{on "change" (action "resetSettingsValid")}}
- />
+ <div class="group-imap-prefill-options">
+ {{i18n "groups.manage.email.prefill.title"}}
+ <a
+ id="prefill_imap_gmail"
+ href
+ {{on "click" (fn this.prefillSettings "gmail")}}
+ >{{i18n "groups.manage.email.prefill.gmail"}}</a>
+ </div>
</div>
- <label for="enable_ssl_imap" class="groups-form__enable-ssl">
- <Input
- @type="checkbox"
- @checked={{this.form.imap_ssl}}
- id="enable_ssl_imap"
- tabindex="11"
- {{on "change" (action "resetSettingsValid")}}
+ {{#unless this.mailboxSelected}}
+ <div class="alert alert-error imap-no-mailbox-selected">
+ {{i18n "groups.manage.email.imap_mailbox_not_selected"}}
+ </div>
+ {{/unless}}
+
+ <div class="control-group buttons">
+ <DButton
+ @disabled={{or this.missingSettings this.testingSettings}}
+ @action={{this.testImapSettings}}
+ @icon="gear"
+ @label="groups.manage.email.test_settings"
+ @title="groups.manage.email.settings_required"
+ tabindex="12"
+ class="btn-primary test-imap-settings"
/>
- {{i18n "groups.manage.email.credentials.imap_ssl"}}
- </label>
- </div>
- <div>
- <div class="control-group">
- <label for="imap_port">{{i18n
- "groups.manage.email.credentials.imap_port"
- }}</label>
- <Input
- @type="text"
- name="imap_port"
- @value={{this.form.imap_port}}
- tabindex="9"
- {{on "change" (action "resetSettingsValid" this.form.imap_port)}}
+ <ConditionalLoadingSpinner
+ @size="small"
+ @condition={{this.testingSettings}}
/>
- </div>
- </div>
- <div>
- <div class="control-group group-imap-mailboxes">
- {{#if this.mailboxes}}
- <label for="imap_mailbox_name">{{i18n
- "groups.manage.email.mailboxes.synchronized"
- }}</label>
- <ComboBox
- @name="imap_mailbox_name"
- @id="imap_mailbox"
- @value={{this.group.imap_mailbox_name}}
- @valueProperty="value"
- @content={{this.mailboxes}}
- @tabindex="10"
- @onChange={{fn (mut this.group.imap_mailbox_name)}}
- @options={{hash none="groups.manage.email.mailboxes.disabled"}}
- />
+ {{#if this.imapSettingsValid}}
+ <span class="imap-settings-ok">
+ {{icon "circle-check"}}
+ {{i18n "groups.manage.email.imap_settings_valid"}}
+ </span>
{{/if}}
</div>
+ {{#if this.group.imap_updated_at}}
+ <div class="group-email-last-updated-details for-imap">
+ <small>
+ {{i18n "groups.manage.email.last_updated"}}
+ <strong>{{formatDate
+ this.group.imap_updated_at
+ leaveAgo="true"
+ }}</strong>
+ {{i18n "groups.manage.email.last_updated_by"}}
+ <LinkTo
+ @route="user"
+ @model={{this.group.imap_updated_by.username}}
+ >{{this.group.imap_updated_by.username}}</LinkTo>
+ </small>
+ </div>
+ {{/if}}
</div>
- </form>
-
- <div class="control-group">
- <div class="group-imap-prefill-options">
- {{i18n "groups.manage.email.prefill.title"}}
- <a
- id="prefill_imap_gmail"
- href
- {{on "click" (fn this.prefillSettings "gmail")}}
- >{{i18n "groups.manage.email.prefill.gmail"}}</a>
- </div>
- </div>
-
- {{#unless this.mailboxSelected}}
- <div class="alert alert-error imap-no-mailbox-selected">
- {{i18n "groups.manage.email.imap_mailbox_not_selected"}}
- </div>
- {{/unless}}
-
- <div class="control-group buttons">
- <DButton
- @disabled={{or this.missingSettings this.testingSettings}}
- @action={{this.testImapSettings}}
- @icon="gear"
- @label="groups.manage.email.test_settings"
- @title="groups.manage.email.settings_required"
- tabindex="12"
- class="btn-primary test-imap-settings"
- />
-
- <ConditionalLoadingSpinner
- @size="small"
- @condition={{this.testingSettings}}
- />
-
- {{#if this.imapSettingsValid}}
- <span class="imap-settings-ok">
- {{d-icon "circle-check"}}
- {{i18n "groups.manage.email.imap_settings_valid"}}
- </span>
- {{/if}}
- </div>
-
- {{#if this.group.imap_updated_at}}
- <div class="group-email-last-updated-details for-imap">
- <small>
- {{i18n "groups.manage.email.last_updated"}}
- <strong>{{format-date
- this.group.imap_updated_at
- leaveAgo="true"
- }}</strong>
- {{i18n "groups.manage.email.last_updated_by"}}
- <LinkTo
- @route="user"
- @model={{this.group.imap_updated_by.username}}
- >{{this.group.imap_updated_by.username}}</LinkTo>
- </small>
- </div>
- {{/if}}
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/groups-form-interaction-fields.gjs b/app/assets/javascripts/discourse/app/components/groups-form-interaction-fields.gjs
index c288990d023..3304e1b07dc 100644
--- a/app/assets/javascripts/discourse/app/components/groups-form-interaction-fields.gjs
+++ b/app/assets/javascripts/discourse/app/components/groups-form-interaction-fields.gjs
@@ -1,8 +1,14 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
import { or } from "@ember/object/computed";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TextField from "discourse/components/text-field";
import discourseComputed from "discourse/lib/decorators";
import { NotificationLevels } from "discourse/lib/notification-levels";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import NotificationsButton from "select-kit/components/notifications-button";
+import DTooltip from "float-kit/components/d-tooltip";
export default class GroupsFormInteractionFields extends Component {
@or(
@@ -91,149 +97,157 @@ export default class GroupsFormInteractionFields extends Component {
membersVisibilityLevel !== this.visibilityLevelOptions.firstObject.value
);
}
-}
-{{#if this.canAdminGroup}}
- <div class="control-group">
- <label class="control-label">
- {{i18n "admin.groups.manage.interaction.visibility"}}
- </label>
- <label>
- {{i18n "admin.groups.manage.interaction.visibility_levels.title"}}
- </label>
+ <template>
+ {{#if this.canAdminGroup}}
+ <div class="control-group">
+ <label class="control-label">
+ {{i18n "admin.groups.manage.interaction.visibility"}}
+ </label>
+ <label>
+ {{i18n "admin.groups.manage.interaction.visibility_levels.title"}}
+ </label>
+
+ <ComboBox
+ @name="alias"
+ @valueProperty="value"
+ @value={{this.model.visibility_level}}
+ @content={{this.visibilityLevelOptions}}
+ @onChange={{fn (mut this.model.visibility_level)}}
+ @options={{hash castInteger=true}}
+ class="groups-form-visibility-level"
+ />
+
+ <div class="control-instructions">
+ {{i18n
+ "admin.groups.manage.interaction.visibility_levels.description"
+ }}
+ </div>
+ </div>
- <ComboBox
- @name="alias"
- @valueProperty="value"
- @value={{this.model.visibility_level}}
- @content={{this.visibilityLevelOptions}}
- @onChange={{fn (mut this.model.visibility_level)}}
- @options={{hash castInteger=true}}
- class="groups-form-visibility-level"
- />
-
- <div class="control-instructions">
- {{i18n "admin.groups.manage.interaction.visibility_levels.description"}}
+ <div class="control-group">
+ <label>
+ {{i18n
+ "admin.groups.manage.interaction.members_visibility_levels.title"
+ }}
+ </label>
+
+ <ComboBox
+ @name="alias"
+ @valueProperty="value"
+ @value={{this.membersVisibilityLevel}}
+ @content={{this.visibilityLevelOptions}}
+ @onChange={{fn (mut this.model.members_visibility_level)}}
+ class="groups-form-members-visibility-level"
+ />
+
+ {{#if this.membersVisibilityPrivate}}
+ <div class="control-instructions">
+ {{i18n
+ "admin.groups.manage.interaction.members_visibility_levels.description"
+ }}
+ </div>
+ {{/if}}
+ </div>
+ {{/if}}
+
+ <div class="control-group">
+ <label class="control-label">
+ {{i18n "groups.manage.interaction.posting"}}
+ </label>
+ <label for="alias">{{i18n "groups.alias_levels.mentionable"}}</label>
+
+ <ComboBox
+ @name="alias"
+ @valueProperty="value"
+ @value={{this.mentionableLevel}}
+ @content={{this.aliasLevelOptions}}
+ @onChange={{fn (mut this.model.mentionable_level)}}
+ class="groups-form-mentionable-level"
+ />
</div>
- </div>
- <div class="control-group">
- <label>
- {{i18n "admin.groups.manage.interaction.members_visibility_levels.title"}}
- </label>
+ <div class="control-group">
+ <label for="alias">{{i18n "groups.alias_levels.messageable"}}</label>
- <ComboBox
- @name="alias"
- @valueProperty="value"
- @value={{this.membersVisibilityLevel}}
- @content={{this.visibilityLevelOptions}}
- @onChange={{fn (mut this.model.members_visibility_level)}}
- class="groups-form-members-visibility-level"
- />
-
- {{#if this.membersVisibilityPrivate}}
- <div class="control-instructions">
- {{i18n
- "admin.groups.manage.interaction.members_visibility_levels.description"
- }}
+ <ComboBox
+ @name="alias"
+ @valueProperty="value"
+ @value={{this.messageableLevel}}
+ @content={{this.aliasLevelOptions}}
+ @onChange={{fn (mut this.model.messageable_level)}}
+ class="groups-form-messageable-level"
+ />
+ </div>
+
+ {{#if this.canAdminGroup}}
+ <div class="control-group">
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.model.publish_read_state}}
+ class="groups-form-publish-read-state"
+ />
+
+ {{i18n "admin.groups.manage.interaction.publish_read_state"}}
+ </label>
</div>
{{/if}}
- </div>
-{{/if}}
-
-<div class="control-group">
- <label class="control-label">
- {{i18n "groups.manage.interaction.posting"}}
- </label>
- <label for="alias">{{i18n "groups.alias_levels.mentionable"}}</label>
-
- <ComboBox
- @name="alias"
- @valueProperty="value"
- @value={{this.mentionableLevel}}
- @content={{this.aliasLevelOptions}}
- @onChange={{fn (mut this.model.mentionable_level)}}
- class="groups-form-mentionable-level"
- />
-</div>
-
-<div class="control-group">
- <label for="alias">{{i18n "groups.alias_levels.messageable"}}</label>
-
- <ComboBox
- @name="alias"
- @valueProperty="value"
- @value={{this.messageableLevel}}
- @content={{this.aliasLevelOptions}}
- @onChange={{fn (mut this.model.messageable_level)}}
- class="groups-form-messageable-level"
- />
-</div>
-
-{{#if this.canAdminGroup}}
- <div class="control-group">
- <label>
- <Input
- @type="checkbox"
- @checked={{this.model.publish_read_state}}
- class="groups-form-publish-read-state"
- />
- {{i18n "admin.groups.manage.interaction.publish_read_state"}}
- </label>
- </div>
-{{/if}}
+ {{#if this.showEmailSettings}}
+ <div class="control-group">
+ <label class="control-label">
+ {{i18n "admin.groups.manage.interaction.email"}}
+ </label>
+ <label for="incoming_email">
+ {{i18n "admin.groups.manage.interaction.incoming_email"}}
+ </label>
+
+ <TextField
+ @name="incoming_email"
+ @value={{this.model.incoming_email}}
+ @placeholderKey="admin.groups.manage.interaction.incoming_email_placeholder"
+ class="input-xxlarge groups-form-incoming-email"
+ />
+
+ <DTooltip
+ @icon="circle-info"
+ @content={{i18n
+ "admin.groups.manage.interaction.incoming_email_tooltip"
+ }}
+ />
+
+ <span>
+ <PluginOutlet
+ @name="group-email-in"
+ @connectorTagName="div"
+ @outletArgs={{hash model=this.model}}
+ />
+ </span>
+ </div>
+ {{/if}}
-{{#if this.showEmailSettings}}
- <div class="control-group">
<label class="control-label">
- {{i18n "admin.groups.manage.interaction.email"}}
- </label>
- <label for="incoming_email">
- {{i18n "admin.groups.manage.interaction.incoming_email"}}
+ {{i18n "groups.manage.interaction.notification"}}
</label>
- <TextField
- @name="incoming_email"
- @value={{this.model.incoming_email}}
- @placeholderKey="admin.groups.manage.interaction.incoming_email_placeholder"
- class="input-xxlarge groups-form-incoming-email"
- />
+ <div class="control-group">
+ <label>{{i18n "groups.notification_level"}}</label>
- <DTooltip
- @icon="circle-info"
- @content={{i18n "admin.groups.manage.interaction.incoming_email_tooltip"}}
- />
+ <NotificationsButton
+ @value={{this.defaultNotificationLevel}}
+ @options={{hash i18nPrefix="groups.notifications"}}
+ @onChange={{fn (mut this.model.default_notification_level)}}
+ class="groups-form-default-notification-level"
+ />
+ </div>
<span>
<PluginOutlet
- @name="group-email-in"
+ @name="groups-interaction-custom-options"
@connectorTagName="div"
@outletArgs={{hash model=this.model}}
/>
</span>
- </div>
-{{/if}}
-
-<label class="control-label">
- {{i18n "groups.manage.interaction.notification"}}
-</label>
-
-<div class="control-group">
- <label>{{i18n "groups.notification_level"}}</label>
-
- <NotificationsButton
- @value={{this.defaultNotificationLevel}}
- @options={{hash i18nPrefix="groups.notifications"}}
- @onChange={{fn (mut this.model.default_notification_level)}}
- class="groups-form-default-notification-level"
- />
-</div>
-
-<span>
- <PluginOutlet
- @name="groups-interaction-custom-options"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/groups-form-membership-fields.gjs b/app/assets/javascripts/discourse/app/components/groups-form-membership-fields.gjs
index 152f9b3b31a..4d94c9434e7 100644
--- a/app/assets/javascripts/discourse/app/components/groups-form-membership-fields.gjs
+++ b/app/assets/javascripts/discourse/app/components/groups-form-membership-fields.gjs
@@ -1,9 +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, computed } from "@ember/object";
import { not, readOnly } from "@ember/object/computed";
+import ExpandingTextArea from "discourse/components/expanding-text-area";
+import GroupFlairInputs from "discourse/components/group-flair-inputs";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import withEventValue from "discourse/helpers/with-event-value";
import discourseComputed from "discourse/lib/decorators";
import AssociatedGroup from "discourse/models/associated-group";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import ListSetting from "select-kit/components/list-setting";
export default class GroupsFormMembershipFields extends Component {
tokenSeparator = "|";
@@ -69,158 +77,160 @@ export default class GroupsFormMembershipFields extends Component {
value.join(this.tokenSeparator)
);
}
-}
-<div class="control-group">
- <label class="control-label">{{i18n
- "groups.manage.membership.access"
- }}</label>
-
- <label>
- <Input
- @type="checkbox"
- class="group-form-public-admission"
- @checked={{this.model.public_admission}}
- disabled={{this.disablePublicSetting}}
- />
-
- {{i18n "groups.public_admission"}}
- </label>
-
- <label>
- <Input
- @type="checkbox"
- class="group-form-public-exit"
- @checked={{this.model.public_exit}}
- />
-
- {{i18n "groups.public_exit"}}
- </label>
-
- <label>
- <Input
- @type="checkbox"
- class="group-form-allow-membership-requests"
- @checked={{this.model.allow_membership_requests}}
- disabled={{this.disableMembershipRequestSetting}}
- />
-
- {{i18n "groups.allow_membership_requests"}}
- </label>
-
- {{#if this.model.allow_membership_requests}}
- <div>
- <label for="membership-request-template">
- {{i18n "groups.membership_request_template"}}
+ <template>
+ <div class="control-group">
+ <label class="control-label">{{i18n
+ "groups.manage.membership.access"
+ }}</label>
+
+ <label>
+ <Input
+ @type="checkbox"
+ class="group-form-public-admission"
+ @checked={{this.model.public_admission}}
+ disabled={{this.disablePublicSetting}}
+ />
+
+ {{i18n "groups.public_admission"}}
</label>
- <ExpandingTextArea
- {{on
- "input"
- (with-event-value (fn (mut this.model.membership_request_template)))
- }}
- value={{this.model.membership_request_template}}
- name="membership-request-template"
- class="group-form-membership-request-template input-xxlarge"
- />
- </div>
- {{/if}}
-</div>
-
-{{#if this.model.can_admin_group}}
- <div class="control-group">
- <label class="control-label">{{i18n
- "admin.groups.manage.membership.automatic"
- }}</label>
-
- <label for="automatic_membership">
- {{i18n
- "admin.groups.manage.membership.automatic_membership_email_domains"
- }}
- </label>
-
- <ListSetting
- @name="automatic_membership"
- @value={{this.emailDomains}}
- @choices={{this.emailDomains}}
- @settingName="name"
- @nameProperty={{null}}
- @valueProperty={{null}}
- @onChange={{action "onChangeEmailDomainsSetting"}}
- @options={{hash allowAny=true}}
- class="group-form-automatic-membership-automatic"
- />
-
- {{#if this.showAssociatedGroups}}
- <label for="automatic_membership_associated_groups">
- {{i18n
- "admin.groups.manage.membership.automatic_membership_associated_groups"
- }}
+ <label>
+ <Input
+ @type="checkbox"
+ class="group-form-public-exit"
+ @checked={{this.model.public_exit}}
+ />
+
+ {{i18n "groups.public_exit"}}
</label>
- <ListSetting
- @name="automatic_membership_associated_groups"
- @value={{this.model.associatedGroupIds}}
- @choices={{this.associatedGroups}}
- @settingName="name"
- @nameProperty="label"
- @valueProperty="id"
- @onChange={{fn (mut this.model.associated_group_ids)}}
- class="group-form-automatic-membership-associated-groups"
- />
- {{/if}}
- </div>
-
- <span>
- <PluginOutlet
- @name="groups-form-membership-below-automatic"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
-
- <div class="control-group">
- <label class="control-label">{{i18n
- "admin.groups.manage.membership.effects"
- }}</label>
- <label for="grant_trust_level">{{i18n
- "admin.groups.manage.membership.trust_levels_title"
- }}</label>
-
- <ComboBox
- @name="grant_trust_level"
- @valueProperty="value"
- @value={{this.groupTrustLevel}}
- @content={{this.trustLevelOptions}}
- @onChange={{fn (mut this.model.grant_trust_level)}}
- class="groups-form-grant-trust-level"
- />
- <label>
- <Input
- @type="checkbox"
- @checked={{this.model.primary_group}}
- class="groups-form-primary-group"
- />
-
- {{i18n "admin.groups.manage.membership.primary_group"}}
- </label>
- </div>
-
- <div class="control-group">
- <label class="control-label" for="title">
- {{i18n "admin.groups.default_title"}}
- </label>
-
- <Input @value={{this.model.title}} name="title" class="input-xxlarge" />
-
- <div class="control-instructions">
- {{i18n "admin.groups.default_title_description"}}
+ <label>
+ <Input
+ @type="checkbox"
+ class="group-form-allow-membership-requests"
+ @checked={{this.model.allow_membership_requests}}
+ disabled={{this.disableMembershipRequestSetting}}
+ />
+
+ {{i18n "groups.allow_membership_requests"}}
+ </label>
+
+ {{#if this.model.allow_membership_requests}}
+ <div>
+ <label for="membership-request-template">
+ {{i18n "groups.membership_request_template"}}
+ </label>
+
+ <ExpandingTextArea
+ {{on
+ "input"
+ (withEventValue (fn (mut this.model.membership_request_template)))
+ }}
+ value={{this.model.membership_request_template}}
+ name="membership-request-template"
+ class="group-form-membership-request-template input-xxlarge"
+ />
+ </div>
+ {{/if}}
</div>
- </div>
-{{/if}}
-
-{{#if this.canEdit}}
- <div class="control-group">
- <GroupFlairInputs @model={{this.model}} />
- </div>
-{{/if}}
\ No newline at end of file
+
+ {{#if this.model.can_admin_group}}
+ <div class="control-group">
+ <label class="control-label">{{i18n
+ "admin.groups.manage.membership.automatic"
+ }}</label>
+
+ <label for="automatic_membership">
+ {{i18n
+ "admin.groups.manage.membership.automatic_membership_email_domains"
+ }}
+ </label>
+
+ <ListSetting
+ @name="automatic_membership"
+ @value={{this.emailDomains}}
+ @choices={{this.emailDomains}}
+ @settingName="name"
+ @nameProperty={{null}}
+ @valueProperty={{null}}
+ @onChange={{this.onChangeEmailDomainsSetting}}
+ @options={{hash allowAny=true}}
+ class="group-form-automatic-membership-automatic"
+ />
+
+ {{#if this.showAssociatedGroups}}
+ <label for="automatic_membership_associated_groups">
+ {{i18n
+ "admin.groups.manage.membership.automatic_membership_associated_groups"
+ }}
+ </label>
+
+ <ListSetting
+ @name="automatic_membership_associated_groups"
+ @value={{this.model.associatedGroupIds}}
+ @choices={{this.associatedGroups}}
+ @settingName="name"
+ @nameProperty="label"
+ @valueProperty="id"
+ @onChange={{fn (mut this.model.associated_group_ids)}}
+ class="group-form-automatic-membership-associated-groups"
+ />
+ {{/if}}
+ </div>
+
+ <span>
+ <PluginOutlet
+ @name="groups-form-membership-below-automatic"
+ @connectorTagName="div"
+ @outletArgs={{hash model=this.model}}
+ />
+ </span>
+
+ <div class="control-group">
+ <label class="control-label">{{i18n
+ "admin.groups.manage.membership.effects"
+ }}</label>
+ <label for="grant_trust_level">{{i18n
+ "admin.groups.manage.membership.trust_levels_title"
+ }}</label>
+
+ <ComboBox
+ @name="grant_trust_level"
+ @valueProperty="value"
+ @value={{this.groupTrustLevel}}
+ @content={{this.trustLevelOptions}}
+ @onChange={{fn (mut this.model.grant_trust_level)}}
+ class="groups-form-grant-trust-level"
+ />
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.model.primary_group}}
+ class="groups-form-primary-group"
+ />
+
+ {{i18n "admin.groups.manage.membership.primary_group"}}
+ </label>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="title">
+ {{i18n "admin.groups.default_title"}}
+ </label>
+
+ <Input @value={{this.model.title}} name="title" class="input-xxlarge" />
+
+ <div class="control-instructions">
+ {{i18n "admin.groups.default_title_description"}}
+ </div>
+ </div>
+ {{/if}}
+
+ {{#if this.canEdit}}
+ <div class="control-group">
+ <GroupFlairInputs @model={{this.model}} />
+ </div>
+ {{/if}}
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/invite-panel.gjs b/app/assets/javascripts/discourse/app/components/invite-panel.gjs
index c03d32b8f5f..e98e04c28c2 100644
--- a/app/assets/javascripts/discourse/app/components/invite-panel.gjs
+++ b/app/assets/javascripts/discourse/app/components/invite-panel.gjs
@@ -1,13 +1,21 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
+import { fn, hash } from "@ember/helper";
import EmberObject, { action } from "@ember/object";
import { alias, and, equal, readOnly } from "@ember/object/computed";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
+import DButton from "discourse/components/d-button";
+import DiscourseLinkedText from "discourse/components/discourse-linked-text";
+import GeneratedInviteLink from "discourse/components/generated-invite-link";
+import TextField from "discourse/components/text-field";
+import htmlSafe from "discourse/helpers/html-safe";
import { computedI18n } from "discourse/lib/computed";
import discourseComputed from "discourse/lib/decorators";
import { getNativeContact } from "discourse/lib/pwa-utils";
import { emailValid } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
+import GroupChooser from "select-kit/components/group-chooser";
export default class InvitePanel extends Component {
@service site;
@@ -441,120 +449,122 @@ export default class InvitePanel extends Component {
});
}
}
-}
-{{#if this.inviteModel.error}}
- <div class="alert alert-error">
- {{html-safe this.errorMessage}}
- </div>
-{{/if}}
-
-<div class="body">
- {{#if this.inviteModel.finished}}
- {{#if this.inviteModel.inviteLink}}
- <GeneratedInviteLink
- @link={{this.inviteModel.inviteLink}}
- @email={{this.invitee}}
- />
- {{else}}
- <div class="success-message">
- {{html-safe this.successMessage}}
+ <template>
+ {{#if this.inviteModel.error}}
+ <div class="alert alert-error">
+ {{htmlSafe this.errorMessage}}
</div>
{{/if}}
- {{else}}
- <div class="invite-user-control">
- <label class="instructions">{{this.inviteInstructions}}</label>
- <div class="invite-user-input-wrapper">
- {{#if this.allowExistingMembers}}
- <EmailGroupUserChooser
- @value={{this.invitee}}
- @onChange={{action "updateInvitee"}}
- @options={{hash
- maximum=1
- allowEmails=this.canInviteViaEmail
- excludeCurrentUser=true
- includeMessageableGroups=this.isPM
- filterPlaceholder=this.placeholderKey
- fullWidthWrap=true
- }}
- class="invite-user-input"
+
+ <div class="body">
+ {{#if this.inviteModel.finished}}
+ {{#if this.inviteModel.inviteLink}}
+ <GeneratedInviteLink
+ @link={{this.inviteModel.inviteLink}}
+ @email={{this.invitee}}
/>
{{else}}
- <TextField
- @value={{this.invitee}}
- @placeholderKey="topic.invite_reply.email_placeholder"
- class="email-or-username-input"
- />
+ <div class="success-message">
+ {{htmlSafe this.successMessage}}
+ </div>
{{/if}}
- {{#if this.capabilities.hasContactPicker}}
- <DButton
- @icon="address-book"
- @action={{this.searchContact}}
- class="btn-primary open-contact-picker"
- />
+ {{else}}
+ <div class="invite-user-control">
+ <label class="instructions">{{this.inviteInstructions}}</label>
+ <div class="invite-user-input-wrapper">
+ {{#if this.allowExistingMembers}}
+ <EmailGroupUserChooser
+ @value={{this.invitee}}
+ @onChange={{this.updateInvitee}}
+ @options={{hash
+ maximum=1
+ allowEmails=this.canInviteViaEmail
+ excludeCurrentUser=true
+ includeMessageableGroups=this.isPM
+ filterPlaceholder=this.placeholderKey
+ fullWidthWrap=true
+ }}
+ class="invite-user-input"
+ />
+ {{else}}
+ <TextField
+ @value={{this.invitee}}
+ @placeholderKey="topic.invite_reply.email_placeholder"
+ class="email-or-username-input"
+ />
+ {{/if}}
+ {{#if this.capabilities.hasContactPicker}}
+ <DButton
+ @icon="address-book"
+ @action={{this.searchContact}}
+ class="btn-primary open-contact-picker"
+ />
+ {{/if}}
+ </div>
+ </div>
+
+ {{#if this.showGroups}}
+ <div class="group-access-control">
+ <label class="instructions {{this.showGroupsClass}}">
+ {{i18n "topic.automatically_add_to_groups"}}
+ </label>
+ <GroupChooser
+ @content={{this.allGroups}}
+ @value={{this.groupIds}}
+ @labelProperty="name"
+ @onChange={{fn (mut this.groupIds)}}
+ />
+ </div>
{{/if}}
- </div>
- </div>
- {{#if this.showGroups}}
- <div class="group-access-control">
- <label class="instructions {{this.showGroupsClass}}">
- {{i18n "topic.automatically_add_to_groups"}}
- </label>
- <GroupChooser
- @content={{this.allGroups}}
- @value={{this.groupIds}}
- @labelProperty="name"
- @onChange={{fn (mut this.groupIds)}}
- />
- </div>
- {{/if}}
+ {{#if this.showCustomMessage}}
+ <div class="show-custom-message-control">
+ <label class="instructions">
+ <DiscourseLinkedText
+ @action={{this.showCustomMessageBox}}
+ @text="invite.custom_message"
+ class="optional"
+ />
+ </label>
+ {{#if this.hasCustomMessage}}
+ <Textarea
+ @value={{this.customMessage}}
+ placeholder={{this.customMessagePlaceholder}}
+ />
+ {{/if}}
+ </div>
+ {{/if}}
+ {{/if}}
- {{#if this.showCustomMessage}}
- <div class="show-custom-message-control">
- <label class="instructions">
- <DiscourseLinkedText
- @action={{action "showCustomMessageBox"}}
- @text="invite.custom_message"
- class="optional"
- />
+ {{#if this.showApprovalMessage}}
+ <label class="instructions approval-notice">
+ {{i18n "invite.approval_not_required"}}
</label>
- {{#if this.hasCustomMessage}}
- <Textarea
- @value={{this.customMessage}}
- placeholder={{this.customMessagePlaceholder}}
+ {{/if}}
+ </div>
+
+ <div class="footer">
+ {{#if this.inviteModel.finished}}
+ <DButton @action={{@closeModal}} @label="close" class="btn-primary" />
+ {{else}}
+ <DButton
+ @icon={{this.inviteIcon}}
+ @action={{this.createInvite}}
+ @disabled={{this.disabled}}
+ @label={{this.buttonTitle}}
+ class="btn-primary send-invite"
+ />
+ {{#if this.showCopyInviteButton}}
+ <DButton
+ @icon="link"
+ @action={{this.generateInviteLink}}
+ @disabled={{this.disabledCopyLink}}
+ @label="user.invited.generate_link"
+ class="btn-primary generate-invite-link"
/>
{{/if}}
- </div>
- {{/if}}
- {{/if}}
-
- {{#if this.showApprovalMessage}}
- <label class="instructions approval-notice">
- {{i18n "invite.approval_not_required"}}
- </label>
- {{/if}}
-</div>
-
-<div class="footer">
- {{#if this.inviteModel.finished}}
- <DButton @action={{@closeModal}} @label="close" class="btn-primary" />
- {{else}}
- <DButton
- @icon={{this.inviteIcon}}
- @action={{this.createInvite}}
- @disabled={{this.disabled}}
- @label={{this.buttonTitle}}
- class="btn-primary send-invite"
- />
- {{#if this.showCopyInviteButton}}
- <DButton
- @icon="link"
- @action={{this.generateInviteLink}}
- @disabled={{this.disabledCopyLink}}
- @label="user.invited.generate_link"
- class="btn-primary generate-invite-link"
- />
- {{/if}}
- {{/if}}
-</div>
\ No newline at end of file
+ {{/if}}
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/bookmark.gjs b/app/assets/javascripts/discourse/app/components/modal/bookmark.gjs
index 71cc08ca771..f63ac0b1f44 100644
--- a/app/assets/javascripts/discourse/app/components/modal/bookmark.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/bookmark.gjs
@@ -1,11 +1,22 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { and, notEmpty } from "@ember/object/computed";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import ItsATrap from "@discourse/itsatrap";
import { Promise } from "rsvp";
-import { CLOSE_INITIATED_BY_CLICK_OUTSIDE } from "discourse/components/d-modal";
+import DButton from "discourse/components/d-button";
+import DModal, {
+ CLOSE_INITIATED_BY_CLICK_OUTSIDE,
+} from "discourse/components/d-modal";
+import DModalCancel from "discourse/components/d-modal-cancel";
+import TimeShortcutPicker from "discourse/components/time-shortcut-picker";
+import basePath from "discourse/helpers/base-path";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
import { extractError } from "discourse/lib/ajax-error";
import { formattedReminderTime } from "discourse/lib/bookmark";
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
@@ -18,6 +29,7 @@ import {
import { now, parseCustomDatetime, startOfDay } from "discourse/lib/time-utils";
import { AUTO_DELETE_PREFERENCES } from "discourse/models/bookmark";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
const BOOKMARK_BINDINGS = {
enter: { handler: "saveAndClose" },
@@ -334,111 +346,113 @@ export default class BookmarkModal extends Component {
this.postDetectedLocalTimezone = localDateEl.dataset.timezone;
}
}
-}
-<DModal
- @closeModal={{this.closingModal}}
- @title={{this.modalTitle}}
- @flash={{this.flash}}
- @flashType="error"
- id="bookmark-reminder-modal"
- class="bookmark-reminder-modal"
- data-bookmark-id={{this.bookmark.id}}
- {{did-insert this.didInsert}}
->
- <:headerPrimaryAction>
- <DButton
- @label="bookmarks.save"
- @action={{this.saveAndClose}}
- @title="modal.close"
- class="btn-transparent btn-primary"
- />
- </:headerPrimaryAction>
-
- <:body>
- <div class="control-group bookmark-name-wrap">
- <Input
- id="bookmark-name"
- @value={{this.bookmark.name}}
- name="bookmark-name"
- class="bookmark-name"
- placeholder={{i18n "post.bookmarks.name_placeholder"}}
- aria-label={{i18n "post.bookmarks.name_input_label"}}
- />
- <DButton
- @icon="gear"
- @action={{this.toggleShowOptions}}
- @ariaLabel="post.bookmarks.options"
- @title="post.bookmarks.options"
- class="bookmark-options-button"
- />
- </div>
-
- {{#if this.showOptions}}
- <div class="bookmark-options-panel">
- <label
- class="control-label"
- for="bookmark_auto_delete_preference"
- >{{i18n "bookmarks.auto_delete_preference.label"}}</label>
- <ComboBox
- @content={{this.autoDeletePreferences}}
- @value={{this.bookmark.autoDeletePreference}}
- @id="bookmark-auto-delete-preference"
- @onChange={{fn (mut this.bookmark.autoDeletePreference)}}
- class="bookmark-option-selector"
+ <template>
+ <DModal
+ @closeModal={{this.closingModal}}
+ @title={{this.modalTitle}}
+ @flash={{this.flash}}
+ @flashType="error"
+ id="bookmark-reminder-modal"
+ class="bookmark-reminder-modal"
+ data-bookmark-id={{this.bookmark.id}}
+ {{didInsert this.didInsert}}
+ >
+ <:headerPrimaryAction>
+ <DButton
+ @label="bookmarks.save"
+ @action={{this.saveAndClose}}
+ @title="modal.close"
+ class="btn-transparent btn-primary"
/>
- </div>
- {{/if}}
-
- {{#if this.showExistingReminderAt}}
- <div class="alert alert-info existing-reminder-at-alert">
- {{d-icon "far-clock"}}
- <span>{{i18n
- "bookmarks.reminders.existing_reminder"
- at_date_time=this.existingReminderAtFormatted
- }}</span>
- </div>
- {{/if}}
-
- <div class="control-group">
- <label class="control-label">
- {{i18n "post.bookmarks.set_reminder"}}
- </label>
-
- {{#if this.userHasTimezoneSet}}
- <TimeShortcutPicker
- @timeShortcuts={{this.timeOptions}}
- @prefilledDatetime={{this.prefilledDatetime}}
- @onTimeSelected={{this.onTimeSelected}}
- @hiddenOptions={{this.hiddenTimeShortcutOptions}}
- @customLabels={{this.customTimeShortcutLabels}}
- @_itsatrap={{this._itsatrap}}
+ </:headerPrimaryAction>
+
+ <:body>
+ <div class="control-group bookmark-name-wrap">
+ <Input
+ id="bookmark-name"
+ @value={{this.bookmark.name}}
+ name="bookmark-name"
+ class="bookmark-name"
+ placeholder={{i18n "post.bookmarks.name_placeholder"}}
+ aria-label={{i18n "post.bookmarks.name_input_label"}}
+ />
+ <DButton
+ @icon="gear"
+ @action={{this.toggleShowOptions}}
+ @ariaLabel="post.bookmarks.options"
+ @title="post.bookmarks.options"
+ class="bookmark-options-button"
+ />
+ </div>
+
+ {{#if this.showOptions}}
+ <div class="bookmark-options-panel">
+ <label
+ class="control-label"
+ for="bookmark_auto_delete_preference"
+ >{{i18n "bookmarks.auto_delete_preference.label"}}</label>
+ <ComboBox
+ @content={{this.autoDeletePreferences}}
+ @value={{this.bookmark.autoDeletePreference}}
+ @id="bookmark-auto-delete-preference"
+ @onChange={{fn (mut this.bookmark.autoDeletePreference)}}
+ class="bookmark-option-selector"
+ />
+ </div>
+ {{/if}}
+
+ {{#if this.showExistingReminderAt}}
+ <div class="alert alert-info existing-reminder-at-alert">
+ {{icon "far-clock"}}
+ <span>{{i18n
+ "bookmarks.reminders.existing_reminder"
+ at_date_time=this.existingReminderAtFormatted
+ }}</span>
+ </div>
+ {{/if}}
+
+ <div class="control-group">
+ <label class="control-label">
+ {{i18n "post.bookmarks.set_reminder"}}
+ </label>
+
+ {{#if this.userHasTimezoneSet}}
+ <TimeShortcutPicker
+ @timeShortcuts={{this.timeOptions}}
+ @prefilledDatetime={{this.prefilledDatetime}}
+ @onTimeSelected={{this.onTimeSelected}}
+ @hiddenOptions={{this.hiddenTimeShortcutOptions}}
+ @customLabels={{this.customTimeShortcutLabels}}
+ @_itsatrap={{this._itsatrap}}
+ />
+ {{else}}
+ <div class="alert alert-info">{{htmlSafe
+ (i18n "bookmarks.no_timezone" basePath=(basePath))
+ }}</div>
+ {{/if}}
+ </div>
+ </:body>
+
+ <:footer>
+ <DButton
+ @label="bookmarks.save"
+ @action={{this.saveAndClose}}
+ id="save-bookmark"
+ class="btn-primary"
/>
- {{else}}
- <div class="alert alert-info">{{html-safe
- (i18n "bookmarks.no_timezone" basePath=(base-path))
- }}</div>
- {{/if}}
- </div>
- </:body>
-
- <:footer>
- <DButton
- @label="bookmarks.save"
- @action={{this.saveAndClose}}
- id="save-bookmark"
- class="btn-primary"
- />
- <DModalCancel @close={{this.closeWithoutSavingBookmark}} />
- {{#if this.showDelete}}
- <DButton
- @icon="trash-can"
- @action={{this.delete}}
- @ariaLabel="post.bookmarks.actions.delete_bookmark.name"
- @title="post.bookmarks.actions.delete_bookmark.name"
- id="delete-bookmark"
- class="delete-bookmark btn-danger"
- />
- {{/if}}
- </:footer>
-</DModal>
\ No newline at end of file
+ <DModalCancel @close={{this.closeWithoutSavingBookmark}} />
+ {{#if this.showDelete}}
+ <DButton
+ @icon="trash-can"
+ @action={{this.delete}}
+ @ariaLabel="post.bookmarks.actions.delete_bookmark.name"
+ @title="post.bookmarks.actions.delete_bookmark.name"
+ id="delete-bookmark"
+ class="delete-bookmark btn-danger"
+ />
+ {{/if}}
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/change-owner.gjs b/app/assets/javascripts/discourse/app/components/modal/change-owner.gjs
index ec328fb9e87..21261b0714a 100644
--- a/app/assets/javascripts/discourse/app/components/modal/change-owner.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/change-owner.gjs
@@ -1,10 +1,16 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { hash } from "@ember/helper";
+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 htmlSafe from "discourse/helpers/html-safe";
import DiscourseURL from "discourse/lib/url";
import Topic from "discourse/models/topic";
import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default class ChangeOwnerModal extends Component {
@tracked saving = false;
@@ -56,47 +62,49 @@ export default class ChangeOwnerModal extends Component {
async updateNewOwner(selected) {
this.newOwner = selected.firstObject;
}
-}
-<DModal
- @bodyClass="change-ownership"
- @closeModal={{@closeModal}}
- @title={{i18n "topic.change_owner.title"}}
- @flash={{this.flash}}
- @flashType="error"
- class="change-ownership-modal"
->
- <:body>
- <span>
- {{html-safe
- (i18n
- (if
- this.selectedPostsUsername
- "topic.change_owner.instructions"
- "topic.change_owner.instructions_without_old_user"
- )
- count=this.selectedPostsCount
- old_user=this.selectedPostsUsername
- )
- }}
- </span>
+ <template>
+ <DModal
+ @bodyClass="change-ownership"
+ @closeModal={{@closeModal}}
+ @title={{i18n "topic.change_owner.title"}}
+ @flash={{this.flash}}
+ @flashType="error"
+ class="change-ownership-modal"
+ >
+ <:body>
+ <span>
+ {{htmlSafe
+ (i18n
+ (if
+ this.selectedPostsUsername
+ "topic.change_owner.instructions"
+ "topic.change_owner.instructions_without_old_user"
+ )
+ count=this.selectedPostsCount
+ old_user=this.selectedPostsUsername
+ )
+ }}
+ </span>
- <EmailGroupUserChooser
- @value={{this.newOwner}}
- @autofocus={{true}}
- @onChange={{this.updateNewOwner}}
- @options={{hash
- maximum=1
- filterPlaceholder="topic.change_owner.placeholder"
- }}
- />
- </:body>
- <:footer>
- <DButton
- {{on "click" this.changeOwnershipOfPosts}}
- @disabled={{this.buttonDisabled}}
- @label={{if this.saving "saving" "topic.change_owner.action"}}
- class="btn-primary"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <EmailGroupUserChooser
+ @value={{this.newOwner}}
+ @autofocus={{true}}
+ @onChange={{this.updateNewOwner}}
+ @options={{hash
+ maximum=1
+ filterPlaceholder="topic.change_owner.placeholder"
+ }}
+ />
+ </:body>
+ <:footer>
+ <DButton
+ {{on "click" this.changeOwnershipOfPosts}}
+ @disabled={{this.buttonDisabled}}
+ @label={{if this.saving "saving" "topic.change_owner.action"}}
+ class="btn-primary"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/convert-to-public-topic.gjs b/app/assets/javascripts/discourse/app/components/modal/convert-to-public-topic.gjs
index bb44e9de9c5..185c59f2765 100644
--- a/app/assets/javascripts/discourse/app/components/modal/convert-to-public-topic.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/convert-to-public-topic.gjs
@@ -1,8 +1,13 @@
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 DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
import { extractError } from "discourse/lib/ajax-error";
+import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
export default class ConvertToPublicTopic extends Component {
@service appEvents;
@@ -28,34 +33,36 @@ export default class ConvertToPublicTopic extends Component {
this.saving = false;
}
}
-}
-<DModal
- @title={{i18n "topic.make_public.title"}}
- @closeModal={{@closeModal}}
- class="convert-to-public-topic"
- @flash={{this.flash}}
->
- <:body>
- <div class="instructions">
- {{i18n "topic.make_public.choose_category"}}
- </div>
- <CategoryChooser
- @value={{this.publicCategoryId}}
- @onChange={{fn (mut this.publicCategoryId)}}
- />
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @action={{this.makePublic}}
- @label="composer.modal_ok"
- @disabled={{this.saving}}
- />
- <DButton
- class="btn-flat d-modal-cancel"
- @action={{@closeModal}}
- @label="cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "topic.make_public.title"}}
+ @closeModal={{@closeModal}}
+ class="convert-to-public-topic"
+ @flash={{this.flash}}
+ >
+ <:body>
+ <div class="instructions">
+ {{i18n "topic.make_public.choose_category"}}
+ </div>
+ <CategoryChooser
+ @value={{this.publicCategoryId}}
+ @onChange={{fn (mut this.publicCategoryId)}}
+ />
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @action={{this.makePublic}}
+ @label="composer.modal_ok"
+ @disabled={{this.saving}}
+ />
+ <DButton
+ class="btn-flat d-modal-cancel"
+ @action={{@closeModal}}
+ @label="cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/edit-slow-mode.gjs b/app/assets/javascripts/discourse/app/components/modal/edit-slow-mode.gjs
index 4004d7b6d31..0ce1e3ca104 100644
--- a/app/assets/javascripts/discourse/app/components/modal/edit-slow-mode.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/edit-slow-mode.gjs
@@ -1,12 +1,18 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { fn } from "@ember/helper";
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 FutureDateInput from "discourse/components/future-date-input";
import { fromSeconds, toSeconds } from "discourse/helpers/slow-mode";
import { extractError } from "discourse/lib/ajax-error";
import { timeShortcuts } from "discourse/lib/time-shortcut";
import Topic from "discourse/models/topic";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
const SLOW_MODE_OPTIONS = [
{
@@ -181,75 +187,77 @@ export default class EditSlowMode extends Component {
_parseValue(value) {
return parseInt(value, 10) || 0;
}
-}
-<DModal
- @title={{i18n "topic.slow_mode_update.title"}}
- class="edit-slow-mode-modal"
- @closeModal={{@closeModal}}
- @flash={{this.flash}}
->
- <:body>
- <div class="control-group">
- <label class="slow-mode-label">
- {{i18n "topic.slow_mode_update.description"}}
- </label>
- </div>
- <div class="control-group">
- <label class="slow-mode-label">
- {{i18n "topic.slow_mode_update.select"}}
- </label>
- <ComboBox
- class="slow-mode-type"
- @content={{this.slowModes}}
- @value={{this.selectedSlowMode}}
- @onChange={{this.setSlowModeDuration}}
- />
- </div>
- {{#if this.showCustomSelect}}
- <div class="control-group">
- <label class="slow-mode-label">
- {{i18n "topic.slow_mode_update.hours"}}
- </label>
- <Input @value={{this.hours}} @type="number" class="input-small" />
- <label class="slow-mode-label">
- {{i18n "topic.slow_mode_update.minutes"}}
- </label>
- <Input @value={{this.minutes}} @type="number" class="input-small" />
- <label class="slow-mode-label">
- {{i18n "topic.slow_mode_update.seconds"}}
- </label>
- <Input @value={{this.seconds}} @type="number" class="input-small" />
- </div>
- {{/if}}
-
- <div class="control-group">
- <FutureDateInput
- class="enabled-until"
- @label="topic.slow_mode_update.enabled_until"
- @labelClasses="slow-mode-label"
- @customShortcuts={{this.timeShortcuts}}
- @clearable={{true}}
- @input={{@model.topic.slow_mode_enabled_until}}
- @onChangeInput={{fn (mut @model.topic.slow_mode_enabled_until)}}
- />
- </div>
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @disabled={{this.submitDisabled}}
- @icon="hourglass-start"
- @label={{this.saveButtonLabel}}
- @action={{this.enableSlowMode}}
- />
- {{#if @model.topic.slow_mode_seconds}}
- <DButton
- class="btn-danger"
- @action={{this.disableSlowMode}}
- @disabled={{this.submitDisabled}}
- @label="topic.slow_mode_update.remove"
- />
- {{/if}}
- </:footer>
-</DModal>
\ No newline at end of file
+ <template>
+ <DModal
+ @title={{i18n "topic.slow_mode_update.title"}}
+ class="edit-slow-mode-modal"
+ @closeModal={{@closeModal}}
+ @flash={{this.flash}}
+ >
+ <:body>
+ <div class="control-group">
+ <label class="slow-mode-label">
+ {{i18n "topic.slow_mode_update.description"}}
+ </label>
+ </div>
+ <div class="control-group">
+ <label class="slow-mode-label">
+ {{i18n "topic.slow_mode_update.select"}}
+ </label>
+ <ComboBox
+ class="slow-mode-type"
+ @content={{this.slowModes}}
+ @value={{this.selectedSlowMode}}
+ @onChange={{this.setSlowModeDuration}}
+ />
+ </div>
+ {{#if this.showCustomSelect}}
+ <div class="control-group">
+ <label class="slow-mode-label">
+ {{i18n "topic.slow_mode_update.hours"}}
+ </label>
+ <Input @value={{this.hours}} @type="number" class="input-small" />
+ <label class="slow-mode-label">
+ {{i18n "topic.slow_mode_update.minutes"}}
+ </label>
+ <Input @value={{this.minutes}} @type="number" class="input-small" />
+ <label class="slow-mode-label">
+ {{i18n "topic.slow_mode_update.seconds"}}
+ </label>
+ <Input @value={{this.seconds}} @type="number" class="input-small" />
+ </div>
+ {{/if}}
+
+ <div class="control-group">
+ <FutureDateInput
+ class="enabled-until"
+ @label="topic.slow_mode_update.enabled_until"
+ @labelClasses="slow-mode-label"
+ @customShortcuts={{this.timeShortcuts}}
+ @clearable={{true}}
+ @input={{@model.topic.slow_mode_enabled_until}}
+ @onChangeInput={{fn (mut @model.topic.slow_mode_enabled_until)}}
+ />
+ </div>
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @disabled={{this.submitDisabled}}
+ @icon="hourglass-start"
+ @label={{this.saveButtonLabel}}
+ @action={{this.enableSlowMode}}
+ />
+ {{#if @model.topic.slow_mode_seconds}}
+ <DButton
+ class="btn-danger"
+ @action={{this.disableSlowMode}}
+ @disabled={{this.submitDisabled}}
+ @label="topic.slow_mode_update.remove"
+ />
+ {{/if}}
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/feature-topic.gjs b/app/assets/javascripts/discourse/app/components/modal/feature-topic.gjs
index 357d15faa4e..478fe97781e 100644
--- a/app/assets/javascripts/discourse/app/components/modal/feature-topic.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/feature-topic.gjs
@@ -1,5 +1,6 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn } from "@ember/helper";
import EmberObject, { action } from "@ember/object";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
@@ -259,7 +260,7 @@ export default class FeatureTopic extends Component {
class="pin-until"
@clearable={{true}}
@input={{@model.topic.pinnedInCategoryUntil}}
- @onChangeInput={{action
+ @onChangeInput={{fn
(mut @model.topic.pinnedInCategoryUntil)
}}
/>
@@ -277,7 +278,7 @@ export default class FeatureTopic extends Component {
class="pin-until"
@clearable={{true}}
@input={{@model.topic.pinnedInCategoryUntil}}
- @onChangeInput={{action
+ @onChangeInput={{fn
(mut @model.topic.pinnedInCategoryUntil)
}}
/>
@@ -333,7 +334,7 @@ export default class FeatureTopic extends Component {
class="pin-until"
@clearable={{true}}
@input={{@model.topic.pinnedGloballyUntil}}
- @onChangeInput={{action
+ @onChangeInput={{fn
(mut @model.topic.pinnedGloballyUntil)
}}
/>
@@ -351,7 +352,7 @@ export default class FeatureTopic extends Component {
class="pin-until"
@clearable={{true}}
@input={{@model.topic.pinnedGloballyUntil}}
- @onChangeInput={{action
+ @onChangeInput={{fn
(mut @model.topic.pinnedGloballyUntil)
}}
/>
diff --git a/app/assets/javascripts/discourse/app/components/modal/group-add-members.gjs b/app/assets/javascripts/discourse/app/components/modal/group-add-members.gjs
index ef5ab5bbad8..007de99ff91 100644
--- a/app/assets/javascripts/discourse/app/components/modal/group-add-members.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/group-add-members.gjs
@@ -1,11 +1,17 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
+import { and, not, or } from "truth-helpers";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
import { extractError } from "discourse/lib/ajax-error";
import { emailValid } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default class GroupAddMembers extends Component {
@service currentUser;
@@ -72,65 +78,67 @@ export default class GroupAddMembers extends Component {
this.loading = false;
}
}
-}
-
-<DModal
- @title={{this.title}}
- @closeModal={{@closeModal}}
- class="group-add-members-modal"
- @flash={{this.flash}}
->
- <:body>
- <form class="form-vertical group-add-members">
- <p>{{i18n "groups.add_members.description"}}</p>
- <div class="input-group">
- <EmailGroupUserChooser
- @value={{this.usernamesAndEmails}}
- @onChange={{this.setUsernamesAndEmails}}
- @options={{hash
- allowEmails=this.currentUser.can_invite_to_forum
- filterPlaceholder=(if
- this.currentUser.can_invite_to_forum
- "groups.add_members.usernames_or_emails_placeholder"
- "groups.add_members.usernames_placeholder"
- )
- }}
- />
- </div>
- {{#if @model.can_admin_group}}
- <div class="input-group">
- <label>
- <Input
- id="set-owner"
- @type="checkbox"
- @checked={{this.setOwner}}
- disabled={{this.emails}}
+ <template>
+ <DModal
+ @title={{this.title}}
+ @closeModal={{@closeModal}}
+ class="group-add-members-modal"
+ @flash={{this.flash}}
+ >
+ <:body>
+ <form class="form-vertical group-add-members">
+ <p>{{i18n "groups.add_members.description"}}</p>
+ <div class="input-group">
+ <EmailGroupUserChooser
+ @value={{this.usernamesAndEmails}}
+ @onChange={{this.setUsernamesAndEmails}}
+ @options={{hash
+ allowEmails=this.currentUser.can_invite_to_forum
+ filterPlaceholder=(if
+ this.currentUser.can_invite_to_forum
+ "groups.add_members.usernames_or_emails_placeholder"
+ "groups.add_members.usernames_placeholder"
+ )
+ }}
/>
- {{i18n "groups.add_members.set_owner"}}
- </label>
- </div>
- {{/if}}
+ </div>
- <div class="input-group">
- <label>
- <Input
- @type="checkbox"
- @checked={{this.notifyUsers}}
- disabled={{and (not this.usernames) this.emails}}
- />
- {{i18n "groups.add_members.notify_users"}}
- </label>
- </div>
- </form>
- </:body>
- <:footer>
- <DButton
- @action={{this.addMembers}}
- class="add btn-primary"
- @icon="plus"
- @disabled={{or this.loading (not this.usernamesAndEmails)}}
- @label="groups.add"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ {{#if @model.can_admin_group}}
+ <div class="input-group">
+ <label>
+ <Input
+ id="set-owner"
+ @type="checkbox"
+ @checked={{this.setOwner}}
+ disabled={{this.emails}}
+ />
+ {{i18n "groups.add_members.set_owner"}}
+ </label>
+ </div>
+ {{/if}}
+
+ <div class="input-group">
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.notifyUsers}}
+ disabled={{and (not this.usernames) this.emails}}
+ />
+ {{i18n "groups.add_members.notify_users"}}
+ </label>
+ </div>
+ </form>
+ </:body>
+ <:footer>
+ <DButton
+ @action={{this.addMembers}}
+ class="add btn-primary"
+ @icon="plus"
+ @disabled={{or this.loading (not this.usernamesAndEmails)}}
+ @label="groups.add"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/ignore-duration-with-username.gjs b/app/assets/javascripts/discourse/app/components/modal/ignore-duration-with-username.gjs
index cc7e3cc41e0..a76ee05ec31 100644
--- a/app/assets/javascripts/discourse/app/components/modal/ignore-duration-with-username.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/ignore-duration-with-username.gjs
@@ -1,11 +1,18 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { fn, hash } from "@ember/helper";
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 FutureDateInput from "discourse/components/future-date-input";
+import icon from "discourse/helpers/d-icon";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { timeShortcuts } from "discourse/lib/time-shortcut";
import User from "discourse/models/user";
import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
export default class IgnoreDurationModal extends Component {
@service currentUser;
@@ -67,43 +74,47 @@ export default class IgnoreDurationModal extends Component {
updateIgnoredUsername(selected) {
this.ignoredUsername = selected.firstObject;
}
-}
-<DModal
- @closeModal={{@closeModal}}
- @title={{i18n "user.user_notifications.ignore_duration_title"}}
- @flash={{this.flash}}
- @autoFocus="false"
- class="ignore-duration-with-username-modal"
->
- <:body>
- {{#if this.enableSelection}}
- <div class="controls tracking-controls">
- <label>{{d-icon "far-eye-slash" class="icon"}}
- {{i18n "user.user_notifications.ignore_duration_username"}}</label>
- <EmailGroupUserChooser
- @value={{this.ignoredUsername}}
- @onChange={{this.updateIgnoredUsername}}
- @options={{hash excludeCurrentUser=true maximum=1}}
+ <template>
+ <DModal
+ @closeModal={{@closeModal}}
+ @title={{i18n "user.user_notifications.ignore_duration_title"}}
+ @flash={{this.flash}}
+ @autoFocus="false"
+ class="ignore-duration-with-username-modal"
+ >
+ <:body>
+ {{#if this.enableSelection}}
+ <div class="controls tracking-controls">
+ <label>{{icon "far-eye-slash" class="icon"}}
+ {{i18n
+ "user.user_notifications.ignore_duration_username"
+ }}</label>
+ <EmailGroupUserChooser
+ @value={{this.ignoredUsername}}
+ @onChange={{this.updateIgnoredUsername}}
+ @options={{hash excludeCurrentUser=true maximum=1}}
+ />
+ </div>
+ {{/if}}
+ <FutureDateInput
+ @label="user.user_notifications.ignore_duration_when"
+ @input={{readonly this.ignoredUntil}}
+ @customShortcuts={{this.timeShortcuts}}
+ @includeDateTime={{false}}
+ @onChangeInput={{fn (mut this.ignoredUntil)}}
+ />
+ <p>{{i18n "user.user_notifications.ignore_duration_note"}}</p>
+ </:body>
+ <:footer>
+ <DButton
+ @disabled={{this.saveDisabled}}
+ @label="user.user_notifications.ignore_duration_save"
+ @action={{this.ignore}}
+ class="btn-primary"
/>
- </div>
- {{/if}}
- <FutureDateInput
- @label="user.user_notifications.ignore_duration_when"
- @input={{readonly this.ignoredUntil}}
- @customShortcuts={{this.timeShortcuts}}
- @includeDateTime={{false}}
- @onChangeInput={{fn (mut this.ignoredUntil)}}
- />
- <p>{{i18n "user.user_notifications.ignore_duration_note"}}</p>
- </:body>
- <:footer>
- <DButton
- @disabled={{this.saveDisabled}}
- @label="user.user_notifications.ignore_duration_save"
- @action={{this.ignore}}
- class="btn-primary"
- />
- <ConditionalLoadingSpinner @size="small" @condition={{this.loading}} />
- </:footer>
-</DModal>
\ No newline at end of file
+ <ConditionalLoadingSpinner @size="small" @condition={{this.loading}} />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.gjs b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.gjs
index c669353c230..a863c76ccae 100644
--- a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.gjs
@@ -1,12 +1,25 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
+import ChooseMessage from "discourse/components/choose-message";
+import ChooseTopic from "discourse/components/choose-topic";
+import DButton from "discourse/components/d-button";
+import DModal from "discourse/components/d-modal";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import RadioButton from "discourse/components/radio-button";
+import TextField from "discourse/components/text-field";
+import htmlSafe from "discourse/helpers/html-safe";
import { applyValueTransformer } from "discourse/lib/transformer";
import DiscourseURL from "discourse/lib/url";
import { mergeTopic, movePosts } from "discourse/models/topic";
import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
+import TagChooser from "select-kit/components/tag-chooser";
export default class MoveToTopic extends Component {
@service currentUser;
@@ -192,270 +205,278 @@ export default class MoveToTopic extends Component {
newTopicSelected(topic) {
this.selectedTopic = topic;
}
-}
-
-<DModal
- id="choosing-topic"
- @title={{i18n "topic.move_to.title"}}
- @closeModal={{@closeModal}}
- class="choose-topic-modal"
- @flash={{this.flash}}
- @flashType="error"
->
- <:body>
- {{#if @model.topic.isPrivateMessage}}
- <div class="radios">
- {{#if this.canSplitToPM}}
- <label class="radio-label" for="move-to-new-message">
- <RadioButton
- id="move-to-new-message"
- @name="move-to-entity"
- @value="new_message"
- @selection={{this.selection}}
- />
- <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>
- </label>
- {{/if}}
- <label class="radio-label" for="move-to-existing-message">
- <RadioButton
- id="move-to-existing-message"
- @name="move-to-entity"
- @value="existing_message"
- @selection={{this.selection}}
- />
- <b>{{i18n "topic.move_to_existing_message.radio_label"}}</b>
- </label>
- </div>
-
- {{#if this.canSplitTopic}}
- {{#if this.newMessage}}
- <p>
- {{html-safe
- (i18n
- "topic.move_to_new_message.instructions"
- )
- }}
- </p>
- <form>
- <label>{{i18n "topic.move_to_new_message.message_title"}}</label>
- <TextField
- @value={{this.topicName}}
- @placeholderKey="composer.title_placeholder"
- id="split-topic-name"
- />
-
- {{#if this.canTagMessages}}
- <label>{{i18n "tagging.tags"}}</label>
- <TagChooser @tags={{this.tags}} />
+ <template>
+ <DModal
+ id="choosing-topic"
+ @title={{i18n "topic.move_to.title"}}
+ @closeModal={{@closeModal}}
+ class="choose-topic-modal"
+ @flash={{this.flash}}
+ @flashType="error"
+ >
+ <:body>
+ {{#if @model.topic.isPrivateMessage}}
+ <div class="radios">
+ {{#if this.canSplitToPM}}
+ <label class="radio-label" for="move-to-new-message">
+ <RadioButton
+ id="move-to-new-message"
+ @name="move-to-entity"
+ @value="new_message"
+ @selection={{this.selection}}
+ />
+ <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>
+ </label>
{{/if}}
- </form>
- {{/if}}
- {{/if}}
-
- {{#if this.existingMessage}}
- <p>
- {{html-safe
- (i18n
- "topic.move_to_existing_message.instructions"
- )
- }}
- </p>
- <form>
- <ChooseMessage
- @currentTopicId={{@model.topic.id}}
- @setSelectedTopicId={{fn (mut this.selectedTopic)}}
- @selectedTopicId={{this.selectedTopic.id}}
- />
-
- <label>{{i18n "topic.move_to_new_message.participants"}}</label>
- <EmailGroupUserChooser
- class="participant-selector"
- @value={{this.participants}}
- @onChange={{fn (mut this.participants)}}
- />
-
- {{#if this.selectedTopic}}
- <hr />
- <label for="chronological-order" class="checkbox-label">
- <Input
- id="chronological-order"
- @type="checkbox"
- @checked={{this.chronologicalOrder}}
+
+ <label class="radio-label" for="move-to-existing-message">
+ <RadioButton
+ id="move-to-existing-message"
+ @name="move-to-entity"
+ @value="existing_message"
+ @selection={{this.selection}}
/>
- {{i18n "topic.merge_topic.chronological_order"}}
+ <b>{{i18n "topic.move_to_existing_message.radio_label"}}</b>
</label>
+ </div>
+
+ {{#if this.canSplitTopic}}
+ {{#if this.newMessage}}
+ <p>
+ {{htmlSafe
+ (i18n
+ "topic.move_to_new_message.instructions"
+ )
+ }}
+ </p>
+ <form>
+ <label>{{i18n
+ "topic.move_to_new_message.message_title"
+ }}</label>
+ <TextField
+ @value={{this.topicName}}
+ @placeholderKey="composer.title_placeholder"
+ id="split-topic-name"
+ />
+
+ {{#if this.canTagMessages}}
+ <label>{{i18n "tagging.tags"}}</label>
+ <TagChooser @tags={{this.tags}} />
+ {{/if}}
+ </form>
+ {{/if}}
{{/if}}
- </form>
- {{/if}}
-
- {{else}}
- <div class="radios">
- {{#if this.canSplitTopic}}
- <label class="radio-label" for="move-to-new-topic">
- <RadioButton
- id="move-to-new-topic"
- @name="move-to-entity"
- @value="new_topic"
- @selection={{this.selection}}
- />
- <b>{{i18n "topic.split_topic.radio_label"}}</b>
- </label>
- {{/if}}
- <label class="radio-label" for="move-to-existing-topic">
- <RadioButton
- id="move-to-existing-topic"
- @name="move-to-entity"
- @value="existing_topic"
- @selection={{this.selection}}
- />
- <b>{{i18n "topic.merge_topic.radio_label"}}</b>
- </label>
-
- {{#if this.canSplitToPM}}
- <label class="radio-label" for="move-to-new-message">
- <RadioButton
- id="move-to-new-message"
- @name="move-to-entity"
- @value="new_message"
- @selection={{this.selection}}
- />
- <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>
- </label>
- {{/if}}
- </div>
-
- <PluginOutlet @name="move-to-topic-after-radio-buttons" />
-
- {{#if this.existingTopic}}
- <p>
- {{html-safe
- (i18n
- "topic.merge_topic.instructions" [email protected]
- )
- }}
- </p>
- <form>
- <ChooseTopic
- @topicChangedCallback={{this.newTopicSelected}}
- @currentTopicId={{@model.topic.id}}
- @selectedTopicId={{this.selectedTopic.id}}
- />
-
- {{#if this.selectedTopic}}
- <hr />
- <label for="chronological-order" class="checkbox-label">
- <Input
- id="chronological-order"
- @type="checkbox"
- @checked={{this.chronologicalOrder}}
+ {{#if this.existingMessage}}
+ <p>
+ {{htmlSafe
+ (i18n
+ "topic.move_to_existing_message.instructions"
+ )
+ }}
+ </p>
+ <form>
+ <ChooseMessage
+ @currentTopicId={{@model.topic.id}}
+ @setSelectedTopicId={{fn (mut this.selectedTopic)}}
+ @selectedTopicId={{this.selectedTopic.id}}
/>
- {{i18n "topic.merge_topic.chronological_order"}}
- </label>
- {{/if}}
- </form>
- {{/if}}
-
- {{#if this.canSplitTopic}}
- {{#if this.newTopic}}
- <p>
- {{html-safe
- (i18n
- "topic.split_topic.instructions" [email protected]
- )
- }}
- </p>
- <form class="split-new-topic-form">
- <div class="control-group">
- <label>{{i18n "topic.split_topic.topic_name"}}</label>
- <TextField
- @value={{this.topicName}}
- @placeholderKey="composer.title_placeholder"
- id="split-topic-name"
+
+ <label>{{i18n "topic.move_to_new_message.participants"}}</label>
+ <EmailGroupUserChooser
+ class="participant-selector"
+ @value={{this.participants}}
+ @onChange={{fn (mut this.participants)}}
/>
- <PluginOutlet
- @name="split-new-topic-title-after"
- @outletArgs={{hash
- updateTopicName=this.updateTopicName
- }}
+
+ {{#if this.selectedTopic}}
+ <hr />
+ <label for="chronological-order" class="checkbox-label">
+ <Input
+ id="chronological-order"
+ @type="checkbox"
+ @checked={{this.chronologicalOrder}}
+ />
+ {{i18n "topic.merge_topic.chronological_order"}}
+ </label>
+ {{/if}}
+ </form>
+ {{/if}}
+
+ {{else}}
+ <div class="radios">
+ {{#if this.canSplitTopic}}
+ <label class="radio-label" for="move-to-new-topic">
+ <RadioButton
+ id="move-to-new-topic"
+ @name="move-to-entity"
+ @value="new_topic"
+ @selection={{this.selection}}
+ />
+ <b>{{i18n "topic.split_topic.radio_label"}}</b>
+ </label>
+ {{/if}}
+
+ <label class="radio-label" for="move-to-existing-topic">
+ <RadioButton
+ id="move-to-existing-topic"
+ @name="move-to-entity"
+ @value="existing_topic"
+ @selection={{this.selection}}
/>
- </div>
-
- <div class="control-group">
- <label>{{i18n "categories.category"}}</label>
- <CategoryChooser
- @value={{this.categoryId}}
- class="small"
- @onChange={{fn (mut this.categoryId)}}
+ <b>{{i18n "topic.merge_topic.radio_label"}}</b>
+ </label>
+
+ {{#if this.canSplitToPM}}
+ <label class="radio-label" for="move-to-new-message">
+ <RadioButton
+ id="move-to-new-message"
+ @name="move-to-entity"
+ @value="new_message"
+ @selection={{this.selection}}
+ />
+ <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>
+ </label>
+ {{/if}}
+ </div>
+
+ <PluginOutlet @name="move-to-topic-after-radio-buttons" />
+
+ {{#if this.existingTopic}}
+ <p>
+ {{htmlSafe
+ (i18n
+ "topic.merge_topic.instructions"
+ )
+ }}
+ </p>
+ <form>
+ <ChooseTopic
+ @topicChangedCallback={{this.newTopicSelected}}
+ @currentTopicId={{@model.topic.id}}
+ @selectedTopicId={{this.selectedTopic.id}}
/>
- <PluginOutlet
- @name="split-new-topic-category-after"
- @outletArgs={{hash
- updateCategoryId=this.updateCategoryId
+
+ {{#if this.selectedTopic}}
+ <hr />
+ <label for="chronological-order" class="checkbox-label">
+ <Input
+ id="chronological-order"
+ @type="checkbox"
+ @checked={{this.chronologicalOrder}}
+ />
+ {{i18n "topic.merge_topic.chronological_order"}}
+ </label>
+ {{/if}}
+ </form>
+ {{/if}}
+
+ {{#if this.canSplitTopic}}
+ {{#if this.newTopic}}
+ <p>
+ {{htmlSafe
+ (i18n
+ "topic.split_topic.instructions"
+ )
}}
- />
- </div>
-
- {{#if this.canAddTags}}
- <div class="control-group">
- <label>{{i18n "tagging.tags"}}</label>
- <TagChooser
- @tags={{this.tags}}
- @categoryId={{this.categoryId}}
- />
- <PluginOutlet
- @name="split-new-topic-tag-after"
- @outletArgs={{hash
- updateTags=this.updateTags
- tags=this.tags
- }}
- />
- </div>
+ </p>
+ <form class="split-new-topic-form">
+ <div class="control-group">
+ <label>{{i18n "topic.split_topic.topic_name"}}</label>
+ <TextField
+ @value={{this.topicName}}
+ @placeholderKey="composer.title_placeholder"
+ id="split-topic-name"
+ />
+ <PluginOutlet
+ @name="split-new-topic-title-after"
+ @outletArgs={{hash
+ updateTopicName=this.updateTopicName
+ }}
+ />
+ </div>
+
+ <div class="control-group">
+ <label>{{i18n "categories.category"}}</label>
+ <CategoryChooser
+ @value={{this.categoryId}}
+ class="small"
+ @onChange={{fn (mut this.categoryId)}}
+ />
+ <PluginOutlet
+ @name="split-new-topic-category-after"
+ @outletArgs={{hash
+ updateCategoryId=this.updateCategoryId
+ }}
+ />
+ </div>
+
+ {{#if this.canAddTags}}
+ <div class="control-group">
+ <label>{{i18n "tagging.tags"}}</label>
+ <TagChooser
+ @tags={{this.tags}}
+ @categoryId={{this.categoryId}}
+ />
+ <PluginOutlet
+ @name="split-new-topic-tag-after"
+ @outletArgs={{hash
+ updateTags=this.updateTags
+ tags=this.tags
+ }}
+ />
+ </div>
+ {{/if}}
+ </form>
{{/if}}
- </form>
- {{/if}}
- {{/if}}
-
- {{#if this.canSplitTopic}}
- {{#if this.newMessage}}
- <p>
- {{html-safe
- (i18n
- "topic.move_to_new_message.instructions"
- )
- }}
- </p>
- <form>
- <label>{{i18n "topic.move_to_new_message.message_title"}}</label>
- <TextField
- @value={{this.topicName}}
- @placeholderKey="composer.title_placeholder"
- id="split-topic-name"
- />
-
- {{#if this.canTagMessages}}
- <label>{{i18n "tagging.tags"}}</label>
- <TagChooser @tags={{this.tags}} />
+ {{/if}}
+
+ {{#if this.canSplitTopic}}
+ {{#if this.newMessage}}
+ <p>
+ {{htmlSafe
+ (i18n
+ "topic.move_to_new_message.instructions"
+ )
+ }}
+ </p>
+ <form>
+ <label>{{i18n
+ "topic.move_to_new_message.message_title"
+ }}</label>
+ <TextField
+ @value={{this.topicName}}
+ @placeholderKey="composer.title_placeholder"
+ id="split-topic-name"
+ />
+
+ {{#if this.canTagMessages}}
+ <label>{{i18n "tagging.tags"}}</label>
+ <TagChooser @tags={{this.tags}} />
+ {{/if}}
+ </form>
{{/if}}
- </form>
+ {{/if}}
{{/if}}
- {{/if}}
- {{/if}}
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @disabled={{this.buttonDisabled}}
- @action={{this.performMove}}
- @icon="right-from-bracket"
- @label={{this.buttonTitle}}
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @disabled={{this.buttonDisabled}}
+ @action={{this.performMove}}
+ @icon="right-from-bracket"
+ @label={{this.buttonTitle}}
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/modal/revise-and-reject-post-reviewable.gjs b/app/assets/javascripts/discourse/app/components/modal/revise-and-reject-post-reviewable.gjs
index d049e382a3a..323e0f1d7b3 100644
--- a/app/assets/javascripts/discourse/app/components/modal/revise-and-reject-post-reviewable.gjs
+++ b/app/assets/javascripts/discourse/app/components/modal/revise-and-reject-post-reviewable.gjs
@@ -1,10 +1,17 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
+import { Input } from "@ember/component";
+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 DTextarea from "discourse/components/d-textarea";
+import ReviewableQueuedPost from "discourse/components/reviewable-queued-post";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
const OTHER_REASON = "other_reason";
@@ -59,72 +66,74 @@ export default class ReviseAndRejectPostReviewable extends Component {
this.submitting = false;
}
}
-}
-<DModal
- class="revise-and-reject-reviewable"
- @closeModal={{@closeModal}}
- @title={{i18n "review.revise_and_reject_post.title"}}
->
- <:body>
- <div class="revise-and-reject-reviewable__queued-post">
- <ReviewableQueuedPost @reviewable={{@model.reviewable}} @tagName="" />
- </div>
+ <template>
+ <DModal
+ class="revise-and-reject-reviewable"
+ @closeModal={{@closeModal}}
+ @title={{i18n "review.revise_and_reject_post.title"}}
+ >
+ <:body>
+ <div class="revise-and-reject-reviewable__queued-post">
+ <ReviewableQueuedPost @reviewable={{@model.reviewable}} @tagName="" />
+ </div>
- <div class="control-group">
- <label class="control-label" for="reason">{{i18n
- "review.revise_and_reject_post.reason"
- }}</label>
- <ComboBox
- @name="reason"
- @content={{this.configuredReasons}}
- @value={{this.reason}}
- @onChange={{fn (mut this.reason)}}
- class="revise-and-reject-reviewable__reason"
- />
- </div>
+ <div class="control-group">
+ <label class="control-label" for="reason">{{i18n
+ "review.revise_and_reject_post.reason"
+ }}</label>
+ <ComboBox
+ @name="reason"
+ @content={{this.configuredReasons}}
+ @value={{this.reason}}
+ @onChange={{fn (mut this.reason)}}
+ class="revise-and-reject-reviewable__reason"
+ />
+ </div>
- {{#if this.showCustomReason}}
- <div class="control-group">
- <label class="control-label" for="custom_reason">{{i18n
- "review.revise_and_reject_post.custom_reason"
- }}</label>
- <Input
- name="custom_reason"
- class="revise-and-reject-reviewable__custom-reason"
- @type="text"
- @value={{this.customReason}}
- />
- </div>
- {{/if}}
+ {{#if this.showCustomReason}}
+ <div class="control-group">
+ <label class="control-label" for="custom_reason">{{i18n
+ "review.revise_and_reject_post.custom_reason"
+ }}</label>
+ <Input
+ name="custom_reason"
+ class="revise-and-reject-reviewable__custom-reason"
+ @type="text"
+ @value={{this.customReason}}
+ />
+ </div>
+ {{/if}}
- <div class="control-group">
- <label class="control-label" for="feedback">{{i18n
- "review.revise_and_reject_post.feedback"
- }}
- <span class="revise-and-reject-reviewable__optional">({{i18n
- "review.revise_and_reject_post.optional"
- }})</span>
- </label>
- <DTextarea
- @name="feedback"
- @value={{this.feedback}}
- @onChange={{fn (mut this.feedback)}}
- class="revise-and-reject-reviewable__feedback"
- />
- </div>
- </:body>
- <:footer>
- <DButton
- class="btn-primary"
- @action={{this.rejectAndSendPM}}
- @disabled={{this.sendPMDisabled}}
- @label="review.revise_and_reject_post.send_pm"
- />
- <DButton
- class="btn-flat d-modal-cancel"
- @action={{@closeModal}}
- @label="cancel"
- />
- </:footer>
-</DModal>
\ No newline at end of file
+ <div class="control-group">
+ <label class="control-label" for="feedback">{{i18n
+ "review.revise_and_reject_post.feedback"
+ }}
+ <span class="revise-and-reject-reviewable__optional">({{i18n
+ "review.revise_and_reject_post.optional"
+ }})</span>
+ </label>
+ <DTextarea
+ @name="feedback"
+ @value={{this.feedback}}
+ @onChange={{fn (mut this.feedback)}}
+ class="revise-and-reject-reviewable__feedback"
+ />
+ </div>
+ </:body>
+ <:footer>
+ <DButton
+ class="btn-primary"
+ @action={{this.rejectAndSendPM}}
+ @disabled={{this.sendPMDisabled}}
+ @label="review.revise_and_reject_post.send_pm"
+ />
+ <DButton
+ class="btn-flat d-modal-cancel"
+ @action={{@closeModal}}
+ @label="cancel"
+ />
+ </:footer>
+ </DModal>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-field-category.gjs b/app/assets/javascripts/discourse/app/components/reviewable-field-category.gjs
index 83c7d89e1a4..3b77e52067f 100644
--- a/app/assets/javascripts/discourse/app/components/reviewable-field-category.gjs
+++ b/app/assets/javascripts/discourse/app/components/reviewable-field-category.gjs
@@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
+import CategoryChooser from "select-kit/components/category-chooser";
export default class extends Component {
@tracked categoryId = this.args.value;
@@ -10,6 +11,8 @@ export default class extends Component {
this.categoryId = category;
this.args.categoryChanged?.(category);
}
-}
-<CategoryChooser @value={{this.categoryId}} @onChange={{this.onChange}} />
\ No newline at end of file
+ <template>
+ <CategoryChooser @value={{this.categoryId}} @onChange={{this.onChange}} />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-field-tags.gjs b/app/assets/javascripts/discourse/app/components/reviewable-field-tags.gjs
index c0fe1a7ccee..477ebf00601 100644
--- a/app/assets/javascripts/discourse/app/components/reviewable-field-tags.gjs
+++ b/app/assets/javascripts/discourse/app/components/reviewable-field-tags.gjs
@@ -1,5 +1,7 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
+import MiniTagChooser from "select-kit/components/mini-tag-chooser";
export default class ReviewableFieldTags extends Component {
@action
@@ -13,10 +15,12 @@ export default class ReviewableFieldTags extends Component {
},
});
}
-}
-<MiniTagChooser
- @value={{this.value}}
- @onChange={{action "onChange"}}
- @options={{hash categoryId=this.tagCategoryId}}
-/>
\ No newline at end of file
+ <template>
+ <MiniTagChooser
+ @value={{this.value}}
+ @onChange={{this.onChange}}
+ @options={{hash categoryId=this.tagCategoryId}}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/search-advanced-options.gjs b/app/assets/javascripts/discourse/app/components/search-advanced-options.gjs
index 01427c3dd03..91740e8832d 100644
--- a/app/assets/javascripts/discourse/app/components/search-advanced-options.gjs
+++ b/app/assets/javascripts/discourse/app/components/search-advanced-options.gjs
@@ -1,13 +1,24 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import {
attributeBindings,
classNames,
tagName,
} from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import DateInput from "discourse/components/date-input";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import withEventValue from "discourse/helpers/with-event-value";
import { escapeExpression } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import SearchAdvancedCategoryChooser from "select-kit/components/search-advanced-category-chooser";
+import TagChooser from "select-kit/components/tag-chooser";
+import UserChooser from "select-kit/components/user-chooser";
const REGEXP_BLOCKS = /(([^" \t\n\x0B\f\r]+)?(("[^"]+")?))/g;
@@ -453,32 +464,32 @@ export default class SearchAdvancedOptions extends Component {
}
@action
- onChangeSearchTermForAllTags(checked) {
- this.set("searchedTerms.special.all_tags", checked);
+ onChangeSearchTermForAllTags(event) {
+ this.set("searchedTerms.special.all_tags", event.target.checked);
this._updateSearchTermForTags();
}
@action
- onChangeSearchTermForSpecialInLikes(checked) {
- this.set("searchedTerms.special.in.likes", checked);
+ onChangeSearchTermForSpecialInLikes(event) {
+ this.set("searchedTerms.special.in.likes", event.target.checked);
this.updateInRegex(REGEXP_SPECIAL_IN_LIKES_MATCH, "likes");
}
@action
- onChangeSearchTermForSpecialInMessages(checked) {
- this.set("searchedTerms.special.in.messages", checked);
+ onChangeSearchTermForSpecialInMessages(event) {
+ this.set("searchedTerms.special.in.messages", event.target.checked);
this.updateInRegex(REGEXP_SPECIAL_IN_MESSAGES_MATCH, "messages");
}
@action
- onChangeSearchTermForSpecialInSeen(checked) {
- this.set("searchedTerms.special.in.seen", checked);
+ onChangeSearchTermForSpecialInSeen(event) {
+ this.set("searchedTerms.special.in.seen", event.target.checked);
this.updateInRegex(REGEXP_SPECIAL_IN_SEEN_MATCH, "seen");
}
@action
- onChangeSearchTermForSpecialInTitle(checked) {
- this.set("searchedTerms.special.in.title", checked);
+ onChangeSearchTermForSpecialInTitle(event) {
+ this.set("searchedTerms.special.in.title", event.target.checked);
this.updateInRegex(REGEXP_SPECIAL_IN_TITLE_MATCH, "title");
}
@@ -756,308 +767,293 @@ export default class SearchAdvancedOptions extends Component {
_updateSearchTerm(searchTerm) {
this.onChangeSearchTerm(searchTerm.trim());
}
-}
-<summary>
- {{i18n "search.advanced.title"}}
-</summary>
-<div class="search-advanced-filters">
- <div class="search-advanced-options">
- <PluginOutlet
- @name="advanced-search-options-above"
- @connectorTagName="div"
- @outletArgs={{hash
- searchedTerms=this.searchedTerms
- onChangeSearchedTermField=this.onChangeSearchedTermField
- }}
- />
-
- <div class="control-group advanced-search-category">
- <label class="control-label">{{i18n
- "search.advanced.in_category.label"
- }}</label>
- <div class="controls">
- <SearchAdvancedCategoryChooser
- @id="search-in-category"
- @value={{this.searchedTerms.category.id}}
- @onChange={{action "onChangeSearchTermForCategory"}}
+ <template>
+ <summary>
+ {{i18n "search.advanced.title"}}
+ </summary>
+ <div class="search-advanced-filters">
+ <div class="search-advanced-options">
+ <PluginOutlet
+ @name="advanced-search-options-above"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ searchedTerms=this.searchedTerms
+ onChangeSearchedTermField=this.onChangeSearchedTermField
+ }}
/>
- </div>
- </div>
- {{#if this.siteSettings.tagging_enabled}}
- <div class="control-group advanced-search-tags">
- <label class="control-label">{{i18n
- "search.advanced.with_tags.label"
- }}</label>
- <div class="controls">
- <TagChooser
- @id="search-with-tags"
- @tags={{this.searchedTerms.tags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @onChange={{action "onChangeSearchTermForTags"}}
- @options={{hash
- allowAny=false
- headerAriaLabel=(i18n "search.advanced.with_tags.aria_label")
- }}
- />
- {{#if this.showAllTagsCheckbox}}
- <section class="field">
- <label>
- <Input
- @type="checkbox"
- class="all-tags"
- @checked={{this.searchedTerms.special.all_tags}}
- {{on
- "click"
- (action
- "onChangeSearchTermForAllTags" value="target.checked"
- )
- }}
- />
- {{i18n "search.advanced.filters.all_tags"}}
- </label>
- </section>
- {{/if}}
+ <div class="control-group advanced-search-category">
+ <label class="control-label">{{i18n
+ "search.advanced.in_category.label"
+ }}</label>
+ <div class="controls">
+ <SearchAdvancedCategoryChooser
+ @id="search-in-category"
+ @value={{this.searchedTerms.category.id}}
+ @onChange={{this.onChangeSearchTermForCategory}}
+ />
+ </div>
</div>
- </div>
- {{/if}}
-
- <div class="control-group advanced-search-topics-posts">
- <div class="controls">
- <fieldset class="grouped-control">
- <legend class="grouped-control-label">{{i18n
- "search.advanced.filters.label"
- }}</legend>
-
- {{#if this.currentUser}}
- <div class="grouped-control-field">
- <Input
- id="matching-title-only"
- @type="checkbox"
- class="in-title"
- @checked={{this.searchedTerms.special.in.title}}
- {{on
- "click"
- (action
- "onChangeSearchTermForSpecialInTitle" value="target.checked"
- )
- }}
- />
- <label class="checkbox-label" for="matching-title-only">
- {{i18n "search.advanced.filters.title"}}
- </label>
- </div>
- <div class="grouped-control-field">
- <Input
- id="matching-liked"
- @type="checkbox"
- class="in-likes"
- @checked={{this.searchedTerms.special.in.likes}}
- {{on
- "click"
- (action
- "onChangeSearchTermForSpecialInLikes" value="target.checked"
- )
+ {{#if this.siteSettings.tagging_enabled}}
+ <div class="control-group advanced-search-tags">
+ <label class="control-label">{{i18n
+ "search.advanced.with_tags.label"
+ }}</label>
+ <div class="controls">
+ <TagChooser
+ @id="search-with-tags"
+ @tags={{this.searchedTerms.tags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @onChange={{this.onChangeSearchTermForTags}}
+ @options={{hash
+ allowAny=false
+ headerAriaLabel=(i18n "search.advanced.with_tags.aria_label")
}}
/>
- <label class="checkbox-label" for="matching-liked">{{i18n
- "search.advanced.filters.likes"
- }}</label>
+ {{#if this.showAllTagsCheckbox}}
+ <section class="field">
+ <label>
+ <Input
+ @type="checkbox"
+ class="all-tags"
+ @checked={{this.searchedTerms.special.all_tags}}
+ {{on "click" this.onChangeSearchTermForAllTags}}
+ />
+ {{i18n "search.advanced.filters.all_tags"}}
+ </label>
+ </section>
+ {{/if}}
</div>
-
- <div class="grouped-control-field">
- <Input
- id="matching-in-messages"
- @type="checkbox"
- class="in-private"
- @checked={{this.searchedTerms.special.in.messages}}
- {{on
- "click"
- (action
- "onChangeSearchTermForSpecialInMessages"
- value="target.checked"
- )
- }}
+ </div>
+ {{/if}}
+
+ <div class="control-group advanced-search-topics-posts">
+ <div class="controls">
+ <fieldset class="grouped-control">
+ <legend class="grouped-control-label">{{i18n
+ "search.advanced.filters.label"
+ }}</legend>
+
+ {{#if this.currentUser}}
+ <div class="grouped-control-field">
+ <Input
+ id="matching-title-only"
+ @type="checkbox"
+ class="in-title"
+ @checked={{this.searchedTerms.special.in.title}}
+ {{on "click" this.onChangeSearchTermForSpecialInTitle}}
+ />
+ <label class="checkbox-label" for="matching-title-only">
+ {{i18n "search.advanced.filters.title"}}
+ </label>
+ </div>
+
+ <div class="grouped-control-field">
+ <Input
+ id="matching-liked"
+ @type="checkbox"
+ class="in-likes"
+ @checked={{this.searchedTerms.special.in.likes}}
+ {{on "click" this.onChangeSearchTermForSpecialInLikes}}
+ />
+ <label class="checkbox-label" for="matching-liked">{{i18n
+ "search.advanced.filters.likes"
+ }}</label>
+ </div>
+
+ <div class="grouped-control-field">
+ <Input
+ id="matching-in-messages"
+ @type="checkbox"
+ class="in-private"
+ @checked={{this.searchedTerms.special.in.messages}}
+ {{on "click" this.onChangeSearchTermForSpecialInMessages}}
+ />
+ <label
+ class="checkbox-label"
+ for="matching-in-messages"
+ >{{i18n "search.advanced.filters.private"}}</label>
+ </div>
+
+ <div class="grouped-control-field">
+ <Input
+ id="matching-seen"
+ @type="checkbox"
+ class="in-seen"
+ @checked={{this.searchedTerms.special.in.seen}}
+ {{on "click" this.onChangeSearchTermForSpecialInSeen}}
+ />
+ <label class="checkbox-label" for="matching-seen">{{i18n
+ "search.advanced.filters.seen"
+ }}</label>
+ </div>
+ {{/if}}
+
+ <ComboBox
+ @id="in"
+ @valueProperty="value"
+ @content={{this.inOptions}}
+ @value={{this.searchedTerms.in}}
+ @onChange={{this.onChangeSearchTermForIn}}
+ @options={{hash none="user.locale.any" clearable=true}}
/>
- <label class="checkbox-label" for="matching-in-messages">{{i18n
- "search.advanced.filters.private"
- }}</label>
- </div>
+ </fieldset>
+ </div>
+ </div>
- <div class="grouped-control-field">
- <Input
- id="matching-seen"
- @type="checkbox"
- class="in-seen"
- @checked={{this.searchedTerms.special.in.seen}}
- {{on
- "click"
- (action
- "onChangeSearchTermForSpecialInSeen" value="target.checked"
- )
- }}
- />
- <label class="checkbox-label" for="matching-seen">{{i18n
- "search.advanced.filters.seen"
- }}</label>
- </div>
- {{/if}}
-
- <ComboBox
- @id="in"
- @valueProperty="value"
- @content={{this.inOptions}}
- @value={{this.searchedTerms.in}}
- @onChange={{action "onChangeSearchTermForIn"}}
- @options={{hash none="user.locale.any" clearable=true}}
- />
- </fieldset>
- </div>
- </div>
+ <div class="control-group advanced-search-topic-status">
+ <label class="control-label">{{i18n
+ "search.advanced.statuses.label"
+ }}</label>
+ <div class="controls">
+ <ComboBox
+ @id="search-status-options"
+ @valueProperty="value"
+ @content={{this.statusOptions}}
+ @value={{this.searchedTerms.status}}
+ @onChange={{this.onChangeSearchTermForStatus}}
+ @options={{hash
+ none="user.locale.any"
+ headerAriaLabel=(i18n "search.advanced.statuses.label")
+ clearable=true
+ }}
+ />
+ </div>
+ </div>
- <div class="control-group advanced-search-topic-status">
- <label class="control-label">{{i18n
- "search.advanced.statuses.label"
- }}</label>
- <div class="controls">
- <ComboBox
- @id="search-status-options"
- @valueProperty="value"
- @content={{this.statusOptions}}
- @value={{this.searchedTerms.status}}
- @onChange={{action "onChangeSearchTermForStatus"}}
- @options={{hash
- none="user.locale.any"
- headerAriaLabel=(i18n "search.advanced.statuses.label")
- clearable=true
- }}
- />
- </div>
- </div>
+ <div class="control-group advanced-search-posted-by">
+ <label class="control-label">
+ {{i18n "search.advanced.posted_by.label"}}
+ </label>
+ <div class="controls">
+ <UserChooser
+ @id="search-posted-by"
+ @value={{this.searchedTerms.username}}
+ @onChange={{this.onChangeSearchTermForUsername}}
+ @options={{hash
+ headerAriaLabel=(i18n "search.advanced.posted_by.aria_label")
+ maximum=1
+ excludeCurrentUser=false
+ }}
+ />
+ </div>
+ </div>
- <div class="control-group advanced-search-posted-by">
- <label class="control-label">
- {{i18n "search.advanced.posted_by.label"}}
- </label>
- <div class="controls">
- <UserChooser
- @id="search-posted-by"
- @value={{this.searchedTerms.username}}
- @onChange={{action "onChangeSearchTermForUsername"}}
- @options={{hash
- headerAriaLabel=(i18n "search.advanced.posted_by.aria_label")
- maximum=1
- excludeCurrentUser=false
- }}
- />
- </div>
- </div>
+ <div class="control-group advanced-search-posted-date">
+ <label class="control-label">{{i18n
+ "search.advanced.post.time.label"
+ }}</label>
+ <div class="controls inline-form full-width">
+ <ComboBox
+ @id="postTime"
+ @valueProperty="value"
+ @content={{this.postTimeOptions}}
+ @value={{this.searchedTerms.time.when}}
+ @onChange={{this.onChangeWhenTime}}
+ @options={{hash
+ headerAriaLabel=(i18n "search.advanced.post.time.aria_label")
+ }}
+ />
+ <DateInput
+ @date={{this.searchedTerms.time.days}}
+ @onChange={{this.onChangeWhenDate}}
+ @inputId="search-post-date"
+ />
+ </div>
+ </div>
- <div class="control-group advanced-search-posted-date">
- <label class="control-label">{{i18n
- "search.advanced.post.time.label"
- }}</label>
- <div class="controls inline-form full-width">
- <ComboBox
- @id="postTime"
- @valueProperty="value"
- @content={{this.postTimeOptions}}
- @value={{this.searchedTerms.time.when}}
- @onChange={{action "onChangeWhenTime"}}
- @options={{hash
- headerAriaLabel=(i18n "search.advanced.post.time.aria_label")
+ <PluginOutlet
+ @name="advanced-search-options-below"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ searchedTerms=this.searchedTerms
+ onChangeSearchedTermField=this.onChangeSearchedTermField
}}
/>
- <DateInput
- @date={{this.searchedTerms.time.days}}
- @onChange={{action "onChangeWhenDate"}}
- @inputId="search-post-date"
- />
</div>
- </div>
- <PluginOutlet
- @name="advanced-search-options-below"
- @connectorTagName="div"
- @outletArgs={{hash
- searchedTerms=this.searchedTerms
- onChangeSearchedTermField=this.onChangeSearchedTermField
- }}
- />
- </div>
-
- <details class="search-advanced-additional-options">
- <summary>
- {{i18n "search.advanced.additional_options.label"}}
- </summary>
- <div class="count-group control-group">
- {{! TODO: Using a label here fails no-nested-interactive lint rule }}
- <span class="control-label">{{i18n
- "search.advanced.post.count.label"
- }}</span>
- <div class="controls">
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.min_posts}}
- class="input-small"
- id="search-min-post-count"
- placeholder={{i18n "search.advanced.post.min.placeholder"}}
- aria-label={{i18n "search.advanced.post.min.aria_label"}}
- {{on "input" (with-event-value this.onChangeSearchTermMinPostCount)}}
- />
- {{d-icon "left-right"}}
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.max_posts}}
- class="input-small"
- id="search-max-post-count"
- placeholder={{i18n "search.advanced.post.max.placeholder"}}
- aria-label={{i18n "search.advanced.post.max.aria_label"}}
- {{on "input" (with-event-value this.onChangeSearchTermMaxPostCount)}}
- />
- </div>
- </div>
+ <details class="search-advanced-additional-options">
+ <summary>
+ {{i18n "search.advanced.additional_options.label"}}
+ </summary>
+ <div class="count-group control-group">
+ {{! TODO: Using a label here fails no-nested-interactive lint rule }}
+ <span class="control-label">{{i18n
+ "search.advanced.post.count.label"
+ }}</span>
+ <div class="controls">
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.min_posts}}
+ class="input-small"
+ id="search-min-post-count"
+ placeholder={{i18n "search.advanced.post.min.placeholder"}}
+ aria-label={{i18n "search.advanced.post.min.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMinPostCount)
+ }}
+ />
+ {{icon "left-right"}}
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.max_posts}}
+ class="input-small"
+ id="search-max-post-count"
+ placeholder={{i18n "search.advanced.post.max.placeholder"}}
+ aria-label={{i18n "search.advanced.post.max.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMaxPostCount)
+ }}
+ />
+ </div>
+ </div>
- <div class="count-group control-group">
- {{! TODO: Using a label here fails no-nested-interactive lint rule }}
- <span class="control-label">{{i18n "search.advanced.views.label"}}</span>
- <div class="controls">
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.min_views}}
- class="input-small"
- id="search-min-views"
- placeholder={{i18n "search.advanced.min_views.placeholder"}}
- aria-label={{i18n "search.advanced.min_views.aria_label"}}
- {{on "input" (with-event-value this.onChangeSearchTermMinViews)}}
- />
- {{d-icon "left-right"}}
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.max_views}}
- class="input-small"
- id="search-max-views"
- placeholder={{i18n "search.advanced.max_views.placeholder"}}
- aria-label={{i18n "search.advanced.max_views.aria_label"}}
- {{on "input" (with-event-value this.onChangeSearchTermMaxViews)}}
- />
- </div>
- </div>
- </details>
-
- {{#if this.site.mobileView}}
- <div class="second-search-button">
- <DButton
- @action={{this.search}}
- @icon="magnifying-glass"
- @label="search.search_button"
- @ariaLabel="search.search_button"
- @disabled={{this.searchButtonDisabled}}
- class="btn-primary search-cta"
- />
+ <div class="count-group control-group">
+ {{! TODO: Using a label here fails no-nested-interactive lint rule }}
+ <span class="control-label">{{i18n
+ "search.advanced.views.label"
+ }}</span>
+ <div class="controls">
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.min_views}}
+ class="input-small"
+ id="search-min-views"
+ placeholder={{i18n "search.advanced.min_views.placeholder"}}
+ aria-label={{i18n "search.advanced.min_views.aria_label"}}
+ {{on "input" (withEventValue this.onChangeSearchTermMinViews)}}
+ />
+ {{icon "left-right"}}
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.max_views}}
+ class="input-small"
+ id="search-max-views"
+ placeholder={{i18n "search.advanced.max_views.placeholder"}}
+ aria-label={{i18n "search.advanced.max_views.aria_label"}}
+ {{on "input" (withEventValue this.onChangeSearchTermMaxViews)}}
+ />
+ </div>
+ </div>
+ </details>
+
+ {{#if this.site.mobileView}}
+ <div class="second-search-button">
+ <DButton
+ @action={{this.search}}
+ @icon="magnifying-glass"
+ @label="search.search_button"
+ @ariaLabel="search.search_button"
+ @disabled={{this.searchButtonDisabled}}
+ class="btn-primary search-cta"
+ />
+ </div>
+ {{/if}}
</div>
- {{/if}}
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/shared-draft-controls.gjs b/app/assets/javascripts/discourse/app/components/shared-draft-controls.gjs
index d3036d8bc1e..07d545fe594 100644
--- a/app/assets/javascripts/discourse/app/components/shared-draft-controls.gjs
+++ b/app/assets/javascripts/discourse/app/components/shared-draft-controls.gjs
@@ -2,8 +2,10 @@ import Component from "@ember/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
@tagName("")
export default class SharedDraftControls extends Component {
@@ -43,31 +45,33 @@ export default class SharedDraftControls extends Component {
},
});
}
-}
-<div class="shared-draft-controls">
- {{#if this.publishing}}
- {{i18n "shared_drafts.publishing"}}
- {{else}}
- {{i18n "shared_drafts.notice"}}
+ <template>
+ <div class="shared-draft-controls">
+ {{#if this.publishing}}
+ {{i18n "shared_drafts.publishing"}}
+ {{else}}
+ {{i18n "shared_drafts.notice"}}
- <div class="publish-field">
- <label>{{i18n "shared_drafts.destination_category"}}</label>
- <CategoryChooser
- @value={{this.topic.destination_category_id}}
- @onChange={{action "updateDestinationCategory"}}
- />
- </div>
+ <div class="publish-field">
+ <label>{{i18n "shared_drafts.destination_category"}}</label>
+ <CategoryChooser
+ @value={{this.topic.destination_category_id}}
+ @onChange={{this.updateDestinationCategory}}
+ />
+ </div>
- <div class="publish-field">
- {{#if this.validCategory}}
- <DButton
- @action={{action "publish"}}
- @label="shared_drafts.publish"
- @icon="far-clipboard"
- class="btn-primary publish-shared-draft"
- />
+ <div class="publish-field">
+ {{#if this.validCategory}}
+ <DButton
+ @action={{this.publish}}
+ @label="shared_drafts.publish"
+ @icon="far-clipboard"
+ class="btn-primary publish-shared-draft"
+ />
+ {{/if}}
+ </div>
{{/if}}
</div>
- {{/if}}
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/tag-groups-form.gjs b/app/assets/javascripts/discourse/app/components/tag-groups-form.gjs
index 0aa23d945c7..ac7ee3d5113 100644
--- a/app/assets/javascripts/discourse/app/components/tag-groups-form.gjs
+++ b/app/assets/javascripts/discourse/app/components/tag-groups-form.gjs
@@ -1,12 +1,18 @@
-import Component from "@ember/component";
+import Component, { Input } from "@ember/component";
+import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import RadioButton from "discourse/components/radio-button";
+import TextField from "discourse/components/text-field";
import discourseComputed from "discourse/lib/decorators";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import PermissionType from "discourse/models/permission-type";
import { i18n } from "discourse-i18n";
+import GroupChooser from "select-kit/components/group-chooser";
+import TagChooser from "select-kit/components/tag-chooser";
@tagName("")
export default class TagGroupsForm extends Component.extend(
@@ -92,136 +98,138 @@ export default class TagGroupsForm extends Component.extend(
this.model.destroyRecord().then(() => this.onDestroy?.()),
});
}
-}
-<section class="group-name">
- <label>{{i18n "tagging.groups.name_placeholder"}}</label>
- <div><TextField @value={{this.buffered.name}} /></div>
-</section>
-
-<section class="group-tags-list">
- <label>{{i18n "tagging.groups.tags_label"}}</label><br />
- <TagChooser
- @tags={{this.buffered.tag_names}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @excludeSynonyms={{true}}
- @options={{hash
- allowAny=true
- filterPlaceholder="tagging.groups.tags_placeholder"
- }}
- />
-</section>
-
-<section class="parent-tag-section">
- <label>{{i18n "tagging.groups.parent_tag_label"}}</label>
- <div>
- <TagChooser
- @tags={{this.buffered.parent_tag_name}}
- @everyTag={{true}}
- @excludeSynonyms={{true}}
- @options={{hash
- allowAny=true
- filterPlaceholder="tagging.groups.parent_tag_placeholder"
- maximum=1
- }}
- />
- </div>
- <div class="description">{{i18n
- "tagging.groups.parent_tag_description"
- }}</div>
-</section>
-
-<section class="group-one-per-topic">
- <label>
- <Input
- @type="checkbox"
- @checked={{this.buffered.one_per_topic}}
- name="onepertopic"
- />
- {{i18n "tagging.groups.one_per_topic_label"}}
- </label>
-</section>
-
-<section class="group-visibility">
- <div class="group-visibility-option">
- <RadioButton
- @name="tag-permissions-choice"
- @value="public"
- @id="public-permission"
- @selection={{this.buffered.permissionName}}
- class="tag-permissions-choice"
- />
-
- <label class="radio" for="public-permission">
- {{i18n "tagging.groups.everyone_can_use"}}
- </label>
- </div>
- <div class="group-visibility-option">
- <RadioButton
- @name="tag-permissions-choice"
- @value="visible"
- @id="visible-permission"
- @selection={{this.buffered.permissionName}}
- class="tag-permissions-choice"
- />
-
- <label class="radio" for="visible-permission">
- {{i18n "tagging.groups.usable_only_by_groups"}}
- </label>
-
- <div class="group-access-control">
- <GroupChooser
- @content={{this.allGroups}}
- @value={{this.selectedGroupIds}}
- @labelProperty="name"
- @onChange={{action "setPermissionsGroups"}}
+ <template>
+ <section class="group-name">
+ <label>{{i18n "tagging.groups.name_placeholder"}}</label>
+ <div><TextField @value={{this.buffered.name}} /></div>
+ </section>
+
+ <section class="group-tags-list">
+ <label>{{i18n "tagging.groups.tags_label"}}</label><br />
+ <TagChooser
+ @tags={{this.buffered.tag_names}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @excludeSynonyms={{true}}
@options={{hash
- filterPlaceholder="tagging.groups.select_groups_placeholder"
+ allowAny=true
+ filterPlaceholder="tagging.groups.tags_placeholder"
}}
/>
- </div>
- </div>
- <div class="group-visibility-option">
- <RadioButton
- @name="tag-permissions-choice"
- @value="private"
- @id="private-permission"
- @selection={{this.buffered.permissionName}}
- class="tag-permissions-choice"
- />
-
- <label class="radio" for="private-permission">
- {{i18n "tagging.groups.visible_only_to_groups"}}
- </label>
-
- <div class="group-access-control">
- <GroupChooser
- @content={{this.allGroups}}
- @value={{this.selectedGroupIds}}
- @labelProperty="name"
- @onChange={{action "setPermissionsGroups"}}
- @options={{hash
- filterPlaceholder="tagging.groups.select_groups_placeholder"
- }}
+ </section>
+
+ <section class="parent-tag-section">
+ <label>{{i18n "tagging.groups.parent_tag_label"}}</label>
+ <div>
+ <TagChooser
+ @tags={{this.buffered.parent_tag_name}}
+ @everyTag={{true}}
+ @excludeSynonyms={{true}}
+ @options={{hash
+ allowAny=true
+ filterPlaceholder="tagging.groups.parent_tag_placeholder"
+ maximum=1
+ }}
+ />
+ </div>
+ <div class="description">{{i18n
+ "tagging.groups.parent_tag_description"
+ }}</div>
+ </section>
+
+ <section class="group-one-per-topic">
+ <label>
+ <Input
+ @type="checkbox"
+ @checked={{this.buffered.one_per_topic}}
+ name="onepertopic"
+ />
+ {{i18n "tagging.groups.one_per_topic_label"}}
+ </label>
+ </section>
+
+ <section class="group-visibility">
+ <div class="group-visibility-option">
+ <RadioButton
+ @name="tag-permissions-choice"
+ @value="public"
+ @id="public-permission"
+ @selection={{this.buffered.permissionName}}
+ class="tag-permissions-choice"
+ />
+
+ <label class="radio" for="public-permission">
+ {{i18n "tagging.groups.everyone_can_use"}}
+ </label>
+ </div>
+ <div class="group-visibility-option">
+ <RadioButton
+ @name="tag-permissions-choice"
+ @value="visible"
+ @id="visible-permission"
+ @selection={{this.buffered.permissionName}}
+ class="tag-permissions-choice"
+ />
+
+ <label class="radio" for="visible-permission">
+ {{i18n "tagging.groups.usable_only_by_groups"}}
+ </label>
+
+ <div class="group-access-control">
+ <GroupChooser
+ @content={{this.allGroups}}
+ @value={{this.selectedGroupIds}}
+ @labelProperty="name"
+ @onChange={{this.setPermissionsGroups}}
+ @options={{hash
+ filterPlaceholder="tagging.groups.select_groups_placeholder"
+ }}
+ />
+ </div>
+ </div>
+ <div class="group-visibility-option">
+ <RadioButton
+ @name="tag-permissions-choice"
+ @value="private"
+ @id="private-permission"
+ @selection={{this.buffered.permissionName}}
+ class="tag-permissions-choice"
+ />
+
+ <label class="radio" for="private-permission">
+ {{i18n "tagging.groups.visible_only_to_groups"}}
+ </label>
+
+ <div class="group-access-control">
+ <GroupChooser
+ @content={{this.allGroups}}
+ @value={{this.selectedGroupIds}}
+ @labelProperty="name"
+ @onChange={{this.setPermissionsGroups}}
+ @options={{hash
+ filterPlaceholder="tagging.groups.select_groups_placeholder"
+ }}
+ />
+ </div>
+ </div>
+ </section>
+
+ <div class="tag-group-controls">
+ <DButton
+ @action={{this.save}}
+ @disabled={{this.buffered.isSaving}}
+ @label="tagging.groups.save"
+ class="btn-primary"
+ />
+
+ <DButton
+ @action={{this.destroyTagGroup}}
+ @disabled={{this.buffered.isNew}}
+ @icon="trash-can"
+ @label="tagging.groups.delete"
+ class="btn-danger"
/>
</div>
- </div>
-</section>
-
-<div class="tag-group-controls">
- <DButton
- @action={{action "save"}}
- @disabled={{this.buffered.isSaving}}
- @label="tagging.groups.save"
- class="btn-primary"
- />
-
- <DButton
- @action={{this.destroyTagGroup}}
- @disabled={{this.buffered.isNew}}
- @icon="trash-can"
- @label="tagging.groups.delete"
- class="btn-danger"
- />
-</div>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/tag-info.gjs b/app/assets/javascripts/discourse/app/components/tag-info.gjs
index cf1a037ed4b..075e1723d0f 100644
--- a/app/assets/javascripts/discourse/app/components/tag-info.gjs
+++ b/app/assets/javascripts/discourse/app/components/tag-info.gjs
@@ -1,14 +1,25 @@
-import Component from "@ember/component";
+import Component, { Textarea } from "@ember/component";
+import { array, fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { and, reads } from "@ember/object/computed";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
+import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TextField from "discourse/components/text-field";
+import basePath from "discourse/helpers/base-path";
+import categoryLink from "discourse/helpers/category-link";
+import icon from "discourse/helpers/d-icon";
+import discourseTag from "discourse/helpers/discourse-tag";
+import withEventValue from "discourse/helpers/with-event-value";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
@tagName("")
export default class TagInfo extends Component {
@@ -221,174 +232,181 @@ export default class TagInfo extends Component {
},
});
}
-}
-
-<section class="tag-info">
- {{#if this.tagInfo}}
- <div class="tag-name">
- {{#if this.editing}}
- <div class="edit-tag-wrapper">
- <TextField
- @id="edit-name"
- @value={{readonly this.tagInfo.name}}
- @maxlength={{this.siteSettings.max_tag_length}}
- @input={{with-event-value (fn (mut this.newTagName))}}
- @autofocus="true"
- />
- <Textarea
- id="edit-description"
- @value={{readonly this.tagInfo.descriptionWithNewLines}}
- placeholder={{i18n "tagging.description"}}
- maxlength={{1000}}
- {{on "input" (with-event-value (fn (mut this.newTagDescription)))}}
- autofocus="true"
- />
+ <template>
+ <section class="tag-info">
+ {{#if this.tagInfo}}
+ <div class="tag-name">
+ {{#if this.editing}}
+ <div class="edit-tag-wrapper">
+ <TextField
+ @id="edit-name"
+ @value={{readonly this.tagInfo.name}}
+ @maxlength={{this.siteSettings.max_tag_length}}
+ @input={{withEventValue (fn (mut this.newTagName))}}
+ @autofocus="true"
+ />
- <div class="edit-controls">
- {{#unless this.updateDisabled}}
- <DButton
- @action={{action "finishedEditing"}}
- @icon="check"
- @ariaLabel="tagging.save"
- class="btn-primary submit-edit"
+ <Textarea
+ id="edit-description"
+ @value={{readonly this.tagInfo.descriptionWithNewLines}}
+ placeholder={{i18n "tagging.description"}}
+ maxlength={{1000}}
+ {{on
+ "input"
+ (withEventValue (fn (mut this.newTagDescription)))
+ }}
+ autofocus="true"
/>
- {{/unless}}
- <DButton
- @action={{action "cancelEditing"}}
- @icon="xmark"
- @ariaLabel="cancel"
- class="btn-default cancel-edit"
- />
- </div>
- </div>
- {{else}}
- <div class="tag-name-wrapper">
- {{discourse-tag this.tagInfo.name tagName="div"}}
- {{#if this.canAdminTag}}
- <a
- href
- {{on "click" this.edit}}
- class="edit-tag"
- title={{i18n "tagging.edit_tag"}}
- >{{d-icon "pencil"}}</a>
+
+ <div class="edit-controls">
+ {{#unless this.updateDisabled}}
+ <DButton
+ @action={{this.finishedEditing}}
+ @icon="check"
+ @ariaLabel="tagging.save"
+ class="btn-primary submit-edit"
+ />
+ {{/unless}}
+ <DButton
+ @action={{this.cancelEditing}}
+ @icon="xmark"
+ @ariaLabel="cancel"
+ class="btn-default cancel-edit"
+ />
+ </div>
+ </div>
+ {{else}}
+ <div class="tag-name-wrapper">
+ {{discourseTag this.tagInfo.name tagName="div"}}
+ {{#if this.canAdminTag}}
+ <a
+ href
+ {{on "click" this.edit}}
+ class="edit-tag"
+ title={{i18n "tagging.edit_tag"}}
+ >{{icon "pencil"}}</a>
+ {{/if}}
+ </div>
+ {{#if this.tagInfo.description}}
+ <div class="tag-description-wrapper">
+ <span>{{htmlSafe this.tagInfo.description}}</span>
+ </div>
+ {{/if}}
{{/if}}
</div>
- {{#if this.tagInfo.description}}
- <div class="tag-description-wrapper">
- <span>{{html-safe this.tagInfo.description}}</span>
+ <div class="tag-associations">
+ {{~#if this.tagInfo.tag_group_names}}
+ {{this.tagGroupsInfo}}
+ {{/if~}}
+ {{~#if this.tagInfo.categories}}
+ {{this.categoriesInfo}}
+ <br />
+ {{#each this.tagInfo.categories as |category|}}
+ {{categoryLink category}}
+ {{/each}}
+ {{/if~}}
+ {{~#if this.nothingToShow}}
+ {{#if this.tagInfo.category_restricted}}
+ {{i18n "tagging.category_restricted"}}
+ {{else}}
+ {{htmlSafe (i18n "tagging.default_info")}}
+ {{#if this.canAdminTag}}
+ {{htmlSafe (i18n "tagging.staff_info" basePath=(basePath))}}
+ {{/if}}
+ {{/if}}
+ {{/if~}}
+ </div>
+ {{#if this.tagInfo.synonyms}}
+ <div class="synonyms-list">
+ <h3>{{i18n "tagging.synonyms"}}</h3>
+ <div>{{htmlSafe
+ (i18n
+ "tagging.synonyms_description" base_tag_name=this.tagInfo.name
+ )
+ }}</div>
+ <div class="tag-list">
+ {{#each this.tagInfo.synonyms as |tag|}}
+ <div class="tag-box">
+ {{discourseTag tag.id pmOnly=tag.pmOnly tagName="div"}}
+ {{#if this.editSynonymsMode}}
+ <a
+ href
+ {{on "click" (fn this.unlinkSynonym tag)}}
+ class="unlink-synonym"
+ >
+ {{icon "link-slash" title="tagging.remove_synonym"}}
+ </a>
+ <a
+ href
+ {{on "click" (fn this.deleteSynonym tag)}}
+ class="delete-synonym"
+ >
+ {{icon "trash-can" title="tagging.delete_tag"}}
+ </a>
+ {{/if}}
+ </div>
+ {{/each}}
+ </div>
</div>
{{/if}}
- {{/if}}
- </div>
- <div class="tag-associations">
- {{~#if this.tagInfo.tag_group_names}}
- {{this.tagGroupsInfo}}
- {{/if~}}
- {{~#if this.tagInfo.categories}}
- {{this.categoriesInfo}}
- <br />
- {{#each this.tagInfo.categories as |category|}}
- {{category-link category}}
- {{/each}}
- {{/if~}}
- {{~#if this.nothingToShow}}
- {{#if this.tagInfo.category_restricted}}
- {{i18n "tagging.category_restricted"}}
- {{else}}
- {{html-safe (i18n "tagging.default_info")}}
- {{#if this.canAdminTag}}
- {{html-safe (i18n "tagging.staff_info" basePath=(base-path))}}
- {{/if}}
- {{/if}}
- {{/if~}}
- </div>
- {{#if this.tagInfo.synonyms}}
- <div class="synonyms-list">
- <h3>{{i18n "tagging.synonyms"}}</h3>
- <div>{{html-safe
- (i18n
- "tagging.synonyms_description" base_tag_name=this.tagInfo.name
- )
- }}</div>
- <div class="tag-list">
- {{#each this.tagInfo.synonyms as |tag|}}
- <div class="tag-box">
- {{discourse-tag tag.id pmOnly=tag.pmOnly tagName="div"}}
- {{#if this.editSynonymsMode}}
- <a
- href
- {{on "click" (fn this.unlinkSynonym tag)}}
- class="unlink-synonym"
- >
- {{d-icon "link-slash" title="tagging.remove_synonym"}}
- </a>
- <a
- href
- {{on "click" (fn this.deleteSynonym tag)}}
- class="delete-synonym"
- >
- {{d-icon "trash-can" title="tagging.delete_tag"}}
- </a>
+ {{#if this.editSynonymsMode}}
+ <section class="add-synonyms field">
+ <label for="add-synonyms">{{i18n
+ "tagging.add_synonyms_label"
+ }}</label>
+ <div class="add-synonyms__controls">
+ <TagChooser
+ @id="add-synonyms"
+ @tags={{this.newSynonyms}}
+ @blockedTags={{array this.tagInfo.name}}
+ @everyTag={{true}}
+ @excludeSynonyms={{true}}
+ @excludeHasSynonyms={{true}}
+ @unlimitedTagCount={{true}}
+ @allowCreate={{true}}
+ />
+ {{#if this.newSynonyms}}
+ <DButton
+ @action={{this.addSynonyms}}
+ @disabled={{this.addSynonymsDisabled}}
+ @icon="check"
+ class="ok"
+ />
{{/if}}
</div>
- {{/each}}
- </div>
- </div>
- {{/if}}
- {{#if this.editSynonymsMode}}
- <section class="add-synonyms field">
- <label for="add-synonyms">{{i18n "tagging.add_synonyms_label"}}</label>
- <div class="add-synonyms__controls">
- <TagChooser
- @id="add-synonyms"
- @tags={{this.newSynonyms}}
- @blockedTags={{array this.tagInfo.name}}
- @everyTag={{true}}
- @excludeSynonyms={{true}}
- @excludeHasSynonyms={{true}}
- @unlimitedTagCount={{true}}
- @allowCreate={{true}}
+ </section>
+ {{/if}}
+ {{#if this.canAdminTag}}
+ <PluginOutlet
+ @name="tag-custom-settings"
+ @outletArgs={{hash tag=this.tagInfo}}
+ @connectorTagName="section"
/>
- {{#if this.newSynonyms}}
+
+ <div class="tag-actions">
<DButton
- @action={{action "addSynonyms"}}
- @disabled={{this.addSynonymsDisabled}}
- @icon="check"
- class="ok"
+ @action={{this.toggleEditControls}}
+ @icon="gear"
+ @label="tagging.edit_synonyms"
+ id="edit-synonyms"
+ class="btn-default"
/>
- {{/if}}
- </div>
- </section>
- {{/if}}
- {{#if this.canAdminTag}}
- <PluginOutlet
- @name="tag-custom-settings"
- @outletArgs={{hash tag=this.tagInfo}}
- @connectorTagName="section"
- />
-
- <div class="tag-actions">
- <DButton
- @action={{action "toggleEditControls"}}
- @icon="gear"
- @label="tagging.edit_synonyms"
- id="edit-synonyms"
- class="btn-default"
- />
- {{#if this.canAdminTag}}
- <DButton
- @action={{action "deleteTag"}}
- @icon="trash-can"
- @label="tagging.delete_tag"
- id="delete-tag"
- class="btn-danger delete-tag"
- />
+ {{#if this.canAdminTag}}
+ <DButton
+ @action={{this.deleteTag}}
+ @icon="trash-can"
+ @label="tagging.delete_tag"
+ id="delete-tag"
+ class="btn-danger delete-tag"
+ />
+ {{/if}}
+ </div>
{{/if}}
- </div>
- {{/if}}
- {{/if}}
- {{#if this.loading}}
- <div>{{i18n "loading"}}</div>
- {{/if}}
-</section>
\ No newline at end of file
+ {{/if}}
+ {{#if this.loading}}
+ <div>{{i18n "loading"}}</div>
+ {{/if}}
+ </section>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/time-input.gjs b/app/assets/javascripts/discourse/app/components/time-input.gjs
index 8795b4672a6..33c40cd5b4d 100644
--- a/app/assets/javascripts/discourse/app/components/time-input.gjs
+++ b/app/assets/javascripts/discourse/app/components/time-input.gjs
@@ -1,8 +1,10 @@
import Component from "@ember/component";
+import { hash } from "@ember/helper";
import { action, computed } from "@ember/object";
import { htmlSafe } from "@ember/template";
import { isPresent } from "@ember/utils";
import { classNames } from "@ember-decorators/component";
+import ComboBox from "select-kit/components/combo-box";
function convertMinutes(num) {
return { hours: Math.floor(num / 60), minutes: num % 60 };
@@ -184,17 +186,19 @@ export default class TimeInput extends Component {
}
}
}
-}
-<ComboBox
- @value={{this.time}}
- @content={{this.timeOptions}}
- @onChange={{action "onChangeTime"}}
- @options={{hash
- translatedNone="--:--"
- allowAny=true
- filterable=false
- autoInsertNoneItem=false
- translatedFilterPlaceholder="--:--"
- }}
-/>
\ No newline at end of file
+ <template>
+ <ComboBox
+ @value={{this.time}}
+ @content={{this.timeOptions}}
+ @onChange={{this.onChangeTime}}
+ @options={{hash
+ translatedNone="--:--"
+ allowAny=true
+ filterable=false
+ autoInsertNoneItem=false
+ translatedFilterPlaceholder="--:--"
+ }}
+ />
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.gjs b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.gjs
index 4cf7b89cbb2..c85a31069e9 100644
--- a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.gjs
@@ -1,13 +1,28 @@
import Component from "@ember/component";
+import { concat, hash } from "@ember/helper";
import { computed } from "@ember/object";
import { alias, or } from "@ember/object/computed";
import { getOwner } from "@ember/owner";
import { attributeBindings } from "@ember-decorators/component";
+import { eq, gt } from "truth-helpers";
+import BookmarkMenu from "discourse/components/bookmark-menu";
+import DButton from "discourse/components/d-button";
+import DropdownMenu from "discourse/components/dropdown-menu";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import TopicAdminMenu from "discourse/components/topic-admin-menu";
+import UserTip from "discourse/components/user-tip";
+import concatClass from "discourse/helpers/concat-class";
+import icon from "discourse/helpers/d-icon";
import discourseComputed from "discourse/lib/decorators";
import { NotificationLevels } from "discourse/lib/notification-levels";
import { getTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
import { getTopicFooterDropdowns } from "discourse/lib/register-topic-footer-dropdown";
import TopicBookmarkManager from "discourse/lib/topic-bookmark-manager";
+import { i18n } from "discourse-i18n";
+import DropdownSelectBox from "select-kit/components/dropdown-select-box";
+import PinnedButton from "select-kit/components/pinned-button";
+import TopicNotificationsButton from "select-kit/components/topic-notifications-button";
+import DMenu from "float-kit/components/d-menu";
@attributeBindings("role")
export default class TopicFooterButtons extends Component {
@@ -84,185 +99,190 @@ export default class TopicFooterButtons extends Component {
showBookmarkLabel(isPM) {
return !isPM;
}
-}
-<div class="topic-footer-main-buttons">
- <div class="topic-footer-main-buttons__actions">
- <TopicAdminMenu
- @topic={{this.topic}}
- @toggleMultiSelect={{this.toggleMultiSelect}}
- @showTopicSlowModeUpdate={{this.showTopicSlowModeUpdate}}
- @deleteTopic={{this.deleteTopic}}
- @recoverTopic={{this.recoverTopic}}
- @toggleFeaturedOnProfile={{this.toggleFeaturedOnProfile}}
- @toggleClosed={{this.toggleClosed}}
- @toggleArchived={{this.toggleArchived}}
- @toggleVisibility={{this.toggleVisibility}}
- @showTopicTimerModal={{this.showTopicTimerModal}}
- @showFeatureTopic={{this.showFeatureTopic}}
- @showChangeTimestamp={{this.showChangeTimestamp}}
- @resetBumpDate={{this.resetBumpDate}}
- @convertToPublicTopic={{this.convertToPublicTopic}}
- @convertToPrivateMessage={{this.convertToPrivateMessage}}
- @buttonClasses="topic-footer-button"
- />
+ <template>
+ <div class="topic-footer-main-buttons">
+ <div class="topic-footer-main-buttons__actions">
+ <TopicAdminMenu
+ @topic={{this.topic}}
+ @toggleMultiSelect={{this.toggleMultiSelect}}
+ @showTopicSlowModeUpdate={{this.showTopicSlowModeUpdate}}
+ @deleteTopic={{this.deleteTopic}}
+ @recoverTopic={{this.recoverTopic}}
+ @toggleFeaturedOnProfile={{this.toggleFeaturedOnProfile}}
+ @toggleClosed={{this.toggleClosed}}
+ @toggleArchived={{this.toggleArchived}}
+ @toggleVisibility={{this.toggleVisibility}}
+ @showTopicTimerModal={{this.showTopicTimerModal}}
+ @showFeatureTopic={{this.showFeatureTopic}}
+ @showChangeTimestamp={{this.showChangeTimestamp}}
+ @resetBumpDate={{this.resetBumpDate}}
+ @convertToPublicTopic={{this.convertToPublicTopic}}
+ @convertToPrivateMessage={{this.convertToPrivateMessage}}
+ @buttonClasses="topic-footer-button"
+ />
- {{#each this.inlineActionables as |actionable|}}
- {{#if (eq actionable.type "inline-button")}}
- {{#if (eq actionable.id "bookmark")}}
- <BookmarkMenu
- @showLabel={{this.showBookmarkLabel}}
- @bookmarkManager={{this.topicBookmarkManager}}
- @buttonClasses="btn-default topic-footer-button"
- />
- {{else}}
- <DButton
- @action={{actionable.action}}
- @icon={{actionable.icon}}
- @translatedLabel={{actionable.label}}
- @translatedTitle={{actionable.title}}
- @translatedAriaLabel={{actionable.ariaLabel}}
- @disabled={{actionable.disabled}}
- id={{concat "topic-footer-button-" actionable.id}}
- class={{concat-class
- "btn-default"
- "topic-footer-button"
- actionable.classNames
- }}
+ {{#each this.inlineActionables as |actionable|}}
+ {{#if (eq actionable.type "inline-button")}}
+ {{#if (eq actionable.id "bookmark")}}
+ <BookmarkMenu
+ @showLabel={{this.showBookmarkLabel}}
+ @bookmarkManager={{this.topicBookmarkManager}}
+ @buttonClasses="btn-default topic-footer-button"
+ />
+ {{else}}
+ <DButton
+ @action={{actionable.action}}
+ @icon={{actionable.icon}}
+ @translatedLabel={{actionable.label}}
+ @translatedTitle={{actionable.title}}
+ @translatedAriaLabel={{actionable.ariaLabel}}
+ @disabled={{actionable.disabled}}
+ id={{concat "topic-footer-button-" actionable.id}}
+ class={{concatClass
+ "btn-default"
+ "topic-footer-button"
+ actionable.classNames
+ }}
+ />
+ {{/if}}
+ {{else}}
+ <DropdownSelectBox
+ @id={{concat "topic-footer-dropdown-" actionable.id}}
+ @value={{actionable.value}}
+ @content={{actionable.content}}
+ @onChange={{action actionable.action}}
+ @options={{hash
+ icon=actionable.icon
+ none=actionable.noneItem
+ disabled=actionable.disabled
+ }}
+ class={{concatClass
+ "topic-footer-dropdown"
+ actionable.classNames
+ }}
+ />
+ {{/if}}
+ {{/each}}
+
+ {{#if this.site.mobileView}}
+ {{#if this.loneDropdownButton}}
+ <DButton
+ @action={{this.loneDropdownButton.action}}
+ @icon={{this.loneDropdownButton.icon}}
+ @translatedLabel={{this.loneDropdownButton.label}}
+ @translatedTitle={{this.loneDropdownButton.title}}
+ @translatedAriaLabel={{this.loneDropdownButton.ariaLabel}}
+ @disabled={{this.loneDropdownButton.disabled}}
+ id={{concat "topic-footer-button-" this.loneDropdownButton.id}}
+ class={{concatClass
+ "btn-default"
+ "topic-footer-button"
+ this.loneDropdownButton.classNames
+ }}
+ />
+ {{else if (gt this.dropdownButtons.length 1)}}
+ <DMenu
+ @modalForMobile={{true}}
+ @identifier="topic-footer-mobile-dropdown"
+ class="topic-footer-button btn-default"
+ >
+ <:trigger>
+ {{icon "ellipsis-vertical"}}
+ </:trigger>
+ <:content>
+ <DropdownMenu as |dropdown|>
+ {{#each this.dropdownButtons as |button|}}
+ <dropdown.item>
+ <DButton
+ @action={{button.action}}
+ @icon={{button.icon}}
+ @translatedLabel={{button.label}}
+ @translatedTitle={{button.title}}
+ @translatedAriaLabel={{button.ariaLabel}}
+ @disabled={{button.disabled}}
+ id={{concat "topic-footer-button-" button.id}}
+ class={{concatClass
+ "btn-default"
+ "topic-footer-button"
+ button.classNames
+ }}
+ />
+ </dropdown.item>
+ {{/each}}
+ </DropdownMenu>
+ </:content>
+ </DMenu>
+ {{/if}}
+
+ <PinnedButton
+ @pinned={{this.topic.pinned}}
+ @topic={{this.topic}}
+ @appendReason={{false}}
/>
+
+ {{#if this.showNotificationsButton}}
+ <TopicNotificationsButton
+ @topic={{this.topic}}
+ @appendReason={{false}}
+ />
+ {{/if}}
{{/if}}
- {{else}}
- <DropdownSelectBox
- @id={{concat "topic-footer-dropdown-" actionable.id}}
- @value={{actionable.value}}
- @content={{actionable.content}}
- @onChange={{action actionable.action}}
- @options={{hash
- icon=actionable.icon
- none=actionable.noneItem
- disabled=actionable.disabled
- }}
- class={{concat-class "topic-footer-dropdown" actionable.classNames}}
- />
- {{/if}}
- {{/each}}
+ </div>
- {{#if this.site.mobileView}}
- {{#if this.loneDropdownButton}}
+ <PluginOutlet
+ @name="topic-footer-main-buttons-before-create"
+ @outletArgs={{hash topic=this.topic}}
+ @connectorTagName="span"
+ />
+
+ {{#if this.topic.details.can_create_post}}
<DButton
- @action={{this.loneDropdownButton.action}}
- @icon={{this.loneDropdownButton.icon}}
- @translatedLabel={{this.loneDropdownButton.label}}
- @translatedTitle={{this.loneDropdownButton.title}}
- @translatedAriaLabel={{this.loneDropdownButton.ariaLabel}}
- @disabled={{this.loneDropdownButton.disabled}}
- id={{concat "topic-footer-button-" this.loneDropdownButton.id}}
- class={{concat-class
- "btn-default"
- "topic-footer-button"
- this.loneDropdownButton.classNames
- }}
+ @icon="reply"
+ @action={{this.replyToPost}}
+ @label="topic.reply.title"
+ @title="topic.reply.help"
+ class="btn-primary create topic-footer-button"
/>
- {{else if (gt this.dropdownButtons.length 1)}}
- <DMenu
- @modalForMobile={{true}}
- @identifier="topic-footer-mobile-dropdown"
- class="topic-footer-button btn-default"
- >
- <:trigger>
- {{d-icon "ellipsis-vertical"}}
- </:trigger>
- <:content>
- <DropdownMenu as |dropdown|>
- {{#each this.dropdownButtons as |button|}}
- <dropdown.item>
- <DButton
- @action={{button.action}}
- @icon={{button.icon}}
- @translatedLabel={{button.label}}
- @translatedTitle={{button.title}}
- @translatedAriaLabel={{button.ariaLabel}}
- @disabled={{button.disabled}}
- id={{concat "topic-footer-button-" button.id}}
- class={{concat-class
- "btn-default"
- "topic-footer-button"
- button.classNames
- }}
- />
- </dropdown.item>
- {{/each}}
- </DropdownMenu>
- </:content>
- </DMenu>
{{/if}}
+ <PluginOutlet
+ @name="after-topic-footer-main-buttons"
+ @outletArgs={{hash topic=this.topic}}
+ @connectorTagName="span"
+ />
+ </div>
+
+ {{#if this.site.desktopView}}
<PinnedButton
@pinned={{this.topic.pinned}}
@topic={{this.topic}}
- @appendReason={{false}}
+ @appendReason={{true}}
/>
{{#if this.showNotificationsButton}}
<TopicNotificationsButton
@topic={{this.topic}}
- @appendReason={{false}}
+ @expanded={{true}}
+ class="notifications-button-footer"
/>
+
+ {{#if this.showNotificationUserTip}}
+ <UserTip
+ @id="topic_notification_levels"
+ @triggerSelector=".notifications-button-footer details"
+ @titleText={{i18n "user_tips.topic_notification_levels.title"}}
+ @contentText={{i18n "user_tips.topic_notification_levels.content"}}
+ @priority={{800}}
+ />
+ {{/if}}
{{/if}}
{{/if}}
- </div>
-
- <PluginOutlet
- @name="topic-footer-main-buttons-before-create"
- @outletArgs={{hash topic=this.topic}}
- @connectorTagName="span"
- />
- {{#if this.topic.details.can_create_post}}
- <DButton
- @icon="reply"
- @action={{this.replyToPost}}
- @label="topic.reply.title"
- @title="topic.reply.help"
- class="btn-primary create topic-footer-button"
+ <PluginOutlet
+ @name="after-topic-footer-buttons"
+ @outletArgs={{hash topic=this.topic}}
+ @connectorTagName="span"
/>
- {{/if}}
-
- <PluginOutlet
- @name="after-topic-footer-main-buttons"
- @outletArgs={{hash topic=this.topic}}
- @connectorTagName="span"
- />
-</div>
-
-{{#if this.site.desktopView}}
- <PinnedButton
- @pinned={{this.topic.pinned}}
- @topic={{this.topic}}
- @appendReason={{true}}
- />
-
- {{#if this.showNotificationsButton}}
- <TopicNotificationsButton
- @topic={{this.topic}}
- @expanded={{true}}
- class="notifications-button-footer"
- />
-
- {{#if this.showNotificationUserTip}}
- <UserTip
- @id="topic_notification_levels"
- @triggerSelector=".notifications-button-footer details"
- @titleText={{i18n "user_tips.topic_notification_levels.title"}}
- @contentText={{i18n "user_tips.topic_notification_levels.content"}}
- @priority={{800}}
- />
- {{/if}}
- {{/if}}
-{{/if}}
-
-<PluginOutlet
- @name="after-topic-footer-buttons"
- @outletArgs={{hash topic=this.topic}}
- @connectorTagName="span"
-/>
\ No newline at end of file
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/user-fields/dropdown.gjs b/app/assets/javascripts/discourse/app/components/user-fields/dropdown.gjs
index a8f80088ebe..1e2d3569952 100644
--- a/app/assets/javascripts/discourse/app/components/user-fields/dropdown.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-fields/dropdown.gjs
@@ -1,24 +1,31 @@
+import { concat, fn, hash } from "@ember/helper";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
import UserFieldBase from "./base";
-export default class UserFieldDropdown extends UserFieldBase {}
+export default class UserFieldDropdown extends UserFieldBase {
+ <template>
+ <label
+ class="control-label alt-placeholder"
+ for={{concat "user-" this.elementId}}
+ >
+ {{this.field.name}}
+ {{~#unless this.field.required}}
+ {{i18n "user_fields.optional"}}{{/unless~}}
+ </label>
-<label
- class="control-label alt-placeholder"
- for={{concat "user-" this.elementId}}
->
- {{this.field.name}}
- {{~#unless this.field.required}} {{i18n "user_fields.optional"}}{{/unless~}}
-</label>
-
-<div class="controls">
- <ComboBox
- @id={{concat "user-" this.elementId}}
- @content={{this.field.options}}
- @valueProperty={{null}}
- @nameProperty={{null}}
- @value={{this.value}}
- @onChange={{fn (mut this.value)}}
- @options={{hash none=this.noneLabel}}
- />
- <div class="instructions">{{html-safe this.field.description}}</div>
-</div>
\ No newline at end of file
+ <div class="controls">
+ <ComboBox
+ @id={{concat "user-" this.elementId}}
+ @content={{this.field.options}}
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @value={{this.value}}
+ @onChange={{fn (mut this.value)}}
+ @options={{hash none=this.noneLabel}}
+ />
+ <div class="instructions">{{htmlSafe this.field.description}}</div>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/user-fields/multiselect.gjs b/app/assets/javascripts/discourse/app/components/user-fields/multiselect.gjs
index 3a23eb211b9..71d01ef989f 100644
--- a/app/assets/javascripts/discourse/app/components/user-fields/multiselect.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-fields/multiselect.gjs
@@ -1,24 +1,31 @@
+import { concat, fn, hash } from "@ember/helper";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import MultiSelect from "select-kit/components/multi-select";
import UserFieldBase from "./base";
-export default class UserFieldMultiselect extends UserFieldBase {}
+export default class UserFieldMultiselect extends UserFieldBase {
+ <template>
+ <label
+ class="control-label alt-placeholder"
+ for={{concat "user-" this.elementId}}
+ >
+ {{this.field.name}}
+ {{~#unless this.field.required}}
+ {{i18n "user_fields.optional"}}{{/unless~}}
+ </label>
-<label
- class="control-label alt-placeholder"
- for={{concat "user-" this.elementId}}
->
- {{this.field.name}}
- {{~#unless this.field.required}} {{i18n "user_fields.optional"}}{{/unless~}}
-</label>
-
-<div class="controls">
- <MultiSelect
- @id={{concat "user-" this.elementId}}
- @content={{this.field.options}}
- @valueProperty={{null}}
- @nameProperty={{null}}
- @value={{this.value}}
- @onChange={{fn (mut this.value)}}
- @options={{hash none=this.noneLabel}}
- />
- <div class="instructions">{{html-safe this.field.description}}</div>
-</div>
\ No newline at end of file
+ <div class="controls">
+ <MultiSelect
+ @id={{concat "user-" this.elementId}}
+ @content={{this.field.options}}
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @value={{this.value}}
+ @onChange={{fn (mut this.value)}}
+ @options={{hash none=this.noneLabel}}
+ />
+ <div class="instructions">{{htmlSafe this.field.description}}</div>
+ </div>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/user-notification-schedule-day.gjs b/app/assets/javascripts/discourse/app/components/user-notification-schedule-day.gjs
index 85a3c3bb6a2..75204a594f3 100644
--- a/app/assets/javascripts/discourse/app/components/user-notification-schedule-day.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-notification-schedule-day.gjs
@@ -1,31 +1,35 @@
import Component from "@ember/component";
import { tagName } from "@ember-decorators/component";
-import { i18n } from "discourse/lib/computed";
+import { i18n as computedI18n } from "discourse/lib/computed";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
@tagName("")
export default class UserNotificationScheduleDay extends Component {
- @i18n("day", "user.notification_schedule.%@") dayLabel;
-}
+ @computedI18n("day", "user.notification_schedule.%@") dayLabel;
-<tr class="day {{this.dayLabel}}">
- <td class="day-label">{{this.dayLabel}}</td>
- <td class="starts-at">
- <ComboBox
- @valueProperty="value"
- @content={{this.startTimeOptions}}
- @value={{this.startTimeValue}}
- @onChange={{this.onChangeStartTime}}
- />
- </td>
- {{#if this.endTimeOptions}}
- <td class="to">{{i18n "user.notification_schedule.to"}}</td>
- <td class="ends-at">
- <ComboBox
- @valueProperty="value"
- @content={{this.endTimeOptions}}
- @value={{this.endTimeValue}}
- @onChange={{this.onChangeEndTime}}
- />
- </td>
- {{/if}}
-</tr>
\ No newline at end of file
+ <template>
+ <tr class="day {{this.dayLabel}}">
+ <td class="day-label">{{this.dayLabel}}</td>
+ <td class="starts-at">
+ <ComboBox
+ @valueProperty="value"
+ @content={{this.startTimeOptions}}
+ @value={{this.startTimeValue}}
+ @onChange={{this.onChangeStartTime}}
+ />
+ </td>
+ {{#if this.endTimeOptions}}
+ <td class="to">{{i18n "user.notification_schedule.to"}}</td>
+ <td class="ends-at">
+ <ComboBox
+ @valueProperty="value"
+ @content={{this.endTimeOptions}}
+ @value={{this.endTimeValue}}
+ @onChange={{this.onChangeEndTime}}
+ />
+ </td>
+ {{/if}}
+ </tr>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/user-preferences/categories.gjs b/app/assets/javascripts/discourse/app/components/user-preferences/categories.gjs
index dc02ee527e8..03774282220 100644
--- a/app/assets/javascripts/discourse/app/components/user-preferences/categories.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-preferences/categories.gjs
@@ -1,110 +1,125 @@
-<div class="control-group category-notifications">
- <label class="control-label">{{i18n "user.categories_settings"}}</label>
+import { fn, hash } from "@ember/helper";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import CategorySelector from "select-kit/components/category-selector";
- <div class="controls tracking-controls tracking-controls__watched-categories">
- <label>{{d-icon "d-watching"}} {{i18n "user.watched_categories"}}</label>
- {{#if @canSee}}
- <a class="show-tracking" href={{@model.watchingTopicsPath}}>{{i18n
- "user.tracked_topics_link"
- }}</a>
- {{/if}}
- <CategorySelector
- @categories={{@model.watchedCategories}}
- @blockedCategories={{@selectedCategories}}
- @onChange={{fn (mut @model.watchedCategories)}}
- />
- </div>
- <div class="instructions">{{i18n
- "user.watched_categories_instructions"
- }}</div>
+const Categories = <template>
+ <div class="control-group category-notifications">
+ <label class="control-label">{{i18n "user.categories_settings"}}</label>
- <div class="controls tracking-controls tracking-controls__tracked-categories">
- <label>{{d-icon "d-tracking"}} {{i18n "user.tracked_categories"}}</label>
- {{#if @canSee}}
- <a class="show-tracking" href={{@model.trackingTopicsPath}}>{{i18n
- "user.tracked_topics_link"
- }}</a>
- {{/if}}
- <CategorySelector
- @categories={{@model.trackedCategories}}
- @blockedCategories={{@selectedCategories}}
- @onChange={{fn (mut @model.trackedCategories)}}
- />
- </div>
- <div class="instructions">{{i18n
- "user.tracked_categories_instructions"
- }}</div>
-
- <div
- class="controls tracking-controls tracking-controls__watched-first-categories"
- >
- <label>{{d-icon "d-watching-first"}}
- {{i18n "user.watched_first_post_categories"}}</label>
- <CategorySelector
- @categories={{@model.watchedFirstPostCategories}}
- @blockedCategories={{@selectedCategories}}
- @onChange={{fn (mut @model.watchedFirstPostCategories)}}
- />
- </div>
- <div class="instructions">{{i18n
- "user.watched_first_post_categories_instructions"
- }}</div>
-
- {{#if @siteSettings.mute_all_categories_by_default}}
<div
- class="controls tracking-controls tracking-controls__regular-categories"
+ class="controls tracking-controls tracking-controls__watched-categories"
>
- <label>{{d-icon "d-regular"}} {{i18n "user.regular_categories"}}</label>
+ <label>{{icon "d-watching"}} {{i18n "user.watched_categories"}}</label>
+ {{#if @canSee}}
+ <a class="show-tracking" href={{@model.watchingTopicsPath}}>{{i18n
+ "user.tracked_topics_link"
+ }}</a>
+ {{/if}}
<CategorySelector
- @categories={{@model.regularCategories}}
+ @categories={{@model.watchedCategories}}
@blockedCategories={{@selectedCategories}}
- @onChange={{fn (mut @model.regularCategories)}}
+ @onChange={{fn (mut @model.watchedCategories)}}
/>
</div>
<div class="instructions">{{i18n
- "user.regular_categories_instructions"
+ "user.watched_categories_instructions"
}}</div>
- {{else}}
- <div class="controls tracking-controls tracking-controls__muted-categories">
- <label>{{d-icon "d-muted"}} {{i18n "user.muted_categories"}}</label>
+ <div
+ class="controls tracking-controls tracking-controls__tracked-categories"
+ >
+ <label>{{icon "d-tracking"}} {{i18n "user.tracked_categories"}}</label>
{{#if @canSee}}
- <a class="show-tracking" href={{@model.mutedTopicsPath}}>{{i18n
+ <a class="show-tracking" href={{@model.trackingTopicsPath}}>{{i18n
"user.tracked_topics_link"
}}</a>
{{/if}}
-
<CategorySelector
- @categories={{@model.mutedCategories}}
+ @categories={{@model.trackedCategories}}
@blockedCategories={{@selectedCategories}}
- @onChange={{fn (mut @model.mutedCategories)}}
+ @onChange={{fn (mut @model.trackedCategories)}}
/>
</div>
+ <div class="instructions">{{i18n
+ "user.tracked_categories_instructions"
+ }}</div>
+ <div
+ class="controls tracking-controls tracking-controls__watched-first-categories"
+ >
+ <label>{{icon "d-watching-first"}}
+ {{i18n "user.watched_first_post_categories"}}</label>
+ <CategorySelector
+ @categories={{@model.watchedFirstPostCategories}}
+ @blockedCategories={{@selectedCategories}}
+ @onChange={{fn (mut @model.watchedFirstPostCategories)}}
+ />
+ </div>
<div class="instructions">{{i18n
- (if
- @hideMutedTags
- "user.muted_categories_instructions"
- "user.muted_categories_instructions_dont_hide"
- )
+ "user.watched_first_post_categories_instructions"
}}</div>
- {{/if}}
-</div>
-<span>
- <PluginOutlet
- @name="user-preferences-categories"
- @connectorTagName="div"
- @outletArgs={{hash model=@model save=@save}}
- />
-</span>
+ {{#if @siteSettings.mute_all_categories_by_default}}
+ <div
+ class="controls tracking-controls tracking-controls__regular-categories"
+ >
+ <label>{{icon "d-regular"}} {{i18n "user.regular_categories"}}</label>
+ <CategorySelector
+ @categories={{@model.regularCategories}}
+ @blockedCategories={{@selectedCategories}}
+ @onChange={{fn (mut @model.regularCategories)}}
+ />
+ </div>
+ <div class="instructions">{{i18n
+ "user.regular_categories_instructions"
+ }}</div>
+ {{else}}
+ <div
+ class="controls tracking-controls tracking-controls__muted-categories"
+ >
+ <label>{{icon "d-muted"}} {{i18n "user.muted_categories"}}</label>
-<br />
+ {{#if @canSee}}
+ <a class="show-tracking" href={{@model.mutedTopicsPath}}>{{i18n
+ "user.tracked_topics_link"
+ }}</a>
+ {{/if}}
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=@model}}
- />
-</span>
\ No newline at end of file
+ <CategorySelector
+ @categories={{@model.mutedCategories}}
+ @blockedCategories={{@selectedCategories}}
+ @onChange={{fn (mut @model.mutedCategories)}}
+ />
+ </div>
+
+ <div class="instructions">{{i18n
+ (if
+ @hideMutedTags
+ "user.muted_categories_instructions"
+ "user.muted_categories_instructions_dont_hide"
+ )
+ }}</div>
+ {{/if}}
+ </div>
+
+ <span>
+ <PluginOutlet
+ @name="user-preferences-categories"
+ @connectorTagName="div"
+ @outletArgs={{hash model=@model save=@save}}
+ />
+ </span>
+
+ <br />
+
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash model=@model}}
+ />
+ </span>
+</template>;
+export default Categories;
diff --git a/app/assets/javascripts/discourse/app/components/user-preferences/tags.gjs b/app/assets/javascripts/discourse/app/components/user-preferences/tags.gjs
index 65c751fa1e6..cee5df3e4d6 100644
--- a/app/assets/javascripts/discourse/app/components/user-preferences/tags.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-preferences/tags.gjs
@@ -1,75 +1,84 @@
-{{#if @siteSettings.tagging_enabled}}
- <div class="control-group tag-notifications">
- <label class="control-label">{{i18n "user.tag_settings"}}</label>
+import { hash } from "@ember/helper";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
- <div class="controls tracking-controls tracking-controls__watched-tags">
- <label>{{d-icon "d-watching" class="icon watching"}}
- {{i18n "user.watched_tags"}}</label>
- <TagChooser
- @tags={{@model.watched_tags}}
- @blockedTags={{@selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
- </div>
+const Tags = <template>
+ {{#if @siteSettings.tagging_enabled}}
+ <div class="control-group tag-notifications">
+ <label class="control-label">{{i18n "user.tag_settings"}}</label>
- <div class="instructions">{{i18n "user.watched_tags_instructions"}}</div>
+ <div class="controls tracking-controls tracking-controls__watched-tags">
+ <label>{{icon "d-watching" class="icon watching"}}
+ {{i18n "user.watched_tags"}}</label>
+ <TagChooser
+ @tags={{@model.watched_tags}}
+ @blockedTags={{@selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+ </div>
- <div class="controls tracking-controls tracking-controls__tracked-tags">
- <label>{{d-icon "d-tracking" class="icon tracking"}}
- {{i18n "user.tracked_tags"}}</label>
- <TagChooser
- @tags={{@model.tracked_tags}}
- @blockedTags={{@selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
- </div>
+ <div class="instructions">{{i18n "user.watched_tags_instructions"}}</div>
- <div class="instructions">{{i18n "user.tracked_tags_instructions"}}</div>
+ <div class="controls tracking-controls tracking-controls__tracked-tags">
+ <label>{{icon "d-tracking" class="icon tracking"}}
+ {{i18n "user.tracked_tags"}}</label>
+ <TagChooser
+ @tags={{@model.tracked_tags}}
+ @blockedTags={{@selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+ </div>
- <div
- class="controls tracking-controls tracking-controls__watched-first-post-tags"
- >
- <label>{{d-icon "d-watching-first" class="icon watching-first-post"}}
- {{i18n "user.watched_first_post_tags"}}</label>
- <TagChooser
- @tags={{@model.watching_first_post_tags}}
- @blockedTags={{@selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
- </div>
+ <div class="instructions">{{i18n "user.tracked_tags_instructions"}}</div>
- <div class="instructions">
- {{i18n "user.watched_first_post_tags_instructions"}}
- </div>
+ <div
+ class="controls tracking-controls tracking-controls__watched-first-post-tags"
+ >
+ <label>{{icon "d-watching-first" class="icon watching-first-post"}}
+ {{i18n "user.watched_first_post_tags"}}</label>
+ <TagChooser
+ @tags={{@model.watching_first_post_tags}}
+ @blockedTags={{@selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+ </div>
+
+ <div class="instructions">
+ {{i18n "user.watched_first_post_tags_instructions"}}
+ </div>
- <div class="controls tracking-controls tracking-controls__muted-tags">
- <label>{{d-icon "d-muted" class="icon muted"}}
- {{i18n "user.muted_tags"}}</label>
- <TagChooser
- @tags={{@model.muted_tags}}
- @blockedTags={{@selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
+ <div class="controls tracking-controls tracking-controls__muted-tags">
+ <label>{{icon "d-muted" class="icon muted"}}
+ {{i18n "user.muted_tags"}}</label>
+ <TagChooser
+ @tags={{@model.muted_tags}}
+ @blockedTags={{@selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+ </div>
+ <div class="instructions">{{i18n "user.muted_tags_instructions"}}</div>
</div>
- <div class="instructions">{{i18n "user.muted_tags_instructions"}}</div>
- </div>
- <PluginOutlet
- @name="user-preferences-tags"
- @connectorTagName="div"
- @outletArgs={{hash model=@model save=@save}}
- />
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=@model}}
- />
-{{/if}}
\ No newline at end of file
+ <PluginOutlet
+ @name="user-preferences-tags"
+ @connectorTagName="div"
+ @outletArgs={{hash model=@model save=@save}}
+ />
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash model=@model}}
+ />
+ {{/if}}
+</template>;
+export default Tags;
diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.js
index b1e285e7d26..a0d67a2f63e 100644
--- a/app/assets/javascripts/discourse/app/controllers/user.js
+++ b/app/assets/javascripts/discourse/app/controllers/user.js
@@ -87,7 +87,7 @@ export default class UserController extends Controller {
ariaLabel: this.collapsedInfo
? "user.sr_expand_profile"
: "user.sr_collapse_profile",
- action: "toggleProfile",
+ action: this.toggleProfile,
};
}
diff --git a/app/assets/javascripts/discourse/app/templates/full-page-search.gjs b/app/assets/javascripts/discourse/app/templates/full-page-search.gjs
index e13ecc4eb82..9dc7b3d9f51 100644
--- a/app/assets/javascripts/discourse/app/templates/full-page-search.gjs
+++ b/app/assets/javascripts/discourse/app/templates/full-page-search.gjs
@@ -1,314 +1,361 @@
-{{#if this.loading}}
- {{hide-application-footer}}
-{{/if}}
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import RouteTemplate from "ember-route-template";
+import { or } from "truth-helpers";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import GoogleSearch from "discourse/components/google-search";
+import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import SearchAdvancedOptions from "discourse/components/search-advanced-options";
+import SearchResultEntries from "discourse/components/search-result-entries";
+import SearchTextField from "discourse/components/search-text-field";
+import TopicBulkSelectDropdown from "discourse/components/topic-list/topic-bulk-select-dropdown";
+import UserLink from "discourse/components/user-link";
+import avatar from "discourse/helpers/avatar";
+import bodyClass from "discourse/helpers/body-class";
+import categoryLink from "discourse/helpers/category-link";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlSafe from "discourse/helpers/html-safe";
+import loadingSpinner from "discourse/helpers/loading-spinner";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
-{{body-class "search-page"}}
+export default RouteTemplate(
+ <template>
+ {{#if @controller.loading}}
+ {{hideApplicationFooter}}
+ {{/if}}
-<section class="search-container">
- <PluginOutlet
- @name="full-page-search-above-search-header"
- @connectorTagName="div"
- @outletArgs={{hash searchTerm=this.searchTerm}}
- />
- <div class="search-header" role="search">
- <h1 class="search-page-heading">
- {{#if this.hasResults}}
- <div class="result-count" id="search-result-count" aria-live="polite">
- {{html-safe this.resultCountLabel}}
- </div>
- {{else}}
- <div class="search-page-heading__page-title">
- {{i18n "search.full_page_title"}}
- </div>
- {{/if}}
- </h1>
- <div class="search-bar">
- <SearchTextField
- @value={{this.searchTerm}}
- @aria-label={{i18n "search.search_term_label"}}
- @enter={{action "search" (hash collapseFilters=true)}}
- @hasAutofocus={{this.hasAutofocus}}
- @aria-controls="search-result-count"
- type="search"
- class="full-page-search search no-blur search-query"
- />
- <ComboBox
- @id="search-type"
- @value={{this.search_type}}
- @content={{this.searchTypes}}
- @onChange={{fn (mut this.search_type)}}
- @options={{hash castInteger=true}}
- />
- <DButton
- @action={{fn (action "search") (hash collapseFilters=true)}}
- @icon="magnifying-glass"
- @label="search.search_button"
- @ariaLabel="search.search_button"
- @disabled={{this.searchButtonDisabled}}
- class="btn-primary search-cta"
+ {{bodyClass "search-page"}}
+
+ <section class="search-container">
+ <PluginOutlet
+ @name="full-page-search-above-search-header"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
- </div>
- {{#if this.usingDefaultSearchType}}
- {{! context is only provided when searching from mobile view }}
- {{#if this.context}}
- <div class="search-context">
- <label>
- <Input
- @type="checkbox"
- name="searchContext"
- @checked={{this.searchContextEnabled}}
- />
- {{this.searchContextDescription}}
- </label>
+ <div class="search-header" role="search">
+ <h1 class="search-page-heading">
+ {{#if @controller.hasResults}}
+ <div
+ class="result-count"
+ id="search-result-count"
+ aria-live="polite"
+ >
+ {{htmlSafe @controller.resultCountLabel}}
+ </div>
+ {{else}}
+ <div class="search-page-heading__page-title">
+ {{i18n "search.full_page_title"}}
+ </div>
+ {{/if}}
+ </h1>
+ <div class="search-bar">
+ <SearchTextField
+ @value={{@controller.searchTerm}}
+ @aria-label={{i18n "search.search_term_label"}}
+ @enter={{fn @controller.search (hash collapseFilters=true)}}
+ @hasAutofocus={{@controller.hasAutofocus}}
+ @aria-controls="search-result-count"
+ type="search"
+ class="full-page-search search no-blur search-query"
+ />
+ <ComboBox
+ @id="search-type"
+ @value={{@controller.search_type}}
+ @content={{@controller.searchTypes}}
+ @onChange={{fn (mut @controller.search_type)}}
+ @options={{hash castInteger=true}}
+ />
+ <DButton
+ @action={{fn @controller.search (hash collapseFilters=true)}}
+ @icon="magnifying-glass"
+ @label="search.search_button"
+ @ariaLabel="search.search_button"
+ @disabled={{@controller.searchButtonDisabled}}
+ class="btn-primary search-cta"
+ />
</div>
- {{/if}}
+ {{#if @controller.usingDefaultSearchType}}
+ {{! context is only provided when searching from mobile view }}
+ {{#if @controller.context}}
+ <div class="search-context">
+ <label>
+ <Input
+ @type="checkbox"
+ name="searchContext"
+ @checked={{@controller.searchContextEnabled}}
+ />
+ {{@controller.searchContextDescription}}
+ </label>
+ </div>
+ {{/if}}
- <div class="search-filters">
- <PluginOutlet
- @name="full-page-search-filters"
- @outletArgs={{hash
- searchTerm=(readonly this.searchTerm)
- onChangeSearchTerm=(fn (mut this.searchTerm))
- search=(action "search" (hash collapseFilters=true))
- searchButtonDisabled=this.searchButtonDisabled
- expandFilters=this.expandFilters
- sortOrder=this.sortOrder
- sortOrderOptions=this.sortOrders
- setSortOrder=this.setSortOrder
- type=this.search_type
- addSearchResults=this.addSearchResults
- resultCount=this.resultCount
- }}
- >
- <SearchAdvancedOptions
- @searchTerm={{readonly this.searchTerm}}
- @onChangeSearchTerm={{fn (mut this.searchTerm)}}
- @search={{action "search" (hash collapseFilters=true)}}
- @searchButtonDisabled={{this.searchButtonDisabled}}
- @expandFilters={{this.expandFilters}}
- />
- </PluginOutlet>
- </div>
- {{/if}}
+ <div class="search-filters">
+ <PluginOutlet
+ @name="full-page-search-filters"
+ @outletArgs={{hash
+ searchTerm=(readonly @controller.searchTerm)
+ onChangeSearchTerm=(fn (mut @controller.searchTerm))
+ search=(fn @controller.search (hash collapseFilters=true))
+ }}
+ >
+ <SearchAdvancedOptions
+ @searchTerm={{readonly @controller.searchTerm}}
+ @onChangeSearchTerm={{fn (mut @controller.searchTerm)}}
+ @search={{fn @controller.search (hash collapseFilters=true)}}
+ @searchButtonDisabled={{@controller.searchButtonDisabled}}
+ @expandFilters={{@controller.expandFilters}}
+ />
+ </PluginOutlet>
+ </div>
+ {{/if}}
- <div class="search-notice">
- {{#if this.invalidSearch}}
- <div class="fps-invalid">
- {{i18n "search.too_short"}}
+ <div class="search-notice">
+ {{#if @controller.invalidSearch}}
+ <div class="fps-invalid">
+ {{i18n "search.too_short"}}
+ </div>
+ {{/if}}
</div>
- {{/if}}
- </div>
- </div>
+ </div>
- <div class="search-advanced">
- <PluginOutlet
- @name="full-page-search-below-search-header"
- @connectorTagName="div"
- @outletArgs={{hash
- search=this.searchTerm
- type=this.search_type
- model=this.model
- addSearchResults=this.addSearchResults
- sortOrder=this.sortOrder
- }}
- />
+ <div class="search-advanced">
+ <PluginOutlet
+ @name="full-page-search-below-search-header"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
- {{#if this.hasResults}}
- {{#if this.usingDefaultSearchType}}
- <div
- class={{this.searchInfoClassNames}}
- role="region"
- ariaLabel={{i18n "search.sort_or_bulk_actions"}}
- >
- {{#if this.canBulkSelect}}
- <DButton
- @icon="list"
- @title="topics.bulk.toggle"
- @action={{action "toggleBulkSelect"}}
- class="btn-default bulk-select"
- />
- {{#if this.bulkSelectHelper.selected}}
- <TopicList::TopicBulkSelectDropdown
- @bulkSelectHelper={{this.bulkSelectHelper}}
- @afterBulkActionComplete={{this.afterBulkActionComplete}}
- />
- {{/if}}
- {{/if}}
+ {{#if @controller.hasResults}}
+ {{#if @controller.usingDefaultSearchType}}
+ <div
+ class={{@controller.searchInfoClassNames}}
+ role="region"
+ ariaLabel={{i18n "search.sort_or_bulk_actions"}}
+ >
+ {{#if @controller.canBulkSelect}}
+ <DButton
+ @icon="list"
+ @title="topics.bulk.toggle"
+ @action={{@controller.toggleBulkSelect}}
+ class="btn-default bulk-select"
+ />
+ {{#if @controller.bulkSelectHelper.selected}}
+ <TopicBulkSelectDropdown
+ @bulkSelectHelper={{@controller.bulkSelectHelper}}
+ @afterBulkActionComplete={{@controller.afterBulkActionComplete}}
+ />
+ {{/if}}
+ {{/if}}
- {{#if this.bulkSelectEnabled}}
- {{#if this.hasUnselectedResults}}
- <DButton
- @icon="square-check"
- @action={{action "selectAll"}}
- @label="search.select_all"
- class="btn-default bulk-select-all"
- />
- {{/if}}
+ {{#if @controller.bulkSelectEnabled}}
+ {{#if @controller.hasUnselectedResults}}
+ <DButton
+ @icon="square-check"
+ @action={{@controller.selectAll}}
+ @label="search.select_all"
+ class="btn-default bulk-select-all"
+ />
+ {{/if}}
- {{#if this.hasSelection}}
- <DButton
- @icon="far-square"
- @action={{action "clearAll"}}
- @label="search.clear_all"
- class="btn-default bulk-select-clear"
- />
- {{/if}}
+ {{#if @controller.hasSelection}}
+ <DButton
+ @icon="far-square"
+ @action={{@controller.clearAll}}
+ @label="search.clear_all"
+ class="btn-default bulk-select-clear"
+ />
+ {{/if}}
+ {{/if}}
+
+ <div class="sort-by inline-form">
+ <label>
+ {{i18n "search.sort_by"}}
+ </label>
+ <ComboBox
+ @value={{@controller.sortOrder}}
+ @content={{@controller.sortOrders}}
+ @onChange={{@controller.setSortOrder}}
+ @id="search-sort-by"
+ @options={{hash castInteger=true}}
+ />
+ </div>
+ </div>
{{/if}}
+ {{/if}}
- <div class="sort-by inline-form">
- <label>
- {{i18n "search.sort_by"}}
- </label>
- <ComboBox
- @value={{this.sortOrder}}
- @content={{this.sortOrders}}
- @onChange={{this.setSortOrder}}
- @id="search-sort-by"
- @options={{hash castInteger=true}}
- />
- </div>
- </div>
- {{/if}}
- {{/if}}
+ <span>
+ <PluginOutlet
+ @name="full-page-search-below-search-info"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
- <span>
- <PluginOutlet
- @name="full-page-search-below-search-info"
- @connectorTagName="div"
- @outletArgs={{hash search=this.searchTerm}}
- />
- </span>
+ {{#if @controller.searching}}
+ {{loadingSpinner size="medium"}}
+ {{else}}
+ <div class="search-results" role="region">
+ <LoadMore @selector=".fps-result" @action={{@controller.loadMore}}>
+ {{#if
+ (or
+ @controller.usingDefaultSearchType
+ @controller.customSearchType
+ )
+ }}
+ <SearchResultEntries
+ @posts={{@controller.searchResultPosts}}
+ @bulkSelectEnabled={{@controller.bulkSelectEnabled}}
+ @selected={{@controller.bulkSelectHelper.selected}}
+ @highlightQuery={{@controller.highlightQuery}}
+ @searchLogId={{@controller.model.grouped_search_result.search_log_id}}
+ />
- {{#if this.searching}}
- {{loading-spinner size="medium"}}
- {{else}}
- <div class="search-results" role="region">
- <LoadMore @selector=".fps-result" @action={{action "loadMore"}}>
- {{#if (or this.usingDefaultSearchType this.customSearchType)}}
- <SearchResultEntries
- @posts={{this.searchResultPosts}}
- @bulkSelectEnabled={{this.bulkSelectEnabled}}
- @selected={{this.bulkSelectHelper.selected}}
- @highlightQuery={{this.highlightQuery}}
- @searchLogId={{this.model.grouped_search_result.search_log_id}}
- />
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.error}}
+ <div class="warning">
+ {{@controller.error}}
+ </div>
+ {{/if}}
- <ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.error}}
- <div class="warning">
- {{this.error}}
- </div>
- {{/if}}
+ {{#unless @controller.hasResults}}
+ {{#if @controller.searchActive}}
+ <div class="no-results-container">
+ <h3>{{i18n "search.no_results"}}</h3>
- {{#unless this.hasResults}}
- {{#if this.searchActive}}
- <div class="no-results-container">
- <h3>{{i18n "search.no_results"}}</h3>
+ {{#if @controller.showSuggestion}}
+ <div class="no-results-suggestion">
+ {{i18n "search.cant_find"}}
+ {{#if @controller.canCreateTopic}}
+ <a
+ href
+ {{on
+ "click"
+ (fn
+ @controller.createTopic
+ @controller.searchTerm
+ )
+ }}
+ >{{i18n "search.start_new_topic"}}</a>
+ {{#unless
+ @controller.siteSettings.login_required
+ }}
+ {{i18n "search.or_search_google"}}
+ {{/unless}}
+ {{else}}
+ {{i18n "search.search_google"}}
+ {{/if}}
+ </div>
- {{#if this.showSuggestion}}
- <div class="no-results-suggestion">
- {{i18n "search.cant_find"}}
- {{#if this.canCreateTopic}}
- <a
- href
- {{on "click" (fn this.createTopic this.searchTerm)}}
- >{{i18n "search.start_new_topic"}}</a>
- {{#unless this.siteSettings.login_required}}
- {{i18n "search.or_search_google"}}
- {{/unless}}
- {{else}}
- {{i18n "search.search_google"}}
+ <GoogleSearch
+ @searchTerm={{@controller.searchTerm}}
+ />
{{/if}}
</div>
-
- <GoogleSearch @searchTerm={{this.searchTerm}} />
{{/if}}
- </div>
- {{/if}}
- {{/unless}}
+ {{/unless}}
- {{#if this.hasResults}}
- <h3 class="search-footer">
- {{#if
- this.model.grouped_search_result.more_full_page_results
- }}
- {{#if this.isLastPage}}
- {{i18n "search.more_results"}}
- {{/if}}
- {{else}}
- {{i18n "search.no_more_results"}}
- {{/if}}
- </h3>
- {{/if}}
- </ConditionalLoadingSpinner>
- {{else}}
- <ConditionalLoadingSpinner @condition={{this.loading}}>
- {{#if this.hasResults}}
- {{#if this.model.categories.length}}
- <h4 class="category-heading">
- {{i18n "search.categories"}}
- </h4>
- <div class="category-items">
- {{#each this.model.categories as |category|}}
- {{category-link
- category
- extraClasses="fps-category-item"
+ {{#if @controller.hasResults}}
+ <h3 class="search-footer">
+ {{#if
+ @controller.model.grouped_search_result.more_full_page_results
}}
- {{/each}}
- </div>
- {{/if}}
+ {{#if @controller.isLastPage}}
+ {{i18n "search.more_results"}}
+ {{/if}}
+ {{else}}
+ {{i18n "search.no_more_results"}}
+ {{/if}}
+ </h3>
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ {{else}}
+ <ConditionalLoadingSpinner @condition={{@controller.loading}}>
+ {{#if @controller.hasResults}}
+ {{#if @controller.model.categories.length}}
+ <h4 class="category-heading">
+ {{i18n "search.categories"}}
+ </h4>
+ <div class="category-items">
+ {{#each @controller.model.categories as |category|}}
+ {{categoryLink
+ category
+ extraClasses="fps-category-item"
+ }}
+ {{/each}}
+ </div>
+ {{/if}}
- {{#if this.model.tags.length}}
- <h4 class="tag-heading">
- {{i18n "search.tags"}}
- </h4>
+ {{#if @controller.model.tags.length}}
+ <h4 class="tag-heading">
+ {{i18n "search.tags"}}
+ </h4>
- <div class="tag-items">
- {{#each this.model.tags as |tag|}}
- <div class="fps-tag-item">
- <a href={{tag.url}}>
- {{tag.id}}
- </a>
+ <div class="tag-items">
+ {{#each @controller.model.tags as |tag|}}
+ <div class="fps-tag-item">
+ <a href={{tag.url}}>
+ {{tag.id}}
+ </a>
+ </div>
+ {{/each}}
</div>
- {{/each}}
- </div>
- {{/if}}
+ {{/if}}
- {{#if this.model.users}}
- <div class="user-items">
- {{#each this.model.users as |user|}}
- <UserLink @user={{user}} class="fps-user-item">
- {{avatar user imageSize="large"}}
+ {{#if @controller.model.users}}
+ <div class="user-items">
+ {{#each @controller.model.users as |user|}}
+ <UserLink @user={{user}} class="fps-user-item">
+ {{avatar user imageSize="large"}}
- <div class="user-titles">
- {{#if user.name}}
- <span class="name">
- {{user.name}}
- </span>
- {{/if}}
+ <div class="user-titles">
+ {{#if user.name}}
+ <span class="name">
+ {{user.name}}
+ </span>
+ {{/if}}
- <span class="username">
- {{user.username}}
- </span>
- </div>
- </UserLink>
- {{/each}}
- </div>
- {{/if}}
- {{else}}
- {{#if this.searchActive}}
- <h3>{{i18n "search.no_results"}}</h3>
- {{/if}}
+ <span class="username">
+ {{user.username}}
+ </span>
+ </div>
+ </UserLink>
+ {{/each}}
+ </div>
+ {{/if}}
+ {{else}}
+ {{#if @controller.searchActive}}
+ <h3>{{i18n "search.no_results"}}</h3>
+ {{/if}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
{{/if}}
- </ConditionalLoadingSpinner>
- {{/if}}
- <PluginOutlet
- @name="full-page-search-below-results"
- @outletArgs={{hash canLoadMore=this.canLoadMore}}
- />
- </LoadMore>
+ <PluginOutlet
+ @name="full-page-search-below-results"
+ @outletArgs={{hash [email protected]}}
+ />
+ </LoadMore>
+ </div>
+ {{/if}}
</div>
- {{/if}}
- </div>
-</section>
\ No newline at end of file
+ </section>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/group/manage/categories.gjs b/app/assets/javascripts/discourse/app/templates/group/manage/categories.gjs
index 6000e120379..336574e65d8 100644
--- a/app/assets/javascripts/discourse/app/templates/group/manage/categories.gjs
+++ b/app/assets/javascripts/discourse/app/templates/group/manage/categories.gjs
@@ -1,87 +1,98 @@
-<form class="groups-form form-vertical groups-notifications-form">
- <div class="control-group">
- <label class="control-label">{{i18n
- "groups.manage.categories.long_title"
- }}</label>
- <div>{{i18n "groups.manage.categories.description"}}</div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-watching"}}
- {{i18n "groups.notifications.watching.title"}}</label>
-
- <CategorySelector
- @categories={{this.model.watchingCategories}}
- @blockedCategories={{this.selectedCategories}}
- @onChange={{fn (mut this.model.watchingCategories)}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.categories.watched_categories_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-tracking"}}
- {{i18n "groups.notifications.tracking.title"}}</label>
-
- <CategorySelector
- @categories={{this.model.trackingCategories}}
- @blockedCategories={{this.selectedCategories}}
- @onChange={{fn (mut this.model.trackingCategories)}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.categories.tracked_categories_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-watching-first"}}
- {{i18n "groups.notifications.watching_first_post.title"}}</label>
-
- <CategorySelector
- @categories={{this.model.watchingFirstPostCategories}}
- @blockedCategories={{this.selectedCategories}}
- @onChange={{fn (mut this.model.watchingFirstPostCategories)}}
- />
-
- <div class="control-instructions">
- {{i18n
- "groups.manage.categories.watching_first_post_categories_instructions"
- }}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-regular"}}
- {{i18n "groups.notifications.regular.title"}}</label>
-
- <CategorySelector
- @categories={{this.model.regularCategories}}
- @blockedCategories={{this.selectedCategories}}
- @onChange={{fn (mut this.model.regularCategories)}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.categories.regular_categories_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-muted"}}
- {{i18n "groups.notifications.muted.title"}}</label>
-
- <CategorySelector
- @categories={{this.model.mutedCategories}}
- @blockedCategories={{this.selectedCategories}}
- @onChange={{fn (mut this.model.mutedCategories)}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.categories.muted_categories_instructions"}}
- </div>
- </div>
-
- <GroupManageSaveButton @model={{this.model}} />
-</form>
\ No newline at end of file
+import { fn } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import GroupManageSaveButton from "discourse/components/group-manage-save-button";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import CategorySelector from "select-kit/components/category-selector";
+
+export default RouteTemplate(
+ <template>
+ <form class="groups-form form-vertical groups-notifications-form">
+ <div class="control-group">
+ <label class="control-label">{{i18n
+ "groups.manage.categories.long_title"
+ }}</label>
+ <div>{{i18n "groups.manage.categories.description"}}</div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-watching"}}
+ {{i18n "groups.notifications.watching.title"}}</label>
+
+ <CategorySelector
+ @categories={{@controller.model.watchingCategories}}
+ @blockedCategories={{@controller.selectedCategories}}
+ @onChange={{fn (mut @controller.model.watchingCategories)}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.categories.watched_categories_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-tracking"}}
+ {{i18n "groups.notifications.tracking.title"}}</label>
+
+ <CategorySelector
+ @categories={{@controller.model.trackingCategories}}
+ @blockedCategories={{@controller.selectedCategories}}
+ @onChange={{fn (mut @controller.model.trackingCategories)}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.categories.tracked_categories_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-watching-first"}}
+ {{i18n "groups.notifications.watching_first_post.title"}}</label>
+
+ <CategorySelector
+ @categories={{@controller.model.watchingFirstPostCategories}}
+ @blockedCategories={{@controller.selectedCategories}}
+ @onChange={{fn (mut @controller.model.watchingFirstPostCategories)}}
+ />
+
+ <div class="control-instructions">
+ {{i18n
+ "groups.manage.categories.watching_first_post_categories_instructions"
+ }}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-regular"}}
+ {{i18n "groups.notifications.regular.title"}}</label>
+
+ <CategorySelector
+ @categories={{@controller.model.regularCategories}}
+ @blockedCategories={{@controller.selectedCategories}}
+ @onChange={{fn (mut @controller.model.regularCategories)}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.categories.regular_categories_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-muted"}}
+ {{i18n "groups.notifications.muted.title"}}</label>
+
+ <CategorySelector
+ @categories={{@controller.model.mutedCategories}}
+ @blockedCategories={{@controller.selectedCategories}}
+ @onChange={{fn (mut @controller.model.mutedCategories)}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.categories.muted_categories_instructions"}}
+ </div>
+ </div>
+
+ <GroupManageSaveButton @model={{@controller.model}} />
+ </form>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/group/manage/tags.gjs b/app/assets/javascripts/discourse/app/templates/group/manage/tags.gjs
index 5635b458422..39b8ec646c2 100644
--- a/app/assets/javascripts/discourse/app/templates/group/manage/tags.gjs
+++ b/app/assets/javascripts/discourse/app/templates/group/manage/tags.gjs
@@ -1,102 +1,114 @@
-<form class="groups-form form-vertical groups-notifications-form">
-
- <PluginOutlet
- @name="before-manage-group-tags"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-
- <div class="control-group">
- <label class="control-label">{{i18n
- "groups.manage.tags.long_title"
- }}</label>
- <div>{{i18n "groups.manage.tags.description"}}</div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-watching"}}
- {{i18n "groups.notifications.watching.title"}}</label>
-
- <TagChooser
- @tags={{this.model.watching_tags}}
- @blockedTags={{this.selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.tags.watched_tags_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-tracking"}}
- {{i18n "groups.notifications.tracking.title"}}</label>
-
- <TagChooser
- @tags={{this.model.tracking_tags}}
- @blockedTags={{this.selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.tags.tracked_tags_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-watching-first"}}
- {{i18n "groups.notifications.watching_first_post.title"}}</label>
-
- <TagChooser
- @tags={{this.model.watching_first_post_tags}}
- @blockedTags={{this.selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.tags.watching_first_post_tags_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-regular"}}
- {{i18n "groups.notifications.regular.title"}}</label>
-
- <TagChooser
- @tags={{this.model.regular_tags}}
- @blockedTags={{this.selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.tags.regular_tags_instructions"}}
- </div>
- </div>
-
- <div class="control-group">
- <label>{{d-icon "d-muted"}}
- {{i18n "groups.notifications.muted.title"}}</label>
-
- <TagChooser
- @tags={{this.model.muted_tags}}
- @blockedTags={{this.selectedTags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @options={{hash allowAny=false}}
- />
-
- <div class="control-instructions">
- {{i18n "groups.manage.tags.muted_tags_instructions"}}
- </div>
- </div>
-
- <GroupManageSaveButton @model={{this.model}} />
-</form>
\ No newline at end of file
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import GroupManageSaveButton from "discourse/components/group-manage-save-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import TagChooser from "select-kit/components/tag-chooser";
+
+export default RouteTemplate(
+ <template>
+ <form class="groups-form form-vertical groups-notifications-form">
+
+ <PluginOutlet
+ @name="before-manage-group-tags"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+
+ <div class="control-group">
+ <label class="control-label">{{i18n
+ "groups.manage.tags.long_title"
+ }}</label>
+ <div>{{i18n "groups.manage.tags.description"}}</div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-watching"}}
+ {{i18n "groups.notifications.watching.title"}}</label>
+
+ <TagChooser
+ @tags={{@controller.model.watching_tags}}
+ @blockedTags={{@controller.selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.tags.watched_tags_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-tracking"}}
+ {{i18n "groups.notifications.tracking.title"}}</label>
+
+ <TagChooser
+ @tags={{@controller.model.tracking_tags}}
+ @blockedTags={{@controller.selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.tags.tracked_tags_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-watching-first"}}
+ {{i18n "groups.notifications.watching_first_post.title"}}</label>
+
+ <TagChooser
+ @tags={{@controller.model.watching_first_post_tags}}
+ @blockedTags={{@controller.selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.tags.watching_first_post_tags_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-regular"}}
+ {{i18n "groups.notifications.regular.title"}}</label>
+
+ <TagChooser
+ @tags={{@controller.model.regular_tags}}
+ @blockedTags={{@controller.selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.tags.regular_tags_instructions"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label>{{icon "d-muted"}}
+ {{i18n "groups.notifications.muted.title"}}</label>
+
+ <TagChooser
+ @tags={{@controller.model.muted_tags}}
+ @blockedTags={{@controller.selectedTags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @options={{hash allowAny=false}}
+ />
+
+ <div class="control-instructions">
+ {{i18n "groups.manage.tags.muted_tags_instructions"}}
+ </div>
+ </div>
+
+ <GroupManageSaveButton @model={{@controller.model}} />
+ </form>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/groups/index.gjs b/app/assets/javascripts/discourse/app/templates/groups/index.gjs
index 3784ad45fc5..4f0d6a8de83 100644
--- a/app/assets/javascripts/discourse/app/templates/groups/index.gjs
+++ b/app/assets/javascripts/discourse/app/templates/groups/index.gjs
@@ -1,130 +1,164 @@
-{{#if (or this.loading this.groups.canLoadMore)}}
- {{hide-application-footer}}
-{{/if}}
+import { Input } from "@ember/component";
+import { fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import { or } from "truth-helpers";
+import AvatarFlair from "discourse/components/avatar-flair";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import GroupInfo from "discourse/components/group-info";
+import GroupMembershipButton from "discourse/components/group-membership-button";
+import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import bodyClass from "discourse/helpers/body-class";
+import icon from "discourse/helpers/d-icon";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlSafe from "discourse/helpers/html-safe";
+import routeAction from "discourse/helpers/route-action";
+import withEventValue from "discourse/helpers/with-event-value";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
-{{body-class "groups-page"}}
-
-<PluginOutlet @name="before-groups-index-container" @connectorTagName="div" />
-
-<section class="container groups-index">
- <div class="groups-header">
- {{#if this.currentUser.can_create_group}}
- <DButton
- @action={{this.new}}
- @icon="plus"
- @label="admin.groups.new.title"
- class="btn-default groups-header-new pull-right"
- />
+export default RouteTemplate(
+ <template>
+ {{#if (or @controller.loading @controller.groups.canLoadMore)}}
+ {{hideApplicationFooter}}
{{/if}}
- <div class="groups-header-filters">
- <Input
- @value={{readonly this.filter}}
- placeholder={{i18n "groups.index.all"}}
- class="groups-header-filters-name no-blur"
- {{on "input" (with-event-value this.onFilterChanged)}}
- @type="search"
- aria-description={{i18n "groups.index.search_results"}}
- />
+ {{bodyClass "groups-page"}}
- <ComboBox
- @value={{this.type}}
- @content={{this.types}}
- @onChange={{fn (mut this.type)}}
- @options={{hash clearable=true none="groups.index.filter"}}
- class="groups-header-filters-type"
- />
- </div>
- </div>
+ <PluginOutlet
+ @name="before-groups-index-container"
+ @connectorTagName="div"
+ />
- {{#if this.groups}}
- <LoadMore
- @selector=".groups-boxes .group-box"
- @action={{action "loadMore"}}
- >
- <div class="container">
- <div class="groups-boxes">
- {{#each this.groups as |group|}}
- <LinkTo
- @route="group.members"
- @model={{group.name}}
- class="group-box"
- data-group-name={{group.name}}
- >
- <div class="group-box-inner">
- <div class="group-info-wrapper">
- {{#if group.flair_url}}
- <span class="group-avatar-flair">
- <AvatarFlair
- @flairName={{group.name}}
- @flairUrl={{group.flair_url}}
- @flairBgColor={{group.flair_bg_color}}
- @flairColor={{group.flair_color}}
- />
- </span>
- {{/if}}
+ <section class="container groups-index">
+ <div class="groups-header">
+ {{#if @controller.currentUser.can_create_group}}
+ <DButton
+ @action={{@controller.new}}
+ @icon="plus"
+ @label="admin.groups.new.title"
+ class="btn-default groups-header-new pull-right"
+ />
+ {{/if}}
- <span class="group-info">
- <GroupInfo @group={{group}} />
- <div class="group-user-count">{{d-icon
- "user"
- }}{{group.user_count}}</div>
- </span>
- </div>
+ <div class="groups-header-filters">
+ <Input
+ @value={{readonly @controller.filter}}
+ placeholder={{i18n "groups.index.all"}}
+ class="groups-header-filters-name no-blur"
+ {{on "input" (withEventValue @controller.onFilterChanged)}}
+ @type="search"
+ aria-description={{i18n "groups.index.search_results"}}
+ />
- <div class="group-description">{{html-safe
- group.bio_excerpt
- }}</div>
+ <ComboBox
+ @value={{@controller.type}}
+ @content={{@controller.types}}
+ @onChange={{fn (mut @controller.type)}}
+ @options={{hash clearable=true none="groups.index.filter"}}
+ class="groups-header-filters-type"
+ />
+ </div>
+ </div>
- <div class="group-membership">
- <GroupMembershipButton
- @tagName=""
- @model={{group}}
- @showLogin={{route-action "showLogin"}}
- >
- {{#if group.is_group_owner}}
- <span class="is-group-owner">
- {{d-icon "shield-halved"}}
- {{i18n "groups.index.is_group_owner"}}
- </span>
- {{else if group.is_group_user}}
- <span class="is-group-member">
- {{d-icon "check"}}
- {{i18n "groups.index.is_group_user"}}
- </span>
- {{else if group.public_admission}}
- {{i18n "groups.index.public"}}
- {{else if group.isPrivate}}
- {{d-icon "far-eye-slash"}}
- {{i18n "groups.index.private"}}
- {{else}}
- {{#if group.automatic}}
- {{i18n "groups.index.automatic"}}
- {{else}}
- {{d-icon "ban"}}
- {{i18n "groups.index.closed"}}
+ {{#if @controller.groups}}
+ <LoadMore
+ @selector=".groups-boxes .group-box"
+ @action={{@controller.loadMore}}
+ >
+ <div class="container">
+ <div class="groups-boxes">
+ {{#each @controller.groups as |group|}}
+ <LinkTo
+ @route="group.members"
+ @model={{group.name}}
+ class="group-box"
+ data-group-name={{group.name}}
+ >
+ <div class="group-box-inner">
+ <div class="group-info-wrapper">
+ {{#if group.flair_url}}
+ <span class="group-avatar-flair">
+ <AvatarFlair
+ @flairName={{group.name}}
+ @flairUrl={{group.flair_url}}
+ @flairBgColor={{group.flair_bg_color}}
+ @flairColor={{group.flair_color}}
+ />
+ </span>
{{/if}}
- {{/if}}
- </GroupMembershipButton>
- <span>
- <PluginOutlet
- @name="group-index-box-after"
- @connectorTagName="div"
- @outletArgs={{hash model=group}}
- />
- </span>
- </div>
- </div>
- </LinkTo>
- {{/each}}
- </div>
- </div>
- </LoadMore>
- <ConditionalLoadingSpinner @condition={{this.groups.loadingMore}} />
- {{else}}
- <p role="status">{{i18n "groups.index.empty"}}</p>
- {{/if}}
-</section>
+ <span class="group-info">
+ <GroupInfo @group={{group}} />
+ <div class="group-user-count">{{icon
+ "user"
+ }}{{group.user_count}}</div>
+ </span>
+ </div>
+
+ <div class="group-description">{{htmlSafe
+ group.bio_excerpt
+ }}</div>
+
+ <div class="group-membership">
+ <GroupMembershipButton
+ @tagName=""
+ @model={{group}}
+ @showLogin={{routeAction "showLogin"}}
+ >
+ {{#if group.is_group_owner}}
+ <span class="is-group-owner">
+ {{icon "shield-halved"}}
+ {{i18n "groups.index.is_group_owner"}}
+ </span>
+ {{else if group.is_group_user}}
+ <span class="is-group-member">
+ {{icon "check"}}
+ {{i18n "groups.index.is_group_user"}}
+ </span>
+ {{else if group.public_admission}}
+ {{i18n "groups.index.public"}}
+ {{else if group.isPrivate}}
+ {{icon "far-eye-slash"}}
+ {{i18n "groups.index.private"}}
+ {{else}}
+ {{#if group.automatic}}
+ {{i18n "groups.index.automatic"}}
+ {{else}}
+ {{icon "ban"}}
+ {{i18n "groups.index.closed"}}
+ {{/if}}
+ {{/if}}
+ </GroupMembershipButton>
+
+ <span>
+ <PluginOutlet
+ @name="group-index-box-after"
+ @connectorTagName="div"
+ @outletArgs={{hash model=group}}
+ />
+ </span>
+ </div>
+ </div>
+ </LinkTo>
+ {{/each}}
+ </div>
+ </div>
+ </LoadMore>
+ <ConditionalLoadingSpinner
+ @condition={{@controller.groups.loadingMore}}
+ />
+ {{else}}
+ <p role="status">{{i18n "groups.index.empty"}}</p>
+ {{/if}}
+ </section>
-<PluginOutlet @name="after-groups-index-container" @connectorTagName="div" />
\ No newline at end of file
+ <PluginOutlet
+ @name="after-groups-index-container"
+ @connectorTagName="div"
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/groups/new.gjs b/app/assets/javascripts/discourse/app/templates/groups/new.gjs
index 131d4ed8f5c..f6a27ead78f 100644
--- a/app/assets/javascripts/discourse/app/templates/groups/new.gjs
+++ b/app/assets/javascripts/discourse/app/templates/groups/new.gjs
@@ -1,56 +1,74 @@
-{{body-class "groups-new-page"}}
-
-<section>
- <h1>{{i18n "admin.groups.new.title"}}</h1>
-
- <hr />
-
- <form class="groups-form form-vertical">
- <GroupsFormProfileFields @model={{this.model}} @disableSave={{this.saving}}>
- <div class="control-group">
- <label class="control-label" for="owner-selector">{{i18n
- "admin.groups.add_owners"
- }}</label>
-
- <EmailGroupUserChooser
- @id="owner-selector"
- @value={{this.splitOwnerUsernames}}
- @onChange={{action "updateOwnerUsernames"}}
- @options={{hash filterPlaceholder="groups.selector_placeholder"}}
- class="input-xxlarge"
- />
- </div>
-
- <div class="control-group">
- <label class="control-label" for="member-selector">{{i18n
- "groups.members.title"
- }}</label>
-
- <EmailGroupUserChooser
- @id="member-selector"
- @value={{this.splitUsernames}}
- @onChange={{action "updateUsernames"}}
- @options={{hash filterPlaceholder="groups.selector_placeholder"}}
- class="input-xxlarge"
- />
- </div>
- </GroupsFormProfileFields>
-
- <GroupsFormMembershipFields @model={{this.model}} />
- <GroupsFormInteractionFields @model={{this.model}} />
-
- <div class="control-group buttons">
- <DButton
- @action={{this.save}}
- @disabled={{this.saving}}
- @label="admin.groups.new.create"
- type="submit"
- class="btn-primary group-form-save"
- />
-
- <LinkTo @route="groups">
- {{i18n "cancel"}}
- </LinkTo>
- </div>
- </form>
-</section>
\ No newline at end of file
+import { hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import GroupsFormInteractionFields from "discourse/components/groups-form-interaction-fields";
+import GroupsFormMembershipFields from "discourse/components/groups-form-membership-fields";
+import GroupsFormProfileFields from "discourse/components/groups-form-profile-fields";
+import bodyClass from "discourse/helpers/body-class";
+import { i18n } from "discourse-i18n";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
+
+export default RouteTemplate(
+ <template>
+ {{bodyClass "groups-new-page"}}
+
+ <section>
+ <h1>{{i18n "admin.groups.new.title"}}</h1>
+
+ <hr />
+
+ <form class="groups-form form-vertical">
+ <GroupsFormProfileFields
+ @model={{@controller.model}}
+ @disableSave={{@controller.saving}}
+ >
+ <div class="control-group">
+ <label class="control-label" for="owner-selector">{{i18n
+ "admin.groups.add_owners"
+ }}</label>
+
+ <EmailGroupUserChooser
+ @id="owner-selector"
+ @value={{@controller.splitOwnerUsernames}}
+ @onChange={{@controller.updateOwnerUsernames}}
+ @options={{hash filterPlaceholder="groups.selector_placeholder"}}
+ class="input-xxlarge"
+ />
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="member-selector">{{i18n
+ "groups.members.title"
+ }}</label>
+
+ <EmailGroupUserChooser
+ @id="member-selector"
+ @value={{@controller.splitUsernames}}
+ @onChange={{@controller.updateUsernames}}
+ @options={{hash filterPlaceholder="groups.selector_placeholder"}}
+ class="input-xxlarge"
+ />
+ </div>
+ </GroupsFormProfileFields>
+
+ <GroupsFormMembershipFields @model={{@controller.model}} />
+ <GroupsFormInteractionFields @model={{@controller.model}} />
+
+ <div class="control-group buttons">
+ <DButton
+ @action={{@controller.save}}
+ @disabled={{@controller.saving}}
+ @label="admin.groups.new.create"
+ type="submit"
+ class="btn-primary group-form-save"
+ />
+
+ <LinkTo @route="groups">
+ {{i18n "cancel"}}
+ </LinkTo>
+ </div>
+ </form>
+ </section>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences-second-factor.gjs b/app/assets/javascripts/discourse/app/templates/preferences-second-factor.gjs
index c66df360d9f..82ea27e0c9d 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences-second-factor.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences-second-factor.gjs
@@ -58,9 +58,7 @@ export default RouteTemplate(
<TokenBasedAuthDropdown
@totp={{totp}}
@editSecondFactor={{@controller.editSecondFactor}}
- @disableSingleSecondFactor={{action
- @controller.disableSingleSecondFactor
- }}
+ @disableSingleSecondFactor={{@controller.disableSingleSecondFactor}}
/>
</div>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/account.gjs b/app/assets/javascripts/discourse/app/templates/preferences/account.gjs
index 8a8bf62a218..4587725974b 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/account.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/account.gjs
@@ -1,338 +1,373 @@
-<div class="control-group pref-username" data-setting-name="user-username">
- <label class="control-label">{{i18n "user.username.title"}}</label>
- <UsernamePreference @user={{this.model}} />
-</div>
+import { fn, get, 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 EmailDropdown from "discourse/components/email-dropdown";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import SaveControls from "discourse/components/save-controls";
+import TextField from "discourse/components/text-field";
+import UserStatusMessage from "discourse/components/user-status-message";
+import UsernamePreference from "discourse/components/username-preference";
+import boundAvatar from "discourse/helpers/bound-avatar";
+import icon from "discourse/helpers/d-icon";
+import dasherize from "discourse/helpers/dasherize";
+import routeAction from "discourse/helpers/route-action";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import FlairChooser from "select-kit/components/flair-chooser";
-{{#unless this.siteSettings.discourse_connect_overrides_avatar}}
- <div class="control-group pref-avatar" data-setting-name="user-avatar">
- <label class="control-label" id="profile-picture">{{i18n
- "user.avatar.title"
- }}</label>
- <input
- type="hidden"
- id="user-avatar-uploads"
- data-custom-avatar-upload-id={{this.model.custom_avatar_upload_id}}
- data-system-avatar-upload-id={{this.model.system_avatar_upload_id}}
- />
- <div class="controls">
- {{! we want the "huge" version even though we're downsizing it in CSS }}
- {{bound-avatar this.model "huge"}}
- <DButton
- @action={{fn (route-action "showAvatarSelector") this.model}}
- @icon="pencil"
- id="edit-avatar"
- class="btn-default pad-left"
- />
+export default RouteTemplate(
+ <template>
+ <div class="control-group pref-username" data-setting-name="user-username">
+ <label class="control-label">{{i18n "user.username.title"}}</label>
+ <UsernamePreference @user={{@controller.model}} />
</div>
- </div>
-{{/unless}}
-{{#if this.canCheckEmails}}
- <div class="control-group pref-email" data-setting-name="user-email">
- <label class="control-label">{{i18n "user.email.title"}}</label>
- {{#if this.model.email}}
- {{#if this.siteSettings.enable_secondary_emails}}
- <div class="emails">
- {{#each this.emails as |email|}}
- <div class="row email">
- <div class="email-first">{{email.email}}</div>
- <div class="email-second">
- {{#if email.primary}}
- <span class="primary">
- {{i18n "user.email.primary_label"}}
- </span>
- {{/if}}
- {{#unless email.confirmed}}
- <span class="unconfirmed">
- {{i18n "user.email.unconfirmed_label"}}
- </span>
- &bull;
- {{#if email.resending}}
- <span>{{i18n "user.email.resending_label"}}</span>
- {{else if email.resent}}
- <span>{{i18n "user.email.resent_label"}}</span>
- {{else}}
- <button
- type="button"
- class="resend-email-confirmation"
- {{on "click" (fn this.resendConfirmationEmail email)}}
- >
- {{i18n "user.email.resend_label"}}
- </button>
+ {{#unless @controller.siteSettings.discourse_connect_overrides_avatar}}
+ <div class="control-group pref-avatar" data-setting-name="user-avatar">
+ <label class="control-label" id="profile-picture">{{i18n
+ "user.avatar.title"
+ }}</label>
+ <input
+ type="hidden"
+ id="user-avatar-uploads"
+ data-custom-avatar-upload-id={{@controller.model.custom_avatar_upload_id}}
+ data-system-avatar-upload-id={{@controller.model.system_avatar_upload_id}}
+ />
+ <div class="controls">
+ {{! we want the "huge" version even though we're downsizing it in CSS }}
+ {{boundAvatar @controller.model "huge"}}
+ <DButton
+ @action={{fn (routeAction "showAvatarSelector") @controller.model}}
+ @icon="pencil"
+ id="edit-avatar"
+ class="btn-default pad-left"
+ />
+ </div>
+ </div>
+ {{/unless}}
+
+ {{#if @controller.canCheckEmails}}
+ <div class="control-group pref-email" data-setting-name="user-email">
+ <label class="control-label">{{i18n "user.email.title"}}</label>
+ {{#if @controller.model.email}}
+ {{#if @controller.siteSettings.enable_secondary_emails}}
+ <div class="emails">
+ {{#each @controller.emails as |email|}}
+ <div class="row email">
+ <div class="email-first">{{email.email}}</div>
+ <div class="email-second">
+ {{#if email.primary}}
+ <span class="primary">
+ {{i18n "user.email.primary_label"}}
+ </span>
+ {{/if}}
+ {{#unless email.confirmed}}
+ <span class="unconfirmed">
+ {{i18n "user.email.unconfirmed_label"}}
+ </span>
+ &bull;
+ {{#if email.resending}}
+ <span>{{i18n "user.email.resending_label"}}</span>
+ {{else if email.resent}}
+ <span>{{i18n "user.email.resent_label"}}</span>
+ {{else}}
+ <button
+ type="button"
+ class="resend-email-confirmation"
+ {{on
+ "click"
+ (fn @controller.resendConfirmationEmail email)
+ }}
+ >
+ {{i18n "user.email.resend_label"}}
+ </button>
+ {{/if}}
+ {{/unless}}
+ </div>
+ {{#if @controller.model.can_edit_email}}
+ <EmailDropdown
+ @email={{email}}
+ @setPrimaryEmail={{@controller.setPrimaryEmail}}
+ @destroyEmail={{@controller.destroyEmail}}
+ />
{{/if}}
- {{/unless}}
+ </div>
+ {{/each}}
+ </div>
+
+ {{#if @controller.canAddEmail}}
+ <div class="controls">
+ <LinkTo @route="preferences.email" @query={{hash new=1}}>
+ {{icon "plus"}}
+ {{i18n "user.email.add_email"}}
+ </LinkTo>
</div>
- {{#if this.model.can_edit_email}}
- <EmailDropdown
- @email={{email}}
- @setPrimaryEmail={{action "setPrimaryEmail"}}
- @destroyEmail={{action "destroyEmail"}}
- />
+ {{/if}}
+ {{else}}
+ <div class="controls">
+ <span class="static">{{@controller.model.email}}</span>
+ {{#if @controller.model.can_edit_email}}
+ <LinkTo
+ @route="preferences.email"
+ class="btn btn-default btn-small btn-icon pad-left no-text"
+ >
+ {{icon "pencil"}}
+ </LinkTo>
{{/if}}
</div>
- {{/each}}
- </div>
+ {{/if}}
+
+ <div class="instructions">
+ {{#if @controller.siteSettings.auth_overrides_email}}
+ {{i18n "user.email.auth_override_instructions"}}
+ {{/if}}
+ {{i18n "user.email.instructions"}}
+ </div>
+ {{else}}
+ <div class="controls">
+ <DButton
+ @action={{fn (routeAction "checkEmail") @controller.model}}
+ @title="admin.users.check_email.title"
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ class="btn-default"
+ />
+ </div>
+ {{/if}}
+ </div>
+ {{/if}}
- {{#if this.canAddEmail}}
+ {{#if @controller.canUpdateAssociatedAccounts}}
+ <div
+ class="control-group pref-associated-accounts"
+ data-setting-name="user-associated-accounts"
+ >
+ <label class="control-label">{{i18n
+ "user.associated_accounts.title"
+ }}</label>
+ {{#if @controller.associatedAccountsLoaded}}
+ <table>
+ <tbody>
+ {{#each @controller.authProviders as |authProvider|}}
+ {{#if authProvider.account}}
+ <tr
+ class="{{dasherize authProvider.method.name}}
+ account-connected"
+ >
+ <td>{{authProvider.method.prettyName}}</td>
+ <td>{{authProvider.account.description}}</td>
+ <td>
+ {{#if authProvider.method.can_revoke}}
+ <DButton
+ @action={{fn
+ @controller.revokeAccount
+ authProvider.account
+ }}
+ @title="user.associated_accounts.revoke"
+ @icon="trash-can"
+ @disabled={{get
+ @controller.revoking
+ authProvider.method.name
+ }}
+ class="btn-danger no-text"
+ />
+ {{/if}}
+ </td>
+ </tr>
+ {{else}}
+ <tr class={{dasherize authProvider.method.name}}>
+ <td>{{authProvider.method.prettyName}}</td>
+ <td colspan="2">
+ {{#if authProvider.method.can_connect}}
+ <DButton
+ @action={{fn
+ @controller.connectAccount
+ authProvider.method
+ }}
+ @label="user.associated_accounts.connect"
+ @icon="plug"
+ @disabled={{@controller.disableConnectButtons}}
+ class="btn-default"
+ />
+ {{else}}
+ {{i18n "user.associated_accounts.not_connected"}}
+ {{/if}}
+ </td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ </tbody>
+ </table>
+ {{else}}
<div class="controls">
- <LinkTo @route="preferences.email" @query={{hash new=1}}>
- {{d-icon "plus"}}
- {{i18n "user.email.add_email"}}
- </LinkTo>
+ <DButton
+ @action={{fn (routeAction "checkEmail") @controller.model}}
+ @title="admin.users.check_email.title"
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ />
</div>
{{/if}}
- {{else}}
+ </div>
+ {{/if}}
+
+ {{#if @controller.canEditName}}
+ <div class="control-group pref-name" data-setting-name="user-name">
+ <label class="control-label">{{i18n "user.name.title"}}</label>
<div class="controls">
- <span class="static">{{this.model.email}}</span>
- {{#if this.model.can_edit_email}}
- <LinkTo
- @route="preferences.email"
- class="btn btn-default btn-small btn-icon pad-left no-text"
- >
- {{d-icon "pencil"}}
- </LinkTo>
+ {{#if @controller.model.can_edit_name}}
+ <TextField
+ @value={{@controller.newNameInput}}
+ @classNames="input-xxlarge"
+ @maxlength="255"
+ />
+ {{else}}
+ <span class="static">{{@controller.model.name}}</span>
{{/if}}
</div>
- {{/if}}
+ <div class="instructions">
+ {{@controller.nameInstructions}}
+ </div>
+ </div>
+ {{/if}}
- <div class="instructions">
- {{#if this.siteSettings.auth_overrides_email}}
- {{i18n "user.email.auth_override_instructions"}}
- {{/if}}
- {{i18n "user.email.instructions"}}
+ {{#if @controller.canSelectTitle}}
+ <div class="control-group pref-title" data-setting-name="user-title">
+ <label class="control-label">{{i18n "user.title.title"}}</label>
+ <div class="controls">
+ <ComboBox
+ @value={{@controller.newTitleInput}}
+ @content={{@controller.model.availableTitles}}
+ @onChange={{fn (mut @controller.newTitleInput)}}
+ @options={{hash none="user.title.none"}}
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.title.instructions"}}
+ </div>
</div>
- {{else}}
- <div class="controls">
- <DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @title="admin.users.check_email.title"
- @icon="envelope"
- @label="admin.users.check_email.text"
- class="btn-default"
- />
+ {{/if}}
+
+ {{#if @controller.canSelectFlair}}
+ <div class="control-group pref-flair" data-setting-name="user-flair">
+ <label class="control-label">{{i18n "user.flair.title"}}</label>
+ <div class="controls">
+ <FlairChooser
+ @value={{@controller.newFlairGroupId}}
+ @content={{@controller.model.availableFlairs}}
+ @onChange={{fn (mut @controller.newFlairGroupId)}}
+ @options={{hash none="user.flair.none"}}
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.flair.instructions"}}
+ </div>
</div>
{{/if}}
- </div>
-{{/if}}
-{{#if this.canUpdateAssociatedAccounts}}
- <div
- class="control-group pref-associated-accounts"
- data-setting-name="user-associated-accounts"
- >
- <label class="control-label">{{i18n
- "user.associated_accounts.title"
- }}</label>
- {{#if this.associatedAccountsLoaded}}
- <table>
- <tbody>
- {{#each this.authProviders as |authProvider|}}
- {{#if authProvider.account}}
- <tr
- class="{{dasherize authProvider.method.name}} account-connected"
- >
- <td>{{authProvider.method.prettyName}}</td>
- <td>{{authProvider.account.description}}</td>
- <td>
- {{#if authProvider.method.can_revoke}}
- <DButton
- @action={{fn
- (action "revokeAccount")
- authProvider.account
- }}
- @title="user.associated_accounts.revoke"
- @icon="trash-can"
- @disabled={{get this.revoking authProvider.method.name}}
- class="btn-danger no-text"
- />
- {{/if}}
- </td>
- </tr>
- {{else}}
- <tr class={{dasherize authProvider.method.name}}>
- <td>{{authProvider.method.prettyName}}</td>
- <td colspan="2">
- {{#if authProvider.method.can_connect}}
- <DButton
- @action={{fn
- (action "connectAccount")
- authProvider.method
- }}
- @label="user.associated_accounts.connect"
- @icon="plug"
- @disabled={{this.disableConnectButtons}}
- class="btn-default"
- />
- {{else}}
- {{i18n "user.associated_accounts.not_connected"}}
- {{/if}}
- </td>
- </tr>
- {{/if}}
- {{/each}}
- </tbody>
- </table>
- {{else}}
- <div class="controls">
- <DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @title="admin.users.check_email.title"
- @icon="envelope"
- @label="admin.users.check_email.text"
- />
+ {{#if @controller.canSelectUserStatus}}
+ <div
+ class="control-group pref-user-status"
+ data-setting-name="user-status"
+ >
+ <label class="control-label">{{i18n "user.status.title"}}</label>
+ <div class="controls">
+ {{#if @controller.newStatus}}
+ <UserStatusMessage
+ @status={{@controller.newStatus}}
+ @showDescription={{true}}
+ />
+ {{else}}
+ <span class="static">{{i18n "user.status.not_set"}}</span>
+ {{/if}}
+ <DButton
+ @action={{fn @controller.showUserStatusModal @controller.newStatus}}
+ @icon="pencil"
+ class="btn-default btn-small pad-left"
+ />
+ </div>
</div>
{{/if}}
- </div>
-{{/if}}
-{{#if this.canEditName}}
- <div class="control-group pref-name" data-setting-name="user-name">
- <label class="control-label">{{i18n "user.name.title"}}</label>
- <div class="controls">
- {{#if this.model.can_edit_name}}
- <TextField
- @value={{this.newNameInput}}
- @classNames="input-xxlarge"
- @maxlength="255"
- />
- {{else}}
- <span class="static">{{this.model.name}}</span>
- {{/if}}
- </div>
- <div class="instructions">
- {{this.nameInstructions}}
- </div>
- </div>
-{{/if}}
+ {{#if @controller.canSelectPrimaryGroup}}
+ <div
+ class="control-group pref-primary-group"
+ data-setting-name="user-primary-group"
+ >
+ <label class="control-label">{{i18n "user.primary_group.title"}}</label>
+ <div class="controls">
+ <ComboBox
+ @value={{@controller.newPrimaryGroupInput}}
+ @content={{@controller.model.filteredGroups}}
+ @options={{hash none="user.primary_group.none"}}
+ />
+ </div>
+ </div>
+ {{/if}}
-{{#if this.canSelectTitle}}
- <div class="control-group pref-title" data-setting-name="user-title">
- <label class="control-label">{{i18n "user.title.title"}}</label>
- <div class="controls">
- <ComboBox
- @value={{this.newTitleInput}}
- @content={{this.model.availableTitles}}
- @onChange={{fn (mut this.newTitleInput)}}
- @options={{hash none="user.title.none"}}
- />
- </div>
- <div class="instructions">
- {{i18n "user.title.instructions"}}
- </div>
- </div>
-{{/if}}
+ {{#if @controller.canDownloadPosts}}
+ <div
+ class="control-group pref-data-export"
+ data-setting-name="user-data-export"
+ >
+ <label class="control-label">{{i18n
+ "user.download_archive.title"
+ }}</label>
+ <div class="controls">
+ <DButton
+ @action={{@controller.exportUserArchive}}
+ @label="user.download_archive.button_text"
+ @icon="download"
+ class="btn-default btn-request-archive"
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.download_archive.description"}}
+ </div>
+ </div>
+ {{/if}}
-{{#if this.canSelectFlair}}
- <div class="control-group pref-flair" data-setting-name="user-flair">
- <label class="control-label">{{i18n "user.flair.title"}}</label>
- <div class="controls">
- <FlairChooser
- @value={{this.newFlairGroupId}}
- @content={{this.model.availableFlairs}}
- @onChange={{fn (mut this.newFlairGroupId)}}
- @options={{hash none="user.flair.none"}}
+ <span>
+ <PluginOutlet
+ @name="user-preferences-account"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
/>
- </div>
- <div class="instructions">
- {{i18n "user.flair.instructions"}}
- </div>
- </div>
-{{/if}}
+ </span>
-{{#if this.canSelectUserStatus}}
- <div class="control-group pref-user-status" data-setting-name="user-status">
- <label class="control-label">{{i18n "user.status.title"}}</label>
- <div class="controls">
- {{#if this.newStatus}}
- <UserStatusMessage
- @status={{this.newStatus}}
- @showDescription={{true}}
- />
- {{else}}
- <span class="static">{{i18n "user.status.not_set"}}</span>
- {{/if}}
- <DButton
- @action={{fn (action "showUserStatusModal") this.newStatus}}
- @icon="pencil"
- class="btn-default btn-small pad-left"
- />
- </div>
- </div>
-{{/if}}
+ <br />
-{{#if this.canSelectPrimaryGroup}}
- <div
- class="control-group pref-primary-group"
- data-setting-name="user-primary-group"
- >
- <label class="control-label">{{i18n "user.primary_group.title"}}</label>
- <div class="controls">
- <ComboBox
- @value={{this.newPrimaryGroupInput}}
- @content={{this.model.filteredGroups}}
- @options={{hash none="user.primary_group.none"}}
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
- </div>
- </div>
-{{/if}}
+ </span>
-{{#if this.canDownloadPosts}}
- <div
- class="control-group pref-data-export"
- data-setting-name="user-data-export"
- >
- <label class="control-label">{{i18n "user.download_archive.title"}}</label>
- <div class="controls">
- <DButton
- @action={{action "exportUserArchive"}}
- @label="user.download_archive.button_text"
- @icon="download"
- class="btn-default btn-request-archive"
+ {{#if @controller.canSaveUser}}
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
/>
- </div>
- <div class="instructions">
- {{i18n "user.download_archive.description"}}
- </div>
- </div>
-{{/if}}
-
-<span>
- <PluginOutlet
- @name="user-preferences-account"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
-</span>
-
-<br />
-
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
-
-{{#if this.canSaveUser}}
- <SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
- />
-{{/if}}
+ {{/if}}
-{{#if this.model.canDeleteAccount}}
- <div class="control-group delete-account">
- <br />
- <div class="controls">
- <DButton
- @action={{action "delete"}}
- @disabled={{this.deleteDisabled}}
- @icon="trash-can"
- @label="user.delete_account"
- class="btn-danger"
- />
- </div>
- </div>
-{{/if}}
\ No newline at end of file
+ {{#if @controller.model.canDeleteAccount}}
+ <div class="control-group delete-account">
+ <br />
+ <div class="controls">
+ <DButton
+ @action={{@controller.delete}}
+ @disabled={{@controller.deleteDisabled}}
+ @icon="trash-can"
+ @label="user.delete_account"
+ class="btn-danger"
+ />
+ </div>
+ </div>
+ {{/if}}
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/emails.gjs b/app/assets/javascripts/discourse/app/templates/preferences/emails.gjs
index e2a29e7694b..6515ef74f00 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/emails.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/emails.gjs
@@ -1,154 +1,184 @@
-{{#unless this.siteSettings.disable_mailing_list_mode}}
- {{~#if this.model.user_option.mailing_list_mode}}
- <div class="warning-wrap">
- <div class="warning">{{i18n "user.mailing_list_mode.warning"}}</div>
- </div>
- {{/if}}
-{{/unless}}
-<div class="control-group pref-email-settings">
- <label class="control-label">{{i18n "user.email_settings"}}</label>
+import { fn, hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PreferenceCheckbox from "discourse/components/preference-checkbox";
+import SaveControls from "discourse/components/save-controls";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
- <div
- class="controls controls-dropdown"
- data-setting-name="user-email-messages-level"
- >
- <label for="user-email-messages-level">{{i18n
- "user.email_messages_level"
- }}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.emailLevelOptions}}
- @value={{this.model.user_option.email_messages_level}}
- @id="user-email-messages-level"
- @onChange={{fn (mut this.model.user_option.email_messages_level)}}
- />
- {{#if this.emailMessagesLevelAway}}
- <div class="instructions">{{this.emailFrequencyInstructions}}</div>
- {{/if}}
- </div>
+export default RouteTemplate(
+ <template>
+ {{#unless @controller.siteSettings.disable_mailing_list_mode}}
+ {{~#if @controller.model.user_option.mailing_list_mode}}
+ <div class="warning-wrap">
+ <div class="warning">{{i18n "user.mailing_list_mode.warning"}}</div>
+ </div>
+ {{/if}}
+ {{/unless}}
+ <div class="control-group pref-email-settings">
+ <label class="control-label">{{i18n "user.email_settings"}}</label>
- <div class="controls controls-dropdown" data-setting-name="user-email-level">
- <label for="user-email-level">{{i18n "user.email_level.title"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.emailLevelOptions}}
- @value={{this.model.user_option.email_level}}
- @id="user-email-level"
- @onChange={{fn (mut this.model.user_option.email_level)}}
- />
- {{#if this.emailLevelAway}}
- <div class="instructions">{{this.emailFrequencyInstructions}}</div>
- {{/if}}
- </div>
-
- <div
- class="controls controls-dropdown"
- data-setting-name="user-email-previous-replies"
- >
- <label>{{i18n "user.email_previous_replies.title"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.previousRepliesOptions}}
- @value={{this.model.user_option.email_previous_replies}}
- @onChange={{fn (mut this.model.user_option.email_previous_replies)}}
- />
- </div>
- <PreferenceCheckbox
- data-setting-name="user-email-in-reply-to"
- @labelKey="user.email_in_reply_to"
- @checked={{this.model.user_option.email_in_reply_to}}
- />
-
- <span>
- <PluginOutlet
- @name="user-preferences-emails-pref-email-settings"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
- </span>
-</div>
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-email-messages-level"
+ >
+ <label for="user-email-messages-level">{{i18n
+ "user.email_messages_level"
+ }}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.emailLevelOptions}}
+ @value={{@controller.model.user_option.email_messages_level}}
+ @id="user-email-messages-level"
+ @onChange={{fn
+ (mut @controller.model.user_option.email_messages_level)
+ }}
+ />
+ {{#if @controller.emailMessagesLevelAway}}
+ <div
+ class="instructions"
+ >{{@controller.emailFrequencyInstructions}}</div>
+ {{/if}}
+ </div>
-{{#unless this.siteSettings.disable_digest_emails}}
- <div class="control-group pref-activity-summary">
- <label class="control-label">{{i18n "user.email_activity_summary"}}</label>
- <PreferenceCheckbox
- data-setting-name="user-email-digests"
- @labelKey="user.email_digests.title"
- @disabled={{this.model.user_option.mailing_list_mode}}
- @checked={{this.model.user_option.email_digests}}
- />
- {{#if this.model.user_option.email_digests}}
<div
class="controls controls-dropdown"
- data-setting-name="user-email-digests-frequency"
+ data-setting-name="user-email-level"
>
+ <label for="user-email-level">{{i18n "user.email_level.title"}}</label>
<ComboBox
@valueProperty="value"
- @content={{this.digestFrequencies}}
- @value={{this.model.user_option.digest_after_minutes}}
- @onChange={{fn (mut this.model.user_option.digest_after_minutes)}}
- @options={{hash filterable=true}}
+ @content={{@controller.emailLevelOptions}}
+ @value={{@controller.model.user_option.email_level}}
+ @id="user-email-level"
+ @onChange={{fn (mut @controller.model.user_option.email_level)}}
/>
+ {{#if @controller.emailLevelAway}}
+ <div
+ class="instructions"
+ >{{@controller.emailFrequencyInstructions}}</div>
+ {{/if}}
</div>
- <PreferenceCheckbox
- data-setting-name="user-include-tl0-in-digests"
- @labelKey="user.include_tl0_in_digests"
- @disabled={{this.model.user_option.mailing_list_mode}}
- @checked={{this.model.user_option.include_tl0_in_digests}}
- />
- {{/if}}
- </div>
-{{/unless}}
-{{#unless this.siteSettings.disable_mailing_list_mode}}
- <div class="control-group pref-mailing-list-mode">
- <label class="control-label">{{i18n "user.mailing_list_mode.label"}}</label>
- <PreferenceCheckbox
- data-setting-name="user-mailing-list-mode-enabled"
- @labelKey="user.mailing_list_mode.enabled"
- @checked={{this.model.user_option.mailing_list_mode}}
- />
- <div class="instructions">
- {{html-safe (i18n "user.mailing_list_mode.instructions")}}
- </div>
- {{#if this.model.user_option.mailing_list_mode}}
<div
class="controls controls-dropdown"
- data-setting-name="user-mailing-list-mode-options"
+ data-setting-name="user-email-previous-replies"
>
+ <label>{{i18n "user.email_previous_replies.title"}}</label>
<ComboBox
@valueProperty="value"
- @content={{this.mailingListModeOptions}}
- @value={{this.model.user_option.mailing_list_mode_frequency}}
- @onChange={{action
- (mut this.model.user_option.mailing_list_mode_frequency)
+ @content={{@controller.previousRepliesOptions}}
+ @value={{@controller.model.user_option.email_previous_replies}}
+ @onChange={{fn
+ (mut @controller.model.user_option.email_previous_replies)
}}
/>
</div>
- {{/if}}
- </div>
-{{/unless}}
+ <PreferenceCheckbox
+ data-setting-name="user-email-in-reply-to"
+ @labelKey="user.email_in_reply_to"
+ @checked={{@controller.model.user_option.email_in_reply_to}}
+ />
-<span>
- <PluginOutlet
- @name="user-preferences-emails"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
-</span>
+ <span>
+ <PluginOutlet
+ @name="user-preferences-emails-pref-email-settings"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
+ </span>
+ </div>
-<br />
+ {{#unless @controller.siteSettings.disable_digest_emails}}
+ <div class="control-group pref-activity-summary">
+ <label class="control-label">{{i18n
+ "user.email_activity_summary"
+ }}</label>
+ <PreferenceCheckbox
+ data-setting-name="user-email-digests"
+ @labelKey="user.email_digests.title"
+ @disabled={{@controller.model.user_option.mailing_list_mode}}
+ @checked={{@controller.model.user_option.email_digests}}
+ />
+ {{#if @controller.model.user_option.email_digests}}
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-email-digests-frequency"
+ >
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.digestFrequencies}}
+ @value={{@controller.model.user_option.digest_after_minutes}}
+ @onChange={{fn
+ (mut @controller.model.user_option.digest_after_minutes)
+ }}
+ @options={{hash filterable=true}}
+ />
+ </div>
+ <PreferenceCheckbox
+ data-setting-name="user-include-tl0-in-digests"
+ @labelKey="user.include_tl0_in_digests"
+ @disabled={{@controller.model.user_option.mailing_list_mode}}
+ @checked={{@controller.model.user_option.include_tl0_in_digests}}
+ />
+ {{/if}}
+ </div>
+ {{/unless}}
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
+ {{#unless @controller.siteSettings.disable_mailing_list_mode}}
+ <div class="control-group pref-mailing-list-mode">
+ <label class="control-label">{{i18n
+ "user.mailing_list_mode.label"
+ }}</label>
+ <PreferenceCheckbox
+ data-setting-name="user-mailing-list-mode-enabled"
+ @labelKey="user.mailing_list_mode.enabled"
+ @checked={{@controller.model.user_option.mailing_list_mode}}
+ />
+ <div class="instructions">
+ {{htmlSafe (i18n "user.mailing_list_mode.instructions")}}
+ </div>
+ {{#if @controller.model.user_option.mailing_list_mode}}
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-mailing-list-mode-options"
+ >
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.mailingListModeOptions}}
+ @value={{@controller.model.user_option.mailing_list_mode_frequency}}
+ @onChange={{fn
+ (mut @controller.model.user_option.mailing_list_mode_frequency)
+ }}
+ />
+ </div>
+ {{/if}}
+ </div>
+ {{/unless}}
+
+ <span>
+ <PluginOutlet
+ @name="user-preferences-emails"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
+ </span>
-<SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
-/>
\ No newline at end of file
+ <br />
+
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/interface.gjs b/app/assets/javascripts/discourse/app/templates/preferences/interface.gjs
index 6317a9cf6b9..a91e7c7f9b7 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/interface.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/interface.gjs
@@ -1,275 +1,295 @@
-<span>
- <PluginOutlet
- @name="user-preferences-interface-top"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
-</span>
+import { fn, hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PreferenceCheckbox from "discourse/components/preference-checkbox";
+import SaveControls from "discourse/components/save-controls";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
-{{#if this.showThemeSelector}}
- <div class="control-group theme" data-setting-name="user-theme">
- <label class="control-label">{{i18n "user.theme"}}</label>
- <div class="controls">
- <ComboBox
- @content={{this.userSelectableThemes}}
- @value={{this.themeId}}
+export default RouteTemplate(
+ <template>
+ <span>
+ <PluginOutlet
+ @name="user-preferences-interface-top"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
/>
- </div>
- {{#if this.themeIdChanged}}
- <p class="alert alert-success save-theme-alert">{{i18n
- "user.save_to_change_theme"
- save_text=(i18n "save")
- }}</p>
- {{/if}}
- {{#if this.showThemeSetDefault}}
- <div class="controls">
- <PreferenceCheckbox
- @labelKey="user.theme_default_on_all_devices"
- @checked={{this.makeThemeDefault}}
- />
- </div>
- {{/if}}
- </div>
-{{/if}}
+ </span>
-{{#if this.showColorSchemeSelector}}
- <fieldset
- class="control-group color-scheme"
- data-setting-name="user-color-scheme"
- >
- <legend class="control-label">{{i18n "user.color_scheme"}}</legend>
- <div class="controls">
- <div class="control-subgroup light-color-scheme">
- {{#if this.showDarkColorSchemeSelector}}
- <div class="instructions">{{i18n "user.color_schemes.regular"}}</div>
- {{/if}}
+ {{#if @controller.showThemeSelector}}
+ <div class="control-group theme" data-setting-name="user-theme">
+ <label class="control-label">{{i18n "user.theme"}}</label>
<div class="controls">
<ComboBox
- @content={{this.userSelectableColorSchemes}}
- @value={{this.selectedColorSchemeId}}
- @onChange={{action "loadColorScheme"}}
- @options={{hash
- translatedNone=this.selectedColorSchemeNoneLabel
- autoInsertNoneItem=this.showColorSchemeNoneItem
- }}
+ @content={{@controller.userSelectableThemes}}
+ @value={{@controller.themeId}}
/>
</div>
- </div>
- {{#if this.showDarkColorSchemeSelector}}
- <div class="control-subgroup dark-color-scheme">
- <div class="instructions">{{i18n "user.color_schemes.dark"}}</div>
+ {{#if @controller.themeIdChanged}}
+ <p class="alert alert-success save-theme-alert">{{i18n
+ "user.save_to_change_theme"
+ save_text=(i18n "save")
+ }}</p>
+ {{/if}}
+ {{#if @controller.showThemeSetDefault}}
<div class="controls">
- <ComboBox
- @content={{this.userSelectableDarkColorSchemes}}
- @value={{this.selectedDarkColorSchemeId}}
- @onChange={{action "loadDarkColorScheme"}}
+ <PreferenceCheckbox
+ @labelKey="user.theme_default_on_all_devices"
+ @checked={{@controller.makeThemeDefault}}
/>
</div>
+ {{/if}}
+ </div>
+ {{/if}}
+
+ {{#if @controller.showColorSchemeSelector}}
+ <fieldset
+ class="control-group color-scheme"
+ data-setting-name="user-color-scheme"
+ >
+ <legend class="control-label">{{i18n "user.color_scheme"}}</legend>
+ <div class="controls">
+ <div class="control-subgroup light-color-scheme">
+ {{#if @controller.showDarkColorSchemeSelector}}
+ <div class="instructions">{{i18n
+ "user.color_schemes.regular"
+ }}</div>
+ {{/if}}
+ <div class="controls">
+ <ComboBox
+ @content={{@controller.userSelectableColorSchemes}}
+ @value={{@controller.selectedColorSchemeId}}
+ @onChange={{@controller.loadColorScheme}}
+ @options={{hash
+ }}
+ />
+ </div>
+ </div>
+ {{#if @controller.showDarkColorSchemeSelector}}
+ <div class="control-subgroup dark-color-scheme">
+ <div class="instructions">{{i18n "user.color_schemes.dark"}}</div>
+ <div class="controls">
+ <ComboBox
+ @content={{@controller.userSelectableDarkColorSchemes}}
+ @value={{@controller.selectedDarkColorSchemeId}}
+ @onChange={{@controller.loadDarkColorScheme}}
+ />
+ </div>
+ </div>
+ {{/if}}
</div>
- {{/if}}
- </div>
- {{#if this.previewingColorScheme}}
- {{#if this.previewingColorScheme}}
- <DButton
- @action={{action "undoColorSchemePreview"}}
- @label="user.color_schemes.undo"
- @icon="arrow-rotate-left"
- class="btn-default btn-small undo-preview"
+ {{#if @controller.previewingColorScheme}}
+ {{#if @controller.previewingColorScheme}}
+ <DButton
+ @action={{@controller.undoColorSchemePreview}}
+ @label="user.color_schemes.undo"
+ @icon="arrow-rotate-left"
+ class="btn-default btn-small undo-preview"
+ />
+ {{/if}}
+ <div class="controls color-scheme-checkbox">
+ <PreferenceCheckbox
+ @labelKey="user.color_scheme_default_on_all_devices"
+ @checked={{@controller.makeColorSchemeDefault}}
+ />
+ </div>
+ {{/if}}
+ {{#if @controller.showDarkColorSchemeSelector}}
+ <div class="instructions">
+ {{i18n "user.color_schemes.dark_instructions"}}
+ </div>
+ {{/if}}
+ </fieldset>
+ {{/if}}
+
+ {{#if @controller.showDarkModeToggle}}
+ <div class="control-group dark-mode" data-setting-name="user-dark-mode">
+ <label class="control-label">{{i18n "user.dark_mode"}}</label>
+ <div class="controls">
+ <PreferenceCheckbox
+ @labelKey="user.dark_mode_enable"
+ @checked={{@controller.enableDarkMode}}
+ />
+ </div>
+ </div>
+ {{/if}}
+
+ <div class="control-group text-size" data-setting-name="user-text-size">
+ <label for="text-size-selector" class="control-label">{{i18n
+ "user.text_size.title"
+ }}</label>
+ <div class="controls">
+ <ComboBox
+ @id="text-size-selector"
+ @valueProperty="value"
+ @content={{@controller.textSizes}}
+ @value={{@controller.textSize}}
+ @onChange={{@controller.selectTextSize}}
/>
+ </div>
+ {{#if @controller.showTextSetDefault}}
+ <div class="controls">
+ <PreferenceCheckbox
+ @labelKey="user.text_size_default_on_all_devices"
+ @checked={{@controller.makeTextSizeDefault}}
+ />
+ </div>
{{/if}}
- <div class="controls color-scheme-checkbox">
- <PreferenceCheckbox
- @labelKey="user.color_scheme_default_on_all_devices"
- @checked={{this.makeColorSchemeDefault}}
- />
+ </div>
+
+ {{#if @controller.siteSettings.allow_user_locale}}
+ <div class="control-group pref-locale" data-setting-name="user-locale">
+ <label for="locale-selector" class="control-label">{{i18n
+ "user.locale.title"
+ }}</label>
+ <div class="controls">
+ <ComboBox
+ @id="locale-selector"
+ @valueProperty="value"
+ @langProperty="value"
+ @content={{@controller.availableLocales}}
+ @value={{@controller.model.locale}}
+ @onChange={{fn (mut @controller.model.locale)}}
+ @options={{hash filterable=true none="user.locale.default"}}
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.locale.instructions"}}
+ </div>
</div>
{{/if}}
- {{#if this.showDarkColorSchemeSelector}}
- <div class="instructions">
- {{i18n "user.color_schemes.dark_instructions"}}
+
+ <div class="control-group home" data-setting-name="user-home">
+ <label for="home-selector" class="control-label">{{i18n
+ "user.home"
+ }}</label>
+ <div class="controls">
+ <ComboBox
+ @id="home-selector"
+ @content={{@controller.userSelectableHome}}
+ @valueProperty="value"
+ @value={{@controller.homepageId}}
+ @onChange={{fn (mut @controller.model.user_option.homepage_id)}}
+ />
</div>
- {{/if}}
- </fieldset>
-{{/if}}
+ </div>
+
+ <fieldset
+ class="control-group other"
+ data-setting-name="user-other-settings"
+ >
+ <legend class="control-label">{{i18n "user.other_settings"}}</legend>
-{{#if this.showDarkModeToggle}}
- <div class="control-group dark-mode" data-setting-name="user-dark-mode">
- <label class="control-label">{{i18n "user.dark_mode"}}</label>
- <div class="controls">
<PreferenceCheckbox
- @labelKey="user.dark_mode_enable"
- @checked={{this.enableDarkMode}}
+ @labelKey="user.external_links_in_new_tab"
+ @checked={{@controller.model.user_option.external_links_in_new_tab}}
+ data-setting-name="user-external-links"
+ class="pref-external-links"
/>
- </div>
- </div>
-{{/if}}
-
-<div class="control-group text-size" data-setting-name="user-text-size">
- <label for="text-size-selector" class="control-label">{{i18n
- "user.text_size.title"
- }}</label>
- <div class="controls">
- <ComboBox
- @id="text-size-selector"
- @valueProperty="value"
- @content={{this.textSizes}}
- @value={{this.textSize}}
- @onChange={{action "selectTextSize"}}
- />
- </div>
- {{#if this.showTextSetDefault}}
- <div class="controls">
<PreferenceCheckbox
- @labelKey="user.text_size_default_on_all_devices"
- @checked={{this.makeTextSizeDefault}}
+ @labelKey="user.enable_quoting"
+ @checked={{@controller.model.user_option.enable_quoting}}
+ data-setting-name="user-enable-quoting"
+ class="pref-enable-quoting"
/>
- </div>
- {{/if}}
-</div>
+ <PreferenceCheckbox
+ @labelKey="user.enable_smart_lists"
+ @checked={{@controller.model.user_option.enable_smart_lists}}
+ data-setting-name="user-enable-smart-lists"
+ class="pref-enable-smart-lists"
+ />
+ <PreferenceCheckbox
+ @labelKey="user.enable_defer"
+ @checked={{@controller.model.user_option.enable_defer}}
+ data-setting-name="user-enable-defer"
+ class="pref-defer-unread"
+ />
+ {{#if @controller.siteSettings.automatically_unpin_topics}}
+ <PreferenceCheckbox
+ @labelKey="user.automatically_unpin_topics"
+ @checked={{@controller.model.user_option.automatically_unpin_topics}}
+ data-setting-name="user-auto-unpin"
+ class="pref-auto-unpin"
+ />
+ {{/if}}
+ <PreferenceCheckbox
+ @labelKey="user.dynamic_favicon"
+ @checked={{@controller.model.user_option.dynamic_favicon}}
+ data-setting-name="user-dynamic-favicon"
+ class="pref-dynamic-favicon"
+ />
+ <div
+ class="controls controls-dropdown pref-page-title"
+ data-setting-name="user-page-title"
+ >
+ <label for="user-title-count-mode">{{i18n
+ "user.title_count_mode.title"
+ }}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.titleCountModes}}
+ @value={{@controller.model.user_option.title_count_mode}}
+ @id="user-title-count-mode"
+ @onChange={{fn (mut @controller.model.user_option.title_count_mode)}}
+ />
+ </div>
+ <div
+ class="controls controls-dropdown pref-bookmark-after-notification"
+ data-setting-name="user-bookmark-after-notification"
+ >
+ <label for="bookmark-after-notification-mode">{{i18n
+ "user.bookmark_after_notification.title"
+ }}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.bookmarkAfterNotificationModes}}
+ @value={{@controller.model.user_option.bookmark_auto_delete_preference}}
+ @id="bookmark-after-notification-mode"
+ @onChange={{fn
+ (mut @controller.model.user_option.bookmark_auto_delete_preference)
+ }}
+ />
+ </div>
+ <PreferenceCheckbox
+ @labelKey="user.skip_new_user_tips.description"
+ @checked={{@controller.model.user_option.skip_new_user_tips}}
+ data-setting-name="user-new-user-tips"
+ class="pref-new-user-tips"
+ />
+ {{#if @controller.site.user_tips}}
+ <DButton
+ @action={{@controller.resetSeenUserTips}}
+ data-setting-name="user-reset-seen-user-tips"
+ class="btn-default pref-reset-seen-user-tips"
+ >{{i18n "user.reset_seen_user_tips"}}</DButton>
+ {{/if}}
+ </fieldset>
-{{#if this.siteSettings.allow_user_locale}}
- <div class="control-group pref-locale" data-setting-name="user-locale">
- <label for="locale-selector" class="control-label">{{i18n
- "user.locale.title"
- }}</label>
- <div class="controls">
- <ComboBox
- @id="locale-selector"
- @valueProperty="value"
- @langProperty="value"
- @content={{this.availableLocales}}
- @value={{this.model.locale}}
- @onChange={{fn (mut this.model.locale)}}
- @options={{hash filterable=true none="user.locale.default"}}
+ <span>
+ <PluginOutlet
+ @name="user-preferences-interface"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
/>
- </div>
- <div class="instructions">
- {{i18n "user.locale.instructions"}}
- </div>
- </div>
-{{/if}}
+ </span>
-<div class="control-group home" data-setting-name="user-home">
- <label for="home-selector" class="control-label">{{i18n "user.home"}}</label>
- <div class="controls">
- <ComboBox
- @id="home-selector"
- @content={{this.userSelectableHome}}
- @valueProperty="value"
- @value={{this.homepageId}}
- @onChange={{fn (mut this.model.user_option.homepage_id)}}
- />
- </div>
-</div>
+ <br />
-<fieldset class="control-group other" data-setting-name="user-other-settings">
- <legend class="control-label">{{i18n "user.other_settings"}}</legend>
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
- <PreferenceCheckbox
- @labelKey="user.external_links_in_new_tab"
- @checked={{this.model.user_option.external_links_in_new_tab}}
- data-setting-name="user-external-links"
- class="pref-external-links"
- />
- <PreferenceCheckbox
- @labelKey="user.enable_quoting"
- @checked={{this.model.user_option.enable_quoting}}
- data-setting-name="user-enable-quoting"
- class="pref-enable-quoting"
- />
- <PreferenceCheckbox
- @labelKey="user.enable_smart_lists"
- @checked={{this.model.user_option.enable_smart_lists}}
- data-setting-name="user-enable-smart-lists"
- class="pref-enable-smart-lists"
- />
- <PreferenceCheckbox
- @labelKey="user.enable_defer"
- @checked={{this.model.user_option.enable_defer}}
- data-setting-name="user-enable-defer"
- class="pref-defer-unread"
- />
- {{#if this.siteSettings.automatically_unpin_topics}}
- <PreferenceCheckbox
- @labelKey="user.automatically_unpin_topics"
- @checked={{this.model.user_option.automatically_unpin_topics}}
- data-setting-name="user-auto-unpin"
- class="pref-auto-unpin"
- />
- {{/if}}
- <PreferenceCheckbox
- @labelKey="user.dynamic_favicon"
- @checked={{this.model.user_option.dynamic_favicon}}
- data-setting-name="user-dynamic-favicon"
- class="pref-dynamic-favicon"
- />
- <div
- class="controls controls-dropdown pref-page-title"
- data-setting-name="user-page-title"
- >
- <label for="user-title-count-mode">{{i18n
- "user.title_count_mode.title"
- }}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.titleCountModes}}
- @value={{this.model.user_option.title_count_mode}}
- @id="user-title-count-mode"
- @onChange={{fn (mut this.model.user_option.title_count_mode)}}
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
/>
- </div>
- <div
- class="controls controls-dropdown pref-bookmark-after-notification"
- data-setting-name="user-bookmark-after-notification"
- >
- <label for="bookmark-after-notification-mode">{{i18n
- "user.bookmark_after_notification.title"
- }}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.bookmarkAfterNotificationModes}}
- @value={{this.model.user_option.bookmark_auto_delete_preference}}
- @id="bookmark-after-notification-mode"
- @onChange={{action
- (mut this.model.user_option.bookmark_auto_delete_preference)
- }}
- />
- </div>
- <PreferenceCheckbox
- @labelKey="user.skip_new_user_tips.description"
- @checked={{this.model.user_option.skip_new_user_tips}}
- data-setting-name="user-new-user-tips"
- class="pref-new-user-tips"
- />
- {{#if this.site.user_tips}}
- <DButton
- @action={{action "resetSeenUserTips"}}
- data-setting-name="user-reset-seen-user-tips"
- class="btn-default pref-reset-seen-user-tips"
- >{{i18n "user.reset_seen_user_tips"}}</DButton>
- {{/if}}
-</fieldset>
-
-<span>
- <PluginOutlet
- @name="user-preferences-interface"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
-</span>
-
-<br />
-
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
-
-<SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
-/>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/notifications.gjs b/app/assets/javascripts/discourse/app/templates/preferences/notifications.gjs
index 6b0f382fb1f..4f73a3b51b0 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/notifications.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/notifications.gjs
@@ -1,66 +1,79 @@
-<div class="control-group notifications">
- <label class="control-label">{{i18n "user.notifications"}}</label>
+import { fn, hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DesktopNotificationConfig from "discourse/components/desktop-notification-config";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import SaveControls from "discourse/components/save-controls";
+import UserNotificationSchedule from "discourse/components/user-notification-schedule";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
- <div
- class="controls controls-dropdown"
- data-setting-name="user-like-notification-frequency"
- >
- <label>{{i18n "user.like_notification_frequency.title"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.likeNotificationFrequencies}}
- @value={{this.model.user_option.like_notification_frequency}}
- @onChange={{action
- (mut this.model.user_option.like_notification_frequency)
- }}
- />
- </div>
-</div>
+export default RouteTemplate(
+ <template>
+ <div class="control-group notifications">
+ <label class="control-label">{{i18n "user.notifications"}}</label>
+
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-like-notification-frequency"
+ >
+ <label>{{i18n "user.like_notification_frequency.title"}}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.likeNotificationFrequencies}}
+ @value={{@controller.model.user_option.like_notification_frequency}}
+ @onChange={{fn
+ (mut @controller.model.user_option.like_notification_frequency)
+ }}
+ />
+ </div>
+ </div>
+
+ {{#unless @controller.capabilities.isAppWebview}}
+ <div
+ class="control-group desktop-notifications"
+ data-setting-name="user-desktop-notifications"
+ >
+ <label class="control-label">{{i18n
+ "user.desktop_notifications.label"
+ }}</label>
+ <DesktopNotificationConfig />
+ <div class="instructions">{{i18n
+ "user.desktop_notifications.each_browser_note"
+ }}</div>
+ <span>
+ <PluginOutlet
+ @name="user-preferences-desktop-notifications"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
+ </span>
+ </div>
+ {{/unless}}
+
+ <UserNotificationSchedule @model={{@controller.model}} />
-{{#unless this.capabilities.isAppWebview}}
- <div
- class="control-group desktop-notifications"
- data-setting-name="user-desktop-notifications"
- >
- <label class="control-label">{{i18n
- "user.desktop_notifications.label"
- }}</label>
- <DesktopNotificationConfig />
- <div class="instructions">{{i18n
- "user.desktop_notifications.each_browser_note"
- }}</div>
<span>
<PluginOutlet
- @name="user-preferences-desktop-notifications"
+ @name="user-preferences-notifications"
@connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
+ @outletArgs={{hash [email protected] [email protected]}}
/>
</span>
- </div>
-{{/unless}}
-
-<UserNotificationSchedule @model={{this.model}} />
-
-<span>
- <PluginOutlet
- @name="user-preferences-notifications"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
-</span>
-<br />
+ <br />
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
-<SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
-/>
\ No newline at end of file
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/profile.gjs b/app/assets/javascripts/discourse/app/templates/preferences/profile.gjs
index db20d5c1490..04c9d3b2f83 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/profile.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/profile.gjs
@@ -1,220 +1,254 @@
-{{#if this.showEnforcedRequiredFieldsNotice}}
- <div class="alert alert-error">{{i18n
- "user.preferences.profile.enforced_required_fields"
- }}</div>
-{{/if}}
+import { Input } from "@ember/component";
+import { array, fn, 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 PluginOutlet from "discourse/components/plugin-outlet";
+import PreferenceCheckbox from "discourse/components/preference-checkbox";
+import SaveControls from "discourse/components/save-controls";
+import UppyImageUploader from "discourse/components/uppy-image-uploader";
+import UserField from "discourse/components/user-field";
+import htmlSafe from "discourse/helpers/html-safe";
+import replaceEmoji from "discourse/helpers/replace-emoji";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import TimezoneInput from "select-kit/components/timezone-input";
-{{#unless this.showEnforcedRequiredFieldsNotice}}
- {{#if this.siteSettings.allow_users_to_hide_profile}}
- <div
- class="control-group user-hide-profile"
- data-setting-name="user-hide-profile"
- >
- <PreferenceCheckbox
- @labelKey="user.hide_profile"
- @checked={{this.model.user_option.hide_profile}}
- data-setting-name="user-hide-profile"
- class="pref-hide-profile"
- />
- </div>
- {{/if}}
+export default RouteTemplate(
+ <template>
+ {{#if @controller.showEnforcedRequiredFieldsNotice}}
+ <div class="alert alert-error">{{i18n
+ "user.preferences.profile.enforced_required_fields"
+ }}</div>
+ {{/if}}
- {{#if this.canChangeBio}}
- <div class="control-group pref-bio" data-setting-name="user-bio">
- <label class="control-label">{{i18n "user.bio"}}</label>
- <div class="controls bio-composer input-xxlarge">
- <DEditor @value={{this.model.bio_raw}} />
- </div>
- </div>
- {{/if}}
+ {{#unless @controller.showEnforcedRequiredFieldsNotice}}
+ {{#if @controller.siteSettings.allow_users_to_hide_profile}}
+ <div
+ class="control-group user-hide-profile"
+ data-setting-name="user-hide-profile"
+ >
+ <PreferenceCheckbox
+ @labelKey="user.hide_profile"
+ @checked={{@controller.model.user_option.hide_profile}}
+ data-setting-name="user-hide-profile"
+ class="pref-hide-profile"
+ />
+ </div>
+ {{/if}}
- <div class="control-group pref-timezone" data-setting-name="user-timezone">
- <label class="control-label">{{i18n "user.timezone"}}</label>
- <TimezoneInput
- @value={{this.model.user_option.timezone}}
- @onChange={{fn (mut this.model.user_option.timezone)}}
- class="input-xxlarge"
- />
- <DButton
- @icon="globe"
- @label="user.use_current_timezone"
- @action={{action "useCurrentTimezone"}}
- class="btn-default"
- />
- </div>
+ {{#if @controller.canChangeBio}}
+ <div class="control-group pref-bio" data-setting-name="user-bio">
+ <label class="control-label">{{i18n "user.bio"}}</label>
+ <div class="controls bio-composer input-xxlarge">
+ <DEditor @value={{@controller.model.bio_raw}} />
+ </div>
+ </div>
+ {{/if}}
- {{#if this.model.can_change_location}}
- <div class="control-group pref-location" data-setting-name="user-location">
- <label class="control-label" for="edit-location">{{i18n
- "user.location"
- }}</label>
- <div class="controls">
- <Input
- @type="text"
- @value={{this.model.location}}
+ <div
+ class="control-group pref-timezone"
+ data-setting-name="user-timezone"
+ >
+ <label class="control-label">{{i18n "user.timezone"}}</label>
+ <TimezoneInput
+ @value={{@controller.model.user_option.timezone}}
+ @onChange={{fn (mut @controller.model.user_option.timezone)}}
class="input-xxlarge"
- id="edit-location"
/>
- </div>
- </div>
- {{/if}}
-
- {{#if this.model.can_change_website}}
- <div class="control-group pref-website" data-setting-name="user-website">
- <label class="control-label" for="edit-website">{{i18n
- "user.website"
- }}</label>
- <div class="controls">
- <Input
- @type="text"
- @value={{this.model.website}}
- class="input-xxlarge"
- id="edit-website"
+ <DButton
+ @icon="globe"
+ @label="user.use_current_timezone"
+ @action={{@controller.useCurrentTimezone}}
+ class="btn-default"
/>
</div>
- </div>
- {{/if}}
-{{/unless}}
-{{#each this.userFields as |uf|}}
- <div class="control-group" data-setting-name="user-user-fields">
- <UserField @field={{uf.field}} @value={{uf.value}} />
- </div>
-{{/each}}
-<div class="clearfix"></div>
-
-{{#unless this.showEnforcedRequiredFieldsNotice}}
- {{#if this.siteSettings.allow_profile_backgrounds}}
- {{#if this.canUploadProfileHeader}}
- <div
- class="control-group pref-profile-bg"
- data-setting-name="user-profile-bg"
- >
- <label class="control-label">{{i18n
- "user.change_profile_background.title"
- }}</label>
- <div class="controls">
- <UppyImageUploader
- @imageUrl={{this.model.profile_background_upload_url}}
- @onUploadDone={{this.profileBackgroundUploadDone}}
- @onUploadDeleted={{fn
- (mut this.model.profile_background_upload_url)
- null
- }}
- @type="profile_background"
- @id="profile-background-uploader"
- />
- </div>
- <div class="instructions">
- {{i18n "user.change_profile_background.instructions"}}
- </div>
- </div>
- {{/if}}
- {{#if this.canUploadUserCardBackground}}
- <div
- class="control-group pref-profile-bg"
- data-setting-name="user-card-bg"
- >
- <label class="control-label">{{i18n
- "user.change_card_background.title"
- }}</label>
- <div class="controls">
- <UppyImageUploader
- @imageUrl={{this.model.card_background_upload_url}}
- @onUploadDone={{this.cardBackgroundUploadDone}}
- @onUploadDeleted={{fn
- (mut this.model.card_background_upload_url)
- null
- }}
- @type="card_background"
- @id="profile-card-background-uploader"
- />
+ {{#if @controller.model.can_change_location}}
+ <div
+ class="control-group pref-location"
+ data-setting-name="user-location"
+ >
+ <label class="control-label" for="edit-location">{{i18n
+ "user.location"
+ }}</label>
+ <div class="controls">
+ <Input
+ @type="text"
+ @value={{@controller.model.location}}
+ class="input-xxlarge"
+ id="edit-location"
+ />
+ </div>
</div>
- <div class="instructions">
- {{i18n "user.change_card_background.instructions"}}
+ {{/if}}
+
+ {{#if @controller.model.can_change_website}}
+ <div
+ class="control-group pref-website"
+ data-setting-name="user-website"
+ >
+ <label class="control-label" for="edit-website">{{i18n
+ "user.website"
+ }}</label>
+ <div class="controls">
+ <Input
+ @type="text"
+ @value={{@controller.model.website}}
+ class="input-xxlarge"
+ id="edit-website"
+ />
+ </div>
</div>
+ {{/if}}
+ {{/unless}}
+
+ {{#each @controller.userFields as |uf|}}
+ <div class="control-group" data-setting-name="user-user-fields">
+ <UserField @field={{uf.field}} @value={{uf.value}} />
</div>
- {{/if}}
- {{/if}}
+ {{/each}}
+ <div class="clearfix"></div>
- {{#if this.siteSettings.allow_featured_topic_on_user_profiles}}
- <div class="control-group" data-setting-name="user-featured-topic">
- <label class="control-label">{{i18n "user.featured_topic"}}</label>
- {{#if this.model.featured_topic}}
- <label class="featured-topic-link">
- <LinkTo
- @route="topic"
- @models={{array
- this.model.featured_topic.slug
- this.model.featured_topic.id
- }}
+ {{#unless @controller.showEnforcedRequiredFieldsNotice}}
+ {{#if @controller.siteSettings.allow_profile_backgrounds}}
+ {{#if @controller.canUploadProfileHeader}}
+ <div
+ class="control-group pref-profile-bg"
+ data-setting-name="user-profile-bg"
+ >
+ <label class="control-label">{{i18n
+ "user.change_profile_background.title"
+ }}</label>
+ <div class="controls">
+ <UppyImageUploader
+ @imageUrl={{@controller.model.profile_background_upload_url}}
+ @onUploadDone={{@controller.profileBackgroundUploadDone}}
+ @onUploadDeleted={{fn
+ (mut @controller.model.profile_background_upload_url)
+ null
+ }}
+ @type="profile_background"
+ @id="profile-background-uploader"
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.change_profile_background.instructions"}}
+ </div>
+ </div>
+ {{/if}}
+ {{#if @controller.canUploadUserCardBackground}}
+ <div
+ class="control-group pref-profile-bg"
+ data-setting-name="user-card-bg"
>
- {{replace-emoji (html-safe this.model.featured_topic.fancy_title)}}
- </LinkTo>
- </label>
+ <label class="control-label">{{i18n
+ "user.change_card_background.title"
+ }}</label>
+ <div class="controls">
+ <UppyImageUploader
+ @imageUrl={{@controller.model.card_background_upload_url}}
+ @onUploadDone={{@controller.cardBackgroundUploadDone}}
+ @onUploadDeleted={{fn
+ (mut @controller.model.card_background_upload_url)
+ null
+ }}
+ @type="card_background"
+ @id="profile-card-background-uploader"
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "user.change_card_background.instructions"}}
+ </div>
+ </div>
+ {{/if}}
{{/if}}
- <div>
- <DButton
- @action={{this.showFeaturedTopicModal}}
- @label="user.feature_topic_on_profile.open_search"
- class="btn-default feature-topic-on-profile-btn"
- />
- {{#if this.model.featured_topic}}
- <DButton
- @action={{action "clearFeaturedTopicFromProfile"}}
- @label="user.feature_topic_on_profile.clear.title"
- class="btn-danger clear-feature-topic-on-profile-btn"
- />
- {{/if}}
- </div>
- <div class="instructions">
- {{i18n "user.change_featured_topic.instructions"}}
- </div>
- </div>
- {{/if}}
+ {{#if @controller.siteSettings.allow_featured_topic_on_user_profiles}}
+ <div class="control-group" data-setting-name="user-featured-topic">
+ <label class="control-label">{{i18n "user.featured_topic"}}</label>
+ {{#if @controller.model.featured_topic}}
+ <label class="featured-topic-link">
+ <LinkTo
+ @route="topic"
+ @models={{array
+ @controller.model.featured_topic.slug
+ @controller.model.featured_topic.id
+ }}
+ >
+ {{replaceEmoji
+ (htmlSafe @controller.model.featured_topic.fancy_title)
+ }}
+ </LinkTo>
+ </label>
+ {{/if}}
- {{#if this.canChangeDefaultCalendar}}
- <div class="control-group" data-setting-name="user-default-calendar">
- <label class="control-label">{{i18n
- "download_calendar.default_calendar"
- }}</label>
- <div>
- <ComboBox
- @valueProperty="value"
- @content={{this.calendarOptions}}
- @value={{this.model.user_option.default_calendar}}
- @id="user-default-calendar"
- @onChange={{fn (mut this.model.user_option.default_calendar)}}
- />
- </div>
- <div class="instructions">
- {{i18n "download_calendar.default_calendar_instruction"}}
- </div>
- </div>
- {{/if}}
+ <div>
+ <DButton
+ @action={{@controller.showFeaturedTopicModal}}
+ @label="user.feature_topic_on_profile.open_search"
+ class="btn-default feature-topic-on-profile-btn"
+ />
+ {{#if @controller.model.featured_topic}}
+ <DButton
+ @action={{@controller.clearFeaturedTopicFromProfile}}
+ @label="user.feature_topic_on_profile.clear.title"
+ class="btn-danger clear-feature-topic-on-profile-btn"
+ />
+ {{/if}}
+ </div>
+ <div class="instructions">
+ {{i18n "user.change_featured_topic.instructions"}}
+ </div>
+ </div>
+ {{/if}}
- <PluginOutlet
- @name="user-preferences-profile"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model save=(action "save")}}
- />
+ {{#if @controller.canChangeDefaultCalendar}}
+ <div class="control-group" data-setting-name="user-default-calendar">
+ <label class="control-label">{{i18n
+ "download_calendar.default_calendar"
+ }}</label>
+ <div>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.calendarOptions}}
+ @value={{@controller.model.user_option.default_calendar}}
+ @id="user-default-calendar"
+ @onChange={{fn
+ (mut @controller.model.user_option.default_calendar)
+ }}
+ />
+ </div>
+ <div class="instructions">
+ {{i18n "download_calendar.default_calendar_instruction"}}
+ </div>
+ </div>
+ {{/if}}
+
+ <PluginOutlet
+ @name="user-preferences-profile"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected] [email protected]}}
+ />
- <PluginOutlet
- @name="user-custom-preferences"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
+ <PluginOutlet
+ @name="user-custom-preferences"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-{{/unless}}
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ {{/unless}}
-<SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
-/>
\ No newline at end of file
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/tracking.gjs b/app/assets/javascripts/discourse/app/templates/preferences/tracking.gjs
index 05281b1ea62..fdb423743c9 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/tracking.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/tracking.gjs
@@ -1,101 +1,123 @@
-{{body-class "user-preferences-tracking-page"}}
+import { fn, hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PreferenceCheckbox from "discourse/components/preference-checkbox";
+import SaveControls from "discourse/components/save-controls";
+import Categories from "discourse/components/user-preferences/categories";
+import Tags from "discourse/components/user-preferences/tags";
+import bodyClass from "discourse/helpers/body-class";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
-<div class="user-preferences__tracking-topics-wrapper">
- <label class="control-label">{{i18n "user.topics_settings"}}</label>
+export default RouteTemplate(
+ <template>
+ {{bodyClass "user-preferences-tracking-page"}}
- <div class="user-preferences_tracking-topics-controls">
- <div
- class="controls controls-dropdown"
- data-setting-name="user-new-topic-duration"
- >
- <label>{{i18n "user.new_topic_duration.label"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.considerNewTopicOptions}}
- @value={{this.model.user_option.new_topic_duration_minutes}}
- @onChange={{action
- (mut this.model.user_option.new_topic_duration_minutes)
- }}
- class="duration"
- />
- </div>
+ <div class="user-preferences__tracking-topics-wrapper">
+ <label class="control-label">{{i18n "user.topics_settings"}}</label>
- <div
- class="controls controls-dropdown"
- data-setting-name="user-auto-track-topics"
- >
- <label>{{i18n "user.auto_track_topics"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.autoTrackDurations}}
- @value={{this.model.user_option.auto_track_topics_after_msecs}}
- @onChange={{action
- (mut this.model.user_option.auto_track_topics_after_msecs)
- }}
- />
- </div>
+ <div class="user-preferences_tracking-topics-controls">
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-new-topic-duration"
+ >
+ <label>{{i18n "user.new_topic_duration.label"}}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.considerNewTopicOptions}}
+ @value={{@controller.model.user_option.new_topic_duration_minutes}}
+ @onChange={{fn
+ (mut @controller.model.user_option.new_topic_duration_minutes)
+ }}
+ class="duration"
+ />
+ </div>
- <div
- class="controls controls-dropdown"
- data-setting-name="user-notification-level-when-replying"
- >
- <label>{{i18n "user.notification_level_when_replying.label"}}</label>
- <ComboBox
- @valueProperty="value"
- @content={{this.notificationLevelsForReplying}}
- @value={{this.model.user_option.notification_level_when_replying}}
- @onChange={{action
- (mut this.model.user_option.notification_level_when_replying)
- }}
- />
- </div>
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-auto-track-topics"
+ >
+ <label>{{i18n "user.auto_track_topics"}}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.autoTrackDurations}}
+ @value={{@controller.model.user_option.auto_track_topics_after_msecs}}
+ @onChange={{fn
+ (mut @controller.model.user_option.auto_track_topics_after_msecs)
+ }}
+ />
+ </div>
- <PluginOutlet
- @name="user-preferences-tracking-topics"
- @outletArgs={{hash model=this.model customAttrNames=this.customAttrNames}}
- />
+ <div
+ class="controls controls-dropdown"
+ data-setting-name="user-notification-level-when-replying"
+ >
+ <label>{{i18n "user.notification_level_when_replying.label"}}</label>
+ <ComboBox
+ @valueProperty="value"
+ @content={{@controller.notificationLevelsForReplying}}
+ @value={{@controller.model.user_option.notification_level_when_replying}}
+ @onChange={{fn
+ (mut
+ @controller.model.user_option.notification_level_when_replying
+ )
+ }}
+ />
+ </div>
- <PreferenceCheckbox
- @labelKey="user.topics_unread_when_closed"
- @checked={{this.model.user_option.topics_unread_when_closed}}
- />
- </div>
-</div>
+ <PluginOutlet
+ @name="user-preferences-tracking-topics"
+ @outletArgs={{hash
+ }}
+ />
-<div class="user-preferences__tracking-categories-tags-wrapper">
- <div>
- <UserPreferences::Categories
- @canSee={{this.canSee}}
- @model={{this.model}}
- @selectedCategories={{this.selectedCategories}}
- @hideMutedTags={{this.hideMutedTags}}
- @siteSettings={{this.siteSettings}}
- />
- </div>
+ <PreferenceCheckbox
+ @labelKey="user.topics_unread_when_closed"
+ @checked={{@controller.model.user_option.topics_unread_when_closed}}
+ />
+ </div>
+ </div>
- <div>
- <UserPreferences::Tags
- @model={{this.model}}
- @selectedTags={{this.selectedTags}}
- @save={{this.save}}
- @siteSettings={{this.siteSettings}}
- />
- </div>
-</div>
-{{#if this.showMutePrecedenceSetting}}
- <div class="control-group user-preferences__watched-precedence-over-muted">
- <PreferenceCheckbox
- data-setting-name="watched-precedence-over-muted"
- @labelKey="user.watched_precedence_over_muted"
- @checked={{this.model.user_option.watched_precedence_over_muted}}
- />
- </div>
-{{/if}}
+ <div class="user-preferences__tracking-categories-tags-wrapper">
+ <div>
+ <Categories
+ @canSee={{@controller.canSee}}
+ @model={{@controller.model}}
+ @selectedCategories={{@controller.selectedCategories}}
+ @hideMutedTags={{@controller.hideMutedTags}}
+ @siteSettings={{@controller.siteSettings}}
+ />
+ </div>
-{{#if this.canSave}}
- <SaveControls
- @model={{this.model}}
- @action={{this.save}}
- @saved={{this.saved}}
- />
-{{/if}}
\ No newline at end of file
+ <div>
+ <Tags
+ @model={{@controller.model}}
+ @selectedTags={{@controller.selectedTags}}
+ @save={{@controller.save}}
+ @siteSettings={{@controller.siteSettings}}
+ />
+ </div>
+ </div>
+ {{#if @controller.showMutePrecedenceSetting}}
+ <div
+ class="control-group user-preferences__watched-precedence-over-muted"
+ >
+ <PreferenceCheckbox
+ data-setting-name="watched-precedence-over-muted"
+ @labelKey="user.watched_precedence_over_muted"
+ @checked={{@controller.model.user_option.watched_precedence_over_muted}}
+ />
+ </div>
+ {{/if}}
+
+ {{#if @controller.canSave}}
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ />
+ {{/if}}
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/users.gjs b/app/assets/javascripts/discourse/app/templates/preferences/users.gjs
index 1206dbb69bb..4cba7d96bb8 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/users.gjs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/users.gjs
@@ -1,87 +1,104 @@
-<label class="control-label">{{i18n "user.users"}}</label>
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import IgnoredUserList from "discourse/components/ignored-user-list";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PreferenceCheckbox from "discourse/components/preference-checkbox";
+import SaveControls from "discourse/components/save-controls";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+import UserChooser from "select-kit/components/user-chooser";
-{{#if this.model.can_ignore_users}}
- <div class="control-group user-ignore" data-setting-name="user-ignored-users">
- <div class="controls tracking-controls user-notifications">
- <label>{{d-icon "far-eye-slash" class="icon"}}
- {{i18n "user.ignored_users"}}</label>
- <IgnoredUserList
- @model={{this.model}}
- @items={{this.model.ignored_usernames}}
- />
- </div>
- </div>
-{{/if}}
-
-{{#if this.model.can_mute_users}}
- <div class="control-group user-mute" data-setting-name="user-muted-users">
- <div class="controls tracking-controls">
- <label>
- {{d-icon "d-muted" class="icon"}}
- <span>{{i18n "user.muted_users"}}</span>
- </label>
- <UserChooser
- @value={{this.mutedUsernames}}
- @onChange={{action "onChangeMutedUsernames"}}
- @options={{hash excludeCurrentUser=true}}
- />
- </div>
- <div class="instructions">{{i18n "user.muted_users_instructions"}}</div>
- </div>
-{{/if}}
+export default RouteTemplate(
+ <template>
+ <label class="control-label">{{i18n "user.users"}}</label>
-{{#if this.model.can_send_private_messages}}
- <div class="control-group private-messages">
- <label class="control-label">{{i18n "user.private_messages"}}</label>
- <div
- class="control-group user-allow-pm"
- data-setting-name="user-allow-private-messages"
- >
- <div class="controls">
- <PreferenceCheckbox
- @labelKey="user.allow_private_messages"
- @checked={{this.model.user_option.allow_private_messages}}
- />
+ {{#if @controller.model.can_ignore_users}}
+ <div
+ class="control-group user-ignore"
+ data-setting-name="user-ignored-users"
+ >
+ <div class="controls tracking-controls user-notifications">
+ <label>{{icon "far-eye-slash" class="icon"}}
+ {{i18n "user.ignored_users"}}</label>
+ <IgnoredUserList
+ @model={{@controller.model}}
+ @items={{@controller.model.ignored_usernames}}
+ />
+ </div>
</div>
- </div>
+ {{/if}}
- <div
- class="control-group user-allow-pm"
- data-setting-name="user-allow-private-messages-from-specific-users"
- >
- <div class="controls">
- <PreferenceCheckbox
- @labelKey="user.allow_private_messages_from_specific_users"
- @checked={{this.model.user_option.enable_allowed_pm_users}}
- @disabled={{this.disableAllowPmUsersSetting}}
- />
- </div>
- {{#if this.allowPmUsersEnabled}}
+ {{#if @controller.model.can_mute_users}}
+ <div class="control-group user-mute" data-setting-name="user-muted-users">
<div class="controls tracking-controls">
+ <label>
+ {{icon "d-muted" class="icon"}}
+ <span>{{i18n "user.muted_users"}}</span>
+ </label>
<UserChooser
- @value={{this.allowedPmUsernames}}
- @onChange={{action "onChangeAllowedPmUsernames"}}
+ @value={{@controller.mutedUsernames}}
+ @onChange={{@controller.onChangeMutedUsernames}}
@options={{hash excludeCurrentUser=true}}
/>
</div>
- <div class="instructions">{{i18n
- "user.allowed_pm_users_instructions"
- }}</div>
- {{/if}}
- </div>
- </div>
-{{/if}}
+ <div class="instructions">{{i18n "user.muted_users_instructions"}}</div>
+ </div>
+ {{/if}}
-<span>
- <PluginOutlet
- @name="user-custom-controls"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
-</span>
+ {{#if @controller.model.can_send_private_messages}}
+ <div class="control-group private-messages">
+ <label class="control-label">{{i18n "user.private_messages"}}</label>
+ <div
+ class="control-group user-allow-pm"
+ data-setting-name="user-allow-private-messages"
+ >
+ <div class="controls">
+ <PreferenceCheckbox
+ @labelKey="user.allow_private_messages"
+ @checked={{@controller.model.user_option.allow_private_messages}}
+ />
+ </div>
+ </div>
+
+ <div
+ class="control-group user-allow-pm"
+ data-setting-name="user-allow-private-messages-from-specific-users"
+ >
+ <div class="controls">
+ <PreferenceCheckbox
+ @labelKey="user.allow_private_messages_from_specific_users"
+ @checked={{@controller.model.user_option.enable_allowed_pm_users}}
+ @disabled={{@controller.disableAllowPmUsersSetting}}
+ />
+ </div>
+ {{#if @controller.allowPmUsersEnabled}}
+ <div class="controls tracking-controls">
+ <UserChooser
+ @value={{@controller.allowedPmUsernames}}
+ @onChange={{@controller.onChangeAllowedPmUsernames}}
+ @options={{hash excludeCurrentUser=true}}
+ />
+ </div>
+ <div class="instructions">{{i18n
+ "user.allowed_pm_users_instructions"
+ }}</div>
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
+
+ <span>
+ <PluginOutlet
+ @name="user-custom-controls"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
-<SaveControls
- @model={{this.model}}
- @action={{action "save"}}
- @saved={{this.saved}}
-/>
\ No newline at end of file
+ <SaveControls
+ @model={{@controller.model}}
+ @action={{@controller.save}}
+ @saved={{@controller.saved}}
+ />
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/review-index.gjs b/app/assets/javascripts/discourse/app/templates/review-index.gjs
index 939e4f93344..a8f5709d31a 100644
--- a/app/assets/javascripts/discourse/app/templates/review-index.gjs
+++ b/app/assets/javascripts/discourse/app/templates/review-index.gjs
@@ -1,235 +1,268 @@
-{{#if this.displayUnknownReviewableTypesWarning}}
- <div class="alert alert-info unknown-reviewables">
- <span class="text">{{i18n
- "review.unknown.title"
- count=this.unknownReviewableTypes.length
- }}</span>
-
- <ul>
- {{#each this.unknownReviewableTypes as |reviewable|}}
- {{#if (eq reviewable.source this.unknownTypeSource)}}
- <li>{{i18n
- "review.unknown.reviewable_unknown_source"
- reviewableType=reviewable.type
- }}</li>
- {{else}}
- <li>{{i18n
- "review.unknown.reviewable_known_source"
- reviewableType=reviewable.type
- pluginName=reviewable.source
- }}</li>
- {{/if}}
- {{/each}}
- </ul>
- <span class="text">{{htmlSafe
- (i18n
- "review.unknown.instruction" url="https://meta.discourse.org/t/350179"
- )
- }}</span>
- <div class="unknown-reviewables__options">
- <LinkTo @route="adminPlugins.index" class="btn">
- {{d-icon "puzzle-piece"}}
- <span>{{i18n "review.unknown.enable_plugins"}}</span>
- </LinkTo>
- <DButton
- @label="review.unknown.ignore_all"
- @icon="trash-can"
- @action={{this.ignoreAllUnknownTypes}}
- class="btn-default"
- />
- </div>
- </div>
-{{/if}}
-<div class="reviewable-container">
- <div class="reviewable-list">
- {{#if this.reviewables}}
- <LoadMore @selector=".reviewable-item" @action={{action "loadMore"}}>
- <div class="reviewables">
- {{#each this.reviewables as |r|}}
- <ReviewableItem @reviewable={{r}} @remove={{action "remove"}} />
+import { fn, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import { eq } from "truth-helpers";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import DButton from "discourse/components/d-button";
+import DateTimeInputRange from "discourse/components/date-time-input-range";
+import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import ReviewableItem from "discourse/components/reviewable-item";
+import icon from "discourse/helpers/d-icon";
+import htmlSafe from "discourse/helpers/html-safe";
+import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
+import ComboBox from "select-kit/components/combo-box";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
+
+export default RouteTemplate(
+ <template>
+ {{#if @controller.displayUnknownReviewableTypesWarning}}
+ <div class="alert alert-info unknown-reviewables">
+ <span class="text">{{i18n
+ "review.unknown.title"
+ }}</span>
+
+ <ul>
+ {{#each @controller.unknownReviewableTypes as |reviewable|}}
+ {{#if (eq reviewable.source @controller.unknownTypeSource)}}
+ <li>{{i18n
+ "review.unknown.reviewable_unknown_source"
+ reviewableType=reviewable.type
+ }}</li>
+ {{else}}
+ <li>{{i18n
+ "review.unknown.reviewable_known_source"
+ reviewableType=reviewable.type
+ pluginName=reviewable.source
+ }}</li>
+ {{/if}}
{{/each}}
+ </ul>
+ <span class="text">{{htmlSafe
+ (i18n
+ "review.unknown.instruction"
+ url="https://meta.discourse.org/t/350179"
+ )
+ }}</span>
+ <div class="unknown-reviewables__options">
+ <LinkTo @route="adminPlugins.index" class="btn">
+ {{icon "puzzle-piece"}}
+ <span>{{i18n "review.unknown.enable_plugins"}}</span>
+ </LinkTo>
+ <DButton
+ @label="review.unknown.ignore_all"
+ @icon="trash-can"
+ @action={{@controller.ignoreAllUnknownTypes}}
+ class="btn-default"
+ />
</div>
- </LoadMore>
- <ConditionalLoadingSpinner @condition={{this.reviewables.loadingMore}} />
- {{else}}
- <div class="no-review">
- {{i18n "review.none"}}
</div>
{{/if}}
- </div>
-
- <div class="reviewable-filters">
- <div class="reviewable-filter">
- <label class="filter-label">
- {{i18n "review.filters.status"}}
- </label>
- <ComboBox
- @value={{this.filterStatus}}
- @content={{this.statuses}}
- @onChange={{fn (mut this.filterStatus)}}
- />
- </div>
-
- {{#if this.filtersExpanded}}
-
- <span>
- <PluginOutlet
- @name="above-review-filters"
- @connectorTagName="div"
- @outletArgs={{hash
- model=this.model
- additionalFilters=this.additionalFilters
- }}
- />
- </span>
-
- <div class="reviewable-filter">
- <label class="filter-label">
- {{i18n "review.filters.type.title"}}
- </label>
- <ComboBox
- @value={{this.filterType}}
- @content={{this.allTypes}}
- @onChange={{fn (mut this.filterType)}}
- @options={{hash none="review.filters.type.all"}}
- />
+ <div class="reviewable-container">
+ <div class="reviewable-list">
+ {{#if @controller.reviewables}}
+ <LoadMore
+ @selector=".reviewable-item"
+ @action={{@controller.loadMore}}
+ >
+ <div class="reviewables">
+ {{#each @controller.reviewables as |r|}}
+ <ReviewableItem
+ @reviewable={{r}}
+ @remove={{@controller.remove}}
+ />
+ {{/each}}
+ </div>
+ </LoadMore>
+ <ConditionalLoadingSpinner
+ @condition={{@controller.reviewables.loadingMore}}
+ />
+ {{else}}
+ <div class="no-review">
+ {{i18n "review.none"}}
+ </div>
+ {{/if}}
</div>
- <div class="reviewable-filter">
- <label class="filter-label">
- {{i18n "review.filters.score_type.title"}}
- </label>
- <ComboBox
- @value={{this.filterScoreType}}
- @content={{this.allScoreTypes}}
- @onChange={{fn (mut this.filterScoreType)}}
- @options={{hash none="review.filters.score_type.all"}}
- />
- </div>
+ <div class="reviewable-filters">
+ <div class="reviewable-filter">
+ <label class="filter-label">
+ {{i18n "review.filters.status"}}
+ </label>
+ <ComboBox
+ @value={{@controller.filterStatus}}
+ @content={{@controller.statuses}}
+ @onChange={{fn (mut @controller.filterStatus)}}
+ />
+ </div>
- <div class="reviewable-filter">
- <label class="filter-label">
- {{i18n "review.filters.priority.title"}}
- </label>
- <ComboBox
- @value={{this.filterPriority}}
- @content={{this.priorities}}
- @onChange={{fn (mut this.filterPriority)}}
- />
- </div>
+ {{#if @controller.filtersExpanded}}
- <div class="reviewable-filter">
- <label class="filter-label">
- {{i18n "review.filters.category"}}
- </label>
- <CategoryChooser
- @value={{this.filterCategoryId}}
- @onChange={{fn (mut this.filterCategoryId)}}
- @options={{hash none="review.filters.all_categories" clearable=true}}
- />
- </div>
+ <span>
+ <PluginOutlet
+ @name="above-review-filters"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
+ </span>
- <div class="reviewable-filter topic-filter">
- <label class="filter-label">
- {{i18n "review.filtered_flagged_by"}}
- </label>
- <EmailGroupUserChooser
- @value={{this.filterFlaggedBy}}
- @onChange={{action "updateFilterFlaggedBy"}}
- @options={{hash
- maximum=1
- excludeCurrentUser=false
- fullWidthWrap=true
- }}
- />
- </div>
+ <div class="reviewable-filter">
+ <label class="filter-label">
+ {{i18n "review.filters.type.title"}}
+ </label>
+ <ComboBox
+ @value={{@controller.filterType}}
+ @content={{@controller.allTypes}}
+ @onChange={{fn (mut @controller.filterType)}}
+ @options={{hash none="review.filters.type.all"}}
+ />
+ </div>
- <div class="reviewable-filter topic-filter">
- <label class="filter-label">
- {{i18n "review.filtered_reviewed_by"}}
- </label>
- <EmailGroupUserChooser
- @value={{this.filterReviewedBy}}
- @onChange={{action "updateFilterReviewedBy"}}
- @options={{hash
- maximum=1
- excludeCurrentUser=false
- fullWidthWrap=true
- }}
- />
- </div>
+ <div class="reviewable-filter">
+ <label class="filter-label">
+ {{i18n "review.filters.score_type.title"}}
+ </label>
+ <ComboBox
+ @value={{@controller.filterScoreType}}
+ @content={{@controller.allScoreTypes}}
+ @onChange={{fn (mut @controller.filterScoreType)}}
+ @options={{hash none="review.filters.score_type.all"}}
+ />
+ </div>
- <div class="reviewable-filter topic-filter">
- <label class="filter-label">
- {{i18n "review.filtered_user"}}
- </label>
- <EmailGroupUserChooser
- @value={{this.filterUsername}}
- @onChange={{action "updateFilterUsername"}}
- @options={{hash
- maximum=1
- excludeCurrentUser=false
- fullWidthWrap=true
- }}
- class="user-selector"
- />
- </div>
+ <div class="reviewable-filter">
+ <label class="filter-label">
+ {{i18n "review.filters.priority.title"}}
+ </label>
+ <ComboBox
+ @value={{@controller.filterPriority}}
+ @content={{@controller.priorities}}
+ @onChange={{fn (mut @controller.filterPriority)}}
+ />
+ </div>
- {{#if this.filterTopic}}
- <div class="reviewable-filter topic-filter">
- <label class="filter-label">
- {{i18n "review.filtered_topic"}}
- </label>
+ <div class="reviewable-filter">
+ <label class="filter-label">
+ {{i18n "review.filters.category"}}
+ </label>
+ <CategoryChooser
+ @value={{@controller.filterCategoryId}}
+ @onChange={{fn (mut @controller.filterCategoryId)}}
+ @options={{hash
+ none="review.filters.all_categories"
+ clearable=true
+ }}
+ />
+ </div>
+
+ <div class="reviewable-filter topic-filter">
+ <label class="filter-label">
+ {{i18n "review.filtered_flagged_by"}}
+ </label>
+ <EmailGroupUserChooser
+ @value={{@controller.filterFlaggedBy}}
+ @onChange={{@controller.updateFilterFlaggedBy}}
+ @options={{hash
+ maximum=1
+ excludeCurrentUser=false
+ fullWidthWrap=true
+ }}
+ />
+ </div>
+
+ <div class="reviewable-filter topic-filter">
+ <label class="filter-label">
+ {{i18n "review.filtered_reviewed_by"}}
+ </label>
+ <EmailGroupUserChooser
+ @value={{@controller.filterReviewedBy}}
+ @onChange={{@controller.updateFilterReviewedBy}}
+ @options={{hash
+ maximum=1
+ excludeCurrentUser=false
+ fullWidthWrap=true
+ }}
+ />
+ </div>
+
+ <div class="reviewable-filter topic-filter">
+ <label class="filter-label">
+ {{i18n "review.filtered_user"}}
+ </label>
+ <EmailGroupUserChooser
+ @value={{@controller.filterUsername}}
+ @onChange={{@controller.updateFilterUsername}}
+ @options={{hash
+ maximum=1
+ excludeCurrentUser=false
+ fullWidthWrap=true
+ }}
+ class="user-selector"
+ />
+ </div>
+
+ {{#if @controller.filterTopic}}
+ <div class="reviewable-filter topic-filter">
+ <label class="filter-label">
+ {{i18n "review.filtered_topic"}}
+ </label>
+ <DButton
+ @label="review.show_all_topics"
+ @icon="xmark"
+ @action={{@controller.resetTopic}}
+ class="btn-default"
+ />
+ </div>
+ {{/if}}
+
+ <div class="reviewable-filter date-range">
+ <label class="filter-label">
+ {{i18n "review.date_filter"}}
+ </label>
+ <DateTimeInputRange
+ @from={{@controller.filterFromDate}}
+ @to={{@controller.filterToDate}}
+ @onChange={{@controller.setRange}}
+ @showFromTime={{false}}
+ @showToTime={{false}}
+ />
+ </div>
+
+ <div class="reviewable-filter sort-order">
+ <label class="filter-label">
+ {{i18n "review.order_by"}}
+ </label>
+ <ComboBox
+ @value={{@controller.filterSortOrder}}
+ @content={{@controller.sortOrders}}
+ @onChange={{fn (mut @controller.filterSortOrder)}}
+ />
+ </div>
+ {{/if}}
+
+ <div class="reviewable-filters-actions">
<DButton
- @label="review.show_all_topics"
- @icon="xmark"
- @action={{action "resetTopic"}}
- class="btn-default"
+ @icon="arrows-rotate"
+ @label="review.filters.refresh"
+ @action={{@controller.refresh}}
+ class="btn-primary refresh"
/>
- </div>
- {{/if}}
-
- <div class="reviewable-filter date-range">
- <label class="filter-label">
- {{i18n "review.date_filter"}}
- </label>
- <DateTimeInputRange
- @from={{this.filterFromDate}}
- @to={{this.filterToDate}}
- @onChange={{this.setRange}}
- @showFromTime={{false}}
- @showToTime={{false}}
- />
- </div>
- <div class="reviewable-filter sort-order">
- <label class="filter-label">
- {{i18n "review.order_by"}}
- </label>
- <ComboBox
- @value={{this.filterSortOrder}}
- @content={{this.sortOrders}}
- @onChange={{fn (mut this.filterSortOrder)}}
- />
+ {{#if @controller.site.mobileView}}
+ <DButton
+ @label="show_help"
+ @icon={{@controller.toggleFiltersIcon}}
+ @action={{@controller.toggleFilters}}
+ class="btn-default expand-secondary-filters"
+ />
+ {{/if}}
+ </div>
</div>
- {{/if}}
-
- <div class="reviewable-filters-actions">
- <DButton
- @icon="arrows-rotate"
- @label="review.filters.refresh"
- @action={{action "refresh"}}
- class="btn-primary refresh"
- />
-
- {{#if this.site.mobileView}}
- <DButton
- @label="show_help"
- @icon={{this.toggleFiltersIcon}}
- @action={{action "toggleFilters"}}
- class="btn-default expand-secondary-filters"
- />
- {{/if}}
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/review-settings.gjs b/app/assets/javascripts/discourse/app/templates/review-settings.gjs
index e31ced4b0fd..fcf1154129a 100644
--- a/app/assets/javascripts/discourse/app/templates/review-settings.gjs
+++ b/app/assets/javascripts/discourse/app/templates/review-settings.gjs
@@ -1,33 +1,43 @@
-<div class="reviewable-settings">
- <h4>{{i18n "review.settings.priorities.title"}}</h4>
+import { fn } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import DButton from "discourse/components/d-button";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
- {{#each this.scoreTypes as |rst|}}
- <div class="reviewable-score-type">
- <div class="title">{{rst.title}}</div>
- <div class="field">
- <ComboBox
- @value={{rst.reviewable_priority}}
- @content={{this.settings.reviewable_priorities}}
- @onChange={{fn (mut rst.reviewable_priority)}}
- />
- </div>
- </div>
- {{/each}}
+export default RouteTemplate(
+ <template>
+ <div class="reviewable-settings">
+ <h4>{{i18n "review.settings.priorities.title"}}</h4>
- <div class="reviewable-score-type">
- <div class="title"></div>
- <div class="field">
- <DButton
- @icon="check"
- @label="review.settings.save_changes"
- @action={{action "save"}}
- @disabled={{this.saving}}
- class="btn-primary save-settings"
- />
+ {{#each @controller.scoreTypes as |rst|}}
+ <div class="reviewable-score-type">
+ <div class="title">{{rst.title}}</div>
+ <div class="field">
+ <ComboBox
+ @value={{rst.reviewable_priority}}
+ @content={{@controller.settings.reviewable_priorities}}
+ @onChange={{fn (mut rst.reviewable_priority)}}
+ />
+ </div>
+ </div>
+ {{/each}}
- {{#if this.saved}}
- <span class="saved">{{i18n "review.settings.saved"}}</span>
- {{/if}}
+ <div class="reviewable-score-type">
+ <div class="title"></div>
+ <div class="field">
+ <DButton
+ @icon="check"
+ @label="review.settings.save_changes"
+ @action={{@controller.save}}
+ @disabled={{@controller.saving}}
+ class="btn-primary save-settings"
+ />
+
+ {{#if @controller.saved}}
+ <span class="saved">{{i18n "review.settings.saved"}}</span>
+ {{/if}}
+ </div>
+ </div>
</div>
- </div>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/topic.gjs b/app/assets/javascripts/discourse/app/templates/topic.gjs
index fb75b4da771..f5e8faa8f58 100644
--- a/app/assets/javascripts/discourse/app/templates/topic.gjs
+++ b/app/assets/javascripts/discourse/app/templates/topic.gjs
@@ -1,642 +1,727 @@
-{{#let this.model.postStream as |postStream|}}
- {{#unless (and postStream.loaded postStream.loadedAllPosts)}}
- {{hide-application-footer}}
- {{/unless}}
-{{/let}}
-
-<DiscourseTopic
- {{sticky-avatars}}
- @multiSelect={{this.multiSelect}}
- @enteredAt={{this.enteredAt}}
- @topic={{this.model}}
- @hasScrolled={{this.hasScrolled}}
->
- {{#if this.model}}
- <AddCategoryTagClasses
- @category={{this.model.category}}
- @tags={{this.model.tags}}
- />
- <AddTopicStatusClasses @topic={{this.model}} />
- {{body-class (concat "archetype-" this.model.archetype)}}
- <div class="container">
- <DiscourseBanner
- @overlay={{this.hasScrolled}}
- @hide={{this.model.errorLoading}}
- />
- </div>
- {{/if}}
-
- {{#if this.showSharedDraftControls}}
- <SharedDraftControls @topic={{this.model}} />
- {{/if}}
-
- <span>
- <PluginOutlet
- @name="topic-above-post-stream"
- @connectorTagName="div"
- @outletArgs={{hash
- model=this.model
- editFirstPost=(action "editFirstPost")
- }}
- />
- </span>
-
- {{#if this.model.postStream.loaded}}
- {{#if this.model.postStream.firstPostPresent}}
- <TopicTitle
- @cancelled={{action "cancelEditingTopic"}}
- @save={{action "finishedEditingTopic"}}
- @model={{this.model}}
- >
- {{#if this.editingTopic}}
- <div class="edit-topic-title">
- <PrivateMessageGlyph @shouldShow={{this.model.isPrivateMessage}} />
-
- <div class="edit-title__wrapper">
- <PluginOutlet
- @name="edit-topic-title"
- @outletArgs={{hash model=this.model buffered=this.buffered}}
- >
- <TextField
- @id="edit-title"
- @value={{this.buffered.title}}
- @maxlength={{this.siteSettings.max_topic_title_length}}
- @autofocus="true"
+import { array, concat, fn, hash } from "@ember/helper";
+import { on } from "@ember/modifier";
+import { LinkTo } from "@ember/routing";
+import RouteTemplate from "ember-route-template";
+import { and, eq } from "truth-helpers";
+import AddCategoryTagClasses from "discourse/components/add-category-tag-classes";
+import AddTopicStatusClasses from "discourse/components/add-topic-status-classes";
+import AnonymousTopicFooterButtons from "discourse/components/anonymous-topic-footer-buttons";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import CookText from "discourse/components/cook-text";
+import DButton from "discourse/components/d-button";
+import DiscourseBanner from "discourse/components/discourse-banner";
+import DiscourseTopic from "discourse/components/discourse-topic";
+import MoreTopics from "discourse/components/more-topics";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import PostTextSelection from "discourse/components/post-text-selection";
+import PrivateMessageGlyph from "discourse/components/private-message-glyph";
+import ReviewableCreatedBy from "discourse/components/reviewable-created-by";
+import ReviewableCreatedByName from "discourse/components/reviewable-created-by-name";
+import ScrollingPostStream from "discourse/components/scrolling-post-stream";
+import SelectedPosts from "discourse/components/selected-posts";
+import SharedDraftControls from "discourse/components/shared-draft-controls";
+import SignupCta from "discourse/components/signup-cta";
+import SlowModeInfo from "discourse/components/slow-mode-info";
+import TextField from "discourse/components/text-field";
+import TopicAdminMenu from "discourse/components/topic-admin-menu";
+import TopicCategory from "discourse/components/topic-category";
+import TopicFooterButtons from "discourse/components/topic-footer-buttons";
+import TopicMap from "discourse/components/topic-map/index";
+import TopicNavigation from "discourse/components/topic-navigation";
+import TopicProgress from "discourse/components/topic-progress";
+import TopicStatus from "discourse/components/topic-status";
+import TopicTimeline from "discourse/components/topic-timeline";
+import TopicTimerInfo from "discourse/components/topic-timer-info";
+import TopicTitle from "discourse/components/topic-title";
+import ageWithTooltip from "discourse/helpers/age-with-tooltip";
+import bodyClass from "discourse/helpers/body-class";
+import icon from "discourse/helpers/d-icon";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlSafe from "discourse/helpers/html-safe";
+import routeAction from "discourse/helpers/route-action";
+import stickyAvatars from "discourse/modifiers/sticky-avatars";
+import { i18n } from "discourse-i18n";
+import CategoryChooser from "select-kit/components/category-chooser";
+import MiniTagChooser from "select-kit/components/mini-tag-chooser";
+
+export default RouteTemplate(
+ <template>
+ {{#let @controller.model.postStream as |postStream|}}
+ {{#unless (and postStream.loaded postStream.loadedAllPosts)}}
+ {{hideApplicationFooter}}
+ {{/unless}}
+ {{/let}}
+
+ <DiscourseTopic
+ {{stickyAvatars}}
+ @multiSelect={{@controller.multiSelect}}
+ @enteredAt={{@controller.enteredAt}}
+ @topic={{@controller.model}}
+ @hasScrolled={{@controller.hasScrolled}}
+ >
+ {{#if @controller.model}}
+ <AddCategoryTagClasses
+ @category={{@controller.model.category}}
+ @tags={{@controller.model.tags}}
+ />
+ <AddTopicStatusClasses @topic={{@controller.model}} />
+ {{bodyClass (concat "archetype-" @controller.model.archetype)}}
+ <div class="container">
+ <DiscourseBanner
+ @overlay={{@controller.hasScrolled}}
+ @hide={{@controller.model.errorLoading}}
+ />
+ </div>
+ {{/if}}
+
+ {{#if @controller.showSharedDraftControls}}
+ <SharedDraftControls @topic={{@controller.model}} />
+ {{/if}}
+
+ <span>
+ <PluginOutlet
+ @name="topic-above-post-stream"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
+ </span>
+
+ {{#if @controller.model.postStream.loaded}}
+ {{#if @controller.model.postStream.firstPostPresent}}
+ <TopicTitle
+ @cancelled={{@controller.cancelEditingTopic}}
+ @save={{@controller.finishedEditingTopic}}
+ @model={{@controller.model}}
+ >
+ {{#if @controller.editingTopic}}
+ <div class="edit-topic-title">
+ <PrivateMessageGlyph
+ @shouldShow={{@controller.model.isPrivateMessage}}
/>
- </PluginOutlet>
- </div>
- {{#if this.showCategoryChooser}}
- <div class="edit-category__wrapper">
- <PluginOutlet
- @name="edit-topic-category"
- @outletArgs={{hash model=this.model buffered=this.buffered}}
- >
- <CategoryChooser
- @value={{this.buffered.category_id}}
- @onChange={{action "topicCategoryChanged"}}
- class="small"
- />
- </PluginOutlet>
- </div>
- {{/if}}
+ <div class="edit-title__wrapper">
+ <PluginOutlet
+ @name="edit-topic-title"
+ @outletArgs={{hash
+ }}
+ >
+ <TextField
+ @id="edit-title"
+ @value={{@controller.buffered.title}}
+ @maxlength={{@controller.siteSettings.max_topic_title_length}}
+ @autofocus="true"
+ />
+ </PluginOutlet>
+ </div>
+
+ {{#if @controller.showCategoryChooser}}
+ <div class="edit-category__wrapper">
+ <PluginOutlet
+ @name="edit-topic-category"
+ @outletArgs={{hash
+ }}
+ >
+ <CategoryChooser
+ @value={{@controller.buffered.category_id}}
+ @onChange={{@controller.topicCategoryChanged}}
+ class="small"
+ />
+ </PluginOutlet>
+ </div>
+ {{/if}}
+
+ {{#if @controller.canEditTags}}
+ <div class="edit-tags__wrapper">
+ <PluginOutlet
+ @name="edit-topic-tags"
+ @outletArgs={{hash
+ }}
+ >
+ <MiniTagChooser
+ @value={{@controller.buffered.tags}}
+ @onChange={{@controller.topicTagsChanged}}
+ @options={{hash
+ filterable=true
+ filterPlaceholder="tagging.choose_for_topic"
+ useHeaderFilter=true
+ }}
+ />
+ </PluginOutlet>
+ </div>
+ {{/if}}
- {{#if this.canEditTags}}
- <div class="edit-tags__wrapper">
<PluginOutlet
- @name="edit-topic-tags"
- @outletArgs={{hash model=this.model buffered=this.buffered}}
- >
- <MiniTagChooser
- @value={{this.buffered.tags}}
- @onChange={{action "topicTagsChanged"}}
- @options={{hash
- filterable=true
- categoryId=this.buffered.category_id
- minimum=this.minimumRequiredTags
- filterPlaceholder="tagging.choose_for_topic"
- useHeaderFilter=true
- }}
- />
- </PluginOutlet>
- </div>
- {{/if}}
+ @name="edit-topic"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
- <PluginOutlet
- @name="edit-topic"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model buffered=this.buffered}}
- />
+ <div class="edit-controls">
+ <DButton
+ @action={{@controller.finishedEditingTopic}}
+ @icon="check"
+ @ariaLabel="composer.save_edit"
+ class="btn-primary submit-edit"
+ />
+ <DButton
+ @action={{@controller.cancelEditingTopic}}
+ @icon="xmark"
+ @ariaLabel="composer.cancel"
+ class="btn-default cancel-edit"
+ />
- <div class="edit-controls">
- <DButton
- @action={{action "finishedEditingTopic"}}
- @icon="check"
- @ariaLabel="composer.save_edit"
- class="btn-primary submit-edit"
- />
- <DButton
- @action={{action "cancelEditingTopic"}}
- @icon="xmark"
- @ariaLabel="composer.cancel"
- class="btn-default cancel-edit"
- />
+ {{#if @controller.canRemoveTopicFeaturedLink}}
+ <a
+ href
+ {{on "click" @controller.removeFeaturedLink}}
+ class="remove-featured-link"
+ title={{i18n "composer.remove_featured_link"}}
+ >
+ {{icon "circle-xmark"}}
+ {{@controller.featuredLinkDomain}}
+ </a>
+ {{/if}}
+ </div>
+ </div>
- {{#if this.canRemoveTopicFeaturedLink}}
- <a
- href
- {{on "click" this.removeFeaturedLink}}
- class="remove-featured-link"
- title={{i18n "composer.remove_featured_link"}}
- >
- {{d-icon "circle-xmark"}}
- {{this.featuredLinkDomain}}
- </a>
- {{/if}}
- </div>
- </div>
+ {{else}}
+ <h1 data-topic-id={{@controller.model.id}}>
+ {{#unless @controller.model.is_warning}}
+ {{#if @controller.canSendPms}}
+ <PrivateMessageGlyph
+ @shouldShow={{@controller.model.isPrivateMessage}}
+ @href={{@controller.pmPath}}
+ @title="topic_statuses.personal_message.title"
+ @ariaLabel="user.messages.inbox"
+ />
+ {{else}}
+ <PrivateMessageGlyph
+ @shouldShow={{@controller.model.isPrivateMessage}}
+ />
+ {{/if}}
+ {{/unless}}
+
+ {{#if @controller.model.details.loaded}}
+ <TopicStatus @topic={{@controller.model}} />
+ <a
+ href={{@controller.model.url}}
+ {{on "click" @controller.jumpTop}}
+ class="fancy-title"
+ >
+ {{htmlSafe @controller.model.fancyTitle}}
+ </a>
+ {{/if}}
+
+ {{#if @controller.model.details.can_edit}}
+ <a
+ href
+ {{on "click" @controller.editTopic}}
+ class="edit-topic"
+ title={{i18n "edit_topic"}}
+ >{{icon "pencil"}}</a>
+ {{/if}}
- {{else}}
- <h1 data-topic-id={{this.model.id}}>
- {{#unless this.model.is_warning}}
- {{#if this.canSendPms}}
- <PrivateMessageGlyph
- @shouldShow={{this.model.isPrivateMessage}}
- @href={{this.pmPath}}
- @title="topic_statuses.personal_message.title"
- @ariaLabel="user.messages.inbox"
- />
- {{else}}
- <PrivateMessageGlyph
- @shouldShow={{this.model.isPrivateMessage}}
+ <PluginOutlet
+ @name="topic-title-suffix"
+ @outletArgs={{hash [email protected]}}
/>
- {{/if}}
- {{/unless}}
-
- {{#if this.model.details.loaded}}
- <TopicStatus @topic={{this.model}} />
- <a
- href={{this.model.url}}
- {{on "click" this.jumpTop}}
- class="fancy-title"
+ </h1>
+
+ <PluginOutlet
+ @name="topic-category-wrapper"
+ @outletArgs={{hash [email protected]}}
>
- {{html-safe this.model.fancyTitle}}
- </a>
- {{/if}}
+ <TopicCategory
+ @topic={{@controller.model}}
+ class="topic-category"
+ />
+ </PluginOutlet>
- {{#if this.model.details.can_edit}}
- <a
- href
- {{on "click" this.editTopic}}
- class="edit-topic"
- title={{i18n "edit_topic"}}
- >{{d-icon "pencil"}}</a>
{{/if}}
+ </TopicTitle>
+
+ {{#if @controller.model.publishedPage}}
+ <div class="published-page-notice">
+ <div class="details">
+ {{#if @controller.model.publishedPage.public}}
+ <span class="is-public">{{i18n
+ "topic.publish_page.public"
+ }}</span>
+ {{/if}}
+ {{i18n "topic.publish_page.topic_published"}}
+ <div>
+ <a
+ href={{@controller.model.publishedPage.url}}
+ target="_blank"
+ rel="noopener noreferrer"
+ >{{@controller.model.publishedPage.url}}</a>
+ </div>
+ </div>
+ <div class="controls">
+ <DButton
+ @icon="file"
+ @label="topic.publish_page.publishing_settings"
+ @action={{routeAction "showPagePublish"}}
+ />
+ </div>
+ </div>
+ {{/if}}
- <PluginOutlet
- @name="topic-title-suffix"
- @outletArgs={{hash model=this.model}}
- />
- </h1>
+ {{/if}}
- <PluginOutlet
- @name="topic-category-wrapper"
- @outletArgs={{hash topic=this.model}}
+ <div class="container posts">
+ <div
+ class="selected-posts {{unless @controller.multiSelect 'hidden'}}"
>
- <TopicCategory @topic={{this.model}} class="topic-category" />
- </PluginOutlet>
-
- {{/if}}
- </TopicTitle>
-
- {{#if this.model.publishedPage}}
- <div class="published-page-notice">
- <div class="details">
- {{#if this.model.publishedPage.public}}
- <span class="is-public">{{i18n
- "topic.publish_page.public"
- }}</span>
- {{/if}}
- {{i18n "topic.publish_page.topic_published"}}
- <div>
- <a
- href={{this.model.publishedPage.url}}
- target="_blank"
- rel="noopener noreferrer"
- >{{this.model.publishedPage.url}}</a>
- </div>
- </div>
- <div class="controls">
- <DButton
- @icon="file"
- @label="topic.publish_page.publishing_settings"
- @action={{route-action "showPagePublish"}}
+ <SelectedPosts
+ @selectedPostsCount={{@controller.selectedPostsCount}}
+ @canSelectAll={{@controller.canSelectAll}}
+ @canDeselectAll={{@controller.canDeselectAll}}
+ @canDeleteSelected={{@controller.canDeleteSelected}}
+ @canMergeTopic={{@controller.canMergeTopic}}
+ @canChangeOwner={{@controller.canChangeOwner}}
+ @canMergePosts={{@controller.canMergePosts}}
+ @toggleMultiSelect={{@controller.toggleMultiSelect}}
+ @mergePosts={{@controller.mergePosts}}
+ @deleteSelected={{@controller.deleteSelected}}
+ @deselectAll={{@controller.deselectAll}}
+ @selectAll={{@controller.selectAll}}
/>
</div>
- </div>
- {{/if}}
- {{/if}}
-
- <div class="container posts">
- <div class="selected-posts {{unless this.multiSelect 'hidden'}}">
- <SelectedPosts
- @selectedPostsCount={{this.selectedPostsCount}}
- @canSelectAll={{this.canSelectAll}}
- @canDeselectAll={{this.canDeselectAll}}
- @canDeleteSelected={{this.canDeleteSelected}}
- @canMergeTopic={{this.canMergeTopic}}
- @canChangeOwner={{this.canChangeOwner}}
- @canMergePosts={{this.canMergePosts}}
- @toggleMultiSelect={{action "toggleMultiSelect"}}
- @mergePosts={{action "mergePosts"}}
- @deleteSelected={{action "deleteSelected"}}
- @deselectAll={{action "deselectAll"}}
- @selectAll={{action "selectAll"}}
- />
- </div>
-
- {{#if (and this.showBottomTopicMap this.loadedAllPosts)}}
- <div class="topic-map --bottom">
- <TopicMap
- @model={{this.model}}
- @topicDetails={{this.model.details}}
- @postStream={{this.model.postStream}}
- @showPMMap={{eq this.model.archetype "private_message"}}
- @showInvite={{route-action "showInvite"}}
- @removeAllowedGroup={{action "removeAllowedGroup"}}
- @removeAllowedUser={{action "removeAllowedUser"}}
- />
- </div>
- {{/if}}
+ {{#if
+ (and @controller.showBottomTopicMap @controller.loadedAllPosts)
+ }}
+ <div class="topic-map --bottom">
+ <TopicMap
+ @model={{@controller.model}}
+ @topicDetails={{@controller.model.details}}
+ @postStream={{@controller.model.postStream}}
+ @showPMMap={{eq @controller.model.archetype "private_message"}}
+ @showInvite={{routeAction "showInvite"}}
+ @removeAllowedGroup={{@controller.removeAllowedGroup}}
+ @removeAllowedUser={{@controller.removeAllowedUser}}
+ />
+ </div>
+ {{/if}}
- <PluginOutlet @name="above-timeline" @connectorTagName="div" />
+ <PluginOutlet @name="above-timeline" @connectorTagName="div" />
- <TopicNavigation
- @topic={{this.model}}
- @jumpToDate={{action "jumpToDate"}}
- @jumpToIndex={{action "jumpToIndex"}}
- class="topic-navigation"
- as |info|
- >
- <PluginOutlet
- @name="topic-navigation"
- @connectorTagName="div"
- @outletArgs={{hash
- topic=this.model
- renderTimeline=info.renderTimeline
- topicProgressExpanded=info.topicProgressExpanded
- }}
- />
- {{#if info.renderTimeline}}
- <TopicTimeline
- @info={{info}}
- @model={{this.model}}
- @replyToPost={{action "replyToPost"}}
- @showTopReplies={{action "showTopReplies"}}
- @jumpToPostPrompt={{action "jumpToPostPrompt"}}
- @enteredIndex={{this.enteredIndex}}
- @prevEvent={{info.prevEvent}}
- @jumpTop={{action "jumpTop"}}
- @jumpBottom={{action "jumpBottom"}}
- @jumpEnd={{action "jumpEnd"}}
- @jumpToIndex={{action "jumpToIndex"}}
- @toggleMultiSelect={{action "toggleMultiSelect"}}
- @showTopicSlowModeUpdate={{route-action "showTopicSlowModeUpdate"}}
- @deleteTopic={{action "deleteTopic"}}
- @recoverTopic={{action "recoverTopic"}}
- @toggleClosed={{action "toggleClosed"}}
- @toggleArchived={{action "toggleArchived"}}
- @toggleVisibility={{action "toggleVisibility"}}
- @showTopicTimerModal={{route-action "showTopicTimerModal"}}
- @showFeatureTopic={{route-action "showFeatureTopic"}}
- @showChangeTimestamp={{route-action "showChangeTimestamp"}}
- @resetBumpDate={{action "resetBumpDate"}}
- @convertToPublicTopic={{action "convertToPublicTopic"}}
- @convertToPrivateMessage={{action "convertToPrivateMessage"}}
- @fullscreen={{info.topicProgressExpanded}}
- />
- {{else}}
- <TopicProgress
- @prevEvent={{info.prevEvent}}
- @topic={{this.model}}
- @expanded={{info.topicProgressExpanded}}
- @jumpToPost={{action "jumpToPost"}}
+ <TopicNavigation
+ @topic={{@controller.model}}
+ @jumpToDate={{@controller.jumpToDate}}
+ @jumpToIndex={{@controller.jumpToIndex}}
+ class="topic-navigation"
+ as |info|
>
- <span>
- <PluginOutlet
- @name="before-topic-progress"
- @connectorTagName="div"
- @outletArgs={{hash
- model=this.model
- jumpToPost=(action "jumpToPost")
+ <PluginOutlet
+ @name="topic-navigation"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ renderTimeline=info.renderTimeline
+ topicProgressExpanded=info.topicProgressExpanded
+ }}
+ />
+ {{#if info.renderTimeline}}
+ <TopicTimeline
+ @info={{info}}
+ @model={{@controller.model}}
+ @replyToPost={{@controller.replyToPost}}
+ @showTopReplies={{@controller.showTopReplies}}
+ @jumpToPostPrompt={{@controller.jumpToPostPrompt}}
+ @enteredIndex={{@controller.enteredIndex}}
+ @prevEvent={{info.prevEvent}}
+ @jumpTop={{@controller.jumpTop}}
+ @jumpBottom={{@controller.jumpBottom}}
+ @jumpEnd={{@controller.jumpEnd}}
+ @jumpToIndex={{@controller.jumpToIndex}}
+ @toggleMultiSelect={{@controller.toggleMultiSelect}}
+ @showTopicSlowModeUpdate={{routeAction
+ "showTopicSlowModeUpdate"
}}
+ @deleteTopic={{@controller.deleteTopic}}
+ @recoverTopic={{@controller.recoverTopic}}
+ @toggleClosed={{@controller.toggleClosed}}
+ @toggleArchived={{@controller.toggleArchived}}
+ @toggleVisibility={{@controller.toggleVisibility}}
+ @showTopicTimerModal={{routeAction "showTopicTimerModal"}}
+ @showFeatureTopic={{routeAction "showFeatureTopic"}}
+ @showChangeTimestamp={{routeAction "showChangeTimestamp"}}
+ @resetBumpDate={{@controller.resetBumpDate}}
+ @convertToPublicTopic={{@controller.convertToPublicTopic}}
+ @convertToPrivateMessage={{@controller.convertToPrivateMessage}}
+ @fullscreen={{info.topicProgressExpanded}}
/>
- </span>
- <TopicAdminMenu
- @topic={{this.model}}
- @toggleMultiSelect={{action "toggleMultiSelect"}}
- @showTopicSlowModeUpdate={{route-action
- "showTopicSlowModeUpdate"
- }}
- @deleteTopic={{action "deleteTopic"}}
- @recoverTopic={{action "recoverTopic"}}
- @toggleClosed={{action "toggleClosed"}}
- @toggleArchived={{action "toggleArchived"}}
- @toggleVisibility={{action "toggleVisibility"}}
- @showTopicTimerModal={{route-action "showTopicTimerModal"}}
- @showFeatureTopic={{route-action "showFeatureTopic"}}
- @showChangeTimestamp={{route-action "showChangeTimestamp"}}
- @resetBumpDate={{action "resetBumpDate"}}
- @convertToPublicTopic={{action "convertToPublicTopic"}}
- @convertToPrivateMessage={{action "convertToPrivateMessage"}}
+ {{else}}
+ <TopicProgress
+ @prevEvent={{info.prevEvent}}
+ @topic={{@controller.model}}
+ @expanded={{info.topicProgressExpanded}}
+ @jumpToPost={{@controller.jumpToPost}}
+ >
+ <span>
+ <PluginOutlet
+ @name="before-topic-progress"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
+ </span>
+ <TopicAdminMenu
+ @topic={{@controller.model}}
+ @toggleMultiSelect={{@controller.toggleMultiSelect}}
+ @showTopicSlowModeUpdate={{routeAction
+ "showTopicSlowModeUpdate"
+ }}
+ @deleteTopic={{@controller.deleteTopic}}
+ @recoverTopic={{@controller.recoverTopic}}
+ @toggleClosed={{@controller.toggleClosed}}
+ @toggleArchived={{@controller.toggleArchived}}
+ @toggleVisibility={{@controller.toggleVisibility}}
+ @showTopicTimerModal={{routeAction "showTopicTimerModal"}}
+ @showFeatureTopic={{routeAction "showFeatureTopic"}}
+ @showChangeTimestamp={{routeAction "showChangeTimestamp"}}
+ @resetBumpDate={{@controller.resetBumpDate}}
+ @convertToPublicTopic={{@controller.convertToPublicTopic}}
+ @convertToPrivateMessage={{@controller.convertToPrivateMessage}}
+ />
+ </TopicProgress>
+ {{/if}}
+
+ <PluginOutlet
+ @name="topic-navigation-bottom"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
- </TopicProgress>
- {{/if}}
+ </TopicNavigation>
+
+ <div class="row">
+ <section
+ class="topic-area"
+ id="topic"
+ data-topic-id={{@controller.model.id}}
+ >
+
+ <div class="posts-wrapper">
+ <ConditionalLoadingSpinner
+ @condition={{@controller.model.postStream.loadingAbove}}
+ />
- <PluginOutlet
- @name="topic-navigation-bottom"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </TopicNavigation>
+ <span>
+ <PluginOutlet
+ @name="topic-above-posts"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+
+ {{#unless @controller.model.postStream.loadingFilter}}
+ <ScrollingPostStream
+ @posts={{@controller.postsToRender}}
+ @canCreatePost={{@controller.model.details.can_create_post}}
+ @multiSelect={{@controller.multiSelect}}
+ @selectedPostsCount={{@controller.selectedPostsCount}}
+ @filteredPostsCount={{@controller.model.postStream.filteredPostsCount}}
+ @selectedQuery={{@controller.selectedQuery}}
+ @gaps={{@controller.model.postStream.gaps}}
+ @showReadIndicator={{@controller.model.show_read_indicator}}
+ @streamFilters={{@controller.model.postStream.streamFilters}}
+ @lastReadPostNumber={{@controller.userLastReadPostNumber}}
+ @highestPostNumber={{@controller.highestPostNumber}}
+ @showFlags={{@controller.showPostFlags}}
+ @editPost={{@controller.editPost}}
+ @showHistory={{routeAction "showHistory"}}
+ @showLogin={{routeAction "showLogin"}}
+ @showRawEmail={{routeAction "showRawEmail"}}
+ @deletePost={{@controller.deletePost}}
+ @permanentlyDeletePost={{@controller.permanentlyDeletePost}}
+ @recoverPost={{@controller.recoverPost}}
+ @expandHidden={{@controller.expandHidden}}
+ @toggleBookmark={{@controller.toggleBookmark}}
+ @togglePostType={{@controller.togglePostType}}
+ @rebakePost={{@controller.rebakePost}}
+ @changePostOwner={{@controller.changePostOwner}}
+ @grantBadge={{@controller.grantBadge}}
+ @changeNotice={{@controller.changeNotice}}
+ @lockPost={{@controller.lockPost}}
+ @unlockPost={{@controller.unlockPost}}
+ @unhidePost={{@controller.unhidePost}}
+ @replyToPost={{@controller.replyToPost}}
+ @toggleWiki={{@controller.toggleWiki}}
+ @showTopReplies={{@controller.showTopReplies}}
+ @cancelFilter={{@controller.cancelFilter}}
+ @removeAllowedUser={{@controller.removeAllowedUser}}
+ @removeAllowedGroup={{@controller.removeAllowedGroup}}
+ @topVisibleChanged={{@controller.topVisibleChanged}}
+ @currentPostChanged={{@controller.currentPostChanged}}
+ @currentPostScrolled={{@controller.currentPostScrolled}}
+ @bottomVisibleChanged={{@controller.bottomVisibleChanged}}
+ @togglePostSelection={{@controller.togglePostSelection}}
+ @selectReplies={{@controller.selectReplies}}
+ @selectBelow={{@controller.selectBelow}}
+ @fillGapBefore={{@controller.fillGapBefore}}
+ @fillGapAfter={{@controller.fillGapAfter}}
+ @showInvite={{routeAction "showInvite"}}
+ @showPagePublish={{routeAction "showPagePublish"}}
+ />
+ {{/unless}}
- <div class="row">
- <section class="topic-area" id="topic" data-topic-id={{this.model.id}}>
+ <ConditionalLoadingSpinner
+ @condition={{@controller.model.postStream.loadingBelow}}
+ />
+ </div>
+ <div id="topic-bottom"></div>
- <div class="posts-wrapper">
- <ConditionalLoadingSpinner
- @condition={{this.model.postStream.loadingAbove}}
- />
+ <ConditionalLoadingSpinner
+ @condition={{@controller.model.postStream.loadingFilter}}
+ >
+ {{#if @controller.loadedAllPosts}}
+
+ {{#if @controller.model.pending_posts}}
+ <div class="pending-posts">
+ {{#each @controller.model.pending_posts as |pending|}}
+ <div
+ class="reviewable-item"
+ data-reviewable-id={{pending.id}}
+ >
+ <div class="reviewable-meta-data">
+ <span class="reviewable-type">
+ {{i18n "review.awaiting_approval"}}
+ </span>
+ <span class="created-at">
+ {{ageWithTooltip pending.created_at}}
+ </span>
+ </div>
+ <div class="post-contents-wrapper">
+ <ReviewableCreatedBy
+ @user={{@controller.currentUser}}
+ />
+ <div class="post-contents">
+ <ReviewableCreatedByName
+ @user={{@controller.currentUser}}
+ />
+ <div class="post-body"><CookText
+ @rawText={{pending.raw}}
+ /></div>
+ </div>
+ </div>
+ <div class="reviewable-actions">
+ <PluginOutlet
+ @name="topic-additional-reviewable-actions"
+ @outletArgs={{hash pending=pending}}
+ />
+ <DButton
+ @label="review.delete"
+ @icon="trash-can"
+ @action={{fn @controller.deletePending pending}}
+ class="btn-danger"
+ />
+ </div>
+ </div>
+ {{/each}}
+ </div>
+ {{/if}}
+
+ {{#if @controller.model.queued_posts_count}}
+ <div class="has-pending-posts">
+ <div>
+ {{htmlSafe
+ (i18n
+ "review.topic_has_pending"
+ [email protected]_posts_count
+ )
+ }}
+ </div>
- <span>
- <PluginOutlet
- @name="topic-above-posts"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
-
- {{#unless this.model.postStream.loadingFilter}}
- <ScrollingPostStream
- @posts={{this.postsToRender}}
- @canCreatePost={{this.model.details.can_create_post}}
- @multiSelect={{this.multiSelect}}
- @selectedPostsCount={{this.selectedPostsCount}}
- @filteredPostsCount={{this.model.postStream.filteredPostsCount}}
- @selectedQuery={{this.selectedQuery}}
- @gaps={{this.model.postStream.gaps}}
- @showReadIndicator={{this.model.show_read_indicator}}
- @streamFilters={{this.model.postStream.streamFilters}}
- @lastReadPostNumber={{this.userLastReadPostNumber}}
- @highestPostNumber={{this.highestPostNumber}}
- @showFlags={{action "showPostFlags"}}
- @editPost={{action "editPost"}}
- @showHistory={{route-action "showHistory"}}
- @showLogin={{route-action "showLogin"}}
- @showRawEmail={{route-action "showRawEmail"}}
- @deletePost={{action "deletePost"}}
- @permanentlyDeletePost={{action "permanentlyDeletePost"}}
- @recoverPost={{action "recoverPost"}}
- @expandHidden={{action "expandHidden"}}
- @toggleBookmark={{action "toggleBookmark"}}
- @togglePostType={{action "togglePostType"}}
- @rebakePost={{action "rebakePost"}}
- @changePostOwner={{action "changePostOwner"}}
- @grantBadge={{action "grantBadge"}}
- @changeNotice={{action "changeNotice"}}
- @lockPost={{action "lockPost"}}
- @unlockPost={{action "unlockPost"}}
- @unhidePost={{action "unhidePost"}}
- @replyToPost={{action "replyToPost"}}
- @toggleWiki={{action "toggleWiki"}}
- @showTopReplies={{action "showTopReplies"}}
- @cancelFilter={{action "cancelFilter"}}
- @removeAllowedUser={{action "removeAllowedUser"}}
- @removeAllowedGroup={{action "removeAllowedGroup"}}
- @topVisibleChanged={{action "topVisibleChanged"}}
- @currentPostChanged={{action "currentPostChanged"}}
- @currentPostScrolled={{action "currentPostScrolled"}}
- @bottomVisibleChanged={{action "bottomVisibleChanged"}}
- @togglePostSelection={{action "togglePostSelection"}}
- @selectReplies={{action "selectReplies"}}
- @selectBelow={{action "selectBelow"}}
- @fillGapBefore={{action "fillGapBefore"}}
- @fillGapAfter={{action "fillGapAfter"}}
- @showInvite={{route-action "showInvite"}}
- @showPagePublish={{route-action "showPagePublish"}}
- />
- {{/unless}}
+ <LinkTo
+ @route="review"
+ @query={{hash
+ type="ReviewableQueuedPost"
+ status="pending"
+ }}
+ >
+ {{i18n "review.view_pending"}}
+ </LinkTo>
+ </div>
+ {{/if}}
- <ConditionalLoadingSpinner
- @condition={{this.model.postStream.loadingBelow}}
- />
- </div>
- <div id="topic-bottom"></div>
+ <SlowModeInfo
+ @topic={{@controller.model}}
+ @user={{@controller.currentUser}}
+ @tagName=""
+ />
- <ConditionalLoadingSpinner
- @condition={{this.model.postStream.loadingFilter}}
- >
- {{#if this.loadedAllPosts}}
+ <TopicTimerInfo
+ @topicClosed={{@controller.model.closed}}
+ @statusType={{@controller.model.topic_timer.status_type}}
+ @statusUpdate={{@controller.model.topic_status_update}}
+ @executeAt={{@controller.model.topic_timer.execute_at}}
+ @basedOnLastPost={{@controller.model.topic_timer.based_on_last_post}}
+ @durationMinutes={{@controller.model.topic_timer.duration_minutes}}
+ @categoryId={{@controller.model.topic_timer.category_id}}
+ @showTopicTimerModal={{routeAction "showTopicTimerModal"}}
+ @removeTopicTimer={{fn
+ @controller.removeTopicTimer
+ @controller.model.topic_timer.status_type
+ "topic_timer"
+ }}
+ />
- {{#if this.model.pending_posts}}
- <div class="pending-posts">
- {{#each this.model.pending_posts as |pending|}}
+ {{#if @controller.showSelectedPostsAtBottom}}
<div
- class="reviewable-item"
- data-reviewable-id={{pending.id}}
+ class="selected-posts
+ {{unless @controller.multiSelect 'hidden'}}
+ {{if @controller.showSelectedPostsAtBottom 'hidden'}}"
>
- <div class="reviewable-meta-data">
- <span class="reviewable-type">
- {{i18n "review.awaiting_approval"}}
- </span>
- <span class="created-at">
- {{age-with-tooltip pending.created_at}}
- </span>
- </div>
- <div class="post-contents-wrapper">
- <ReviewableCreatedBy @user={{this.currentUser}} />
- <div class="post-contents">
- <ReviewableCreatedByName @user={{this.currentUser}} />
- <div class="post-body"><CookText
- @rawText={{pending.raw}}
- /></div>
- </div>
- </div>
- <div class="reviewable-actions">
- <PluginOutlet
- @name="topic-additional-reviewable-actions"
- @outletArgs={{hash pending=pending}}
- />
- <DButton
- @label="review.delete"
- @icon="trash-can"
- @action={{fn (action "deletePending") pending}}
- class="btn-danger"
- />
- </div>
+ <SelectedPosts
+ @selectedPostsCount={{@controller.selectedPostsCount}}
+ @canSelectAll={{@controller.canSelectAll}}
+ @canDeselectAll={{@controller.canDeselectAll}}
+ @canDeleteSelected={{@controller.canDeleteSelected}}
+ @canMergeTopic={{@controller.canMergeTopic}}
+ @canChangeOwner={{@controller.canChangeOwner}}
+ @canMergePosts={{@controller.canMergePosts}}
+ @toggleMultiSelect={{@controller.toggleMultiSelect}}
+ @mergePosts={{@controller.mergePosts}}
+ @deleteSelected={{@controller.deleteSelected}}
+ @deselectAll={{@controller.deselectAll}}
+ @selectAll={{@controller.selectAll}}
+ />
</div>
- {{/each}}
- </div>
- {{/if}}
-
- {{#if this.model.queued_posts_count}}
- <div class="has-pending-posts">
- <div>
- {{html-safe
- (i18n
- "review.topic_has_pending"
- count=this.model.queued_posts_count
- )
- }}
- </div>
+ {{/if}}
- <LinkTo
- @route="review"
- @query={{hash
- topic_id=this.model.id
- type="ReviewableQueuedPost"
- status="pending"
- }}
- >
- {{i18n "review.view_pending"}}
- </LinkTo>
- </div>
- {{/if}}
+ {{/if}}
+ </ConditionalLoadingSpinner>
- <SlowModeInfo
- @topic={{this.model}}
- @user={{this.currentUser}}
- @tagName=""
+ <PluginOutlet
+ @name="topic-area-bottom"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
/>
+ </section>
+ </div>
- <TopicTimerInfo
- @topicClosed={{this.model.closed}}
- @statusType={{this.model.topic_timer.status_type}}
- @statusUpdate={{this.model.topic_status_update}}
- @executeAt={{this.model.topic_timer.execute_at}}
- @basedOnLastPost={{this.model.topic_timer.based_on_last_post}}
- @durationMinutes={{this.model.topic_timer.duration_minutes}}
- @categoryId={{this.model.topic_timer.category_id}}
- @showTopicTimerModal={{route-action "showTopicTimerModal"}}
- @removeTopicTimer={{action
- "removeTopicTimer"
- this.model.topic_timer.status_type
- "topic_timer"
+ </div>
+ {{#if @controller.loadedAllPosts}}
+ {{#if @controller.session.showSignupCta}}
+ {{! replace "Log In to Reply" with the infobox }}
+ <SignupCta />
+ {{else}}
+ {{#if @controller.currentUser}}
+ <span>
+ <PluginOutlet
+ @name="topic-above-footer-buttons"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+
+ <TopicFooterButtons
+ @topic={{@controller.model}}
+ @toggleMultiSelect={{@controller.toggleMultiSelect}}
+ @showTopicSlowModeUpdate={{routeAction
+ "showTopicSlowModeUpdate"
}}
+ @deleteTopic={{@controller.deleteTopic}}
+ @recoverTopic={{@controller.recoverTopic}}
+ @toggleClosed={{@controller.toggleClosed}}
+ @toggleArchived={{@controller.toggleArchived}}
+ @toggleVisibility={{@controller.toggleVisibility}}
+ @showTopicTimerModal={{routeAction "showTopicTimerModal"}}
+ @showFeatureTopic={{routeAction "showFeatureTopic"}}
+ @showChangeTimestamp={{routeAction "showChangeTimestamp"}}
+ @resetBumpDate={{@controller.resetBumpDate}}
+ @convertToPublicTopic={{@controller.convertToPublicTopic}}
+ @convertToPrivateMessage={{@controller.convertToPrivateMessage}}
+ @toggleBookmark={{@controller.toggleBookmark}}
+ @showFlagTopic={{routeAction "showFlagTopic"}}
+ @toggleArchiveMessage={{@controller.toggleArchiveMessage}}
+ @editFirstPost={{@controller.editFirstPost}}
+ @deferTopic={{@controller.deferTopic}}
+ @replyToPost={{@controller.replyToPost}}
/>
-
- {{#if this.showSelectedPostsAtBottom}}
- <div
- class="selected-posts
- {{unless this.multiSelect 'hidden'}}
- {{if this.showSelectedPostsAtBottom 'hidden'}}"
- >
- <SelectedPosts
- @selectedPostsCount={{this.selectedPostsCount}}
- @canSelectAll={{this.canSelectAll}}
- @canDeselectAll={{this.canDeselectAll}}
- @canDeleteSelected={{this.canDeleteSelected}}
- @canMergeTopic={{this.canMergeTopic}}
- @canChangeOwner={{this.canChangeOwner}}
- @canMergePosts={{this.canMergePosts}}
- @toggleMultiSelect={{action "toggleMultiSelect"}}
- @mergePosts={{action "mergePosts"}}
- @deleteSelected={{action "deleteSelected"}}
- @deselectAll={{action "deselectAll"}}
- @selectAll={{action "selectAll"}}
- />
- </div>
- {{/if}}
-
+ {{else}}
+ <AnonymousTopicFooterButtons @topic={{@controller.model}} />
{{/if}}
- </ConditionalLoadingSpinner>
+ {{/if}}
+
+ <br />
- <PluginOutlet
- @name="topic-area-bottom"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </section>
- </div>
-
- </div>
- {{#if this.loadedAllPosts}}
- {{#if this.session.showSignupCta}}
- {{! replace "Log In to Reply" with the infobox }}
- <SignupCta />
- {{else}}
- {{#if this.currentUser}}
<span>
<PluginOutlet
- @name="topic-above-footer-buttons"
+ @name="topic-above-suggested"
@connectorTagName="div"
- @outletArgs={{hash model=this.model}}
+ @outletArgs={{hash [email protected]}}
/>
</span>
- <TopicFooterButtons
- @topic={{this.model}}
- @toggleMultiSelect={{action "toggleMultiSelect"}}
- @showTopicSlowModeUpdate={{route-action "showTopicSlowModeUpdate"}}
- @deleteTopic={{action "deleteTopic"}}
- @recoverTopic={{action "recoverTopic"}}
- @toggleClosed={{action "toggleClosed"}}
- @toggleArchived={{action "toggleArchived"}}
- @toggleVisibility={{action "toggleVisibility"}}
- @showTopicTimerModal={{route-action "showTopicTimerModal"}}
- @showFeatureTopic={{route-action "showFeatureTopic"}}
- @showChangeTimestamp={{route-action "showChangeTimestamp"}}
- @resetBumpDate={{action "resetBumpDate"}}
- @convertToPublicTopic={{action "convertToPublicTopic"}}
- @convertToPrivateMessage={{action "convertToPrivateMessage"}}
- @toggleBookmark={{action "toggleBookmark"}}
- @showFlagTopic={{route-action "showFlagTopic"}}
- @toggleArchiveMessage={{action "toggleArchiveMessage"}}
- @editFirstPost={{action "editFirstPost"}}
- @deferTopic={{action "deferTopic"}}
- @replyToPost={{action "replyToPost"}}
+ <MoreTopics @topic={{@controller.model}} />
+ <PluginOutlet
+ @name="topic-below-suggested"
+ @outletArgs={{hash [email protected]}}
/>
- {{else}}
- <AnonymousTopicFooterButtons @topic={{this.model}} />
{{/if}}
+ {{else}}
+ <div class="container">
+ <ConditionalLoadingSpinner @condition={{@controller.noErrorYet}}>
+ {{#if @controller.model.errorHtml}}
+ <div class="not-found">{{htmlSafe
+ @controller.model.errorHtml
+ }}</div>
+ {{else}}
+ <div class="topic-error">
+ <div>{{@controller.model.errorMessage}}</div>
+ {{#if @controller.model.noRetry}}
+ {{#unless @controller.currentUser}}
+ <DButton
+ @action={{routeAction "showLogin"}}
+ @icon="user"
+ @label="log_in"
+ class="btn-primary topic-retry"
+ />
+ {{/unless}}
+ {{else}}
+ <DButton
+ @action={{@controller.retryLoading}}
+ @icon="arrows-rotate"
+ @label="errors.buttons.again"
+ class="btn-primary topic-retry"
+ />
+ {{/if}}
+ </div>
+ <ConditionalLoadingSpinner @condition={{@controller.retrying}} />
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </div>
{{/if}}
- <br />
-
- <span>
- <PluginOutlet
- @name="topic-above-suggested"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
+ {{#each (array @controller.model) as |topic|}}
+ <PostTextSelection
+ @quoteState={{@controller.quoteState}}
+ @selectText={{@controller.selectText}}
+ @buildQuoteMarkdown={{@controller.buildQuoteMarkdown}}
+ @editPost={{@controller.editPost}}
+ @topic={{topic}}
/>
- </span>
-
- <MoreTopics @topic={{this.model}} />
- <PluginOutlet
- @name="topic-below-suggested"
- @outletArgs={{hash model=this.model}}
- />
- {{/if}}
- {{else}}
- <div class="container">
- <ConditionalLoadingSpinner @condition={{this.noErrorYet}}>
- {{#if this.model.errorHtml}}
- <div class="not-found">{{html-safe this.model.errorHtml}}</div>
- {{else}}
- <div class="topic-error">
- <div>{{this.model.errorMessage}}</div>
- {{#if this.model.noRetry}}
- {{#unless this.currentUser}}
- <DButton
- @action={{route-action "showLogin"}}
- @icon="user"
- @label="log_in"
- class="btn-primary topic-retry"
- />
- {{/unless}}
- {{else}}
- <DButton
- @action={{action "retryLoading"}}
- @icon="arrows-rotate"
- @label="errors.buttons.again"
- class="btn-primary topic-retry"
- />
- {{/if}}
- </div>
- <ConditionalLoadingSpinner @condition={{this.retrying}} />
- {{/if}}
- </ConditionalLoadingSpinner>
- </div>
- {{/if}}
-
- {{#each (array this.model) as |topic|}}
- <PostTextSelection
- @quoteState={{this.quoteState}}
- @selectText={{action "selectText"}}
- @buildQuoteMarkdown={{this.buildQuoteMarkdown}}
- @editPost={{action "editPost"}}
- @topic={{topic}}
- />
- {{/each}}
-</DiscourseTopic>
\ No newline at end of file
+ {{/each}}
+ </DiscourseTopic>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/user.gjs b/app/assets/javascripts/discourse/app/templates/user.gjs
index 632bc8de7ad..6da6b431c14 100644
--- a/app/assets/javascripts/discourse/app/templates/user.gjs
+++ b/app/assets/javascripts/discourse/app/templates/user.gjs
@@ -1,488 +1,541 @@
-<PluginOutlet
- @name="above-user-profile"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
-/>
-<div
- class="container
- {{if this.viewingSelf 'viewing-self'}}
- {{if this.model.profile_hidden 'profile-hidden'}}
- {{this.primaryGroup}}"
->
- <section class="user-main">
- <a href="#user-content" id="user-nav-skip-link" class="skip-link__user-nav">
- {{i18n "skip_user_nav"}}
- </a>
- <section
- class="{{if this.collapsedInfo 'collapsed-info'}}
- about
- {{if this.hasProfileBackgroundUrl 'has-background' 'no-background'}}"
- >
- {{#unless this.collapsedInfo}}
- {{#if this.showStaffCounters}}
- <div class="staff-counters">
- {{#if this.model.number_of_flags_given}}
- <div>
- {{html-safe
- (i18n
- "user.staff_counters.flags_given"
- className="helpful-flags"
- count=this.model.number_of_flags_given
- )
- }}
- </div>
- {{/if}}
- {{#if this.model.number_of_flagged_posts}}
- <div>
- <LinkTo
- @route="review"
- @query={{hash
- username=this.model.username
- status="all"
- type="ReviewableFlaggedPost"
- }}
- >
- {{html-safe
- (i18n
- "user.staff_counters.flagged_posts"
- className="flagged-posts"
- count=this.model.number_of_flagged_posts
- )
- }}
- </LinkTo>
- </div>
- {{/if}}
- {{#if this.model.number_of_rejected_posts}}
- <div>
- <LinkTo
- @route="review"
- @query={{hash
- username=this.model.username
- status="rejected"
- type="ReviewableQueuedPost"
- }}
- >
- {{html-safe
- (i18n
- "user.staff_counters.rejected_posts"
- className="flagged-posts"
- count=this.model.number_of_rejected_posts
- )
- }}
- </LinkTo>
- </div>
- {{/if}}
+import { array, concat, 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 HtmlWithLinks from "discourse/components/html-with-links";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import UserNav from "discourse/components/user-nav";
+import UserProfileAvatar from "discourse/components/user-profile-avatar";
+import UserStatusMessage from "discourse/components/user-status-message";
+import boundDate from "discourse/helpers/bound-date";
+import icon from "discourse/helpers/d-icon";
+import formatUsername from "discourse/helpers/format-username";
+import htmlSafe from "discourse/helpers/html-safe";
+import replaceEmoji from "discourse/helpers/replace-emoji";
+import routeAction from "discourse/helpers/route-action";
+import userStatus from "discourse/helpers/user-status";
+import { i18n } from "discourse-i18n";
+import UserNotificationsDropdown from "select-kit/components/user-notifications-dropdown";
- {{#if this.model.number_of_deleted_posts}}
- <div>
- <LinkTo @route="user.deletedPosts" @model={{this.model}}>
- {{html-safe
- (i18n
- "user.staff_counters.deleted_posts"
- className="deleted-posts"
- count=this.model.number_of_deleted_posts
- )
- }}
- </LinkTo>
- </div>
- {{/if}}
- {{#if this.model.number_of_suspensions}}
- <div>
- <a href {{on "click" this.showSuspensions}}>
- {{html-safe
- (i18n
- "user.staff_counters.suspensions"
- className="suspensions"
- count=this.model.number_of_suspensions
- )
- }}
- </a>
- </div>
- {{/if}}
- {{#if this.model.warnings_received_count}}
- <div>
- <LinkTo
- @route="userPrivateMessages.user.warnings"
- @model={{this.model}}
- >
- {{html-safe
- (i18n
- "user.staff_counters.warnings_received"
- className="warnings-received"
- count=this.model.warnings_received_count
- )
- }}
- </LinkTo>
- </div>
- {{/if}}
- </div>
- {{/if}}
- <div
- class="user-profile-image"
- style={{this.model.profileBackgroundUrl}}
- ></div>
- {{/unless}}
- <div class="details">
- <div class="primary">
- <PluginOutlet
- @name="before-user-profile-avatar"
- @outletArgs={{hash model=this.model}}
- />
- <UserProfileAvatar @user={{this.model}} @tagName="" />
- <div class="primary-textual">
- <div class="user-profile-names">
- <div
- class="{{if this.nameFirst 'full-name' 'username'}}
- user-profile-names__primary"
- >
- {{if
- this.nameFirst
- this.model.name
- (format-username this.model.username)
- }}
- {{user-status this.model currentUser=this.currentUser}}
- {{#if this.model.status}}
- <UserStatusMessage @status={{this.model.status}} />
+export default RouteTemplate(
+ <template>
+ <PluginOutlet
+ @name="above-user-profile"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ <div
+ class="container
+ {{if @controller.viewingSelf 'viewing-self'}}
+ {{if @controller.model.profile_hidden 'profile-hidden'}}
+ {{@controller.primaryGroup}}"
+ >
+ <section class="user-main">
+ <a
+ href="#user-content"
+ id="user-nav-skip-link"
+ class="skip-link__user-nav"
+ >
+ {{i18n "skip_user_nav"}}
+ </a>
+ <section
+ class="{{if @controller.collapsedInfo 'collapsed-info'}}
+ about
+ {{if
+ @controller.hasProfileBackgroundUrl
+ 'has-background'
+ 'no-background'
+ }}"
+ >
+ {{#unless @controller.collapsedInfo}}
+ {{#if @controller.showStaffCounters}}
+ <div class="staff-counters">
+ {{#if @controller.model.number_of_flags_given}}
+ <div>
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.flags_given"
+ className="helpful-flags"
+ [email protected]_of_flags_given
+ )
+ }}
+ </div>
+ {{/if}}
+ {{#if @controller.model.number_of_flagged_posts}}
+ <div>
+ <LinkTo
+ @route="review"
+ @query={{hash
+ status="all"
+ type="ReviewableFlaggedPost"
+ }}
+ >
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.flagged_posts"
+ className="flagged-posts"
+ [email protected]_of_flagged_posts
+ )
+ }}
+ </LinkTo>
+ </div>
+ {{/if}}
+ {{#if @controller.model.number_of_rejected_posts}}
+ <div>
+ <LinkTo
+ @route="review"
+ @query={{hash
+ status="rejected"
+ type="ReviewableQueuedPost"
+ }}
+ >
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.rejected_posts"
+ className="flagged-posts"
+ [email protected]_of_rejected_posts
+ )
+ }}
+ </LinkTo>
+ </div>
{{/if}}
- </div>
- <div
- class="{{if this.nameFirst 'username' 'full-name'}}
- user-profile-names__secondary"
- >{{#if
- this.nameFirst
- }}{{this.model.username}}{{else}}{{this.model.name}}{{/if}}</div>
- {{#if this.model.staged}}
- <div class="staged user-profile-names__secondary">{{i18n
- "user.staged"
- }}</div>
- {{/if}}
- {{#if this.model.title}}
- <div
- class="user-profile-names__title"
- >{{this.model.title}}</div>
- {{/if}}
- <span>
- <PluginOutlet
- @name="user-post-names"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
- </div>
- {{#if this.showFeaturedTopic}}
- <div class="featured-topic user-profile__featured-topic">
- <span title={{i18n "user.featured_topic"}}>
- {{d-icon "book"~}}
- </span><LinkTo
- @route="topic"
- @models={{array
- this.model.featured_topic.slug
- this.model.featured_topic.id
- }}
- >{{replace-emoji
- (html-safe this.model.featured_topic.fancy_title)
- }}</LinkTo>
+ {{#if @controller.model.number_of_deleted_posts}}
+ <div>
+ <LinkTo
+ @route="user.deletedPosts"
+ @model={{@controller.model}}
+ >
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.deleted_posts"
+ className="deleted-posts"
+ [email protected]_of_deleted_posts
+ )
+ }}
+ </LinkTo>
+ </div>
+ {{/if}}
+ {{#if @controller.model.number_of_suspensions}}
+ <div>
+ <a href {{on "click" @controller.showSuspensions}}>
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.suspensions"
+ className="suspensions"
+ [email protected]_of_suspensions
+ )
+ }}
+ </a>
+ </div>
+ {{/if}}
+ {{#if @controller.model.warnings_received_count}}
+ <div>
+ <LinkTo
+ @route="userPrivateMessages.user.warnings"
+ @model={{@controller.model}}
+ >
+ {{htmlSafe
+ (i18n
+ "user.staff_counters.warnings_received"
+ className="warnings-received"
+ [email protected]_received_count
+ )
+ }}
+ </LinkTo>
+ </div>
+ {{/if}}
</div>
{{/if}}
-
<div
- class="location-and-website user-profile__location-and-website"
- >
- {{#if this.model.location}}<div
- class="user-profile-location"
- >{{d-icon "location-dot"~}}
- {{this.model.location}}</div>{{/if}}
- {{#if this.model.website_name}}
- <div class="user-profile-website">
- {{! template-lint-disable link-rel-noopener }}
- {{d-icon "globe"~}}
- {{#if this.linkWebsite~}}
- <a
- href={{this.model.website}}
- rel="noopener {{unless
- this.removeNoFollow
- 'nofollow ugc'
- }}"
- target="_blank"
- >{{this.model.website_name}}</a>
- {{else}}
- <span
- title={{this.model.website}}
- >{{this.model.website_name}}</span>
+ class="user-profile-image"
+ style={{@controller.model.profileBackgroundUrl}}
+ ></div>
+ {{/unless}}
+ <div class="details">
+ <div class="primary">
+ <PluginOutlet
+ @name="before-user-profile-avatar"
+ @outletArgs={{hash [email protected]}}
+ />
+ <UserProfileAvatar @user={{@controller.model}} @tagName="" />
+ <div class="primary-textual">
+ <div class="user-profile-names">
+ <div
+ class="{{if @controller.nameFirst 'full-name' 'username'}}
+ user-profile-names__primary"
+ >
+ {{if
+ @controller.nameFirst
+ @controller.model.name
+ (formatUsername @controller.model.username)
+ }}
+ {{userStatus
+ @controller.model
+ }}
+ {{#if @controller.model.status}}
+ <UserStatusMessage @status={{@controller.model.status}} />
+ {{/if}}
+ </div>
+ <div
+ class="{{if @controller.nameFirst 'username' 'full-name'}}
+ user-profile-names__secondary"
+ >{{#if
+ @controller.nameFirst
+ }}{{@controller.model.username}}{{else}}{{@controller.model.name}}{{/if}}</div>
+ {{#if @controller.model.staged}}
+ <div class="staged user-profile-names__secondary">{{i18n
+ "user.staged"
+ }}</div>
{{/if}}
- {{! template-lint-enable link-rel-noopener }}
+ {{#if @controller.model.title}}
+ <div
+ class="user-profile-names__title"
+ >{{@controller.model.title}}</div>
+ {{/if}}
+ <span>
+ <PluginOutlet
+ @name="user-post-names"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
</div>
- {{/if}}
- <span>
- <PluginOutlet
- @name="user-location-and-website"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
- </div>
- <div class="bio">
- {{#if this.model.suspended}}
- <div class="suspended">
- {{d-icon "ban"}}
- <b>
- {{#if this.model.suspendedForever}}
- {{i18n "user.suspended_permanently"}}
- {{else}}
- {{i18n
- "user.suspended_notice"
- date=this.model.suspendedTillDate
+ {{#if @controller.showFeaturedTopic}}
+ <div class="featured-topic user-profile__featured-topic">
+ <span title={{i18n "user.featured_topic"}}>
+ {{icon "book"~}}
+ </span><LinkTo
+ @route="topic"
+ @models={{array
+ @controller.model.featured_topic.slug
+ @controller.model.featured_topic.id
}}
- {{/if}}
- </b>
- <br />
- {{#if this.model.suspend_reason}}
- <b>{{i18n "user.suspended_reason"}}</b>
- {{this.model.suspend_reason}}
+ >{{replaceEmoji
+ (htmlSafe @controller.model.featured_topic.fancy_title)
+ }}</LinkTo>
+ </div>
+ {{/if}}
+
+ <div
+ class="location-and-website user-profile__location-and-website"
+ >
+ {{#if @controller.model.location}}<div
+ class="user-profile-location"
+ >{{icon "location-dot"~}}
+ {{@controller.model.location}}</div>{{/if}}
+ {{#if @controller.model.website_name}}
+ <div class="user-profile-website">
+ {{! template-lint-disable link-rel-noopener }}
+ {{icon "globe"~}}
+ {{#if @controller.linkWebsite~}}
+ <a
+ href={{@controller.model.website}}
+ rel="noopener {{unless
+ @controller.removeNoFollow
+ 'nofollow ugc'
+ }}"
+ target="_blank"
+ >{{@controller.model.website_name}}</a>
+ {{else}}
+ <span
+ title={{@controller.model.website}}
+ >{{@controller.model.website_name}}</span>
+ {{/if}}
+ {{! template-lint-enable link-rel-noopener }}
+ </div>
{{/if}}
+ <span>
+ <PluginOutlet
+ @name="user-location-and-website"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
</div>
- {{/if}}
- {{#if this.isNotSuspendedOrIsStaff}}
- <HtmlWithLinks>
- {{html-safe this.model.bio_cooked}}
- </HtmlWithLinks>
- {{/if}}
- </div>
- {{#if this.publicUserFields}}
- <div class="public-user-fields">
- {{#each this.publicUserFields as |uf|}}
- {{#if uf.value}}
- <div class="public-user-field {{uf.field.dasherized_name}}">
- <span class="user-field-name">{{uf.field.name}}</span>:
- <span class="user-field-value">
- {{#each uf.value as |v|}}
- {{! some values are arrays }}
- <span class="user-field-value-list-item">
- {{#if uf.field.searchable}}
- <LinkTo
- @route="users"
- @query={{hash name=v}}
- >{{v}}</LinkTo>
- {{else}}
- {{v}}
- {{/if}}
- </span>
+ <div class="bio">
+ {{#if @controller.model.suspended}}
+ <div class="suspended">
+ {{icon "ban"}}
+ <b>
+ {{#if @controller.model.suspendedForever}}
+ {{i18n "user.suspended_permanently"}}
{{else}}
- {{uf.value}}
- {{/each}}
- </span>
+ {{i18n
+ "user.suspended_notice"
+ }}
+ {{/if}}
+ </b>
+ <br />
+ {{#if @controller.model.suspend_reason}}
+ <b>{{i18n "user.suspended_reason"}}</b>
+ {{@controller.model.suspend_reason}}
+ {{/if}}
</div>
{{/if}}
- {{/each}}
+ {{#if @controller.isNotSuspendedOrIsStaff}}
+ <HtmlWithLinks>
+ {{htmlSafe @controller.model.bio_cooked}}
+ </HtmlWithLinks>
+ {{/if}}
+ </div>
+
+ {{#if @controller.publicUserFields}}
+ <div class="public-user-fields">
+ {{#each @controller.publicUserFields as |uf|}}
+ {{#if uf.value}}
+ <div
+ class="public-user-field {{uf.field.dasherized_name}}"
+ >
+ <span
+ class="user-field-name"
+ >{{uf.field.name}}</span>:
+ <span class="user-field-value">
+ {{#each uf.value as |v|}}
+ {{! some values are arrays }}
+ <span class="user-field-value-list-item">
+ {{#if uf.field.searchable}}
+ <LinkTo
+ @route="users"
+ @query={{hash name=v}}
+ >{{v}}</LinkTo>
+ {{else}}
+ {{v}}
+ {{/if}}
+ </span>
+ {{else}}
+ {{uf.value}}
+ {{/each}}
+ </span>
+ </div>
+ {{/if}}
+ {{/each}}
+
+ <span>
+ <PluginOutlet
+ @name="user-profile-public-fields"
+ @connectorTagName="div"
+ @outletArgs={{hash
+ }}
+ />
+ </span>
+ </div>
+ {{/if}}
<span>
<PluginOutlet
- @name="user-profile-public-fields"
+ @name="user-profile-primary"
@connectorTagName="div"
- @outletArgs={{hash
- publicUserFields=this.publicUserFields
- model=this.model
- }}
+ @outletArgs={{hash [email protected]}}
/>
</span>
</div>
- {{/if}}
-
- <span>
- <PluginOutlet
- @name="user-profile-primary"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
- </div>
-
- <section class="controls">
- <ul>
- {{#if this.model.can_send_private_message_to_user}}
- <li>
- <DButton
- @action={{fn
- (route-action "composePrivateMessage")
- this.model
- }}
- @icon="envelope"
- @label="user.private_message"
- class="btn-primary compose-pm"
- />
- </li>
- {{/if}}
- {{#if this.canMuteOrIgnoreUser}}
- <li>
- <UserNotificationsDropdown
- @user={{this.model}}
- @value={{this.userNotificationLevel}}
- @updateNotificationLevel={{action
- "updateNotificationLevel"
- }}
- />
- </li>
- {{/if}}
+ <section class="controls">
+ <ul>
+ {{#if @controller.model.can_send_private_message_to_user}}
+ <li>
+ <DButton
+ @action={{fn
+ (routeAction "composePrivateMessage")
+ @controller.model
+ }}
+ @icon="envelope"
+ @label="user.private_message"
+ class="btn-primary compose-pm"
+ />
+ </li>
+ {{/if}}
- {{#if this.displayTopLevelAdminButton}}
- <li><a
- href={{this.model.adminPath}}
- class="btn btn-default user-admin"
- >{{d-icon "wrench"}}<span class="d-button-label">{{i18n
- "admin.user.show_admin_profile"
- }}</span></a></li>
- {{/if}}
+ {{#if @controller.canMuteOrIgnoreUser}}
+ <li>
+ <UserNotificationsDropdown
+ @user={{@controller.model}}
+ @value={{@controller.userNotificationLevel}}
+ @updateNotificationLevel={{@controller.updateNotificationLevel}}
+ />
+ </li>
+ {{/if}}
- <PluginOutlet
- @name="user-profile-controls"
- @connectorTagName="li"
- @outletArgs={{hash model=this.model}}
- />
+ {{#if @controller.displayTopLevelAdminButton}}
+ <li><a
+ href={{@controller.model.adminPath}}
+ class="btn btn-default user-admin"
+ >{{icon "wrench"}}<span class="d-button-label">{{i18n
+ "admin.user.show_admin_profile"
+ }}</span></a></li>
+ {{/if}}
- {{#if this.canExpandProfile}}
- <li>
- <DButton
- @ariaLabel={{this.collapsedInfoState.ariaLabel}}
- @label={{concat "user." this.collapsedInfoState.label}}
- @icon={{this.collapsedInfoState.icon}}
- @action={{action this.collapsedInfoState.action}}
- aria-controls="collapsed-info-panel"
- aria-expanded={{if
- this.collapsedInfoState.isExpanded
- "true"
- "false"
- }}
- class="btn-default"
+ <PluginOutlet
+ @name="user-profile-controls"
+ @connectorTagName="li"
+ @outletArgs={{hash [email protected]}}
/>
- </li>
- {{/if}}
- </ul>
- </section>
- </div>
- <PluginOutlet
- @name="user-profile-above-collapsed-info"
- @outletArgs={{hash model=this.model collapsedInfo=this.collapsedInfo}}
- />
- {{#unless this.collapsedInfo}}
- <div class="secondary" id="collapsed-info-panel">
- <dl>
- {{#if this.model.created_at}}
- <div><dt class="created-at">{{i18n "user.created"}}</dt><dd
- class="created-at"
- >{{bound-date this.model.created_at}}</dd></div>
- {{/if}}
- {{#if this.model.last_posted_at}}
- <div><dt class="last-posted-at">{{i18n
- "user.last_posted"
- }}</dt><dd class="last-posted-at">{{bound-date
- this.model.last_posted_at
- }}</dd></div>
- {{/if}}
- {{#if this.model.last_seen_at}}
- <div><dt class="last-seen-at">{{i18n "user.last_seen"}}</dt><dd
- class="last-seen-at"
- >{{bound-date this.model.last_seen_at}}</dd></div>
- {{/if}}
- {{#if this.model.profile_view_count}}
- <div><dt class="profile-view-count">{{i18n "views"}}</dt><dd
- class="profile-view-count"
- >{{this.model.profile_view_count}}</dd></div>
- {{/if}}
- {{#if this.model.invited_by}}
- <div><dt class="invited-by">{{i18n "user.invited_by"}}</dt><dd
- class="invited-by"
- ><LinkTo
- @route="user"
- @model={{this.model.invited_by}}
- >{{this.model.invited_by.username}}</LinkTo></dd></div>
- {{/if}}
- {{#if this.hasTrustLevel}}
- <div><dt class="trust-level">{{i18n "user.trust_level"}}</dt><dd
- class="trust-level"
- >{{this.model.trustLevel.name}}</dd></div>
- {{/if}}
- {{#if this.canCheckEmails}}
- <div><dt class="email">{{i18n "user.email.title"}}</dt>
- <dd class="email" title={{this.model.email}}>
- {{#if this.model.email}}
- {{this.model.email}}
- {{else}}
+
+ {{#if @controller.canExpandProfile}}
+ <li>
<DButton
- @action={{fn (route-action "checkEmail") this.model}}
- @icon="envelope"
- @label="admin.users.check_email.text"
- class="btn-primary"
+ @ariaLabel={{@controller.collapsedInfoState.ariaLabel}}
+ @label={{concat
+ "user."
+ @controller.collapsedInfoState.label
+ }}
+ @icon={{@controller.collapsedInfoState.icon}}
+ @action={{@controller.collapsedInfoState.action}}
+ aria-controls="collapsed-info-panel"
+ aria-expanded={{if
+ @controller.collapsedInfoState.isExpanded
+ "true"
+ "false"
+ }}
+ class="btn-default"
/>
- {{/if}}
- </dd>
- </div>
- {{/if}}
- {{#if this.model.displayGroups}}
- <div><dt class="groups">{{i18n
- "groups.title"
- count=this.model.displayGroups.length
- }}</dt>
- <dd class="groups">
- {{#each this.model.displayGroups as |group|}}
- <span><LinkTo
- @route="group"
- @model={{group.name}}
- class="group-link"
- >{{group.name}}</LinkTo></span>
- {{/each}}
+ </li>
+ {{/if}}
+ </ul>
+ </section>
+ </div>
+ <PluginOutlet
+ @name="user-profile-above-collapsed-info"
+ @outletArgs={{hash
+ }}
+ />
+ {{#unless @controller.collapsedInfo}}
+ <div class="secondary" id="collapsed-info-panel">
+ <dl>
+ {{#if @controller.model.created_at}}
+ <div><dt class="created-at">{{i18n "user.created"}}</dt><dd
+ class="created-at"
+ >{{boundDate @controller.model.created_at}}</dd></div>
+ {{/if}}
+ {{#if @controller.model.last_posted_at}}
+ <div><dt class="last-posted-at">{{i18n
+ "user.last_posted"
+ }}</dt><dd class="last-posted-at">{{boundDate
+ @controller.model.last_posted_at
+ }}</dd></div>
+ {{/if}}
+ {{#if @controller.model.last_seen_at}}
+ <div><dt class="last-seen-at">{{i18n
+ "user.last_seen"
+ }}</dt><dd class="last-seen-at">{{boundDate
+ @controller.model.last_seen_at
+ }}</dd></div>
+ {{/if}}
+ {{#if @controller.model.profile_view_count}}
+ <div><dt class="profile-view-count">{{i18n "views"}}</dt><dd
+ class="profile-view-count"
+ >{{@controller.model.profile_view_count}}</dd></div>
+ {{/if}}
+ {{#if @controller.model.invited_by}}
+ <div><dt class="invited-by">{{i18n
+ "user.invited_by"
+ }}</dt><dd class="invited-by"><LinkTo
+ @route="user"
+ @model={{@controller.model.invited_by}}
+ >{{@controller.model.invited_by.username}}</LinkTo></dd></div>
+ {{/if}}
+ {{#if @controller.hasTrustLevel}}
+ <div><dt class="trust-level">{{i18n
+ "user.trust_level"
+ }}</dt><dd
+ class="trust-level"
+ >{{@controller.model.trustLevel.name}}</dd></div>
+ {{/if}}
+ {{#if @controller.canCheckEmails}}
+ <div><dt class="email">{{i18n "user.email.title"}}</dt>
+ <dd class="email" title={{@controller.model.email}}>
+ {{#if @controller.model.email}}
+ {{@controller.model.email}}
+ {{else}}
+ <DButton
+ @action={{fn
+ (routeAction "checkEmail")
+ @controller.model
+ }}
+ @icon="envelope"
+ @label="admin.users.check_email.text"
+ class="btn-primary"
+ />
+ {{/if}}
+ </dd>
+ </div>
+ {{/if}}
+ {{#if @controller.model.displayGroups}}
+ <div><dt class="groups">{{i18n
+ "groups.title"
+ }}</dt>
+ <dd class="groups">
+ {{#each @controller.model.displayGroups as |group|}}
+ <span><LinkTo
+ @route="group"
+ @model={{group.name}}
+ class="group-link"
+ >{{group.name}}</LinkTo></span>
+ {{/each}}
- <LinkTo
- @route="groups"
- @query={{hash username=this.model.username}}
- >
- ...
- </LinkTo>
- </dd>
- </div>
- {{/if}}
+ <LinkTo
+ @route="groups"
+ @query={{hash [email protected]}}
+ >
+ ...
+ </LinkTo>
+ </dd>
+ </div>
+ {{/if}}
- {{#if this.canDeleteUser}}
- <div class="pull-right"><DButton
- @action={{action "adminDelete"}}
- @icon="triangle-exclamation"
- @label="user.admin_delete"
- class="btn-danger btn-delete-user"
- /></div>
- {{/if}}
+ {{#if @controller.canDeleteUser}}
+ <div class="pull-right"><DButton
+ @action={{@controller.adminDelete}}
+ @icon="triangle-exclamation"
+ @label="user.admin_delete"
+ class="btn-danger btn-delete-user"
+ /></div>
+ {{/if}}
- <PluginOutlet
- @name="user-profile-secondary"
- @outletArgs={{hash model=this.model}}
- />
- </dl>
+ <PluginOutlet
+ @name="user-profile-secondary"
+ @outletArgs={{hash [email protected]}}
+ />
+ </dl>
+ </div>
+ {{/unless}}
</div>
- {{/unless}}
- </div>
- </section>
+ </section>
- <div class="new-user-wrapper">
- <UserNav
- @user={{this.model}}
- @isStaff={{this.currentUser.staff}}
- @isMobileView={{this.site.mobileView}}
- @showActivityTab={{this.showActivityTab}}
- @showNotificationsTab={{this.showNotificationsTab}}
- @showPrivateMessages={{this.showPrivateMessages}}
- @canInviteToForum={{this.canInviteToForum}}
- @showBadges={{this.showBadges}}
- @currentParentRoute={{this.currentParentRoute}}
- @showRead={{this.showRead}}
- @showDrafts={{this.showDrafts}}
- @showBookmarks={{this.showBookmarks}}
- />
+ <div class="new-user-wrapper">
+ <UserNav
+ @user={{@controller.model}}
+ @isStaff={{@controller.currentUser.staff}}
+ @isMobileView={{@controller.site.mobileView}}
+ @showActivityTab={{@controller.showActivityTab}}
+ @showNotificationsTab={{@controller.showNotificationsTab}}
+ @showPrivateMessages={{@controller.showPrivateMessages}}
+ @canInviteToForum={{@controller.canInviteToForum}}
+ @showBadges={{@controller.showBadges}}
+ @currentParentRoute={{@controller.currentParentRoute}}
+ @showRead={{@controller.showRead}}
+ @showDrafts={{@controller.showDrafts}}
+ @showBookmarks={{@controller.showBookmarks}}
+ />
- <div class="new-user-content-wrapper">
- {{outlet}}
- </div>
+ <div class="new-user-content-wrapper">
+ {{outlet}}
+ </div>
+ </div>
+ </section>
</div>
- </section>
-</div>
\ No newline at end of file
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/user/notifications-index.gjs b/app/assets/javascripts/discourse/app/templates/user/notifications-index.gjs
index 94286869000..1f425b77f9b 100644
--- a/app/assets/javascripts/discourse/app/templates/user/notifications-index.gjs
+++ b/app/assets/javascripts/discourse/app/templates/user/notifications-index.gjs
@@ -1,43 +1,56 @@
-{{#if this.model.error}}
- <div class="item error">
- {{#if this.model.forbidden}}
- {{i18n "errors.reasons.forbidden"}}
+import { hash } from "@ember/helper";
+import RouteTemplate from "ember-route-template";
+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
+import EmptyState from "discourse/components/empty-state";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import MenuItem from "discourse/components/user-menu/menu-item";
+import { i18n } from "discourse-i18n";
+import NotificationsFilter from "select-kit/components/notifications-filter";
+
+export default RouteTemplate(
+ <template>
+ {{#if @controller.model.error}}
+ <div class="item error">
+ {{#if @controller.model.forbidden}}
+ {{i18n "errors.reasons.forbidden"}}
+ {{else}}
+ {{i18n "errors.desc.unknown"}}
+ {{/if}}
+ </div>
+ {{else if @controller.doesNotHaveNotifications}}
+ <PluginOutlet @name="user-notifications-empty-state">
+ <EmptyState
+ @title={{i18n "user.no_notifications_page_title"}}
+ @body={{@controller.emptyStateBody}}
+ />
+ </PluginOutlet>
{{else}}
- {{i18n "errors.desc.unknown"}}
- {{/if}}
- </div>
-{{else if this.doesNotHaveNotifications}}
- <PluginOutlet @name="user-notifications-empty-state">
- <EmptyState
- @title={{i18n "user.no_notifications_page_title"}}
- @body={{this.emptyStateBody}}
- />
- </PluginOutlet>
-{{else}}
- <PluginOutlet @name="user-notifications-above-filter" />
- <div class="user-notifications-filter">
- <NotificationsFilter
- @value={{this.filter}}
- @onChange={{this.updateFilter}}
- />
- <PluginOutlet
- @name="user-notifications-after-filter"
- @outletArgs={{hash items=this.items}}
- />
- </div>
+ <PluginOutlet @name="user-notifications-above-filter" />
+ <div class="user-notifications-filter">
+ <NotificationsFilter
+ @value={{@controller.filter}}
+ @onChange={{@controller.updateFilter}}
+ />
+ <PluginOutlet
+ @name="user-notifications-after-filter"
+ @outletArgs={{hash [email protected]}}
+ />
+ </div>
- {{#if this.nothingFound}}
- <div class="alert alert-info">{{i18n "notifications.empty"}}</div>
- {{else}}
- <div class={{this.listContainerClassNames}}>
- {{#each this.items as |item|}}
- <UserMenu::MenuItem @item={{item}} />
- {{/each}}
- <ConditionalLoadingSpinner @condition={{this.loading}} />
- <PluginOutlet
- @name="user-notifications-list-bottom"
- @outletArgs={{hash controller=this}}
- />
- </div>
- {{/if}}
-{{/if}}
\ No newline at end of file
+ {{#if @controller.nothingFound}}
+ <div class="alert alert-info">{{i18n "notifications.empty"}}</div>
+ {{else}}
+ <div class={{@controller.listContainerClassNames}}>
+ {{#each @controller.items as |item|}}
+ <MenuItem @item={{item}} />
+ {{/each}}
+ <ConditionalLoadingSpinner @condition={{@controller.loading}} />
+ <PluginOutlet
+ @name="user-notifications-list-bottom"
+ @outletArgs={{hash controller=@controller}}
+ />
+ </div>
+ {{/if}}
+ {{/if}}
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/app/templates/users.gjs b/app/assets/javascripts/discourse/app/templates/users.gjs
index f8e3f7e349a..22f57f00d0b 100644
--- a/app/assets/javascripts/discourse/app/templates/users.gjs
+++ b/app/assets/javascripts/discourse/app/templates/users.gjs
@@ -1,105 +1,136 @@
-{{#if this.model.canLoadMore}}
- {{hide-application-footer}}
-{{/if}}
+import { Input } from "@ember/component";
+import { fn, 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 DirectoryTable from "discourse/components/directory-table";
+import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import basePath from "discourse/helpers/base-path";
+import bodyClass from "discourse/helpers/body-class";
+import hideApplicationFooter from "discourse/helpers/hide-application-footer";
+import htmlSafe from "discourse/helpers/html-safe";
+import withEventValue from "discourse/helpers/with-event-value";
+import { i18n } from "discourse-i18n";
+import ComboBox from "select-kit/components/combo-box";
+import PeriodChooser from "select-kit/components/period-chooser";
-{{body-class "users-page"}}
-<section>
- <LoadMore
- @selector=".directory-table .directory-table__cell"
- @action={{action "loadMore"}}
- >
- <div class="container">
- <div class="users-directory directory">
- <span>
- <PluginOutlet
- @name="users-top"
- @connectorTagName="div"
- @outletArgs={{hash model=this.model}}
- />
- </span>
- <div class="directory-controls">
- <div class="period-controls">
- <PeriodChooser
- @period={{this.period}}
- @onChange={{fn (mut this.period)}}
- @fullDay={{false}}
- />
- {{#if this.lastUpdatedAt}}
- <div class="directory-last-updated">
- {{i18n "directory.last_updated"}}
- {{this.lastUpdatedAt}}
- </div>
- {{/if}}
- </div>
- <div class="inline-form">
- <label class="total-rows">
- {{#if this.model.totalRows}}
- {{i18n "directory.total_rows" count=this.model.totalRows}}
- {{/if}}
- </label>
- <Input
- @value={{readonly this.nameInput}}
- placeholder={{i18n "directory.filter_name"}}
- class="filter-name no-blur"
- {{on "input" (with-event-value this.onUsernameFilterChanged)}}
- />
- {{#if this.showGroupFilter}}
- <ComboBox
- @value={{this.group}}
- @content={{this.groupOptions}}
- @onChange={{this.groupChanged}}
- @options={{hash none="directory.group.all"}}
- class="directory-group-selector"
- />
- {{/if}}
- {{#if this.currentUser.staff}}
- <DButton
- @icon="wrench"
- @action={{this.showEditColumnsModal}}
- class="btn-default open-edit-columns-btn"
- />
- {{/if}}
- <PluginOutlet
- @name="users-directory-controls"
- @outletArgs={{hash model=this.model}}
- />
- </div>
- </div>
+export default RouteTemplate(
+ <template>
+ {{#if @controller.model.canLoadMore}}
+ {{hideApplicationFooter}}
+ {{/if}}
- <ConditionalLoadingSpinner @condition={{this.isLoading}}>
- {{#if this.model.length}}
- <DirectoryTable
- @items={{this.model}}
- @columns={{this.columns}}
- @showTimeRead={{this.showTimeRead}}
- @order={{this.order}}
- @updateOrder={{fn (mut this.order)}}
- @asc={{this.asc}}
- @updateAsc={{fn (mut this.asc)}}
- />
- <ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
- {{else}}
- <div class="empty-state">
- <div class="empty-state-body">
- <p>
- {{#if this.name}}
- {{i18n "directory.no_results_with_search"}}
- {{else}}
- {{i18n "directory.no_results.body"}}
- {{#if this.currentUser.staff}}
- {{html-safe
- (i18n
- "directory.no_results.extra_body" basePath=(base-path)
- )
- }}
- {{/if}}
+ {{bodyClass "users-page"}}
+ <section>
+ <LoadMore
+ @selector=".directory-table .directory-table__cell"
+ @action={{@controller.loadMore}}
+ >
+ <div class="container">
+ <div class="users-directory directory">
+ <span>
+ <PluginOutlet
+ @name="users-top"
+ @connectorTagName="div"
+ @outletArgs={{hash [email protected]}}
+ />
+ </span>
+ <div class="directory-controls">
+ <div class="period-controls">
+ <PeriodChooser
+ @period={{@controller.period}}
+ @onChange={{fn (mut @controller.period)}}
+ @fullDay={{false}}
+ />
+ {{#if @controller.lastUpdatedAt}}
+ <div class="directory-last-updated">
+ {{i18n "directory.last_updated"}}
+ {{@controller.lastUpdatedAt}}
+ </div>
+ {{/if}}
+ </div>
+ <div class="inline-form">
+ <label class="total-rows">
+ {{#if @controller.model.totalRows}}
+ {{i18n
+ "directory.total_rows"
+ }}
{{/if}}
- </p>
+ </label>
+ <Input
+ @value={{readonly @controller.nameInput}}
+ placeholder={{i18n "directory.filter_name"}}
+ class="filter-name no-blur"
+ {{on
+ "input"
+ (withEventValue @controller.onUsernameFilterChanged)
+ }}
+ />
+ {{#if @controller.showGroupFilter}}
+ <ComboBox
+ @value={{@controller.group}}
+ @content={{@controller.groupOptions}}
+ @onChange={{@controller.groupChanged}}
+ @options={{hash none="directory.group.all"}}
+ class="directory-group-selector"
+ />
+ {{/if}}
+ {{#if @controller.currentUser.staff}}
+ <DButton
+ @icon="wrench"
+ @action={{@controller.showEditColumnsModal}}
+ class="btn-default open-edit-columns-btn"
+ />
+ {{/if}}
+ <PluginOutlet
+ @name="users-directory-controls"
+ @outletArgs={{hash [email protected]}}
+ />
</div>
</div>
- {{/if}}
- </ConditionalLoadingSpinner>
- </div>
- </div>
- </LoadMore>
-</section>
\ No newline at end of file
+
+ <ConditionalLoadingSpinner @condition={{@controller.isLoading}}>
+ {{#if @controller.model.length}}
+ <DirectoryTable
+ @items={{@controller.model}}
+ @columns={{@controller.columns}}
+ @showTimeRead={{@controller.showTimeRead}}
+ @order={{@controller.order}}
+ @updateOrder={{fn (mut @controller.order)}}
+ @asc={{@controller.asc}}
+ @updateAsc={{fn (mut @controller.asc)}}
+ />
+ <ConditionalLoadingSpinner
+ @condition={{@controller.model.loadingMore}}
+ />
+ {{else}}
+ <div class="empty-state">
+ <div class="empty-state-body">
+ <p>
+ {{#if @controller.name}}
+ {{i18n "directory.no_results_with_search"}}
+ {{else}}
+ {{i18n "directory.no_results.body"}}
+ {{#if @controller.currentUser.staff}}
+ {{htmlSafe
+ (i18n
+ "directory.no_results.extra_body"
+ basePath=(basePath)
+ )
+ }}
+ {{/if}}
+ {{/if}}
+ </p>
+ </div>
+ </div>
+ {{/if}}
+ </ConditionalLoadingSpinner>
+ </div>
+ </div>
+ </LoadMore>
+ </section>
+ </template>
+);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.gjs
index 0d80ce7af49..d87fdba7804 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.gjs
@@ -1120,7 +1120,7 @@ third line`
assert.strictEqual(
this.value,
initialValue + "",
- "it doesn’t continue the list"
+ "doesn't continue the list"
);
},
{ enable_smart_lists: true }
diff --git a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.gjs
index dc575ee7296..6baa76ae52b 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.gjs
@@ -1,14 +1,19 @@
+import { hash } from "@ember/helper";
import { getOwner } from "@ember/owner";
+import didInsert from "@ember/render-modifiers/modifiers/did-insert";
+import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import {
click,
render,
triggerEvent,
triggerKeyEvent,
} from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
+import DButton from "discourse/components/d-button";
+import element_ from "discourse/helpers/element";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import DDefaultToast from "float-kit/components/d-default-toast";
+import DMenu from "float-kit/components/d-menu";
import DMenuInstance from "float-kit/lib/d-menu-instance";
module("Integration | Component | FloatKit | d-menu", function (hooks) {
@@ -23,20 +28,24 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
}
test("@label", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
assert.dom(".fk-d-menu__trigger .d-button-label").hasText(/^label$/);
});
test("@icon", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @icon="check" />`);
+ await render(<template><DMenu @inline={{true}} @icon="check" /></template>);
assert.dom(".fk-d-menu__trigger .d-icon-check").exists();
});
test("@content", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @label="label" @content="content" />`
+ <template>
+ <DMenu @inline={{true}} @label="label" @content="content" />
+ </template>
);
await open();
@@ -47,7 +56,14 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
this.site.mobileView = true;
await render(
- hbs`<DMenu @identifier="foo" @inline={{true}} @modalForMobile={{true}} @content="content" />`
+ <template>
+ <DMenu
+ @identifier="foo"
+ @inline={{true}}
+ @modalForMobile={{true}}
+ @content="content"
+ />
+ </template>
);
await open();
@@ -55,31 +71,43 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@onRegisterApi", async function (assert) {
+ const self = this;
+
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
await render(
- hbs`<DMenu @inline={{true}} @onRegisterApi={{this.onRegisterApi}} />`
+ <template>
+ <DMenu @inline={{true}} @onRegisterApi={{self.onRegisterApi}} />
+ </template>
);
assert.true(this.api instanceof DMenuInstance);
});
test("@onShow", async function (assert) {
+ const self = this;
+
this.test = false;
this.onShow = () => (this.test = true);
- await render(hbs`<DMenu @inline={{true}} @onShow={{this.onShow}} />`);
+ await render(
+ <template><DMenu @inline={{true}} @onShow={{self.onShow}} /></template>
+ );
await open();
assert.true(this.test);
});
test("@onClose", async function (assert) {
+ const self = this;
+
this.test = false;
this.onClose = () => (this.test = true);
- await render(hbs`<DMenu @inline={{true}} @onClose={{this.onClose}} />`);
+ await render(
+ <template><DMenu @inline={{true}} @onClose={{self.onClose}} /></template>
+ );
await open();
await close();
@@ -87,7 +115,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("-expanded class", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
assert.dom(".fk-d-menu__trigger").doesNotHaveClass("-expanded");
@@ -97,14 +127,18 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("trigger id attribute", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
assert.dom(".fk-d-menu__trigger").hasAttribute("id");
});
test("@identifier", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @label="label" @identifier="tip" />`
+ <template>
+ <DMenu @inline={{true}} @label="label" @identifier="tip" />
+ </template>
);
assert.dom(".fk-d-menu__trigger").hasAttribute("data-identifier", "tip");
@@ -115,7 +149,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("aria-expanded attribute", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
assert.dom(".fk-d-menu__trigger").hasAttribute("aria-expanded", "false");
@@ -126,7 +162,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("<:trigger>", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}}><:trigger>label</:trigger></DMenu>`
+ <template>
+ <DMenu @inline={{true}}><:trigger>label</:trigger></DMenu>
+ </template>
);
assert.dom(".fk-d-menu__trigger").containsText("label");
@@ -134,7 +172,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("<:content>", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}}><:content>content</:content></DMenu>`
+ <template>
+ <DMenu @inline={{true}}><:content>content</:content></DMenu>
+ </template>
);
await open();
@@ -143,7 +183,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("content role attribute", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
await open();
@@ -151,10 +193,19 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@component", async function (assert) {
+ const self = this;
+
this.component = DDefaultToast;
await render(
- hbs`<DMenu @inline={{true}} @label="test" @component={{this.component}} @data={{hash message="content"}}/>`
+ <template>
+ <DMenu
+ @inline={{true}}
+ @label="test"
+ @component={{self.component}}
+ @data={{hash message="content"}}
+ />
+ </template>
);
await open();
@@ -167,7 +218,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("content aria-labelledby attribute", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
await open();
@@ -179,7 +232,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("@closeOnEscape", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @label="label" @closeOnEscape={{true}} />`
+ <template>
+ <DMenu @inline={{true}} @label="label" @closeOnEscape={{true}} />
+ </template>
);
await open();
await triggerKeyEvent(document.activeElement, "keydown", "Escape");
@@ -187,7 +242,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
assert.dom(".fk-d-menu").doesNotExist();
await render(
- hbs`<DMenu @inline={{true}} @label="label" @closeOnEscape={{false}} />`
+ <template>
+ <DMenu @inline={{true}} @label="label" @closeOnEscape={{false}} />
+ </template>
);
await open();
await triggerKeyEvent(document.activeElement, "keydown", "Escape");
@@ -197,7 +254,13 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("@closeOnClickOutside", async function (assert) {
await render(
- hbs`<span class="test">test</span><DMenu @inline={{true}} @label="label" @closeOnClickOutside={{true}} />`
+ <template>
+ <span class="test">test</span><DMenu
+ @inline={{true}}
+ @label="label"
+ @closeOnClickOutside={{true}}
+ />
+ </template>
);
await open();
await triggerEvent(".test", "pointerdown");
@@ -205,7 +268,13 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
assert.dom(".fk-d-menu").doesNotExist();
await render(
- hbs`<span class="test">test</span><DMenu @inline={{true}} @label="label" @closeOnClickOutside={{false}} />`
+ <template>
+ <span class="test">test</span><DMenu
+ @inline={{true}}
+ @label="label"
+ @closeOnClickOutside={{false}}
+ />
+ </template>
);
await open();
await triggerEvent(".test", "pointerdown");
@@ -215,7 +284,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("@maxWidth", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @label="label" @maxWidth={{20}} />`
+ <template>
+ <DMenu @inline={{true}} @label="label" @maxWidth={{20}} />
+ </template>
);
await open();
@@ -223,7 +294,9 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("applies position", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @label="label" />`);
+ await render(
+ <template><DMenu @inline={{true}} @label="label" /></template>
+ );
await open();
assert.dom(".fk-d-menu").hasAttribute("style", /top: [\d.]+?px/);
@@ -232,7 +305,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("content close argument", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}}><:trigger>test</:trigger><:content as |args|><DButton @icon="xmark" @action={{args.close}} /></:content></DMenu>`
+ <template>
+ <DMenu @inline={{true}}><:trigger>test</:trigger><:content
+ as |args|
+ ><DButton @icon="xmark" @action={{args.close}} /></:content></DMenu>
+ </template>
);
await open();
@@ -242,20 +319,26 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@autofocus", async function (assert) {
- await render(hbs`
- <DMenu @inline={{true}} @autofocus={{true}}>
- <:content>
- <DButton class="my-button" />
- </:content>
- </DMenu>
- `);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @autofocus={{true}}>
+ <:content>
+ <DButton class="my-button" />
+ </:content>
+ </DMenu>
+ </template>
+ );
await open();
assert.dom(document.activeElement).hasClass("my-button");
});
test("a menu can be closed by identifier", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @identifier="test">test</DMenu>`);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @identifier="test">test</DMenu>
+ </template>
+ );
await open();
await getOwner(this).lookup("service:menu").close("test");
@@ -264,7 +347,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("get a menu by identifier", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @identifier="test">test</DMenu>`);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @identifier="test">test</DMenu>
+ </template>
+ );
await open();
const activeMenu = getOwner(this)
@@ -278,7 +365,13 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("opening a menu with the same identifier", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @identifier="foo" @class="first">1</DMenu><DMenu @inline={{true}} @identifier="foo" @class="second">2</DMenu>`
+ <template>
+ <DMenu @inline={{true}} @identifier="foo" @class="first">1</DMenu><DMenu
+ @inline={{true}}
+ @identifier="foo"
+ @class="second"
+ >2</DMenu>
+ </template>
);
await click(".first.fk-d-menu__trigger");
@@ -294,7 +387,17 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("@groupIdentifier", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @groupIdentifier="foo" @class="first">1</DMenu><DMenu @inline={{true}} @groupIdentifier="foo" @class="second">2</DMenu>`
+ <template>
+ <DMenu
+ @inline={{true}}
+ @groupIdentifier="foo"
+ @class="first"
+ >1</DMenu><DMenu
+ @inline={{true}}
+ @groupIdentifier="foo"
+ @class="second"
+ >2</DMenu>
+ </template>
);
await click(".first.fk-d-menu__trigger");
@@ -310,7 +413,12 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
test("empty @identifier/@groupIdentifier", async function (assert) {
await render(
- hbs`<DMenu @inline={{true}} @class="first">1</DMenu><DMenu @inline={{true}} @class="second">2</DMenu>`
+ <template>
+ <DMenu @inline={{true}} @class="first">1</DMenu><DMenu
+ @inline={{true}}
+ @class="second"
+ >2</DMenu>
+ </template>
);
await click(".first.fk-d-menu__trigger");
@@ -320,12 +428,16 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await click(".second.fk-d-menu__trigger");
- assert.dom(".fk-d-menu.first").exists("doesn’t autoclose");
+ assert.dom(".fk-d-menu.first").exists("doesn't autoclose");
assert.dom(".fk-d-menu.second").exists();
});
test("@class", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @class="first">1</DMenu>`);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @class="first">1</DMenu>
+ </template>
+ );
await open();
@@ -334,7 +446,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@triggerClass", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @triggerClass="first">1</DMenu>`);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @triggerClass="first">1</DMenu>
+ </template>
+ );
await open();
@@ -343,7 +459,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@contentClass", async function (assert) {
- await render(hbs`<DMenu @inline={{true}} @contentClass="first">1</DMenu>`);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @contentClass="first">1</DMenu>
+ </template>
+ );
await open();
@@ -352,14 +472,22 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("focusTrigger on close", async function (assert) {
+ const self = this;
+
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
this.close = async () => await this.api.close();
await render(
- hbs`<DMenu @onRegisterApi={{this.onRegisterApi}} @inline={{true}} @icon="xmark">
- <DButton @icon="xmark" class="close" @action={{this.close}} />
- </DMenu>`
+ <template>
+ <DMenu
+ @onRegisterApi={{self.onRegisterApi}}
+ @inline={{true}}
+ @icon="xmark"
+ >
+ <DButton @icon="xmark" class="close" @action={{self.close}} />
+ </DMenu>
+ </template>
);
await click(".fk-d-menu__trigger");
@@ -370,14 +498,22 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("focusTrigger=false on close", async function (assert) {
+ const self = this;
+
this.api = null;
this.onRegisterApi = (api) => (this.api = api);
this.close = async () => await this.api.close({ focusTrigger: false });
await render(
- hbs`<DMenu @onRegisterApi={{this.onRegisterApi}} @inline={{true}} @icon="xmark">
- <DButton @icon="xmark" class="close" @action={{this.close}} />
- </DMenu>`
+ <template>
+ <DMenu
+ @onRegisterApi={{self.onRegisterApi}}
+ @inline={{true}}
+ @icon="xmark"
+ >
+ <DButton @icon="xmark" class="close" @action={{self.close}} />
+ </DMenu>
+ </template>
);
await click(".fk-d-menu__trigger");
@@ -388,6 +524,8 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("traps pointerdown events only when expanded ", async function (assert) {
+ const self = this;
+
let propagated = false;
const listener = () => {
@@ -401,15 +539,17 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
element.removeEventListener("pointerdown", listener);
};
- await render(hbs`
- <div {{didInsert this.didInsert}} {{will-destroy this.willDestroy}}>
- <DMenu
- @inline={{true}}
- @label="label"
- @identifier="d-menu-pointerdown-trap-test"
- />
- </div>
- `);
+ await render(
+ <template>
+ <div {{didInsert self.didInsert}} {{willDestroy self.willDestroy}}>
+ <DMenu
+ @inline={{true}}
+ @label="label"
+ @identifier="d-menu-pointerdown-trap-test"
+ />
+ </div>
+ </template>
+ );
await triggerEvent(".d-menu-pointerdown-trap-test-trigger", "pointerdown");
@@ -430,9 +570,11 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
});
test("@triggerComponent", async function (assert) {
- await render(hbs`
- <DMenu @inline={{true}} @triggerComponent={{element "span"}}>1</DMenu>
- `);
+ await render(
+ <template>
+ <DMenu @inline={{true}} @triggerComponent={{element_ "span"}}>1</DMenu>
+ </template>
+ );
await open();
diff --git a/app/assets/javascripts/discourse/tests/integration/components/form-kit/controls/select-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/form-kit/controls/select-test.gjs
index 60617670526..f5f6217adba 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/form-kit/controls/select-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/form-kit/controls/select-test.gjs
@@ -98,7 +98,7 @@ module(
.field("foo")
.hasNoValue(
NO_VALUE_OPTION,
- "it doesn’t have the none when value is present"
+ "doesn't have the none when value is present"
);
await render(
@@ -152,7 +152,7 @@ module(
.field("foo")
.hasNoValue(
NO_VALUE_OPTION,
- "it doesn’t have the none for an optional field when value is present and includeNone is false"
+ "doesn't have the none for an optional field when value is present and includeNone is false"
);
});
}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/input-size-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/input-size-test.gjs
index c67e9727cd2..37d836f8e76 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/input-size-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/input-size-test.gjs
@@ -1,7 +1,10 @@
+import { hash } from "@ember/helper";
import { find, render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
+import DButton from "discourse/components/d-button";
+import TextField from "discourse/components/text-field";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
+import ComboBox from "select-kit/components/combo-box";
module(
"Integration | Component | consistent input/dropdown/button sizes",
@@ -10,7 +13,11 @@ module(
test("icon only button, icon and text button, text only button", async function (assert) {
await render(
- hbs`<DButton @icon="plus" /> <DButton @icon="plus" @label="topic.create" /> <DButton @label="topic.create" />`
+ <template>
+ <DButton @icon="plus" />
+ <DButton @icon="plus" @label="topic.create" />
+ <DButton @label="topic.create" />
+ </template>
);
assert.strictEqual(
@@ -27,7 +34,9 @@ module(
test("button + text input", async function (assert) {
await render(
- hbs`<TextField /> <DButton @icon="plus" @label="topic.create" />`
+ <template>
+ <TextField /> <DButton @icon="plus" @label="topic.create" />
+ </template>
);
assert.strictEqual(
@@ -39,7 +48,9 @@ module(
test("combo box + input", async function (assert) {
await render(
- hbs`<ComboBox @options={{hash none="category.none"}} /> <TextField />`
+ <template>
+ <ComboBox @options={{hash none="category.none"}} /> <TextField />
+ </template>
);
assert.strictEqual(
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.gjs
index 9df9bde1ed5..90889ee8e6d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.gjs
@@ -1,5 +1,4 @@
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@@ -7,6 +6,8 @@ import selectKit, {
DEFAULT_CONTENT,
setDefaultState,
} from "discourse/tests/helpers/select-kit-helper";
+import ComboBox from "select-kit/components/combo-box";
+import SingleSelect from "select-kit/components/single-select";
import { clearCallbacks } from "select-kit/mixins/plugin-api";
module("Integration | Component | select-kit/api", function (hooks) {
@@ -24,6 +25,8 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).appendContent", async function (assert) {
+ const self = this;
+
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", (api) => {
@@ -36,10 +39,20 @@ module("Integration | Component | select-kit/api", function (hooks) {
api.modifySelectKit("combo-box").appendContent(() => {});
});
- await render(hbs`
- <ComboBox @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- <SingleSelect @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- `);
+ await render(
+ <template>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
await this.comboBox.expand();
assert.strictEqual(this.comboBox.rows().length, 4);
@@ -54,6 +67,8 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).prependContent", async function (assert) {
+ const self = this;
+
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", (api) => {
@@ -66,10 +81,20 @@ module("Integration | Component | select-kit/api", function (hooks) {
api.modifySelectKit("combo-box").prependContent(() => {});
});
- await render(hbs`
- <ComboBox @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- <SingleSelect @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- `);
+ await render(
+ <template>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
await this.comboBox.expand();
assert.strictEqual(this.comboBox.rows().length, 4);
@@ -84,6 +109,8 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).onChange", async function (assert) {
+ const self = this;
+
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", (api) => {
@@ -92,10 +119,16 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
});
- await render(hbs`
- <div id="test"></div>
- <ComboBox @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- `);
+ await render(
+ <template>
+ <div id="test"></div>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
await this.comboBox.expand();
await this.comboBox.selectRowByIndex(0);
@@ -103,6 +136,8 @@ module("Integration | Component | select-kit/api", function (hooks) {
});
test("modifySelectKit(identifier).replaceContent", async function (assert) {
+ const self = this;
+
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", (api) => {
@@ -115,10 +150,20 @@ module("Integration | Component | select-kit/api", function (hooks) {
api.modifySelectKit("combo-box").replaceContent(() => {});
});
- await render(hbs`
- <ComboBox @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- <SingleSelect @value={{this.value}} @content={{this.content}} @onChange={{this.onChange}} />
- `);
+ await render(
+ <template>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
await this.comboBox.expand();
assert.strictEqual(this.comboBox.rows().length, 1);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.gjs
index 746c707c6c8..7dd5b2d86e9 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.gjs
@@ -1,6 +1,6 @@
+import { hash } from "@ember/helper";
import { set } from "@ember/object";
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import sinon from "sinon";
import DiscourseURL from "discourse/lib/url";
@@ -8,7 +8,7 @@ import Category from "discourse/models/category";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
-import {
+import CategoryDrop, {
ALL_CATEGORIES_ID,
NO_CATEGORIES_ID,
} from "select-kit/components/category-drop";
@@ -42,12 +42,13 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("caretUpIcon", async function (assert) {
- await render(hbs`
- <CategoryDrop
- @category={{this.value}}
- @categories={{this.content}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <CategoryDrop @category={{self.value}} @categories={{self.content}} />
+ </template>
+ );
assert
.dom(".d-icon-caret-right", this.subject.header().el())
@@ -55,12 +56,13 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("none", async function (assert) {
- await render(hbs`
- <CategoryDrop
- @category={{this.value}}
- @categories={{this.content}}
- />
- `);
+ const self = this;
+
+ await render(
+ <template>
+ <CategoryDrop @category={{self.value}} @categories={{self.content}} />
+ </template>
+ );
const text = this.subject.header().label();
assert.strictEqual(
@@ -71,18 +73,22 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[not staff - TL0] displayCategoryDescription", async function (assert) {
+ const self = this;
+
set(this.currentUser, "staff", false);
set(this.currentUser, "trust_level", 0);
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -93,18 +99,22 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[not staff - TL1] displayCategoryDescription", async function (assert) {
+ const self = this;
+
set(this.currentUser, "moderator", false);
set(this.currentUser, "admin", false);
set(this.currentUser, "trust_level", 1);
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -115,18 +125,22 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("[staff - TL0] displayCategoryDescription", async function (assert) {
+ const self = this;
+
set(this.currentUser, "moderator", true);
set(this.currentUser, "trust_level", 0);
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -137,15 +151,19 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("hideParentCategory (default: false)", async function (assert) {
+ const self = this;
+
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -155,18 +173,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("hideParentCategory (true)", async function (assert) {
+ const self = this;
+
initCategoriesWithParentCategory(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- @options={{hash
- hideParentCategory=true
- }}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ @options={{hash hideParentCategory=true}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -182,16 +202,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("allow_uncategorized_topics (true)", async function (assert) {
+ const self = this;
+
this.siteSettings.allow_uncategorized_topics = true;
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -201,16 +225,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("allow_uncategorized_topics (false)", async function (assert) {
+ const self = this;
+
this.siteSettings.allow_uncategorized_topics = false;
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -220,15 +248,19 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("countSubcategories (default: false)", async function (assert) {
+ const self = this;
+
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -241,18 +273,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("countSubcategories (true)", async function (assert) {
+ const self = this;
+
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- @options={{hash
- countSubcategories=true
- }}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ @options={{hash countSubcategories=true}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -265,16 +299,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts:default", async function (assert) {
+ const self = this;
+
initCategories(this);
this.set("category", null);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -286,15 +324,19 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts:category is set", async function (assert) {
+ const self = this;
+
initCategories(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -302,18 +344,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts with parentCategory/subCategory=true:default", async function (assert) {
+ const self = this;
+
initCategoriesWithParentCategory(this);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- @options={{hash
- subCategory=true
- }}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ @options={{hash subCategory=true}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -321,19 +365,21 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("shortcuts with parentCategory/subCategory=true:category is selected", async function (assert) {
+ const self = this;
+
initCategoriesWithParentCategory(this);
this.set("category", this.categories.firstObject);
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- @options={{hash
- subCategory=true
- }}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ @options={{hash subCategory=true}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -342,16 +388,20 @@ module("Integration | Component | select-kit/category-drop", function (hooks) {
});
test("category url", async function (assert) {
+ const self = this;
+
initCategoriesWithParentCategory(this);
sinon.stub(DiscourseURL, "routeTo");
- await render(hbs`
- <CategoryDrop
- @category={{this.category}}
- @categories={{this.categories}}
- @parentCategory={{this.parentCategory}}
- />
- `);
+ await render(
+ <template>
+ <CategoryDrop
+ @category={{self.category}}
+ @categories={{self.categories}}
+ @parentCategory={{self.parentCategory}}
+ />
+ </template>
+ );
await this.subject.expand();
await this.subject.selectRowByValue(26);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.gjs
index 13825a7b61f..5fd9196ebed 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-selector-test.gjs
@@ -1,9 +1,9 @@
import { render } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import Category from "discourse/models/category";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import CategorySelector from "select-kit/components/category-selector";
module(
"Integration | Component | select-kit/category-selector",
@@ -15,15 +15,15 @@ module(
});
test("with value", async function (assert) {
+ const self = this;
+
const category = Category.findById(1001);
const subcategory = Category.findById(1002);
this.set("value", [category, subcategory]);
- await render(hbs`
- <CategorySelector
- @categories={{this.value}}
- />
- `);
+ await render(
+ <template><CategorySelector @categories={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().value(), "1001,1002");
assert.strictEqual(
@@ -33,13 +33,13 @@ module(
});
test("has +subcategories row", async function (assert) {
+ const self = this;
+
this.set("value", []);
- await render(hbs`
- <CategorySelector
- @categories={{this.value}}
- />
- `);
+ await render(
+ <template><CategorySelector @categories={{self.value}} /></template>
+ );
await this.subject.expand();
await this.subject.fillInFilter("Parent Category");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.gjs
index 5c132fedf50..bc300899566 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.gjs
@@ -1,8 +1,9 @@
+import { hash } from "@ember/helper";
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 selectKit from "discourse/tests/helpers/select-kit-helper";
+import ComboBox from "select-kit/components/combo-box";
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
@@ -31,6 +32,8 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
});
test("options.clearable", async function (assert) {
+ const self = this;
+
setDefaultState(this, {
clearable: true,
onChange: (value) => {
@@ -38,14 +41,16 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
},
});
- await render(hbs`
- <ComboBox
- @value={{this.value}}
- @content={{this.content}}
- @onChange={{this.onChange}}
- @options={{hash clearable=this.clearable}}
- />
- `);
+ await render(
+ <template>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @onChange={{self.onChange}}
+ @options={{hash clearable=self.clearable}}
+ />
+ </template>
+ );
const header = this.subject.header();
@@ -61,21 +66,25 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
});
test("options.{caretUpIcon,caretDownIcon}", async function (assert) {
+ const self = this;
+
setDefaultState(this, {
caretUpIcon: "pencil",
caretDownIcon: "trash-can",
});
- await render(hbs`
- <ComboBox
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash
- caretUpIcon=this.caretUpIcon
- caretDownIcon=this.caretDownIcon
- }}
- />
- `);
+ await render(
+ <template>
+ <ComboBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash
+ caretUpIcon=self.caretUpIcon
+ caretDownIcon=self.caretDownIcon
+ }}
+ />
+ </template>
+ );
const header = this.subject.header().el();
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
index e2ce5e84522..2fd0da50a6c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.gjs
@@ -1,8 +1,9 @@
+import { hash } from "@ember/helper";
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 DropdownSelectBox from "select-kit/components/dropdown-select-box";
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
@@ -36,14 +37,15 @@ module(
});
test("selection behavior", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <DropdownSelectBox
- @value={{this.value}}
- @content={{this.content}}
- />
- `);
+ await render(
+ <template>
+ <DropdownSelectBox @value={{self.value}} @content={{self.content}} />
+ </template>
+ );
await this.subject.expand();
assert.true(this.subject.isExpanded());
@@ -56,23 +58,27 @@ module(
});
test("options.showFullTitle=false", async function (assert) {
+ const self = this;
+
setDefaultState(this, {
value: null,
showFullTitle: false,
none: "test_none",
});
- await render(hbs`
- <DropdownSelectBox
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash
- icon="xmark"
- showFullTitle=this.showFullTitle
- none=this.none
- }}
- />
- `);
+ await render(
+ <template>
+ <DropdownSelectBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash
+ icon="xmark"
+ showFullTitle=self.showFullTitle
+ none=self.none
+ }}
+ />
+ </template>
+ );
assert
.dom(".selected-name", this.subject.header().el())
@@ -88,17 +94,19 @@ module(
});
test("options.showFullTitle=true", async function (assert) {
+ const self = this;
+
setDefaultState(this, { showFullTitle: true });
- await render(hbs`
- <DropdownSelectBox
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash
- showFullTitle=this.showFullTitle
- }}
- />
- `);
+ await render(
+ <template>
+ <DropdownSelectBox
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash showFullTitle=self.showFullTitle}}
+ />
+ </template>
+ );
assert
.dom(".selected-name", this.subject.header().el())
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
index c63c38c659a..560036e7c94 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/email-group-user-chooser-test.gjs
@@ -1,9 +1,10 @@
+import { hash } 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 { paste } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import EmailGroupUserChooser from "select-kit/components/email-group-user-chooser";
import pretender, { response } from "../../../helpers/create-pretender";
module(
@@ -16,7 +17,7 @@ module(
});
test("pasting", async function (assert) {
- await render(hbs`<EmailGroupUserChooser/>`);
+ await render(<template><EmailGroupUserChooser /></template>);
await this.subject.expand();
await paste(".filter-input", "foo,bar");
@@ -46,6 +47,8 @@ module(
});
test("excluding usernames", async function (assert) {
+ const self = this;
+
pretender.get("/u/search/users", () => {
const users = [
{
@@ -69,7 +72,11 @@ module(
this.set("excludedUsernames", ["osama", "joshua"]);
await render(
- hbs`<EmailGroupUserChooser @options={{hash excludedUsernames=this.excludedUsernames}} />`
+ <template>
+ <EmailGroupUserChooser
+ @options={{hash excludedUsernames=self.excludedUsernames}}
+ />
+ </template>
);
await this.subject.expand();
@@ -80,7 +87,11 @@ module(
this.set("excludedUsernames", ["osama"]);
await render(
- hbs`<EmailGroupUserChooser @options={{hash excludedUsernames=this.excludedUsernames}} />`
+ <template>
+ <EmailGroupUserChooser
+ @options={{hash excludedUsernames=self.excludedUsernames}}
+ />
+ </template>
);
await this.subject.expand();
@@ -105,7 +116,7 @@ module(
})
);
- await render(hbs`<EmailGroupUserChooser />`);
+ await render(<template><EmailGroupUserChooser /></template>);
await this.subject.expand();
await fillIn(".filter-input", "test-user");
@@ -128,7 +139,9 @@ module(
})
);
- await render(hbs`<EmailGroupUserChooser @showUserStatus={{true}} />`);
+ await render(
+ <template><EmailGroupUserChooser @showUserStatus={{true}} /></template>
+ );
await this.subject.expand();
await fillIn(".filter-input", "test-user");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
index 45aef2281e1..f5e83348871 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/form-template-chooser-test.gjs
@@ -1,9 +1,9 @@
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 pretender, { response } from "discourse/tests/helpers/create-pretender";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import FormTemplateChooser from "select-kit/components/form-template-chooser";
module(
"Integration | Component | select-kit/form-template-chooser",
@@ -23,7 +23,7 @@ module(
});
test("displays form templates", async function (assert) {
- await render(hbs`<FormTemplateChooser />`);
+ await render(<template><FormTemplateChooser /></template>);
await this.subject.expand();
@@ -32,9 +32,13 @@ module(
});
test("displays selected value", async function (assert) {
+ const self = this;
+
this.set("value", [1]);
- await render(hbs`<FormTemplateChooser @value={{this.value}} />`);
+ await render(
+ <template><FormTemplateChooser @value={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().name(), "template 1");
});
@@ -44,7 +48,7 @@ module(
return response({ form_templates: [] });
});
- await render(hbs`<FormTemplateChooser />`);
+ await render(<template><FormTemplateChooser /></template>);
assert.true(this.subject.isDisabled());
});
}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.gjs
index 2cbc8cb8765..83f03244cdb 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.gjs
@@ -1,8 +1,8 @@
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 ListSetting from "select-kit/components/list-setting";
module("Integration | Component | select-kit/list-setting", function (hooks) {
setupRenderingTest(hooks);
@@ -12,15 +12,16 @@ module("Integration | Component | select-kit/list-setting", function (hooks) {
});
test("default", async function (assert) {
+ const self = this;
+
this.set("value", ["bold", "italic"]);
this.set("choices", ["bold", "italic", "underline"]);
- await render(hbs`
- <ListSetting
- @value={{this.value}}
- @choices={{this.choices}}
- />
- `);
+ await render(
+ <template>
+ <ListSetting @value={{self.value}} @choices={{self.choices}} />
+ </template>
+ );
assert.strictEqual(this.subject.header().name(), "bold,italic");
assert.strictEqual(this.subject.header().value(), "bold,italic");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
index 9046a48178a..c8b528d46c6 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
@@ -1,10 +1,11 @@
+import { hash } from "@ember/helper";
import { click, 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 { queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
+import MiniTagChooser from "select-kit/components/mini-tag-chooser";
module(
"Integration | Component | select-kit/mini-tag-chooser",
@@ -16,17 +17,25 @@ module(
});
test("displays tags", async function (assert) {
+ const self = this;
+
this.set("value", ["foo", "bar"]);
- await render(hbs`<MiniTagChooser @value={{this.value}} />`);
+ await render(
+ <template><MiniTagChooser @value={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().value(), "foo,bar");
});
test("create a tag", async function (assert) {
+ const self = this;
+
this.set("value", ["foo", "bar"]);
- await render(hbs`<MiniTagChooser @value={{this.value}} />`);
+ await render(
+ <template><MiniTagChooser @value={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().value(), "foo,bar");
@@ -47,10 +56,14 @@ module(
});
test("max_tags_per_topic", async function (assert) {
+ const self = this;
+
this.set("value", ["foo", "bar"]);
this.siteSettings.max_tags_per_topic = 2;
- await render(hbs`<MiniTagChooser @value={{this.value}} />`);
+ await render(
+ <template><MiniTagChooser @value={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().value(), "foo,bar");
@@ -66,10 +79,14 @@ module(
});
test("disables search and shows limit when max_tags_per_topic is zero", async function (assert) {
+ const self = this;
+
this.set("value", ["cat", "kit"]);
this.siteSettings.max_tags_per_topic = 0;
- await render(hbs`<MiniTagChooser @value={{this.value}} />`);
+ await render(
+ <template><MiniTagChooser @value={{self.value}} /></template>
+ );
assert.strictEqual(this.subject.header().value(), "cat,kit");
await this.subject.expand();
@@ -82,14 +99,21 @@ module(
await this.subject.fillInFilter("dawg");
assert
.dom(".select-kit-collection .select-kit-row")
- .doesNotExist("doesn’t show any options");
+ .doesNotExist("doesn't show any options");
});
test("required_tag_group", async function (assert) {
+ const self = this;
+
this.set("value", ["foo", "bar"]);
await render(
- hbs`<MiniTagChooser @value={{this.value}} @options={{hash categoryId=1}} />`
+ <template>
+ <MiniTagChooser
+ @value={{self.value}}
+ @options={{hash categoryId=1}}
+ />
+ </template>
);
assert.strictEqual(this.subject.header().value(), "foo,bar");
@@ -112,11 +136,13 @@ module(
});
test("creating a tag using invalid character", async function (assert) {
- await render(hbs`<MiniTagChooser @options={{hash allowAny=true}} />`);
+ await render(
+ <template><MiniTagChooser @options={{hash allowAny=true}} /></template>
+ );
await this.subject.expand();
await this.subject.fillInFilter("#");
- assert.dom(".select-kit-error").doesNotExist("doesn’t show any error");
+ assert.dom(".select-kit-error").doesNotExist("doesn't show any error");
assert
.dom(".select-kit-row[data-value='#']")
.doesNotExist("doesn't allow to create this tag");
@@ -131,7 +157,9 @@ module(
test("creating a tag over the length limit", async function (assert) {
this.siteSettings.max_tag_length = 1;
- await render(hbs`<MiniTagChooser @options={{hash allowAny=true}} />`);
+ await render(
+ <template><MiniTagChooser @options={{hash allowAny=true}} /></template>
+ );
await this.subject.expand();
await this.subject.fillInFilter("foo");
@@ -141,11 +169,18 @@ module(
});
test("values in hiddenFromPreview will not display in preview", async function (assert) {
+ const self = this;
+
this.set("value", ["foo", "bar"]);
this.set("hiddenValues", ["foo"]);
await render(
- hbs`<MiniTagChooser @options={{hash allowAny=true hiddenValues=this.hiddenValues}} @value={{this.value}} />`
+ <template>
+ <MiniTagChooser
+ @options={{hash allowAny=true hiddenValues=self.hiddenValues}}
+ @value={{self.value}}
+ />
+ </template>
);
assert.dom(".formatted-selection").hasText("bar");
@@ -170,10 +205,17 @@ module(
});
test("displays tags and filter in header", async function (assert) {
+ const self = this;
+
this.set("value", ["apple", "orange", "potato"]);
await render(
- hbs`<MiniTagChooser @value={{this.value}} @options={{hash filterable=true useHeaderFilter=true}} />`
+ <template>
+ <MiniTagChooser
+ @value={{self.value}}
+ @options={{hash filterable=true useHeaderFilter=true}}
+ />
+ </template>
);
assert.strictEqual(this.subject.header().value(), "apple,orange,potato");
@@ -204,10 +246,17 @@ module(
});
test("removing a tag does not display the dropdown", async function (assert) {
+ const self = this;
+
this.set("value", ["apple", "orange", "potato"]);
await render(
- hbs`<MiniTagChooser @value={{this.value}} @options={{hash filterable=true useHeaderFilter=true}} />`
+ <template>
+ <MiniTagChooser
+ @value={{self.value}}
+ @options={{hash filterable=true useHeaderFilter=true}}
+ />
+ </template>
);
assert.strictEqual(this.subject.header().value(), "apple,orange,potato");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.gjs
index 2b2e243e628..12ebc2b3201 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.gjs
@@ -1,9 +1,10 @@
+import { hash } from "@ember/helper";
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 { paste } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
+import MultiSelect from "select-kit/components/multi-select";
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
@@ -30,14 +31,15 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("content", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <MultiSelect
- @value={{this.value}}
- @content={{this.content}}
- />
- `);
+ await render(
+ <template>
+ <MultiSelect @value={{self.value}} @content={{self.content}} />
+ </template>
+ );
await this.subject.expand();
@@ -61,15 +63,19 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
});
test("maximum=1", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <MultiSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash maximum=1}}
- />
- `);
+ await render(
+ <template>
+ <MultiSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash maximum=1}}
+ />
+ </template>
+ );
await this.subject.expand();
await this.subject.selectRowByValue(1);
@@ -81,37 +87,45 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
assert.true(
this.subject.isExpanded(),
- "doesn’t close the dropdown when no selection has been made"
+ "doesn't close the dropdown when no selection has been made"
);
});
test("maximum=2", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <MultiSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash maximum=2}}
- />
- `);
+ await render(
+ <template>
+ <MultiSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash maximum=2}}
+ />
+ </template>
+ );
await this.subject.expand();
await this.subject.selectRowByValue(1);
- assert.true(this.subject.isExpanded(), "doesn’t close the dropdown");
+ assert.true(this.subject.isExpanded(), "doesn't close the dropdown");
});
test("pasting", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <MultiSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash maximum=2}}
- />
- `);
+ await render(
+ <template>
+ <MultiSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash maximum=2}}
+ />
+ </template>
+ );
await this.subject.expand();
await paste(".filter-input", "foo|bar");
@@ -122,13 +136,11 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
test("no value property with no content", async function (assert) {
setDefaultState(this);
- await render(hbs`
- <MultiSelect @valueProperty={{null}} />
- `);
+ await render(<template><MultiSelect @valueProperty={{null}} /></template>);
await this.subject.expand();
assert
.dom(".selected-content")
- .doesNotExist("doesn’t render an empty content div");
+ .doesNotExist("doesn't render an empty content div");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
index 6ebd24b8954..ee2d35be78b 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/notifications-button-test.gjs
@@ -1,10 +1,11 @@
+import { hash } from "@ember/helper";
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, {
setDefaultState,
} from "discourse/tests/helpers/select-kit-helper";
+import NotificationsButton from "select-kit/components/notifications-button";
module(
"Integration | Component | select-kit/notifications-button",
@@ -16,18 +17,22 @@ module(
});
test("default", async function (assert) {
+ const self = this;
+
this.set("value", 1);
setDefaultState(this, 1, { i18nPrefix: "pre", i18nPostfix: "post" });
- await render(hbs`
- <NotificationsButton
- @value={{this.value}}
- @options={{hash
- i18nPrefix=this.i18nPrefix
- i18nPostfix=this.i18nPostfix
- }}
- />
- `);
+ await render(
+ <template>
+ <NotificationsButton
+ @value={{self.value}}
+ @options={{hash
+ i18nPrefix=self.i18nPrefix
+ i18nPostfix=self.i18nPostfix
+ }}
+ />
+ </template>
+ );
assert.true(!!this.subject.header().value());
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.gjs
index ee131f8367f..2036c71b251 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.gjs
@@ -1,14 +1,16 @@
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 selectKit from "discourse/tests/helpers/select-kit-helper";
+import PinnedOptions from "select-kit/components/pinned-options";
module("Integration | Component | select-kit/pinned-options", function (hooks) {
setupRenderingTest(hooks);
test("unpinning", async function (assert) {
+ const self = this;
+
this.siteSettings.automatically_unpin_topics = false;
this.set("subject", selectKit());
@@ -24,7 +26,9 @@ module("Integration | Component | select-kit/pinned-options", function (hooks) {
);
await render(
- hbs`<PinnedOptions @value={{this.topic.pinned}} @topic={{this.topic}} />`
+ <template>
+ <PinnedOptions @value={{self.topic.pinned}} @topic={{self.topic}} />
+ </template>
);
assert.strictEqual(this.subject.header().name(), "pinned");
@@ -36,6 +40,8 @@ module("Integration | Component | select-kit/pinned-options", function (hooks) {
});
test("pinning", async function (assert) {
+ const self = this;
+
this.siteSettings.automatically_unpin_topics = false;
this.set("subject", selectKit());
const store = getOwner(this).lookup("service:store");
@@ -50,7 +56,9 @@ module("Integration | Component | select-kit/pinned-options", function (hooks) {
);
await render(
- hbs`<PinnedOptions @value={{this.topic.pinned}} @topic={{this.topic}} />`
+ <template>
+ <PinnedOptions @value={{self.topic.pinned}} @topic={{self.topic}} />
+ </template>
);
assert.strictEqual(this.subject.header().name(), "unpinned");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.gjs
index 4525443a6b3..ce55a5ec943 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.gjs
@@ -1,9 +1,11 @@
+import { hash } from "@ember/helper";
import { find, render, tab } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
+import DButton from "discourse/components/d-button";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n, { i18n } from "discourse-i18n";
+import SingleSelect from "select-kit/components/single-select";
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
@@ -37,9 +39,13 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("content", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`<SingleSelect @content={{this.content}} />`);
+ await render(
+ <template><SingleSelect @content={{self.content}} /></template>
+ );
await this.subject.expand();
@@ -63,9 +69,13 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("accessibility", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`<SingleSelect @content={{this.content}} />`);
+ await render(
+ <template><SingleSelect @content={{self.content}} /></template>
+ );
await this.subject.expand();
@@ -109,17 +119,21 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("value", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
assert.strictEqual(
this.subject.header().value(this.content),
@@ -129,20 +143,22 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.filterable", async function (assert) {
+ const self = this;
+
setDefaultState(this, { filterable: true });
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash
- filterable=this.filterable
- }}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash filterable=self.filterable}}
+ />
+ </template>
+ );
await this.subject.expand();
assert.true(this.subject.filter().exists(), "shows the filter");
@@ -157,21 +173,25 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.limitMatches", async function (assert) {
+ const self = this;
+
setDefaultState(this, { limitMatches: 1, filterable: true });
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash
- limitMatches=this.limitMatches
- filterable=this.filterable
- }}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash
+ limitMatches=self.limitMatches
+ filterable=self.filterable
+ }}
+ />
+ </template>
+ );
await this.subject.expand();
await this.subject.fillInFilter("ba");
@@ -184,6 +204,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("valueAttribute (deprecated)", async function (assert) {
+ const self = this;
+
this.set("value", "normal");
const content = [
@@ -195,13 +217,15 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
];
this.set("content", content);
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @valueAttribute="value"
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @valueAttribute="value"
+ />
+ </template>
+ );
await this.subject.expand();
@@ -209,21 +233,23 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("none:string", async function (assert) {
+ const self = this;
+
I18n.translations[I18n.locale].js.test = { none: "(default)" };
setDefaultState(this, { value: 1 });
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash
- none="test.none"
- }}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash none="test.none"}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -233,20 +259,22 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("none:object", async function (assert) {
+ const self = this;
+
setDefaultState(this, { none: { value: null, name: "(default)" } });
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash
- none=this.none
- }}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash none=self.none}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -256,6 +284,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("content is a basic array", async function (assert) {
+ const self = this;
+
I18n.translations[I18n.locale].js.test = { none: "(default)" };
setDefaultState(this, {
nameProperty: null,
@@ -264,18 +294,18 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
content: ["foo", "bar", "baz"],
});
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash
- none="test.none"
- }}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash none="test.none"}}
+ />
+ </template>
+ );
await this.subject.expand();
@@ -290,6 +320,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("selected value can be 0", async function (assert) {
+ const self = this;
+
setDefaultState(this, {
value: 1,
content: [
@@ -298,15 +330,17 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
],
});
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ />
+ </template>
+ );
assert.strictEqual(this.subject.header().value(), "1");
@@ -317,21 +351,25 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("prevents propagating click event on header", async function (assert) {
+ const self = this;
+
this.setProperties({
onClick: () => this.set("value", "foo"),
content: DEFAULT_CONTENT,
value: DEFAULT_VALUE,
});
- await render(hbs`
- <DButton @icon="xmark" @action={{this.onClick}}>
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash preventsClickPropagation=true}}
- />
- </DButton>
- `);
+ await render(
+ <template>
+ <DButton @icon="xmark" @action={{self.onClick}}>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash preventsClickPropagation=true}}
+ />
+ </DButton>
+ </template>
+ );
assert.strictEqual(this.value, DEFAULT_VALUE);
await this.subject.expand();
@@ -339,18 +377,22 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("labelProperty", async function (assert) {
+ const self = this;
+
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1,
});
- await render(hbs`
- <SingleSelect
- @labelProperty="foo"
- @value={{this.value}}
- @content={{this.content}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @labelProperty="foo"
+ @value={{self.value}}
+ @content={{self.content}}
+ />
+ </template>
+ );
assert.strictEqual(this.subject.header().label(), "JACKSON");
@@ -362,18 +404,22 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("titleProperty", async function (assert) {
+ const self = this;
+
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1,
});
- await render(hbs`
- <SingleSelect
- @titleProperty="foo"
- @value={{this.value}}
- @content={{this.content}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @titleProperty="foo"
+ @value={{self.value}}
+ @content={{self.content}}
+ />
+ </template>
+ );
assert.strictEqual(this.subject.header().title(), "JACKSON");
@@ -385,13 +431,21 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("langProperty", async function (assert) {
+ const self = this;
+
this.setProperties({
content: [{ id: 1, name: "john", foo: "be" }],
value: null,
});
await render(
- hbs`<SingleSelect @langProperty="foo" @value={{this.value}} @content={{this.content}} />`
+ <template>
+ <SingleSelect
+ @langProperty="foo"
+ @value={{self.value}}
+ @content={{self.content}}
+ />
+ </template>
);
assert.strictEqual(
@@ -413,13 +467,17 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("name", async function (assert) {
+ const self = this;
+
this.setProperties({
content: [{ id: 1, name: "john" }],
value: null,
});
await render(
- hbs`<SingleSelect @value={{this.value}} @content={{this.content}} />`
+ <template>
+ <SingleSelect @value={{self.value}} @content={{self.content}} />
+ </template>
);
assert
@@ -438,6 +496,8 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("row index", async function (assert) {
+ const self = this;
+
this.setProperties({
content: [
{ id: 1, name: "john" },
@@ -447,7 +507,9 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
await render(
- hbs`<SingleSelect @value={{this.value}} @content={{this.content}} />`
+ <template>
+ <SingleSelect @value={{self.value}} @content={{self.content}} />
+ </template>
);
await this.subject.expand();
@@ -456,17 +518,21 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.verticalOffset", async function (assert) {
+ const self = this;
+
setDefaultState(this, { verticalOffset: -50 });
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @nameProperty={{this.nameProperty}}
- @valueProperty={{this.valueProperty}}
- @onChange={{this.onChange}}
- @options={{hash verticalOffset=this.verticalOffset}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @nameProperty={{self.nameProperty}}
+ @valueProperty={{self.valueProperty}}
+ @onChange={{self.onChange}}
+ @options={{hash verticalOffset=self.verticalOffset}}
+ />
+ </template>
+ );
await this.subject.expand();
const header = find(".select-kit-header").getBoundingClientRect();
const body = find(".select-kit-body").getBoundingClientRect();
@@ -475,27 +541,35 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
});
test("options.expandedOnInsert", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash expandedOnInsert=true}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash expandedOnInsert=true}}
+ />
+ </template>
+ );
assert.dom(".single-select.is-expanded").exists();
});
test("options.formName", async function (assert) {
+ const self = this;
+
setDefaultState(this);
- await render(hbs`
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash formName="foo"}}
- />
- `);
+ await render(
+ <template>
+ <SingleSelect
+ @value={{self.value}}
+ @content={{self.content}}
+ @options={{hash formName="foo"}}
+ />
+ </template>
+ );
assert
.dom('input[name="foo"]')
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
index 50a39c01bd7..40fc115d828 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.gjs
@@ -1,8 +1,8 @@
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 UserChooser from "select-kit/components/user-chooser";
module("Integration | Component | select-kit/user-chooser", function (hooks) {
setupRenderingTest(hooks);
@@ -12,17 +12,21 @@ module("Integration | Component | select-kit/user-chooser", function (hooks) {
});
test("displays usernames", async function (assert) {
+ const self = this;
+
this.set("value", ["bob", "martin"]);
- await render(hbs`<UserChooser @value={{this.value}} />`);
+ await render(<template><UserChooser @value={{self.value}} /></template>);
assert.strictEqual(this.subject.header().name(), "bob,martin");
});
test("can remove a username", async function (assert) {
+ const self = this;
+
this.set("value", ["bob", "martin"]);
- await render(hbs`<UserChooser @value={{this.value}} />`);
+ await render(<template><UserChooser @value={{self.value}} /></template>);
await this.subject.expand();
await this.subject.deselectItemByValue("bob");
@@ -30,13 +34,17 @@ module("Integration | Component | select-kit/user-chooser", function (hooks) {
});
test("can display default search results", async function (assert) {
+ const self = this;
+
this.set("options", {
customSearchOptions: {
defaultSearchResults: [{ username: "foo" }, { username: "bar" }],
},
});
- await render(hbs`<UserChooser @options={{this.options}} />`);
+ await render(
+ <template><UserChooser @options={{self.options}} /></template>
+ );
await this.subject.expand();
assert.strictEqual(this.subject.rowByIndex(0).value(), "foo");
diff --git a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.hbs b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.hbs
index c458caf86ed..b8d2f7b406b 100644
--- a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.hbs
+++ b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.hbs
@@ -93,7 +93,7 @@
@content={{this.headerIndicatorOptions}}
@value={{this.model.user_option.chat_header_indicator_preference}}
@id="user_chat_header_indicator_preference"
- @onChange={{action
+ @onChange={{fn
(mut this.model.user_option.chat_header_indicator_preference)
}}
/>
diff --git a/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs
index 9602b435376..325f9c21620 100644
--- a/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs
+++ b/plugins/chat/test/javascripts/components/chat-thread-heading-test.gjs
@@ -18,7 +18,7 @@ module("Discourse Chat | Component | chat-thread-heading", function (hooks) {
assert.dom(".chat-thread__heading-title").hasText("A nice thread title");
});
- test("it doesn’t render heading when no title", async function (assert) {
+ test("it doesn't render heading when no title", async function (assert) {
const thread = new ChatFabricators(getOwner(this)).thread({
title: null,
});