Added tag banning

This commit is contained in:
Marcin Kurczewski
2014-10-14 22:56:15 +02:00
parent 1e745fa648
commit 250ffb209f
17 changed files with 90 additions and 13 deletions

View File

@ -45,6 +45,7 @@ App.Auth = function(_, jQuery, util, api, appState, promise) {
listTags: 'listTags',
massTag: 'massTag',
changeTagName: 'changeTagName',
banTags: 'banTags',
viewHistory: 'viewHistory',
};

View File

@ -28,6 +28,7 @@ App.Presenters.TagPresenter = function(
topNavigationPresenter.changeTitle('Tags');
privileges.canChangeName = auth.hasPrivilege(auth.privileges.changeTagName);
privileges.canBan = auth.hasPrivilege(auth.privileges.banTags);
promise.wait(
util.promiseTemplate('tag'),
@ -81,6 +82,10 @@ App.Presenters.TagPresenter = function(
formData.name = $form.find('[name=name]').val();
}
if (privileges.canBan) {
formData.banned = $form.find('[name=ban]').is(':checked') ? 1 : 0;
}
promise.wait(api.put('/tags/' + tag.name, formData))
.then(function(response) {
tag = response.json;