mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
UX: move wiki button in post wrench
This commit is contained in:
parent
e0347b18da
commit
df565da3b3
@ -23,7 +23,6 @@ export default createWidget('post-admin-menu', {
|
||||
const contents = [];
|
||||
contents.push(h('h3', I18n.t('admin_title')));
|
||||
|
||||
|
||||
if (!attrs.isWhisper && this.currentUser.staff) {
|
||||
const buttonAtts = { action: 'togglePostType', icon: 'shield', className: 'toggle-post-type' };
|
||||
|
||||
@ -35,25 +34,32 @@ export default createWidget('post-admin-menu', {
|
||||
contents.push(this.attach('post-admin-menu-button', buttonAtts));
|
||||
}
|
||||
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
icon: 'cog', label: 'post.controls.rebake', action: 'rebakePost', className: 'rebuild-html'
|
||||
}));
|
||||
|
||||
if (attrs.hidden) {
|
||||
if (attrs.canManage) {
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
icon: 'eye',
|
||||
label: 'post.controls.unhide',
|
||||
action: 'unhidePost',
|
||||
className: 'unhide-post'
|
||||
icon: 'cog', label: 'post.controls.rebake', action: 'rebakePost', className: 'rebuild-html'
|
||||
}));
|
||||
|
||||
if (attrs.hidden) {
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
icon: 'eye', label: 'post.controls.unhide', action: 'unhidePost', className: 'unhide-post'
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.currentUser.admin) {
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
icon: 'user',
|
||||
label: 'post.controls.change_owner',
|
||||
action: 'changePostOwner',
|
||||
className: 'change-owner'
|
||||
icon: 'user', label: 'post.controls.change_owner', action: 'changePostOwner', className: 'change-owner'
|
||||
}));
|
||||
}
|
||||
|
||||
// toggle Wiki button
|
||||
if (attrs.wiki) {
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
action: 'toggleWiki', label: 'post.controls.unwiki', icon: 'pencil-square-o', className: 'wiki wikied'
|
||||
}));
|
||||
} else {
|
||||
contents.push(this.attach('post-admin-menu-button', {
|
||||
action: 'toggleWiki', label: 'post.controls.wiki', icon: 'pencil-square-o', className: 'wiki'
|
||||
}));
|
||||
}
|
||||
|
||||
@ -64,4 +70,3 @@ export default createWidget('post-admin-menu', {
|
||||
this.sendWidgetAction('closeAdminMenu');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -81,8 +81,7 @@ registerButton('edit', attrs => {
|
||||
className: 'edit',
|
||||
title: 'post.controls.edit',
|
||||
icon: 'pencil',
|
||||
alwaysShowYours: true,
|
||||
alwaysShowWiki: true
|
||||
alwaysShowYours: true
|
||||
};
|
||||
}
|
||||
});
|
||||
@ -161,7 +160,7 @@ registerButton('bookmark', attrs => {
|
||||
});
|
||||
|
||||
registerButton('admin', attrs => {
|
||||
if (!attrs.canManage) { return; }
|
||||
if (!attrs.canManage && !attrs.canWiki) { return; }
|
||||
return { action: 'openAdminMenu',
|
||||
title: 'post.controls.admin',
|
||||
className: 'show-post-admin-menu',
|
||||
@ -180,22 +179,6 @@ registerButton('delete', attrs => {
|
||||
}
|
||||
});
|
||||
|
||||
registerButton('wiki', attrs => {
|
||||
if (!attrs.canWiki) { return; }
|
||||
|
||||
if (attrs.wiki) {
|
||||
return { action: 'toggleWiki',
|
||||
title: 'post.controls.unwiki',
|
||||
icon: 'pencil-square-o',
|
||||
className: 'wiki wikied' };
|
||||
} else {
|
||||
return { action: 'toggleWiki',
|
||||
title: 'post.controls.wiki',
|
||||
icon: 'pencil-square-o',
|
||||
className: 'wiki' };
|
||||
}
|
||||
});
|
||||
|
||||
export default createWidget('post-menu', {
|
||||
tagName: 'section.post-menu-area.clearfix',
|
||||
|
||||
@ -229,9 +212,7 @@ export default createWidget('post-menu', {
|
||||
const button = this.attachButton(i, attrs);
|
||||
if (button) {
|
||||
allButtons.push(button);
|
||||
if ((attrs.yours && button.attrs.alwaysShowYours) ||
|
||||
(attrs.wiki && button.attrs.alwaysShowWiki) ||
|
||||
(hiddenButtons.indexOf(i) === -1)) {
|
||||
if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) {
|
||||
visibleButtons.push(button);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ basic:
|
||||
post_menu:
|
||||
client: true
|
||||
type: list
|
||||
default: 'like-count|like|share|flag|edit|bookmark|wiki|delete|admin|reply'
|
||||
default: 'like-count|like|share|flag|edit|bookmark|delete|admin|reply'
|
||||
choices:
|
||||
- like-count
|
||||
- like
|
||||
@ -119,11 +119,10 @@ basic:
|
||||
- bookmark
|
||||
- admin
|
||||
- reply
|
||||
- wiki
|
||||
post_menu_hidden_items:
|
||||
client: true
|
||||
type: list
|
||||
default: 'bookmark|edit|wiki|delete|admin'
|
||||
default: 'bookmark|edit|delete|admin'
|
||||
choices:
|
||||
- like
|
||||
- edit
|
||||
@ -133,7 +132,6 @@ basic:
|
||||
- bookmark
|
||||
- admin
|
||||
- reply
|
||||
- wiki
|
||||
share_links:
|
||||
client: true
|
||||
type: list
|
||||
|
Loading…
Reference in New Issue
Block a user