Modal for performing a bulk operation

This commit is contained in:
Robin Ward 2014-01-29 13:35:24 -05:00
parent 1696cde2ff
commit 6ee266c7ee
8 changed files with 62 additions and 2 deletions

View File

@ -0,0 +1,14 @@
/**
Modal for performing bulk actions on topics
@class TopicBulkActionsController
@extends Ember.ArrayController
@namespace Discourse
@uses Discourse.ModalFunctionality
@module Discourse
**/
Discourse.TopicBulkActionsController = Ember.ArrayController.extend(Discourse.ModalFunctionality, {
onShow: function() {
this.set('controllers.modal.modalClass', 'topic-bulk-actions-modal');
}
});

View File

@ -35,6 +35,11 @@ Discourse.DiscoveryRoute = Discourse.Route.extend({
draftKey: topicsController.get('draft_key'),
draftSequence: topicsController.get('draft_sequence')
});
},
showBulkActions: function() {
var selected = this.controllerFor('discoveryTopics').get('selected');
Discourse.Route.showModal(this, 'topicBulkActions', selected);
}
}
});

View File

@ -1,3 +1,9 @@
{{#if selected}}
<div id='bulk-select'>
<button class='btn' {{action showBulkActions}}><i class="fa fa-wrench"></i></button>
</div>
{{/if}}
<div class='contents'>
{{#if showTable}}
<table id='topic-list'>

View File

@ -0,0 +1,7 @@
<div class='modal-body'>
<p>{{{i18n topics.selected count=length}}}</p>
<button class='btn'>Change Category</button>
</div>

View File

@ -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')
});

View File

@ -247,6 +247,11 @@
}
}
.topic-bulk-actions-modal {
p {
margin-top: 0;
}
}
.tabbed-modal {
.modal-body {
position: relative;

View File

@ -532,8 +532,6 @@ ol.category-breadcrumb {
text-align: center;
margin-right: 20px;
}
@ -542,3 +540,12 @@ ol.category-breadcrumb {
}
}
#bulk-select {
position: fixed;
right: 20px;
padding: 5px;
background-color: white;
button {
padding: 3px 0 3px 6px;
}
}

View File

@ -601,6 +601,10 @@ en:
topics:
toggle_bulk_select: "toggle bulk selection of topics"
bulk_actions: "Bulk Actions"
selected:
one: "You have selected <b>1</b> topic."
other: "You have selected <b>{{count}}</b> topics."
none:
starred: "You haven't starred any topics yet. To star a topic, click or tap the star next to the title."