From fea63b35184c222b6c5ccf33cd7b819b29517dcd Mon Sep 17 00:00:00 2001 From: OldHawk Date: Fri, 20 Oct 2017 22:43:22 +0800 Subject: [PATCH] feat(about): admin remove maker group --- .../controllers/about.client.controller.js | 27 +++++++++++++++++-- modules/core/client/app/trans-string-en.js | 8 +++++- modules/core/client/app/trans-string-zh.js | 8 +++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/modules/about/client/controllers/about.client.controller.js b/modules/about/client/controllers/about.client.controller.js index b1b7f385..ac80cece 100644 --- a/modules/about/client/controllers/about.client.controller.js +++ b/modules/about/client/controllers/about.client.controller.js @@ -7,11 +7,11 @@ AboutController.$inject = ['$scope', '$state', 'getStorageLangService', 'MeanTorrentConfig', 'AdminService', 'MakerGroupService', 'DebugConsoleService', 'marked', 'localStorageService', '$translate', '$compile', 'Authentication', 'DownloadService', 'TorrentGetInfoServices', 'ResourcesTagsServices', - 'uibButtonConfig', '$window', '$timeout', 'TorrentsService']; + 'uibButtonConfig', '$window', '$timeout', 'TorrentsService', 'ModalConfirmService', 'NotifycationService']; function AboutController($scope, $state, getStorageLangService, MeanTorrentConfig, AdminService, MakerGroupService, mtDebug, marked, localStorageService, $translate, $compile, Authentication, DownloadService, TorrentGetInfoServices, ResourcesTagsServices, - uibButtonConfig, $window, $timeout, TorrentsService) { + uibButtonConfig, $window, $timeout, TorrentsService, ModalConfirmService, NotifycationService) { var vm = this; vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; @@ -215,6 +215,29 @@ }); }; + /** + * beginRemoveMakerGroup + * @param m + */ + vm.beginRemoveMakerGroup = function (m) { + var modalOptions = { + closeButtonText: $translate.instant('ABOUT.DELETE_CONFIRM_CANCEL'), + actionButtonText: $translate.instant('ABOUT.DELETE_CONFIRM_OK'), + headerText: $translate.instant('ABOUT.DELETE_CONFIRM_HEADER_TEXT'), + bodyText: $translate.instant('ABOUT.DELETE_CONFIRM_BODY_TEXT') + }; + + ModalConfirmService.showModal({}, modalOptions) + .then(function (result) { + m.$remove(function (res) { + NotifycationService.showSuccessNotify('ABOUT.DELETE_SUCCESSFULLY'); + $state.go('about.maker'); + }, function (res) { + NotifycationService.showErrorNotify(res.data.message, 'ABOUT.DELETE_FAILED'); + }); + }); + }; + /** * getOperList */ diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index c536ccc2..5dddd20d 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -482,7 +482,13 @@ BTN_REMOVE_GROUP: 'Remove Group', MAKER_TORRENTS_LIST_ERROR: 'Maker group torrents list error', MAKER_TORRENTS_IS_LOADING: 'Maker group torrents is loading...', - MAKER_TORRENTS_IS_EMPTY: 'No torrents of this maker group is founded!' + MAKER_TORRENTS_IS_EMPTY: 'No torrents of this maker group is founded!', + 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 maker group?', + DELETE_SUCCESSFULLY: 'Maker group deleted successfully', + DELETE_FAILED: 'Maker group deleted failed' }, //collections views diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 2900f8ed..f03201c2 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -482,7 +482,13 @@ BTN_REMOVE_GROUP: '删除小组', MAKER_TORRENTS_LIST_ERROR: '小组资源获取失败', MAKER_TORRENTS_IS_LOADING: '正在获取小组资源列表, 请稍候...', - MAKER_TORRENTS_IS_EMPTY: '没有找到该小组的种子资源!' + MAKER_TORRENTS_IS_EMPTY: '没有找到该小组的种子资源!', + DELETE_CONFIRM_OK: '删除', + DELETE_CONFIRM_CANCEL: '取消', + DELETE_CONFIRM_HEADER_TEXT: '删除确认', + DELETE_CONFIRM_BODY_TEXT: '您确定要删除这个资源压制小组?', + DELETE_SUCCESSFULLY: '资源压制小组删除成功', + DELETE_FAILED: '资源压制小组删除失败' }, //collections views