Add ability to select priority in modal
And also disable immediately triggering assign when user is selected
This commit is contained in:
parent
8b575a0bab
commit
ad45c6703f
|
@ -1,10 +1,18 @@
|
||||||
import Controller, { inject as controller } from "@ember/controller";
|
import Controller, { inject as controller } from "@ember/controller";
|
||||||
|
import { action } from "@ember/object";
|
||||||
|
import { not, or } from "@ember/object/computed";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { not, or } from "@ember/object/computed";
|
import I18n from "I18n";
|
||||||
import { isEmpty } from "@ember/utils";
|
|
||||||
import { action } from "@ember/object";
|
const PRIORITIES = [
|
||||||
|
{ name: I18n.t("discourse_assign.priorities.low"), value: 4 },
|
||||||
|
{ name: I18n.t("discourse_assign.priorities.medium"), value: 3 },
|
||||||
|
{ name: I18n.t("discourse_assign.priorities.high"), value: 2 },
|
||||||
|
{ name: I18n.t("discourse_assign.priorities.urgent"), value: 1 },
|
||||||
|
];
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
topicBulkActions: controller(),
|
topicBulkActions: controller(),
|
||||||
|
@ -13,6 +21,7 @@ export default Controller.extend({
|
||||||
taskActions: service(),
|
taskActions: service(),
|
||||||
autofocus: not("capabilities.touch"),
|
autofocus: not("capabilities.touch"),
|
||||||
assigneeName: or("model.username", "model.group_name"),
|
assigneeName: or("model.username", "model.group_name"),
|
||||||
|
priorities: PRIORITIES,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -63,7 +72,6 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
|
|
||||||
return ajax(path, {
|
return ajax(path, {
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
data: {
|
data: {
|
||||||
|
@ -71,6 +79,7 @@ export default Controller.extend({
|
||||||
group_name: this.get("model.group_name"),
|
group_name: this.get("model.group_name"),
|
||||||
target_id: this.get("model.target.id"),
|
target_id: this.get("model.target.id"),
|
||||||
target_type: this.get("model.targetType"),
|
target_type: this.get("model.targetType"),
|
||||||
|
priority: this.get("model.priority"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -99,14 +108,15 @@ export default Controller.extend({
|
||||||
"model.allowedGroups": this.taskActions.allowedGroups,
|
"model.allowedGroups": this.taskActions.allowedGroups,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name) {
|
|
||||||
return this.assign();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
assignUsername(selected) {
|
assignUsername(selected) {
|
||||||
this.assignUser(selected.firstObject);
|
this.assignUser(selected.firstObject);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
|
assignPriority(priority) {
|
||||||
|
this.set("model.priority", priority);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,6 +23,7 @@ const DEPENDENT_KEYS = [
|
||||||
"topic.assigned_to_group",
|
"topic.assigned_to_group",
|
||||||
"currentUser.can_assign",
|
"currentUser.can_assign",
|
||||||
"topic.assigned_to_user.username",
|
"topic.assigned_to_user.username",
|
||||||
|
"topic.assignment_priority",
|
||||||
];
|
];
|
||||||
|
|
||||||
function titleForState(name) {
|
function titleForState(name) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ export default Service.extend({
|
||||||
group_name: target.assigned_to_group?.name,
|
group_name: target.assigned_to_group?.name,
|
||||||
target,
|
target,
|
||||||
targetType: options.targetType,
|
targetType: options.targetType,
|
||||||
|
priority: target.assignment_priority,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,6 +25,17 @@
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
<label>{{i18n "discourse_assign.assign_modal.priority_label"}}</label>
|
||||||
|
{{combo-box
|
||||||
|
name="assign-priority"
|
||||||
|
content=priorities
|
||||||
|
value=model.priority
|
||||||
|
valueProperty="value"
|
||||||
|
onChange=(action "assignPriority")
|
||||||
|
options=(hash
|
||||||
|
none="discourse_assign.priorities.none"
|
||||||
|
)
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
{{/d-modal-body}}
|
{{/d-modal-body}}
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,13 @@ en:
|
||||||
help: "Reassign Topic to a different user"
|
help: "Reassign Topic to a different user"
|
||||||
reassign_modal:
|
reassign_modal:
|
||||||
title: "Reassign Topic"
|
title: "Reassign Topic"
|
||||||
description: "Enter the name of the user you'd like to Reassign this topic"
|
description: "Enter the name of the user you'd like to reassign this topic"
|
||||||
assign_modal:
|
assign_modal:
|
||||||
title: "Assign Topic"
|
title: "Assign Topic"
|
||||||
reassign_title: "Reassign Topic"
|
reassign_title: "Reassign Topic"
|
||||||
description: "Enter the name of the user you'd like to assign this topic"
|
description: "Enter the name of the user you'd like to assign this topic"
|
||||||
assign: "Assign"
|
assign: "Assign"
|
||||||
|
priority_label: Set a priority (Optional)
|
||||||
assign_post_modal:
|
assign_post_modal:
|
||||||
title: "Assign Post"
|
title: "Assign Post"
|
||||||
description: "Enter the name of the user you'd like to assign this post"
|
description: "Enter the name of the user you'd like to assign this post"
|
||||||
|
@ -79,6 +80,12 @@ en:
|
||||||
assign: "Assign"
|
assign: "Assign"
|
||||||
assignable_levels:
|
assignable_levels:
|
||||||
title: "Who can assign this group"
|
title: "Who can assign this group"
|
||||||
|
priorities:
|
||||||
|
none: None
|
||||||
|
low: Low
|
||||||
|
medium: Medium
|
||||||
|
high: High
|
||||||
|
urgent: Urgent
|
||||||
user:
|
user:
|
||||||
messages:
|
messages:
|
||||||
assigned_title: "Assigned (%{count})"
|
assigned_title: "Assigned (%{count})"
|
||||||
|
|
Loading…
Reference in New Issue