feat(forums): add delete CONFIRM

This commit is contained in:
OldHawk
2017-07-04 13:18:30 +08:00
parent 2a1590b7f7
commit 15b53ef628
3 changed files with 28 additions and 10 deletions

View File

@@ -630,6 +630,10 @@
EDIT_FAILED: 'Forum edited failed',
DELETE_SUCCESSFULLY: 'Forum deleted successfully',
DELETE_FAILED: 'Forum deleted failed',
DELETE_CONFIRM_OK: 'Delete',
DELETE_CONFIRM_CANCEL: 'Cancel',
DELETE_CONFIRM_HEADER_TEXT: 'Delete Confirm',
DELETE_CONFIRM_BODY_TEXT: 'Are you sure want to delete this forum?',
CATEGORY: {
AFFAIRS: 'Affairs',
DISCUSS: 'Discuss',

View File

@@ -630,6 +630,10 @@
EDIT_FAILED: '版块编辑失败',
DELETE_SUCCESSFULLY: '版块删除成功',
DELETE_FAILED: '版块删除失败',
DELETE_CONFIRM_OK: '删除',
DELETE_CONFIRM_CANCEL: '取消',
DELETE_CONFIRM_HEADER_TEXT: '删除确认',
DELETE_CONFIRM_BODY_TEXT: '您确定要删除这个版块吗?',
CATEGORY: {
AFFAIRS: '站务区',
DISCUSS: '讨论区',

View File

@@ -6,10 +6,10 @@
.controller('ForumsController', ForumsController);
ForumsController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'MeanTorrentConfig', 'ForumsAdminService', 'SideOverlay', '$filter', 'NotifycationService',
'marked'];
'marked', 'ModalConfirmService'];
function ForumsController($scope, $state, $translate, Authentication, MeanTorrentConfig, ForumsAdminService, SideOverlay, $filter, NotifycationService,
marked) {
marked, ModalConfirmService) {
var vm = this;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.user = Authentication.user;
@@ -99,14 +99,24 @@
* deleteForum
*/
vm.deleteForum = function () {
vm.forum.$remove(function (res) {
NotifycationService.showSuccessNotify('FORUMS.DELETE_SUCCESSFULLY');
vm.forum = undefined;
SideOverlay.close(null, 'popupSlide');
vm.init();
}, function (res) {
NotifycationService.showErrorNotify(res.data.message, 'FORUMS.DELETE_FAILED');
});
var modalOptions = {
closeButtonText: $translate.instant('FORUMS.DELETE_CONFIRM_CANCEL'),
actionButtonText: $translate.instant('FORUMS.DELETE_CONFIRM_OK'),
headerText: $translate.instant('FORUMS.DELETE_CONFIRM_HEADER_TEXT'),
bodyText: $translate.instant('FORUMS.DELETE_CONFIRM_BODY_TEXT')
};
ModalConfirmService.showModal({}, modalOptions)
.then(function (result) {
vm.forum.$remove(function (res) {
NotifycationService.showSuccessNotify('FORUMS.DELETE_SUCCESSFULLY');
vm.forum = undefined;
SideOverlay.close(null, 'popupSlide');
vm.init();
}, function (res) {
NotifycationService.showErrorNotify(res.data.message, 'FORUMS.DELETE_FAILED');
});
});
};
/**