diff --git a/config/env/torrents.js b/config/env/torrents.js
index ac93245e..1252142a 100644
--- a/config/env/torrents.js
+++ b/config/env/torrents.js
@@ -254,6 +254,7 @@ module.exports = {
AdminTorrentDelete: {name: 'AdminTorrentDelete', enable: true},
AdminTorrentSetSaleType: {name: 'AdminTorrentSetSaleType', enable: true},
AdminTorrentSetRecommendLevel: {name: 'AdminTorrentSetRecommendLevel', enable: true},
+ AdminCollectionSetRecommendLevel: {name: 'AdminCollectionSetRecommendLevel', enable: true},
AdminTorrentSetReviewedStatus: {name: 'AdminTorrentSetReviewedStatus', enable: true},
OperCreateMakerGroup: {name: 'OperCreateMakerGroup', enable: true},
OperCreateCollection: {name: 'OperCreateCollection', enable: true},
diff --git a/modules/collections/client/controllers/collections-view.client.controller.js b/modules/collections/client/controllers/collections-view.client.controller.js
index 7f16bf28..5c30dad9 100644
--- a/modules/collections/client/controllers/collections-view.client.controller.js
+++ b/modules/collections/client/controllers/collections-view.client.controller.js
@@ -18,6 +18,7 @@
vm.user = Authentication.user;
vm.RTS = ResourcesTagsServices;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
+ vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel;
vm.searchTags = [];
@@ -151,5 +152,20 @@
});
};
+ /**
+ * vm.setRecommendLevel
+ */
+ vm.setRecommendLevel = function (item, rl) {
+ CollectionsService.setRecommendLevel({
+ _id: item._id,
+ rlevel: rl.value
+ }, function (res) {
+ vm.collection = res;
+ NotifycationService.showSuccessNotify('COLLECTIONS.SETRLEVEL_SUCCESSFULLY');
+ }, function (res) {
+ NotifycationService.showSuccessNotify('COLLECTIONS.SETRLEVEL_ERROR');
+ });
+ };
+
}
}());
diff --git a/modules/collections/client/less/collections.less b/modules/collections/client/less/collections.less
index 89798128..78e42b1c 100644
--- a/modules/collections/client/less/collections.less
+++ b/modules/collections/client/less/collections.less
@@ -139,6 +139,7 @@
text-shadow: 0 0 0.1em #000,-0 -0 0.1em #000;
}
.item-data {
+ text-shadow: 0 0 0.1em #000,-0 -0 0.1em #000;
.fa {
color: @mt-base-color !important;
}
diff --git a/modules/collections/client/services/collections.client.service.js b/modules/collections/client/services/collections.client.service.js
index b780225e..0008bf76 100644
--- a/modules/collections/client/services/collections.client.service.js
+++ b/modules/collections/client/services/collections.client.service.js
@@ -45,7 +45,16 @@
collectionId: '@collectionId',
torrentId: '@torrentId'
}
+ },
+ setRecommendLevel: {
+ method: 'PUT',
+ url: '/api/collections/:collectionId/set/recommendlevel/:rlevel',
+ params: {
+ collectionId: '@_id',
+ rlevel: '@rlevel'
+ }
}
+
});
return collection;
diff --git a/modules/collections/client/views/collection-view.client.view.html b/modules/collections/client/views/collection-view.client.view.html
index 99d4eb71..e0d36000 100644
--- a/modules/collections/client/views/collection-view.client.view.html
+++ b/modules/collections/client/views/collection-view.client.view.html
@@ -42,6 +42,25 @@
ng-if="vm.user.isOper" ng-click="vm.beginRemoveCollection(vm.collection)">
{{'COLLECTIONS.BTN_REMOVE_COLLECTION' | translate}}
+
+
+
+
+
+
diff --git a/modules/collections/server/controllers/collections.server.controller.js b/modules/collections/server/controllers/collections.server.controller.js
index 97012271..e6f69d72 100644
--- a/modules/collections/server/controllers/collections.server.controller.js
+++ b/modules/collections/server/controllers/collections.server.controller.js
@@ -172,6 +172,41 @@ exports.removeFromCollection = function (req, res) {
});
};
+/**
+ * setRecommendLevel
+ * @param req
+ * @param res
+ */
+exports.setRecommendLevel = function (req, res) {
+ var coll = req.collection;
+
+ if (req.params.rlevel) {
+ coll.recommend_level = req.params.rlevel;
+ coll.ordered_at = Date.now();
+
+ coll.save(function (err) {
+ if (err) {
+ return res.status(422).send({
+ message: errorHandler.getErrorMessage(err)
+ });
+ } else {
+ res.json(coll);
+
+ //create trace log
+ traceLogCreate(req, traceConfig.action.AdminCollectionSetRecommendLevel, {
+ coll: coll._id,
+ recommended: req.params.rlevel
+ });
+ }
+ });
+ } else {
+ return res.status(422).send({
+ message: 'PARAMS_RLEVEL_ERROR'
+ });
+ }
+
+};
+
/**
* Delete an collection
*/
diff --git a/modules/collections/server/policies/collections.server.policy.js b/modules/collections/server/policies/collections.server.policy.js
index 62763a1a..1d0474df 100644
--- a/modules/collections/server/policies/collections.server.policy.js
+++ b/modules/collections/server/policies/collections.server.policy.js
@@ -22,7 +22,8 @@ exports.invokeRolesPolicies = function () {
{resources: '/api/collections', permissions: '*'},
{resources: '/api/collections/:collectionId', permissions: '*'},
{resources: '/api/collections/:collectionId/insert/:torrentId', permissions: '*'},
- {resources: '/api/collections/:collectionId/remove/:torrentId', permissions: '*'}
+ {resources: '/api/collections/:collectionId/remove/:torrentId', permissions: '*'},
+ {resources: '/api/collections/:collectionId/set/recommendlevel/:rlevel', permissions: '*'}
]
},
{
diff --git a/modules/collections/server/routes/collections.server.routes.js b/modules/collections/server/routes/collections.server.routes.js
index b9b5ce44..c1142146 100644
--- a/modules/collections/server/routes/collections.server.routes.js
+++ b/modules/collections/server/routes/collections.server.routes.js
@@ -26,6 +26,8 @@ module.exports = function (app) {
.put(collections.insertIntoCollection);
app.route('/api/collections/:collectionId/remove/:torrentId').all(collectionsPolicy.isAllowed)
.put(collections.removeFromCollection);
+ app.route('/api/collections/:collectionId/set/recommendlevel/:rlevel').all(collectionsPolicy.isAllowed)
+ .put(collections.setRecommendLevel);
app.param('collectionId', collections.collectionByID);
};
diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js
index af55e101..af07688f 100644
--- a/modules/core/client/app/trans-string-en.js
+++ b/modules/core/client/app/trans-string-en.js
@@ -525,7 +525,9 @@
BTN_REMOVE_COLLECTION: 'Remove 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'
+ DELETE_FAILED: 'Movie collection deleted failed',
+ SETRLEVEL_SUCCESSFULLY: 'Set collection recommend level successfully',
+ SETRLEVEL_ERROR: 'Set collection recommend level faild'
},
//user settings
diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js
index 1a3ce460..19fcc966 100644
--- a/modules/core/client/app/trans-string-zh.js
+++ b/modules/core/client/app/trans-string-zh.js
@@ -525,7 +525,9 @@
BTN_REMOVE_COLLECTION: '删除系列',
DELETE_CONFIRM_BODY_TEXT: '您确定要删除这个电影系列?',
DELETE_SUCCESSFULLY: '电影系列删除成功',
- DELETE_FAILED: '电影系列删除失败'
+ DELETE_FAILED: '电影系列删除失败',
+ SETRLEVEL_SUCCESSFULLY: '修改系列的推荐级别成功',
+ SETRLEVEL_ERROR: '修改系列的推荐级别失败'
},
//user settings