UX: Move delete button to end and mark it as dangerous
This commit is contained in:
parent
52ae63d5d7
commit
ea0ecb67f3
|
@ -4,31 +4,37 @@ const _buttons = [];
|
||||||
|
|
||||||
const alwaysTrue = () => true;
|
const alwaysTrue = () => true;
|
||||||
|
|
||||||
function addBulkButton(action, key, icon, buttonVisible) {
|
function addBulkButton(action, key, opts) {
|
||||||
_buttons.push({
|
opts = opts || {};
|
||||||
|
|
||||||
|
const btn = {
|
||||||
action,
|
action,
|
||||||
label: `topics.bulk.${key}`,
|
label: `topics.bulk.${key}`,
|
||||||
icon,
|
icon: opts.icon,
|
||||||
buttonVisible: buttonVisible || alwaysTrue
|
buttonVisible: opts.buttonVisible || alwaysTrue,
|
||||||
});
|
class: opts.class
|
||||||
|
};
|
||||||
|
|
||||||
|
_buttons.push(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default buttons
|
// Default buttons
|
||||||
addBulkButton('showChangeCategory', 'change_category', 'pencil');
|
addBulkButton('showChangeCategory', 'change_category', {icon: 'pencil'});
|
||||||
addBulkButton('deleteTopics', 'delete', 'trash');
|
addBulkButton('closeTopics', 'close_topics', {icon: 'lock'});
|
||||||
addBulkButton('closeTopics', 'close_topics', 'lock');
|
addBulkButton('archiveTopics', 'archive_topics', {icon: 'folder'});
|
||||||
addBulkButton('archiveTopics', 'archive_topics', 'folder');
|
addBulkButton('showNotificationLevel', 'notification_level', {icon: 'circle-o'});
|
||||||
addBulkButton('showNotificationLevel', 'notification_level', 'circle-o');
|
addBulkButton('resetRead', 'reset_read', {icon: 'backward'});
|
||||||
addBulkButton('resetRead', 'reset_read', 'backward');
|
addBulkButton('unlistTopics', 'unlist_topics', {
|
||||||
addBulkButton('unlistTopics', 'unlist_topics', 'eye-slash', topics => {
|
icon: 'eye-slash',
|
||||||
return topics.some(t => t.visible);
|
buttonVisible: topics => topics.some(t => t.visible)
|
||||||
});
|
});
|
||||||
addBulkButton('relistTopics', 'relist_topics', 'eye', topics => {
|
addBulkButton('relistTopics', 'relist_topics', {
|
||||||
return topics.some(t => !t.visible);
|
icon: 'eye',
|
||||||
|
buttonVisible: topics => topics.some(t => !t.visible)
|
||||||
});
|
});
|
||||||
|
addBulkButton('showTagTopics', 'change_tags', {icon: 'tag'});
|
||||||
addBulkButton('showTagTopics', 'change_tags', 'tag');
|
addBulkButton('showAppendTagTopics', 'append_tags', {icon: 'tag'});
|
||||||
addBulkButton('showAppendTagTopics', 'append_tags', 'tag');
|
addBulkButton('deleteTopics', 'delete', {icon: 'trash', class: 'btn-danger'});
|
||||||
|
|
||||||
// Modal for performing bulk actions on topics
|
// Modal for performing bulk actions on topics
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class='bulk-buttons'>
|
<div class='bulk-buttons'>
|
||||||
{{#each buttons as |button|}}
|
{{#each buttons as |button|}}
|
||||||
{{d-button action=button.action label=button.label icon=button.icon}}
|
{{d-button action=button.action label=button.label icon=button.icon class=button.class}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue