client/tags: add ability to turn off suggestions

This commit is contained in:
rr- 2016-07-31 23:07:01 +02:00
parent 97b217dc31
commit 673bb52d4a
4 changed files with 11 additions and 0 deletions

View file

@ -18,6 +18,9 @@
<li>
<%= ctx.makeCheckbox({text: 'Enable transparency grid', id: 'transparency-grid', name: 'transparency-grid', checked: ctx.browsingSettings.transparencyGrid}) %>
</li>
<li>
<%= ctx.makeCheckbox({text: 'Show tag suggestions', id: 'tag-suggestions', name: 'tag-suggestions', checked: ctx.browsingSettings.tagSuggestions}) %>
</li>
</ul>
</div>
<div class='messages'></div>

View file

@ -3,6 +3,7 @@
const api = require('../api.js');
const tags = require('../tags.js');
const misc = require('../util/misc.js');
const settings = require('../models/settings.js');
const events = require('../events.js');
const views = require('../util/views.js');
const TagAutoCompleteControl = require('./tag_auto_complete_control.js');
@ -335,6 +336,10 @@ class TagInputControl extends events.EventTarget {
}
_loadSuggestions(tag) {
const browsingSettings = settings.get();
if (!browsingSettings.tagSuggestions) {
return;
}
api.get('/tag-siblings/' + tag.names[0], {noProgress: true})
.then(response => {
return Promise.resolve(response.results);

View file

@ -13,6 +13,7 @@ const defaultSettings = {
keyboardShortcuts: true,
transparencyGrid: true,
fitMode: 'fit-both',
tagSuggestions: true,
};
class Settings extends events.EventTarget {

View file

@ -39,6 +39,8 @@ class SettingsView extends events.EventTarget {
'#keyboard-shortcuts').checked,
transparencyGrid: this._formNode.querySelector(
'#transparency-grid').checked,
tagSuggestions: this._formNode.querySelector(
'#tag-suggestions').checked,
},
},
}));