diff --git a/modules/about/client/less/about.less b/modules/about/client/less/about.less index f101df9b..eab4acf0 100644 --- a/modules/about/client/less/about.less +++ b/modules/about/client/less/about.less @@ -164,16 +164,22 @@ @media (max-width: @screen-xs-max) { min-width: ~"calc(100% - 50px)"; } - padding: 30px 15px; - .maker-form { - margin-top: 20px; - input { - width: 100%; - } - textarea { + .maker-popup { + background-color: #fdfdfd; + width: 100%; + height: ~"calc(100% - 50px)"; + overflow: auto; + padding: 30px 15px; + .maker-form { margin-top: 20px; - width: 100%; - height: 150px; + input { + width: 100%; + } + textarea { + margin-top: 20px; + width: 100%; + height: 150px; + } } } .bottom-control { diff --git a/modules/collections/client/less/collections.less b/modules/collections/client/less/collections.less index f3f32b63..341dbdad 100644 --- a/modules/collections/client/less/collections.less +++ b/modules/collections/client/less/collections.less @@ -8,20 +8,29 @@ @media (max-width: @screen-xs-max) { min-width: ~"calc(100% - 50px)"; } - padding: 30px 15px; - .collection-form { - margin-top: 20px; - input { - width: 100%; - } - textarea { + .collection-popup { + background-color: #fdfdfd; + width: 100%; + height: ~"calc(100% - 50px)"; + overflow: auto; + padding: 30px 15px; + .collection-form { margin-top: 20px; - width: 100%; - height: 200px; - } - img { - margin-top: 10px; - width: 100%; + input { + width: 100%; + } + textarea { + margin-top: 20px; + width: 100%; + height: 200px; + } + img { + margin-top: 10px; + width: 100%; + } + .text-muted { + color: #aaa; + } } } .bottom-control { @@ -34,7 +43,6 @@ bottom: 0; padding: 8px 10px; } - } .collections-list { @@ -50,58 +58,69 @@ } } } - .collection-item { - cursor: pointer; - position: relative; - margin: 20px 0 0 0; - overflow: hidden; - border-radius: 8px; - - &:hover { - img { - /* csslint ignore:start */ - transform: scale(2); - /* csslint ignore:end */ - } - } - - img { - width: 100%; - transition-property: transform, opacity; - transition-duration: 1s; - transition-timing-function: ease; - - border: solid 1px #666; - border-radius: 8px; - } - .item-info { - color: #999; - position: absolute; + .collection-items { + text-align: -webkit-center; + .collection-item { + cursor: pointer; + position: relative; + margin: 20px 0 0 0; overflow: hidden; - top: 0; - bottom: 0; - left: 0; - right: 0; - padding: 30px 20px; - background-color: rgba(0, 0, 0, 0.6); border-radius: 8px; - .name { - margin-bottom: 2px; - font-size: 1.6em; + max-width: 400px; + text-align: -webkit-center; + + &:hover { + img { + /* csslint ignore:start */ + transform: scale(2); + /* csslint ignore:end */ + } } - .collection-data { - position: absolute; - left: 0; - right: 0; - bottom: 30px; - } - } - &:hover { - .fa { - color: @mt-base-color !important; + + img { + width: 100%; + transition-property: transform, opacity; + transition-duration: 1s; + transition-timing-function: ease; + + border: solid 1px #666; + border-radius: 8px; } .item-info { - color: #fff; + color: #ddd; + position: absolute; + overflow: hidden; + top: 0; + bottom: 0; + left: 0; + right: 0; + padding: 30px 20px; + background-color: rgba(0, 0, 0, 0.6); + border-radius: 8px; + .name { + margin-bottom: 2px; + font-size: 1.6em; + text-shadow: 0 0 0.1em #000,-0 -0 0.1em #000; + } + .collection-data { + position: absolute; + left: 0; + right: 0; + bottom: 30px; + + strong { + text-shadow: 0 0 0.1em #000,-0 -0 0.1em #000; + } + } + } + &:hover { + .fa { + color: @mt-base-color !important; + } + .item-info { + background-color: rgba(0, 0, 0, 0.3); + color: #fff; + } } } } diff --git a/modules/collections/client/services/collections.client.service.js b/modules/collections/client/services/collections.client.service.js index 5f7e9b6a..b780225e 100644 --- a/modules/collections/client/services/collections.client.service.js +++ b/modules/collections/client/services/collections.client.service.js @@ -29,6 +29,22 @@ id: '@id', language: '@language' } + }, + insertIntoCollection: { + method: 'PUT', + url: '/api/collections/:collectionId/insert/:torrentId', + params: { + collectionId: '@collectionId', + torrentId: '@torrentId' + } + }, + removeFromCollection: { + method: 'PUT', + url: '/api/collections/:collectionId/remove/:torrentId', + params: { + collectionId: '@collectionId', + torrentId: '@torrentId' + } } }); diff --git a/modules/collections/client/views/collections.client.view.html b/modules/collections/client/views/collections.client.view.html index db2e7b7e..2de826ca 100644 --- a/modules/collections/client/views/collections.client.view.html +++ b/modules/collections/client/views/collections.client.view.html @@ -27,31 +27,26 @@
-
- +
+
+ -
-
{{m.name}}
+
+
{{m.name}}
-
-
- -
-
- {{m.torrents.length}} -
-
- +
+
+ + {{'COLLECTIONS.FILES_NUMBERS' | translate}}: {{m.torrents.length}} +
+
+ + {{'COLLECTIONS.VOTE_AVERAGE' | translate}}: {{m.torrents.length}} +
- - - - - -
diff --git a/modules/collections/server/controllers/collections.server.controller.js b/modules/collections/server/controllers/collections.server.controller.js index 0556916e..de112225 100644 --- a/modules/collections/server/controllers/collections.server.controller.js +++ b/modules/collections/server/controllers/collections.server.controller.js @@ -128,6 +128,49 @@ exports.update = function (req, res) { }); }; +/** + * insertIntoCollection + * @param req + * @param res + */ +exports.insertIntoCollection = function (req, res) { + var coll = req.collection; + var torrent = req.torrent; + + coll.torrents.push(torrent); + coll.save(function (err) { + if (err) { + return res.status(422).send({ + message: errorHandler.getErrorMessage(err) + }); + } else { + res.json(coll); + } + }); +}; + +/** + * removeFromCollection + * @param req + * @param res + */ +exports.removeFromCollection = function (req, res) { + var coll = req.collection; + var torrent = req.torrent; + + coll.update({ + $pull: {torrents: torrent._id} + }).exec(function (err, res) { + if (err) { + return res.status(422).send({ + message: errorHandler.getErrorMessage(err) + }); + } else { + res.json(res); + } + }); +}; + /** * Delete an collection */ @@ -151,16 +194,21 @@ exports.delete = function (req, res) { exports.list = function (req, res) { var skip = 0; var limit = 0; + var tmdb_id = 0; var keysA = []; var condition = {}; - if (req.body.skip !== undefined) { + if (req.query.skip !== undefined) { skip = parseInt(req.query.skip, 10); } - if (req.body.limit !== undefined) { + if (req.query.limit !== undefined) { limit = parseInt(req.query.limit, 10); } + if (req.query.tmdb_id !== undefined) { + tmdb_id = parseInt(req.query.tmdb_id, 10); + } + if (req.query.keys && req.query.keys.length > 0) { var keysS = req.query.keys + ''; var keysT = keysS.split(' '); @@ -171,6 +219,10 @@ exports.list = function (req, res) { }); } + if (tmdb_id !== 0) { + condition.tmdb_id = tmdb_id; + } + if (keysA.length > 0) { condition.$or = [ {name: {'$all': keysA}}, diff --git a/modules/collections/server/policies/collections.server.policy.js b/modules/collections/server/policies/collections.server.policy.js index 9c1065db..62763a1a 100644 --- a/modules/collections/server/policies/collections.server.policy.js +++ b/modules/collections/server/policies/collections.server.policy.js @@ -20,7 +20,9 @@ exports.invokeRolesPolicies = function () { {resources: '/api/search/collection/:language', permissions: '*'}, {resources: '/api/collectionInfo/:id/:language', permissions: '*'}, {resources: '/api/collections', permissions: '*'}, - {resources: '/api/collections/:collectionId', permissions: '*'} + {resources: '/api/collections/:collectionId', permissions: '*'}, + {resources: '/api/collections/:collectionId/insert/:torrentId', permissions: '*'}, + {resources: '/api/collections/:collectionId/remove/:torrentId', permissions: '*'} ] }, { diff --git a/modules/collections/server/routes/collections.server.routes.js b/modules/collections/server/routes/collections.server.routes.js index 42c0556e..b9b5ce44 100644 --- a/modules/collections/server/routes/collections.server.routes.js +++ b/modules/collections/server/routes/collections.server.routes.js @@ -22,5 +22,10 @@ module.exports = function (app) { .put(collections.update) .delete(collections.delete); + app.route('/api/collections/:collectionId/insert/:torrentId').all(collectionsPolicy.isAllowed) + .put(collections.insertIntoCollection); + app.route('/api/collections/:collectionId/remove/:torrentId').all(collectionsPolicy.isAllowed) + .put(collections.removeFromCollection); + 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 3b01e6d5..2d3f79f2 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -511,7 +511,16 @@ COLL_LIST: 'Movie Collections List', CREATE_SUCCESSFULLY: 'Create movie collection successfully', CREATE_FAILED: 'Create movie collection failed', - LIST_ERROR: 'Movie collections list error' + FILES_NUMBERS: 'Torrents', + VOTE_AVERAGE: 'Vote average', + LIST_ERROR: 'Movie collections list error', + INSERT_INTO: 'Insert Movie Into Collection for - {{cid}}', + TORRENT_INTO: 'Torrent info', + SELECT_INFO: 'Select a collection to insert', + INSERT_SUCCESSFULLY: 'Insert move into collection successfully', + INSERT_FAILED: 'Insert move into collection FAILED', + ALREADY_IN: '(Already In)', + NO_COLLECTION: 'No collection founded can insert movie, you can create first, then insert this movie into it.' }, //user settings diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 54205e23..66091194 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -511,7 +511,16 @@ COLL_LIST: '电影系列清单', CREATE_SUCCESSFULLY: '电影系列创建成功', CREATE_FAILED: '电影系列创建失败', - LIST_ERROR: '电影系列清单列出失败' + FILES_NUMBERS: '种子数', + VOTE_AVERAGE: '平均得分', + LIST_ERROR: '电影系列清单列出失败', + INSERT_INTO: '添加电影到系列 - {{cid}}', + TORRENT_INTO: '种子信息', + SELECT_INFO: '选择要加入的电影系列', + INSERT_SUCCESSFULLY: '添加电影到系列成功', + INSERT_FAILED: '添加电影到系列失败', + ALREADY_IN: '(已加入)', + NO_COLLECTION: '没有可加入的系列, 如果还没有创建,你可以先创建一个系列, 再执行加入操作.' }, //user settings diff --git a/modules/torrents/client/controllers/torrent-info.client.controller.js b/modules/torrents/client/controllers/torrent-info.client.controller.js index d50bf6ee..f56fe2bb 100644 --- a/modules/torrents/client/controllers/torrent-info.client.controller.js +++ b/modules/torrents/client/controllers/torrent-info.client.controller.js @@ -227,7 +227,7 @@ status: 'loading' }; - SideOverlay.open(evt, 'collectionsSlide'); + SideOverlay.open(evt, 'collectionsCreateSlide'); CollectionsService.getCollectionInfo({ id: vm.collection.tmdb_id, @@ -250,14 +250,14 @@ * hideCollectionPopup */ vm.hideCollectionPopup = function () { - SideOverlay.close(null, 'collectionsSlide'); + SideOverlay.close(null, 'collectionsCreateSlide'); }; /** * saveCollection */ vm.saveCollection = function () { - SideOverlay.close(null, 'collectionsSlide'); + SideOverlay.close(null, 'collectionsCreateSlide'); var coll = new CollectionsService(vm.collection); coll.$save(function (res) { @@ -268,6 +268,87 @@ }; + /** + * insertIntoCollection + * @param evt + */ + vm.insertIntoCollection = function (evt) { + vm.collectionsItems = undefined; + + vm.collectionTorrent = { + tmdb_id: vm.torrentLocalInfo.resource_detail_info.belongs_to_collection.id || 0, + id: vm.torrentLocalInfo._id, + cid: undefined, + title: vm.TGI.getTorrentTitle(vm.torrentLocalInfo), + file: vm.torrentLocalInfo.torrent_filename, + + status_msg: 'loading movie collection list ...', + status: 'loading' + }; + + SideOverlay.open(evt, 'collectionsInsertSlide'); + + CollectionsService.get({ + tmdb_id: vm.collectionTorrent.tmdb_id + }, function (res) { + vm.collectionsItems = res.rows; + vm.collectionTorrent.status = 'ok'; + + mtDebug.info(res); + }, function (err) { + vm.collectionTorrent.status = 'error'; + vm.collectionTorrent.status_msg = 'Error: get collection items error'; + }); + }; + + /** + * hideCollectionInsertPopup + */ + vm.hideCollectionInsertPopup = function () { + SideOverlay.close(null, 'collectionsInsertSlide'); + }; + + /** + * saveInsertCollection + */ + vm.saveInsertCollection = function () { + SideOverlay.close(null, 'collectionsInsertSlide'); + + var sc = undefined; + angular.forEach(vm.collectionsItems, function (c) { + if (c._id === vm.collectionTorrent.cid) { + sc = c; + } + }); + + CollectionsService.insertIntoCollection({ + collectionId: vm.collectionTorrent.cid, + torrentId: vm.collectionTorrent.id + }, function (res) { + mtDebug.info(res); + NotifycationService.showSuccessNotify('COLLECTIONS.INSERT_SUCCESSFULLY'); + }, function (res) { + NotifycationService.showErrorNotify(res.data.message, 'COLLECTIONS.CREATE_FAILED'); + }); + + }; + + /** + * isAlreadyIn + * @param c + * @returns {boolean} + */ + vm.isAlreadyIn = function (c) { + var result = false; + angular.forEach(c.torrents, function (t) { + if (vm.torrentLocalInfo._id === t._id) { + result = true; + } + }); + + return result; + }; + /** * onRadioTagClicked * @param event diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index 0fa5c244..7bf188bb 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -428,38 +428,41 @@
- -
-

+
+
+ + -
- +
+ - + - + -
{{vm.collection.status_msg}} +
{{vm.collection.status_msg}} +
@@ -472,6 +475,53 @@
+ +
+
+ + + +
+
{{'COLLECTIONS.TORRENT_INTO' | translate}}:
+ + + + +
+
{{'COLLECTIONS.NO_COLLECTION' | translate}}
+
+
+
{{'COLLECTIONS.SELECT_INFO' | translate}}:
+
+ +
+
+ +
{{vm.collectionTorrent.status_msg}} +
+
+
+ +
+ + +
+
+ @@ -937,7 +987,7 @@ ng-click="vm.createCollection($event);">{{ 'ADMIN_COLLECTION_CREATE' | translate}}
diff --git a/modules/users/client/views/admin/view-user.client.view.html b/modules/users/client/views/admin/view-user.client.view.html index 47212261..b86c067f 100644 --- a/modules/users/client/views/admin/view-user.client.view.html +++ b/modules/users/client/views/admin/view-user.client.view.html @@ -249,23 +249,27 @@