Revert "Support for plugins to add bulk operations"
This reverts commit 7a508b201a
.
This commit is contained in:
parent
f95c86ac72
commit
12919f72fa
|
@ -1,39 +1,11 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
const _buttons = [];
|
||||
|
||||
function addBulkButton(action, key) {
|
||||
_buttons.push({ action: action, label: "topics.bulk." + key });
|
||||
}
|
||||
|
||||
// Default buttons
|
||||
addBulkButton('showChangeCategory', 'change_category');
|
||||
addBulkButton('deleteTopics', 'delete');
|
||||
addBulkButton('closeTopics', 'close_topics');
|
||||
addBulkButton('archiveTopics', 'archive_topics');
|
||||
addBulkButton('showNotificationLevel', 'notification_level');
|
||||
addBulkButton('resetRead', 'reset_read');
|
||||
|
||||
// Modal for performing bulk actions on topics
|
||||
export default Ember.ArrayController.extend(ModalFunctionality, {
|
||||
needs: ['discovery/topics'],
|
||||
buttonRows: null,
|
||||
|
||||
onShow: function() {
|
||||
this.set('controllers.modal.modalClass', 'topic-bulk-actions-modal small');
|
||||
|
||||
const buttonRows = [];
|
||||
let row = [];
|
||||
_buttons.forEach(function(b) {
|
||||
row.push(b);
|
||||
if (row.length === 4) {
|
||||
buttonRows.push(row);
|
||||
row = [];
|
||||
}
|
||||
});
|
||||
if (row.length) { buttonRows.push(row); }
|
||||
|
||||
this.set('buttonRows', buttonRows);
|
||||
},
|
||||
|
||||
perform: function(operation) {
|
||||
|
@ -117,5 +89,3 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
export { addBulkButton };
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{{#each row in buttonRows}}
|
||||
<p>
|
||||
{{#each button in row}}
|
||||
{{d-button action=button.action label=button.label}}
|
||||
{{/each}}
|
||||
</p>
|
||||
{{/each}}
|
||||
<p>
|
||||
<button class='btn' {{action "showChangeCategory"}}>{{i18n 'topics.bulk.change_category'}}</button>
|
||||
<button class='btn' {{action "deleteTopics"}}>{{i18n 'topics.bulk.delete'}}</button>
|
||||
<button class='btn' {{action "closeTopics"}}>{{i18n 'topics.bulk.close_topics'}}</button>
|
||||
<button class='btn' {{action "archiveTopics"}}>{{i18n 'topics.bulk.archive_topics'}}</button>
|
||||
</p>
|
||||
<p>
|
||||
<button class='btn' {{action "showNotificationLevel"}}>{{i18n 'topics.bulk.notification_level'}}</button>
|
||||
<button class='btn' {{action "resetRead"}}>{{i18n 'topics.bulk.reset_read'}}</button>
|
||||
</p>
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<p>{{i18n "topics.bulk.choose_new_category"}}</p>
|
||||
<p>Choose the new category for the topics:</p>
|
||||
|
||||
<p>{{category-chooser value=newCategoryId}}</p>
|
||||
|
||||
{{#loading-spinner condition=loading}}
|
||||
{{d-button action="changeCategory" label="topics.bulk.change_category"}}
|
||||
{{/loading-spinner}}
|
||||
{{#if loading}}
|
||||
<div class='loading'>{{i18n 'loading'}}</div>
|
||||
{{else}}
|
||||
<button class='btn' {{action "changeCategory"}}>Change Category</button>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
export default Discourse.ModalBodyView.extend({
|
||||
templateName: 'modal/topic-bulk-actions',
|
||||
title: I18n.t('topics.bulk.actions')
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
Handles the view for the topic bulk actions modal
|
||||
|
||||
@class TopicBulkActionsView
|
||||
@extends Discourse.ModalBodyView
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.TopicBulkActionsView = Discourse.ModalBodyView.extend({
|
||||
templateName: 'modal/topic_bulk_actions',
|
||||
title: I18n.t('topics.bulk.actions')
|
||||
});
|
|
@ -814,7 +814,6 @@ en:
|
|||
close_topics: "Close Topics"
|
||||
archive_topics: "Archive Topics"
|
||||
notification_level: "Change Notification Level"
|
||||
choose_new_category: "Choose the new category for the topics:"
|
||||
selected:
|
||||
one: "You have selected <b>1</b> topic."
|
||||
other: "You have selected <b>{{count}}</b> topics."
|
||||
|
|
|
@ -8,12 +8,7 @@ class TopicsBulkAction
|
|||
end
|
||||
|
||||
def self.operations
|
||||
@operations ||= %w(change_category close archive change_notification_level reset_read dismiss_posts delete)
|
||||
end
|
||||
|
||||
def self.register_operation(name, &block)
|
||||
operations << name
|
||||
define_method(name, &block)
|
||||
%w(change_category close archive change_notification_level reset_read dismiss_posts delete)
|
||||
end
|
||||
|
||||
def perform!
|
||||
|
|
Loading…
Reference in New Issue