diff --git a/modules/collections/client/controllers/collections-view.client.controller.js b/modules/collections/client/controllers/collections-view.client.controller.js index 7154c855..9f24b8a8 100644 --- a/modules/collections/client/controllers/collections-view.client.controller.js +++ b/modules/collections/client/controllers/collections-view.client.controller.js @@ -174,5 +174,31 @@ }); }; + /** + * removeFromCollections + * @param item + */ + vm.removeFromCollections = function (item) { + var modalOptions = { + closeButtonText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_CANCEL'), + actionButtonText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_OK'), + headerText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_HEADER_TEXT'), + bodyText: $translate.instant('COLLECTIONS.REMOVE_CONFIRM_BODY_TEXT') + }; + + ModalConfirmService.showModal({}, modalOptions) + .then(function (result) { + CollectionsService.removeFromCollection({ + collectionId: vm.collection._id, + torrentId: item._id + }, function (res) { + mtDebug.info(res); + vm.collection = res; + NotifycationService.showSuccessNotify('COLLECTIONS.REMOVE_SUCCESSFULLY'); + }, function (res) { + NotifycationService.showErrorNotify(res.data.message, 'COLLECTIONS.REMOVE_FAILED'); + }); + }); + }; } }()); diff --git a/modules/collections/client/views/collection-view.client.view.html b/modules/collections/client/views/collection-view.client.view.html index 942e2472..8f3ba8bc 100644 --- a/modules/collections/client/views/collection-view.client.view.html +++ b/modules/collections/client/views/collection-view.client.view.html @@ -184,11 +184,19 @@

- +
+ -
- - +
+ + +
+
+ +
diff --git a/modules/collections/server/controllers/collections.server.controller.js b/modules/collections/server/controllers/collections.server.controller.js index e6f69d72..8095056d 100644 --- a/modules/collections/server/controllers/collections.server.controller.js +++ b/modules/collections/server/controllers/collections.server.controller.js @@ -159,15 +159,14 @@ exports.removeFromCollection = function (req, res) { var coll = req.collection; var torrent = req.torrent; - coll.update({ - $pull: {torrents: torrent._id} - }).exec(function (err, res) { + coll.torrents.pull(torrent); + coll.save(function (err) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { - res.json(res); + res.json(coll); } }); }; diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 3deb9180..7147c078 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -567,11 +567,19 @@ NO_COLLECTION: 'No collection founded can insert movie, you can create first, then insert this movie into it.', BTN_EDIT_OVERVIEW: 'Edit Overview', BTN_REMOVE_COLLECTION: 'Remove Collection', + BTN_REMOVE_FROM_COLLECTION: 'Remove', + BTN_REMOVE_TITLE: 'Remove From Collection', DELETE_CONFIRM_BODY_TEXT: 'Are you sure want to delete this collection?', DELETE_SUCCESSFULLY: 'Movie collection deleted successfully', DELETE_FAILED: 'Movie collection deleted failed', SETRLEVEL_SUCCESSFULLY: 'Set collection recommend level successfully', - SETRLEVEL_ERROR: 'Set collection recommend level faild' + SETRLEVEL_ERROR: 'Set collection recommend level faild', + REMOVE_CONFIRM_OK: 'Remove', + REMOVE_CONFIRM_CANCEL: 'Cancel', + REMOVE_CONFIRM_HEADER_TEXT: 'Remove Confirm', + REMOVE_CONFIRM_BODY_TEXT: 'Are you sure want to remove the torrent from this collection?', + REMOVE_SUCCESSFULLY: 'Remove the torrent from this collection successfully', + REMOVE_FAILED: 'Remove the torrent from this collection failed' }, //backup views settings diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index e9a0436b..0df3de4f 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -567,11 +567,19 @@ NO_COLLECTION: '没有可加入的系列, 如果还没有创建,你可以先创建一个系列, 再执行加入操作.', BTN_EDIT_OVERVIEW: '编辑系列简介', BTN_REMOVE_COLLECTION: '删除系列', + BTN_REMOVE_FROM_COLLECTION: '移出系列', + BTN_REMOVE_TITLE: '将其从系列中移出', DELETE_CONFIRM_BODY_TEXT: '您确定要删除这个电影系列?', DELETE_SUCCESSFULLY: '电影系列删除成功', DELETE_FAILED: '电影系列删除失败', SETRLEVEL_SUCCESSFULLY: '修改系列的推荐级别成功', - SETRLEVEL_ERROR: '修改系列的推荐级别失败' + SETRLEVEL_ERROR: '修改系列的推荐级别失败', + REMOVE_CONFIRM_OK: '移除', + REMOVE_CONFIRM_CANCEL: '取消', + REMOVE_CONFIRM_HEADER_TEXT: '移除确认', + REMOVE_CONFIRM_BODY_TEXT: '您确认要将此种子移除这个系列?', + REMOVE_SUCCESSFULLY: '从系列中移除种子成功', + REMOVE_FAILED: '从系列中移除种子失败' }, //backup views settings diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index 4945f7df..af15d605 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -769,6 +769,12 @@ body { .label-download { display: none; } + .coll-item-uploader { + display: block; + } + .coll-item-remove { + display: none; + } cursor: pointer; &:hover { .media-object { @@ -788,6 +794,12 @@ body { } } } + .coll-item-uploader { + display: none; + } + .coll-item-remove { + display: block; + } } .media-left { position: relative; diff --git a/modules/torrents/client/controllers/torrent-info.client.controller.js b/modules/torrents/client/controllers/torrent-info.client.controller.js index d48c715c..a6625d40 100644 --- a/modules/torrents/client/controllers/torrent-info.client.controller.js +++ b/modules/torrents/client/controllers/torrent-info.client.controller.js @@ -317,12 +317,12 @@ vm.saveInsertCollection = function () { SideOverlay.close(null, 'collectionsInsertSlide'); - var sc = undefined; - angular.forEach(vm.collectionsItems, function (c) { - if (c._id === vm.collectionTorrent.cid) { - sc = c; - } - }); + //var sc = undefined; + //angular.forEach(vm.collectionsItems, function (c) { + // if (c._id === vm.collectionTorrent.cid) { + // sc = c; + // } + //}); CollectionsService.insertIntoCollection({ collectionId: vm.collectionTorrent.cid, @@ -331,9 +331,8 @@ mtDebug.info(res); NotifycationService.showSuccessNotify('COLLECTIONS.INSERT_SUCCESSFULLY'); }, function (res) { - NotifycationService.showErrorNotify(res.data.message, 'COLLECTIONS.CREATE_FAILED'); + NotifycationService.showErrorNotify(res.data.message, 'COLLECTIONS.INSERT_FAILED'); }); - }; /** diff --git a/modules/torrents/client/templates/modal-confirm.client.view.html b/modules/torrents/client/templates/modal-confirm.client.view.html index 6de08319..5f804641 100644 --- a/modules/torrents/client/templates/modal-confirm.client.view.html +++ b/modules/torrents/client/templates/modal-confirm.client.view.html @@ -8,6 +8,6 @@ \ No newline at end of file