UX: organize topic admin menu into groups (#16489)
This commit is contained in:
parent
2a96bca7a1
commit
4157403308
|
@ -150,6 +150,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "toggleMultiSelect",
|
action: "toggleMultiSelect",
|
||||||
icon: "tasks",
|
icon: "tasks",
|
||||||
label: "actions.multi_select",
|
label: "actions.multi_select",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +165,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "deleteTopic",
|
action: "deleteTopic",
|
||||||
icon: "far-trash-alt",
|
icon: "far-trash-alt",
|
||||||
label: "actions.delete",
|
label: "actions.delete",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +176,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "recoverTopic",
|
action: "recoverTopic",
|
||||||
icon: "undo",
|
icon: "undo",
|
||||||
label: "actions.recover",
|
label: "actions.recover",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,6 +189,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "toggleClosed",
|
action: "toggleClosed",
|
||||||
icon: "unlock",
|
icon: "unlock",
|
||||||
label: "actions.open",
|
label: "actions.open",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.addActionButton({
|
this.addActionButton({
|
||||||
|
@ -194,6 +198,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "toggleClosed",
|
action: "toggleClosed",
|
||||||
icon: "lock",
|
icon: "lock",
|
||||||
label: "actions.close",
|
label: "actions.close",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,6 +210,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "showTopicTimerModal",
|
action: "showTopicTimerModal",
|
||||||
icon: "far-clock",
|
icon: "far-clock",
|
||||||
label: "actions.timed_update",
|
label: "actions.timed_update",
|
||||||
|
button_group: "time",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +225,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "showFeatureTopic",
|
action: "showFeatureTopic",
|
||||||
icon: "thumbtack",
|
icon: "thumbtack",
|
||||||
label: featured ? "actions.unpin" : "actions.pin",
|
label: featured ? "actions.unpin" : "actions.pin",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +237,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "showChangeTimestamp",
|
action: "showChangeTimestamp",
|
||||||
icon: "calendar-alt",
|
icon: "calendar-alt",
|
||||||
label: "change_timestamp.title",
|
label: "change_timestamp.title",
|
||||||
|
button_group: "time",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +247,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "resetBumpDate",
|
action: "resetBumpDate",
|
||||||
icon: "anchor",
|
icon: "anchor",
|
||||||
label: "actions.reset_bump_date",
|
label: "actions.reset_bump_date",
|
||||||
|
button_group: "time",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +261,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
label: topic.get("archived")
|
label: topic.get("archived")
|
||||||
? "actions.unarchive"
|
? "actions.unarchive"
|
||||||
: "actions.archive",
|
: "actions.archive",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,6 +273,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "toggleVisibility",
|
action: "toggleVisibility",
|
||||||
icon: visible ? "far-eye-slash" : "far-eye",
|
icon: visible ? "far-eye-slash" : "far-eye",
|
||||||
label: visible ? "actions.invisible" : "actions.visible",
|
label: visible ? "actions.invisible" : "actions.visible",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,6 +289,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
label: isPrivateMessage
|
label: isPrivateMessage
|
||||||
? "actions.make_public"
|
? "actions.make_public"
|
||||||
: "actions.make_private",
|
: "actions.make_private",
|
||||||
|
button_group: "topic",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +299,7 @@ export default createWidget("topic-admin-menu", {
|
||||||
action: "showTopicSlowModeUpdate",
|
action: "showTopicSlowModeUpdate",
|
||||||
icon: "hourglass-start",
|
icon: "hourglass-start",
|
||||||
label: "actions.slow_mode",
|
label: "actions.slow_mode",
|
||||||
|
button_group: "time",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.currentUser.get("staff")) {
|
if (this.currentUser.get("staff")) {
|
||||||
|
@ -343,13 +356,31 @@ export default createWidget("topic-admin-menu", {
|
||||||
this.attrs,
|
this.attrs,
|
||||||
this.state
|
this.state
|
||||||
);
|
);
|
||||||
return h(
|
|
||||||
"ul",
|
const actionButtons = attrs.actionButtons
|
||||||
attrs.actionButtons
|
.concat(extraButtons)
|
||||||
.concat(extraButtons)
|
.filter(Boolean);
|
||||||
.filter(Boolean)
|
|
||||||
.map((b) => this.attach("admin-menu-button", b))
|
const buttonMap = actionButtons.reduce(
|
||||||
|
(prev, current) =>
|
||||||
|
prev.set(current.button_group, [
|
||||||
|
...(prev.get(current.button_group) || []),
|
||||||
|
current,
|
||||||
|
]),
|
||||||
|
new Map()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let combinedButtonLists = [];
|
||||||
|
|
||||||
|
for (const [group, buttons] of buttonMap.entries()) {
|
||||||
|
let buttonList = [];
|
||||||
|
buttons.forEach((button) => {
|
||||||
|
buttonList.push(this.attach("admin-menu-button", button));
|
||||||
|
});
|
||||||
|
combinedButtonLists.push(h(`ul.topic-admin-menu-${group}`, buttonList));
|
||||||
|
}
|
||||||
|
|
||||||
|
return h("ul", combinedButtonLists);
|
||||||
},
|
},
|
||||||
|
|
||||||
clickOutside() {
|
clickOutside() {
|
||||||
|
|
|
@ -22,6 +22,32 @@
|
||||||
.mobile-view & {
|
.mobile-view & {
|
||||||
z-index: z("modal", "popover");
|
z-index: z("modal", "popover");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding-top: 0.5em;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
|
||||||
|
.d-icon {
|
||||||
|
font-size: var(--font-down-1);
|
||||||
|
margin-top: 1px; // vertical alignment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
li {
|
||||||
|
border: none;
|
||||||
|
&:not(:last-of-type) {
|
||||||
|
// so buttons don't appear "stuck" together when multiple are highlighted
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
padding: 0.5em;
|
||||||
|
&:not(:last-of-type) {
|
||||||
|
border-bottom: 1px solid var(--primary-low);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body.feature-topic {
|
.modal-body.feature-topic {
|
||||||
|
|
|
@ -2835,8 +2835,8 @@ en:
|
||||||
unpin: "Un-Pin Topic…"
|
unpin: "Un-Pin Topic…"
|
||||||
unarchive: "Unarchive Topic"
|
unarchive: "Unarchive Topic"
|
||||||
archive: "Archive Topic"
|
archive: "Archive Topic"
|
||||||
invisible: "Make Unlisted"
|
invisible: "Unlist Topic"
|
||||||
visible: "Make Listed"
|
visible: "List Topic"
|
||||||
reset_read: "Reset Read Data"
|
reset_read: "Reset Read Data"
|
||||||
make_public: "Make Public Topic..."
|
make_public: "Make Public Topic..."
|
||||||
make_private: "Make Personal Message"
|
make_private: "Make Personal Message"
|
||||||
|
|
Loading…
Reference in New Issue