Skip to content

Commit

Permalink
reload top movie info of home page
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Apr 3, 2017
1 parent 0079236 commit 9e01d2e
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 13 deletions.
3 changes: 2 additions & 1 deletion config/env/torrents.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ module.exports = {
//announce config
announce: {
url: 'http://127.0.0.1:3000/announce',
announce_prefix: '[CHD.im].',
admin: '[email protected]',
open_tracker: false
open_tracker: true
},
tmdbConfig: {
//please change it to your api key from themoviedb.org
Expand Down
3 changes: 3 additions & 0 deletions modules/core/client/app/trans-string-cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
'如需其它帮助,请与我们的管理员联系:<strong><a href="mailto:#">{{admin}}</a></strong>.'
],

//HomeController & home views
TOP_MOVIE_INFO_ERROR: '获取电影Top列表失败',

//TorrentsUploadsController
TORRENTS_UPLOAD_SUCCESSFULLY: '文件上传成功',
TORRENTS_UPLOAD_FAILED: '文件上传失败',
Expand Down
3 changes: 3 additions & 0 deletions modules/core/client/app/trans-string-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
'For additional assistance, please contact our administrator: <strong><a href="mailto:#">{{admin}}</a></strong>.'
],

//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',
Expand Down
18 changes: 18 additions & 0 deletions modules/core/client/controllers/home.client.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
};
}
}());
32 changes: 29 additions & 3 deletions modules/core/client/less/mt.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -57,4 +57,30 @@
.img-thumbnail {
padding: 1px !important;
}
}
}

.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;
}
}

41 changes: 35 additions & 6 deletions modules/core/client/views/home.client.view.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<section ng-controller="HomeController as vm" ng-init="vm.initInfo();">
<section ng-controller="HomeController as vm" ng-init="vm.initInfo();vm.getTopInfo();">
<div class="backdrop">
<div class="filter">
<div class="container">
<div ng-show="!vm.info_is_ready" class="text-center loading">
<h3 translate="LOADING_TOP" class="text-capitalize"></h3>
</div>
<div class="topone fadein" ng-show="vm.info_is_ready">
<div class="topone" ng-show="vm.info_is_ready">
<div class="col-md-4">
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{vm.movieinfo.poster_path}}" class="img-thumbnail center-block"
onload="this.style.opacity='1';">
onload="this.style.opacity='1';">

<div class="down-torrent">
<button class="btn btn-success btn-block" translate="DOWNLOAD_TORRENT"></button>
</div>
Expand Down Expand Up @@ -53,11 +54,11 @@ <h3 translate="LOADING_TOP" class="text-capitalize"></h3>

<!--<dt class="h-line">{{ 'TMDB_FIELDS.IMDB_LINK' | translate}}:</dt>-->
<!--<dd class="h-line"><a href="https://www.themoviedb.org/movie/{{vm.movieinfo.imdb_id}}"-->
<!--target="_blank">https://www.themoviedb.org/movie/{{vm.movieinfo.imdb_id}}</a></dd>-->
<!--target="_blank">https://www.themoviedb.org/movie/{{vm.movieinfo.imdb_id}}</a></dd>-->

<!--<dt class="h-line">{{ 'TMDB_FIELDS.TMDB_LINK' | translate}}:</dt>-->
<!--<dd class="h-line"><a href="https://www.themoviedb.org/movie/{{vm.movieinfo.id}}"-->
<!--target="_blank">https://www.themoviedb.org/movie/{{vm.movieinfo.id}}</a></dd>-->
<!--target="_blank">https://www.themoviedb.org/movie/{{vm.movieinfo.id}}</a></dd>-->

<dt class="h-line">{{ 'TMDB_FIELDS.OVERVIEW' | translate}}:</dt>
<dd class="h-line">{{vm.movieinfo.overview}}</dd>
Expand Down Expand Up @@ -120,7 +121,35 @@ <h3 translate="LOADING_TOP" class="text-capitalize"></h3>
</div>
</div>

<div class="container" style="background-color: #efefef;">
<div class="container">
<div class="row">
<legend class="xsmall-legend strong-legend text-uppercase" translate="MENU_TORRENTS_SUB.SUB_MOVIE"></legend>
<div class="col-xs-4 col-sm-2">

</div>
<div class="col-xs-8 col-sm-10">
<div class="row">
<div ng-repeat="item in vm.movieTopList">
<div data-ng-if="$index != 0 && $index % 2 == 0" class="clearfix visible-sm-block"></div>
<div data-ng-if="$index != 0 && $index % 4 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<div class="col-sm-6 col-md-3">
<div class="thumbnail post-info-img">
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{item.torrent_img}}" alt="{{item.torrent_title}}"
class="img-responsive">

<div class="caption">
<ul class="list-unstyled">
</li>
<li style="white-space: nowrap; overflow:hidden; text-overflow: ellipsis;">
<strong>{{item.torrent_title}}</strong>
<li><span class="glyphicon glyphicon-star star-votes"></span><span>{{item.torrent_imdb_votes}}</span><span class="pull-right release-date">{{item.torrent_release}}</span></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
4 changes: 3 additions & 1 deletion modules/torrents/client/services/torrents.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand Down
5 changes: 3 additions & 2 deletions modules/torrents/server/models/torrent.server.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9e01d2e

Please sign in to comment.