-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Modernise assignment topic-list implementation (#510)
- Reuse core `<BasicTopicList` instead of reimplementing - Use raw plugin outlet to add assign controls to topic-list-item (requires discourse/discourse#23592) - Remove use of `.render()` in route
- Loading branch information
1 parent
e9c7cb5
commit 8980754
Showing
22 changed files
with
854 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
{} | ||
{ | ||
"plugins": ["prettier-plugin-ember-template-tag"], | ||
"overrides": [ | ||
{ | ||
"files": "*.gjs", | ||
"options": { | ||
"parser": "ember-template-tag" | ||
} | ||
}, | ||
{ | ||
"files": "*.gts", | ||
"options": { | ||
"parser": "ember-template-tag" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
assets/javascripts/discourse/components/assigned-topic-list-column.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Component from "@glimmer/component"; | ||
import AssignActionsDropdown from "./assign-actions-dropdown"; | ||
import { inject as service } from "@ember/service"; | ||
import { action } from "@ember/object"; | ||
|
||
export default class AssignedTopicListColumn_Test extends Component { | ||
<template> | ||
<td class="topic-list-data"> | ||
{{#if @topic.assigned_to_user}} | ||
<AssignActionsDropdown | ||
@topic={{@topic}} | ||
@assignee={{@topic.assigned_to_user.username}} | ||
@unassign={{this.unassign}} | ||
@reassign={{this.reassign}} | ||
/> | ||
{{else if @topic.assigned_to_group}} | ||
<AssignActionsDropdown | ||
@topic={{@topic}} | ||
@assignee={{@topic.assigned_to_group.name}} | ||
@group={{true}} | ||
@unassign={{this.unassign}} | ||
@reassign={{this.reassign}} | ||
/> | ||
{{else}} | ||
<AssignActionsDropdown @topic={{@topic}} @unassign={{this.unassign}} /> | ||
{{/if}} | ||
</td> | ||
</template> | ||
|
||
@service taskActions; | ||
@service router; | ||
|
||
@action | ||
async unassign(targetId, targetType = "Topic") { | ||
await this.taskActions.unassign(targetId, targetType); | ||
this.router.refresh(); | ||
} | ||
|
||
@action | ||
reassign(topic) { | ||
this.taskActions.showAssignModal(topic, { | ||
onSuccess: () => this.router.refresh(), | ||
}); | ||
} | ||
} |
86 changes: 0 additions & 86 deletions
86
assets/javascripts/discourse/components/assigned-topic-list-item.hbs
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
assets/javascripts/discourse/components/assigned-topic-list-item.js
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
assets/javascripts/discourse/components/assigned-topic-list.hbs
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
assets/javascripts/discourse/components/assigned-topic-list.js
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
assets/javascripts/discourse/components/basic-assigned-topic-list.hbs
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
assets/javascripts/discourse/components/basic-assigned-topic-list.js
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
assets/javascripts/discourse/connectors/topic-list-after-columns/assign-buttons.hbr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{raw "assign-topic-buttons" topic=context.topic}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
assets/javascripts/discourse/raw-templates/assign-topic-buttons.hbr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{{view.html}}} |
21 changes: 21 additions & 0 deletions
21
assets/javascripts/discourse/raw-views/assign-topic-buttons.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import EmberObject from "@ember/object"; | ||
import rawRenderGlimmer from "discourse/lib/raw-render-glimmer"; | ||
import AssignedTopicListColumn from "../components/assigned-topic-list-column"; | ||
import { inject as service } from "@ember/service"; | ||
|
||
const ASSIGN_LIST_ROUTES = ["userActivity.assigned", "group.assigned.show"]; | ||
|
||
export default class extends EmberObject { | ||
@service router; | ||
|
||
get html() { | ||
if (ASSIGN_LIST_ROUTES.includes(this.router.currentRouteName)) { | ||
return rawRenderGlimmer( | ||
this, | ||
"div.assign-topic-buttons", | ||
<template><AssignedTopicListColumn @topic={{@data.topic}} /></template>, | ||
{ topic: this.topic } | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.