UX: Move watched words to the Logs section of admin

This commit is contained in:
Neil Lalonde
2017-07-31 17:06:26 -04:00
parent ce27783da4
commit ec85b41078
9 changed files with 23 additions and 25 deletions
@@ -4,7 +4,7 @@ import UploadMixin from "discourse/mixins/upload";
export default Em.Component.extend(UploadMixin, {
type: 'csv',
classNames: 'watched-words-uploader',
uploadUrl: '/admin/watched_words/upload',
uploadUrl: '/admin/logs/watched_words/upload',
addDisabled: Em.computed.alias("uploading"),
validateUploadedFilesOptions() {
@@ -2,7 +2,7 @@ import { ajax } from 'discourse/lib/ajax';
const WatchedWord = Discourse.Model.extend({
save() {
return ajax("/admin/watched_words" + (this.id ? '/' + this.id : '') + ".json", {
return ajax("/admin/logs/watched_words" + (this.id ? '/' + this.id : '') + ".json", {
type: this.id ? 'PUT' : 'POST',
data: {word: this.get('word'), action_key: this.get('action')},
dataType: 'json'
@@ -10,13 +10,13 @@ const WatchedWord = Discourse.Model.extend({
},
destroy() {
return ajax("/admin/watched_words/" + this.get('id') + ".json", {type: 'DELETE'});
return ajax("/admin/logs/watched_words/" + this.get('id') + ".json", {type: 'DELETE'});
}
});
WatchedWord.reopenClass({
findAll() {
return ajax("/admin/watched_words").then(function (list) {
return ajax("/admin/logs/watched_words").then(function (list) {
const actions = {};
list.words.forEach(s => {
if (!actions[s.action]) { actions[s.action] = []; }
@@ -62,6 +62,10 @@ export default function() {
this.route('screenedEmails', { path: '/screened_emails' });
this.route('screenedIpAddresses', { path: '/screened_ip_addresses' });
this.route('screenedUrls', { path: '/screened_urls' });
this.route('adminWatchedWords', { path: '/watched_words', resetNamespace: true}, function() {
this.route('index', { path: '/' } );
this.route('action', { path: '/action/:action_id' } );
});
});
this.route('adminGroups', { path: '/groups', resetNamespace: true }, function() {
@@ -90,10 +94,5 @@ export default function() {
this.route('adminPlugins', { path: '/plugins', resetNamespace: true }, function() {
this.route('index', { path: '/' });
});
this.route('adminWatchedWords', { path: '/watched_words', resetNamespace: true}, function() {
this.route('index', { path: '/' } );
this.route('action', { path: '/action/:action_id' } );
});
});
};
@@ -22,7 +22,6 @@
{{nav-item route='adminApi' label='admin.api.title'}}
{{nav-item route='admin.backups' label='admin.backups.title'}}
{{/if}}
{{nav-item route='adminWatchedWords' label='admin.watched_words.title'}}
{{nav-item route='adminPlugins' label='admin.plugins.title'}}
{{plugin-outlet name="admin-menu" connectorTagName="li"}}
</ul>
@@ -3,6 +3,7 @@
{{nav-item route='adminLogs.screenedEmails' label='admin.logs.screened_emails.title'}}
{{nav-item route='adminLogs.screenedIpAddresses' label='admin.logs.screened_ips.title'}}
{{nav-item route='adminLogs.screenedUrls' label='admin.logs.screened_urls.title'}}
{{nav-item route='adminWatchedWords' label='admin.watched_words.title'}}
{{#if currentUser.admin}}
{{nav-item path='/logs' label='admin.logs.logster.title'}}
{{/if}}