mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-01 09:40:57 +01:00
feat(collections): oper and admin can remove torrent from collections.
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -184,11 +184,19 @@
|
||||
</p>
|
||||
</td>
|
||||
<td class="col-md-1 td-v-middle text-center td-uploader">
|
||||
<span class="coll-item-uploader" user-info="item.user" info-name></span>
|
||||
<div class="coll-item-uploader">
|
||||
<span user-info="item.user" info-name></span>
|
||||
|
||||
<div maker-info="item.maker"></div>
|
||||
<!--<span vip-flag="item.user"></span>-->
|
||||
<!--<span message-to="item.user" to-class="message-to-icon"></span>-->
|
||||
<div maker-info="item.maker"></div>
|
||||
<!--<span vip-flag="item.user"></span>-->
|
||||
<!--<span message-to="item.user" to-class="message-to-icon"></span>-->
|
||||
</div>
|
||||
<div class="coll-item-remove">
|
||||
<button class="btn btn-default" uib-tooltip="{{ 'COLLECTIONS.BTN_REMOVE_TITLE' | translate}}"
|
||||
ng-click="vm.removeFromCollections(item); $event.stopPropagation();">
|
||||
{{'COLLECTIONS.BTN_REMOVE_FROM_COLLECTION' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-width-100"
|
||||
data-ng-click="modalOptions.close()">{{modalOptions.closeButtonText}}</button>
|
||||
<button class="btn btn-primary btn-width-100"
|
||||
<button class="btn btn-success btn-width-100"
|
||||
data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText}}</button>
|
||||
</div>
|
||||
Reference in New Issue
Block a user