diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index eb1c1a00..9ab98f06 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -78,6 +78,7 @@ SIZE: 'Size', SEEDS_LEECHERS_FINISHED: 'S/L/F', PUBLISHER: 'Publisher', + ADMIN_TOOLS: 'Admin Tools', LIFETIME: 'Life', VOTES: 'Votes', @@ -175,6 +176,7 @@ ADMIN_BASIC_COMMAND: 'Basic Command', ADMIN_BASIC_DELETE: 'Delete torrent', + ADMIN_BASIC_TYPE_SET: 'Sale Type', ADMIN_SALE_TYPE_SET: 'Sale Type Set', TORRENT_DELETE_CONFIRM_OK: 'Delete', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index c3849e00..41f7b690 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -78,6 +78,7 @@ SIZE: '大小', SEEDS_LEECHERS_FINISHED: '上/下/完', PUBLISHER: '发布者', + ADMIN_TOOLS: '管理工具', LIFETIME: '存活时间', VOTES: '评分', @@ -175,6 +176,7 @@ ADMIN_BASIC_COMMAND: '操作命令', ADMIN_BASIC_DELETE: '删除种子', + ADMIN_BASIC_TYPE_SET: '设置促销', ADMIN_SALE_TYPE_SET: '种子促销类型', TORRENT_DELETE_CONFIRM_OK: '删除', diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index 6210596e..76097359 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -561,3 +561,6 @@ .button-variant(@btn-mt-color; @btn-mt-bg; @btn-mt-border); } +.admin-tools-btn-list { + width: 100%; +} diff --git a/modules/torrents/client/controllers/admin/admin-list.client.controller.js b/modules/torrents/client/controllers/admin/admin-list.client.controller.js index a9ed1450..fb990a2e 100644 --- a/modules/torrents/client/controllers/admin/admin-list.client.controller.js +++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js @@ -6,10 +6,10 @@ .controller('TorrentsAdminController', TorrentsAdminController); TorrentsAdminController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService', - 'MeanTorrentConfig', 'DownloadService', '$window']; + 'MeanTorrentConfig', 'DownloadService', '$window', 'ModalConfirmService']; function TorrentsAdminController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, - DownloadService, $window) { + DownloadService, $window, ModalConfirmService) { var vm = this; vm.user = Authentication.user; vm.announce = MeanTorrentConfig.meanTorrentConfig.announce; @@ -275,5 +275,64 @@ var url = $state.href('torrents.view', {torrentId: id}); $window.open(url, '_blank'); }; + + /** + * deleteTorrent + */ + vm.deleteTorrent = function (item) { + var modalOptions = { + closeButtonText: $translate.instant('TORRENT_DELETE_CONFIRM_CANCEL'), + actionButtonText: $translate.instant('TORRENT_DELETE_CONFIRM_OK'), + headerText: $translate.instant('TORRENT_DELETE_CONFIRM_HEADER_TEXT'), + bodyText: $translate.instant('TORRENT_DELETE_CONFIRM_BODY_TEXT'), + bodyParams: item.torrent_filename + }; + + ModalConfirmService.showModal({}, modalOptions) + .then(function (result) { + item.$remove(function (response) { + successCallback(response); + }, function (errorResponse) { + errorCallback(errorResponse); + }); + + function successCallback(res) { + vm.torrentPagedItems.splice(vm.torrentPagedItems.indexOf(item), 1); + Notification.success({ + message: ' ' + $translate.instant('TORRENT_DELETE_SUCCESSFULLY') + }); + } + + function errorCallback(res) { + vm.error_msg = res.data.message; + Notification.error({ + message: res.data.message, + title: ' ' + $translate.instant('TORRENT_DELETE_ERROR') + }); + } + }); + }; + + + /** + * setSaleType + */ + vm.setSaleType = function (item, st) { + TorrentsService.setSaleType({ + _torrentId: item._id, + _saleType: st.name + }, function (res) { + Notification.success({ + message: ' ' + $translate.instant('TORRENT_SETSALETYPE_SUCCESSFULLY') + }); + + vm.torrentPagedItems[vm.torrentPagedItems.indexOf(item)] = res; + }, function (res) { + Notification.error({ + message: res.data.message, + title: ' ' + $translate.instant('TORRENT_SETSALETYPE_ERROR') + }); + }); + }; } }()); diff --git a/modules/torrents/client/services/modal-confirm.client.service.js b/modules/torrents/client/services/modal-confirm.client.service.js index 01d14ac9..07a2d821 100644 --- a/modules/torrents/client/services/modal-confirm.client.service.js +++ b/modules/torrents/client/services/modal-confirm.client.service.js @@ -20,7 +20,8 @@ closeButtonText: 'Close', actionButtonText: 'Yes', headerText: 'Confirm?', - bodyText: 'Confirm this action?' + bodyText: 'Confirm this action?', + bodyParams: undefined }; var showModal = function (customModalDefaults, customModalOptions) { diff --git a/modules/torrents/client/templates/modal-confirm.client.view.html b/modules/torrents/client/templates/modal-confirm.client.view.html index bd1585fe..a7a2fb33 100644 --- a/modules/torrents/client/templates/modal-confirm.client.view.html +++ b/modules/torrents/client/templates/modal-confirm.client.view.html @@ -3,6 +3,7 @@
{{modalOptions.bodyText}}
+{{modalOptions.bodyParams}}