UX: display small action for assignment/unassignment
This commit is contained in:
parent
84f4c30c34
commit
bd5575d975
|
@ -55,6 +55,14 @@ function initialize(api, container) {
|
|||
});
|
||||
|
||||
api.addPostSmallActionIcon('assigned','user-plus');
|
||||
api.addPostSmallActionIcon('unassigned','user-times');
|
||||
|
||||
api.addPostTransformCallback((transformed) => {
|
||||
if (transformed.actionCode === "assigned" || transformed.actionCode === "unassigned") {
|
||||
transformed.isSmallAction = true;
|
||||
transformed.canEdit = false;
|
||||
}
|
||||
});
|
||||
|
||||
api.addDiscoveryQueryParam('assigned', {replace: true, refreshModel: true});
|
||||
|
||||
|
@ -96,7 +104,7 @@ function initialize(api, container) {
|
|||
export default {
|
||||
name: 'extend-for-assign',
|
||||
initialize(container) {
|
||||
withPluginApi('0.8.3', api => {
|
||||
withPluginApi('0.8.5', api => {
|
||||
initialize(api, container);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
en:
|
||||
js:
|
||||
action_codes:
|
||||
assigned: "assigned"
|
||||
assigned: "assigned %{who} %{when}"
|
||||
unassigned: "unassigned %{who} %{when}"
|
||||
discourse_assign:
|
||||
assigned: "Assigned"
|
||||
assign_html: "<p class='assigned-to'><i class='fa-user-plus fa'></i> Assigned to {{userLink}}</p>"
|
||||
|
|
14
plugin.rb
14
plugin.rb
|
@ -131,12 +131,12 @@ SQL
|
|||
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
||||
|
||||
unless silent
|
||||
@topic.add_moderator_post(@assigned_by,
|
||||
I18n.t('discourse_assign.assigned_to',
|
||||
username: assign_to.username),
|
||||
@topic.add_moderator_post(@assigned_by, nil,
|
||||
{ bump: false,
|
||||
post_type: post_type,
|
||||
action_code: "assigned"})
|
||||
action_code: "assigned",
|
||||
custom_fields: {"action_code_who" => assign_to.username}
|
||||
})
|
||||
|
||||
unless @assigned_by.id == assign_to.id
|
||||
|
||||
|
@ -183,11 +183,11 @@ SQL
|
|||
|
||||
if SiteSetting.unassign_creates_tracking_post && !silent
|
||||
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
||||
@topic.add_moderator_post(@assigned_by,
|
||||
I18n.t('discourse_assign.unassigned'),
|
||||
@topic.add_moderator_post(@assigned_by, nil,
|
||||
{ bump: false,
|
||||
post_type: post_type,
|
||||
action_code: "assigned"})
|
||||
custom_fields: {"action_code_who" => assigned_user&.username},
|
||||
action_code: "unassigned"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue