mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FEATURE: Can select topics and hit Dismiss Read
on the /unread
filter
This commit is contained in:
parent
5fd390c600
commit
7a07f14dfc
6 changed files with 40 additions and 5 deletions
|
@ -27,7 +27,7 @@ Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
||||||
|
|
||||||
this.send('loading');
|
this.send('loading');
|
||||||
Discourse.TopicList.find(filter).then(function(list) {
|
Discourse.TopicList.find(filter).then(function(list) {
|
||||||
self.set('model', list);
|
self.setProperties({ model: list, selected: [] });
|
||||||
self.send('loadingComplete');
|
self.send('loadingComplete');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -35,13 +35,32 @@ Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
||||||
toggleBulkSelect: function() {
|
toggleBulkSelect: function() {
|
||||||
this.toggleProperty('bulkSelectEnabled');
|
this.toggleProperty('bulkSelectEnabled');
|
||||||
this.get('selected').clear();
|
this.get('selected').clear();
|
||||||
|
},
|
||||||
|
|
||||||
|
dismissRead: function() {
|
||||||
|
var self = this,
|
||||||
|
selected = this.get('selected'),
|
||||||
|
operation = { type: 'change_notification_level',
|
||||||
|
notification_level: Discourse.Topic.NotificationLevel.REGULAR };
|
||||||
|
|
||||||
|
if (selected.length > 0) {
|
||||||
|
Discourse.Topic.bulkOperation(selected, operation).then(function() {
|
||||||
|
self.send('refresh');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
topicTrackingState: function() {
|
topicTrackingState: function() {
|
||||||
return Discourse.TopicTrackingState.current();
|
return Discourse.TopicTrackingState.current();
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
|
showDismissRead: function() {
|
||||||
|
return this.get('filter') === 'unread' && this.get('topics.length') > 0;
|
||||||
|
}.property('filter', 'topics.length'),
|
||||||
|
|
||||||
canBulkSelect: Em.computed.alias('currentUser.staff'),
|
canBulkSelect: Em.computed.alias('currentUser.staff'),
|
||||||
hasTopics: Em.computed.gt('topics.length', 0),
|
hasTopics: Em.computed.gt('topics.length', 0),
|
||||||
showTable: Em.computed.or('hasTopics', 'topicTrackingState.hasIncoming'),
|
showTable: Em.computed.or('hasTopics', 'topicTrackingState.hasIncoming'),
|
||||||
|
|
|
@ -34,7 +34,12 @@ function buildTopicRoute(filter) {
|
||||||
Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText}));
|
Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText}));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.controllerFor('discoveryTopics').setProperties({ model: model, category: null, period: period });
|
this.controllerFor('discoveryTopics').setProperties({
|
||||||
|
model: model,
|
||||||
|
category: null,
|
||||||
|
period: period,
|
||||||
|
selected: [],
|
||||||
|
});
|
||||||
|
|
||||||
// If there's a draft, open the create topic composer
|
// If there's a draft, open the create topic composer
|
||||||
if (model.draft) {
|
if (model.draft) {
|
||||||
|
@ -108,6 +113,7 @@ function buildCategoryRoute(filter, params) {
|
||||||
model: topics,
|
model: topics,
|
||||||
category: model,
|
category: model,
|
||||||
period: period,
|
period: period,
|
||||||
|
selected: [],
|
||||||
noSubcategories: params && !!params.no_subcategories
|
noSubcategories: params && !!params.no_subcategories
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if showDismissRead}}
|
||||||
|
<button class='btn dismiss-read' {{action dismissRead}}>{{i18n topics.bulk.dismiss_read}}</button>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class='contents'>
|
<div class='contents'>
|
||||||
{{#if showTable}}
|
{{#if showTable}}
|
||||||
<table id='topic-list'>
|
<table id='topic-list'>
|
||||||
|
|
|
@ -546,3 +546,8 @@ ol.category-breadcrumb {
|
||||||
padding: 3px 0 3px 6px;
|
padding: 3px 0 3px 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.dismiss-read {
|
||||||
|
float: right;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
|
@ -628,6 +628,7 @@ en:
|
||||||
|
|
||||||
topics:
|
topics:
|
||||||
bulk:
|
bulk:
|
||||||
|
dismiss_read: "Dismiss Read"
|
||||||
toggle: "toggle bulk selection of topics"
|
toggle: "toggle bulk selection of topics"
|
||||||
actions: "Bulk Actions"
|
actions: "Bulk Actions"
|
||||||
change_category: "Change Category"
|
change_category: "Change Category"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue