From 9e01d2e79807f356a6a7ef06a153dd775a53db61 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Tue, 4 Apr 2017 01:02:21 +0800 Subject: [PATCH] reload top movie info of home page --- config/env/torrents.js | 3 +- modules/core/client/app/trans-string-cn.js | 3 ++ modules/core/client/app/trans-string-en.js | 3 ++ .../controllers/home.client.controller.js | 18 ++++++++ modules/core/client/less/mt.less | 32 +++++++++++++-- .../core/client/views/home.client.view.html | 41 ++++++++++++++++--- .../services/torrents.client.service.js | 4 +- .../server/models/torrent.server.model.js | 5 ++- 8 files changed, 96 insertions(+), 13 deletions(-) diff --git a/config/env/torrents.js b/config/env/torrents.js index c2aa14be..5720dad0 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -4,8 +4,9 @@ module.exports = { //announce config announce: { url: 'http://127.0.0.1:3000/announce', + announce_prefix: '[CHD.im].', admin: 'admin@imean.io', - open_tracker: false + open_tracker: true }, tmdbConfig: { //please change it to your api key from themoviedb.org diff --git a/modules/core/client/app/trans-string-cn.js b/modules/core/client/app/trans-string-cn.js index cfb80d43..eeef1152 100644 --- a/modules/core/client/app/trans-string-cn.js +++ b/modules/core/client/app/trans-string-cn.js @@ -54,6 +54,9 @@ '如需其它帮助,请与我们的管理员联系:{{admin}}.' ], + //HomeController & home views + TOP_MOVIE_INFO_ERROR: '获取电影Top列表失败', + //TorrentsUploadsController TORRENTS_UPLOAD_SUCCESSFULLY: '文件上传成功', TORRENTS_UPLOAD_FAILED: '文件上传失败', diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index e8e796cb..0f84db4e 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -54,6 +54,9 @@ 'For additional assistance, please contact our administrator: {{admin}}.' ], + //HomeController & home views + TOP_MOVIE_INFO_ERROR: 'Get movie top info faild', + //TorrentsUploadsController & views TORRENTS_UPLOAD_SUCCESSFULLY: 'Successfully uploads file', TORRENTS_UPLOAD_FAILED: 'Failed to uploads file', diff --git a/modules/core/client/controllers/home.client.controller.js b/modules/core/client/controllers/home.client.controller.js index 3b77c844..7b5540ff 100644 --- a/modules/core/client/controllers/home.client.controller.js +++ b/modules/core/client/controllers/home.client.controller.js @@ -10,6 +10,7 @@ function HomeController($scope, $translate, TorrentsService, Notification, TMDBConfig) { var vm = this; vm.tmdbConfig = TMDBConfig.tmdbConfig; + vm.movieTopList = undefined; vm.info_is_ready = false; //$translate.use('en'); @@ -34,5 +35,22 @@ }); }); }; + + vm.getTopInfo = function () { + vm.getMovieTopInfo(); + }; + + vm.getMovieTopInfo = function () { + vm.moviesInfo = TorrentsService.query({ + skip: 0, + limit: 8 + }, function (items) { + vm.movieTopList = items; + }, function (err) { + Notification.error({ + message: ' ' + $translate.instant('TOP_MOVIE_INFO_ERROR') + }); + }); + }; } }()); diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index 1728b63a..6ef6d5a7 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -24,8 +24,8 @@ .topone { color: #ccc; img { - opacity:0; - transition-property: transform,opacity; + opacity: 0; + transition-property: transform, opacity; transition-duration: 1s; transition-timing-function: ease; @@ -57,4 +57,30 @@ .img-thumbnail { padding: 1px !important; } -} \ No newline at end of file +} + +.post-info-img { + > img { + opacity: 0.8; + &:hover { + cursor: pointer; + opacity: 1; + } + } + .caption { + padding: 5px 3px; + ul { + margin-bottom: 0; + } + } + .star-votes { + color: #FF6600; + + span { + color: #FF6600; + } + } + .release-date { + color: #FF6600; + } +} + diff --git a/modules/core/client/views/home.client.view.html b/modules/core/client/views/home.client.view.html index 431a2a41..b9bf0aa4 100644 --- a/modules/core/client/views/home.client.view.html +++ b/modules/core/client/views/home.client.view.html @@ -1,14 +1,15 @@ -
+

-
+
+ onload="this.style.opacity='1';"> +
@@ -53,11 +54,11 @@

- + - +
{{ 'TMDB_FIELDS.OVERVIEW' | translate}}:
{{vm.movieinfo.overview}}
@@ -120,7 +121,35 @@

-
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
diff --git a/modules/torrents/client/services/torrents.client.service.js b/modules/torrents/client/services/torrents.client.service.js index e6f534c2..dcc89960 100644 --- a/modules/torrents/client/services/torrents.client.service.js +++ b/modules/torrents/client/services/torrents.client.service.js @@ -9,7 +9,9 @@ TorrentsService.$inject = ['$resource']; function TorrentsService($resource) { - var Torrents = $resource('/api/torrents/:torrentId', {}, { + var Torrents = $resource('/api/torrents/:torrentId', { + torrentId: '@_torrentId' + }, { update: { method: 'POST' }, diff --git a/modules/torrents/server/models/torrent.server.model.js b/modules/torrents/server/models/torrent.server.model.js index 22a8bd58..fd36aa96 100644 --- a/modules/torrents/server/models/torrent.server.model.js +++ b/modules/torrents/server/models/torrent.server.model.js @@ -84,8 +84,9 @@ var TorrentSchema = new Schema({ trim: true }, torrent_release: { - type: Date, - default: null + type: String, + default: '2017', + trim: true }, last_scrape: { type: Date,