DEV: Don't use renderTemplate (#469)
See: https://github.com/discourse/discourse/pull/21517
This commit is contained in:
parent
f75a6a8354
commit
c5e0c2c0b3
|
@ -4,11 +4,14 @@ import cookie from "discourse/lib/cookie";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
|
||||||
export default UserTopicListRoute.extend({
|
export default UserTopicListRoute.extend({
|
||||||
|
templateName: "user-activity-assigned",
|
||||||
|
controllerName: "user-activity-assigned",
|
||||||
|
|
||||||
userActionType: 16,
|
userActionType: 16,
|
||||||
noContentHelpKey: "discourse_assigns.no_assigns",
|
noContentHelpKey: "discourse_assigns.no_assigns",
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (this.currentUser === undefined) {
|
if (!this.currentUser) {
|
||||||
cookie("destination_url", window.location.href);
|
cookie("destination_url", window.location.href);
|
||||||
this.transitionTo("login");
|
this.transitionTo("login");
|
||||||
}
|
}
|
||||||
|
@ -16,11 +19,10 @@ export default UserTopicListRoute.extend({
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.store.findFiltered("topicList", {
|
return this.store.findFiltered("topicList", {
|
||||||
filter: `topics/messages-assigned/${this.modelFor("user").get(
|
filter: `topics/messages-assigned/${
|
||||||
"username_lower"
|
this.modelFor("user").username_lower
|
||||||
)}`,
|
}`,
|
||||||
params: {
|
params: {
|
||||||
// core is a bit odd here and is not sending an array, should be fixed
|
|
||||||
exclude_category_ids: [-1],
|
exclude_category_ids: [-1],
|
||||||
order: params.order,
|
order: params.order,
|
||||||
ascending: params.ascending,
|
ascending: params.ascending,
|
||||||
|
@ -33,16 +35,6 @@ export default UserTopicListRoute.extend({
|
||||||
return I18n.t("discourse_assign.assigned");
|
return I18n.t("discourse_assign.assigned");
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate() {
|
|
||||||
this.render("user-activity-assigned");
|
|
||||||
this.render("user-assigned-topics", { into: "user-activity-assigned" });
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
this._super(controller, model);
|
|
||||||
controller.set("model", model);
|
|
||||||
},
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
changeAssigned() {
|
changeAssigned() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
|
@ -1 +1,44 @@
|
||||||
{{outlet}}
|
{{#if doesntHaveAssignments}}
|
||||||
|
<EmptyState
|
||||||
|
@title={{i18n "user.no_assignments_title"}}
|
||||||
|
@body={{emptyStateBody}}
|
||||||
|
/>
|
||||||
|
{{else}}
|
||||||
|
<div class="topic-search-div">
|
||||||
|
<div class="inline-form full-width">
|
||||||
|
<Input
|
||||||
|
class="no-blur"
|
||||||
|
@value={{readonly search}}
|
||||||
|
placeholder={{i18n "discourse_assign.topic_search_placeholder"}}
|
||||||
|
autocomplete="off"
|
||||||
|
@type="search"
|
||||||
|
{{on "input" (action "onChangeFilter" value="target.value")}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<LoadMore
|
||||||
|
@class="paginated-topics-list"
|
||||||
|
@selector=".paginated-topics-list .topic-list tr"
|
||||||
|
@action={{action "loadMore"}}
|
||||||
|
>
|
||||||
|
{{basic-assigned-topic-list
|
||||||
|
topicList=model
|
||||||
|
hideCategory=hideCategory
|
||||||
|
showPosters=true
|
||||||
|
bulkSelectEnabled=bulkSelectEnabled
|
||||||
|
selected=selected
|
||||||
|
hasIncoming=hasIncoming
|
||||||
|
incomingCount=incomingCount
|
||||||
|
showInserted=(action "showInserted")
|
||||||
|
tagsForUser=tagsForUser
|
||||||
|
changeSort=(action "changeSort")
|
||||||
|
unassign=(action "unassign")
|
||||||
|
reassign=(action "reassign")
|
||||||
|
onScroll=saveScrollPosition
|
||||||
|
scrollOnLoad=true
|
||||||
|
}}
|
||||||
|
|
||||||
|
<ConditionalLoadingSpinner @condition={{model.loadingMore}} />
|
||||||
|
</LoadMore>
|
||||||
|
{{/if}}
|
|
@ -1,44 +0,0 @@
|
||||||
{{#if doesntHaveAssignments}}
|
|
||||||
<EmptyState
|
|
||||||
@title={{i18n "user.no_assignments_title"}}
|
|
||||||
@body={{emptyStateBody}}
|
|
||||||
/>
|
|
||||||
{{else}}
|
|
||||||
<div class="topic-search-div">
|
|
||||||
<div class="inline-form full-width">
|
|
||||||
<Input
|
|
||||||
class="no-blur"
|
|
||||||
@value={{readonly search}}
|
|
||||||
placeholder={{i18n "discourse_assign.topic_search_placeholder"}}
|
|
||||||
autocomplete="off"
|
|
||||||
@type="search"
|
|
||||||
{{on "input" (action "onChangeFilter" value="target.value")}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<LoadMore
|
|
||||||
@class="paginated-topics-list"
|
|
||||||
@selector=".paginated-topics-list .topic-list tr"
|
|
||||||
@action={{action "loadMore"}}
|
|
||||||
>
|
|
||||||
{{basic-assigned-topic-list
|
|
||||||
topicList=model
|
|
||||||
hideCategory=hideCategory
|
|
||||||
showPosters=true
|
|
||||||
bulkSelectEnabled=bulkSelectEnabled
|
|
||||||
selected=selected
|
|
||||||
hasIncoming=hasIncoming
|
|
||||||
incomingCount=incomingCount
|
|
||||||
showInserted=(action "showInserted")
|
|
||||||
tagsForUser=tagsForUser
|
|
||||||
changeSort=(action "changeSort")
|
|
||||||
unassign=(action "unassign")
|
|
||||||
reassign=(action "reassign")
|
|
||||||
onScroll=saveScrollPosition
|
|
||||||
scrollOnLoad=true
|
|
||||||
}}
|
|
||||||
|
|
||||||
<ConditionalLoadingSpinner @condition={{model.loadingMore}} />
|
|
||||||
</LoadMore>
|
|
||||||
{{/if}}
|
|
Loading…
Reference in New Issue