home view data load

This commit is contained in:
OldHawk
2017-05-16 16:42:06 +08:00
parent f091c36b69
commit 6c6bbb4861
7 changed files with 293 additions and 79 deletions

View File

@@ -94,6 +94,7 @@ module.exports = {
//please change it to your api key from themoviedb.org
key: '7888f0042a366f63289ff571b68b7ce0',
backdrop_img_base_url: 'http://image.tmdb.org/t/p/w1280',
backdrop_img_base_url_300: 'http://image.tmdb.org/t/p/w300',
poster_img_base_url: 'http://image.tmdb.org/t/p/w500',
poster_list_base_url: 'http://image.tmdb.org/t/p/w92',
cast_img_base_url: 'http://image.tmdb.org/t/p/w132_and_h132_bestv2'

View File

@@ -10,7 +10,9 @@
function HomeController($scope, $state, $translate, Authentication, TorrentsService, Notification, MeanTorrentConfig, getStorageLangService) {
var vm = this;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.movieTopList = undefined;
vm.movieNewList = undefined;
vm.info_is_ready = false;
@@ -57,7 +59,9 @@
*/
vm.getMovieTopInfo = function () {
vm.moviesInfo = TorrentsService.get({
limit: 16
torrent_status: 'reviewed',
torrent_type: 'movie',
limit: 8
}, function (items) {
vm.movieTopList = items.rows;
}, function (err) {
@@ -65,6 +69,20 @@
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
vm.moviesInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'movie',
newest: true,
limit: 10
}, function (items) {
vm.movieNewList = items.rows;
console.log(vm.movieNewList);
}, function (err) {
Notification.error({
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
};
/**

View File

@@ -88,26 +88,27 @@ body {
&:hover {
background-color: #efefef;
background-color: rgba(224, 224, 224, .3);
.torrent-user-info {
opacity: 1;
color: #fff;
}
.torrent-tmdb-info {
opacity: 1;
color: #fff;
}
> img {
opacity: 1;
}
}
> img {
opacity: 0.8;
&:hover {
opacity: 1;
+ .torrent-user-info {
opacity: 1;
color: #fff;
}
}
}
.caption {
padding: 5px 3px;
padding: 5px 3px 2px;
ul {
margin-bottom: 0;
}
}
.release-date {
color: #000;
}
}
.torrent-votes {
@@ -125,26 +126,56 @@ body {
}
}
.torrent-user-info {
.col-small-padding {
padding: 0 5px;
}
.col-no-padding {
padding: 0;
}
.torrent-tmdb-info {
display: table-cell;
position: absolute;
top: 4px;
left: 20px;
right: 20px;
padding: 8px 0;
bottom: 52px;
left: 10px;
right: 10px;
padding: 6px 5px;
background-color: @mt-body-background-color;
background-color: rgba(0, 0, 0, .7);
color: #ddd;
opacity: 0.8;
&:hover {
opacity: 1;
color: #fff;
}
> ul {
margin-left: 0;
margin-bottom: 0;
}
.release-date {
color: #ccc;
}
}
.torrent-user-info {
font-size: 12px;
display: table-cell;
position: absolute;
top: 5px;
left: 10px;
right: 10px;
padding: 6px 5px;
background-color: @mt-body-background-color;
background-color: rgba(0, 0, 0, .7);
color: #ddd;
opacity: 0.8;
table {
width: 100%;
tr {
td {
width: auto;
}
}
}
.torrent-up {
color: #33CC00;
}
@@ -152,18 +183,7 @@ body {
color: #FF3300;
}
.torrent-finished {
color: #33FFFF;
}
&.small-info {
@media (min-width: @screen-md-min) {
padding: 5px 0;
font-size: 12px;
.list-inline > li {
padding-left: 1px;
padding-right: 1px;
}
}
color: #0366d6;
}
}
@@ -179,6 +199,98 @@ body {
}
}
.panel-newest-list {
@media (max-width: @screen-md-min) {
display: none;
}
.h5,
h5 {
margin-top: 0;
margin-bottom: 0;
}
table {
width: 100%;
tr {
&.show-big {
.newest-item-big {
display: block;
}
.newest-item-small {
display: none;
}
}
&.hide-big {
.newest-item-big {
display: none;
}
.newest-item-small {
display: block;
}
}
td {
cursor: pointer;
max-width: 0;
&:hover {
.newest-info {
color: #fff;
opacity: 1;
}
.newest-user-info {
color: #fff;
opacity: 1;
}
}
}
}
}
.newest-item-small {
padding: 0 5px;
}
.newest-item-big {
position: relative;
img {
width: 100%;
}
.newest-info {
position: absolute;
bottom: 32px;
left: 0;
right: 0;
margin-bottom: -32px;
padding: 6px 5px;
background-color: @mt-body-background-color;
background-color: rgba(0, 0, 0, .7);
color: #ddd;
opacity: 0.8;
}
.newest-user-info {
font-size: 12px;
position: absolute;
top: 0;
left: 0;
right: 0;
margin-bottom: -32px;
padding: 6px 5px;
background-color: @mt-body-background-color;
background-color: rgba(0, 0, 0, .7);
color: #ddd;
opacity: 0.8;
.torrent-up {
color: #33CC00;
}
.torrent-down {
color: #FF3300;
}
.torrent-finished {
color: #0366d6;
}
}
}
}
.btn-tag {
width: 100px;
&,

View File

@@ -111,45 +111,102 @@
</div>
<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 class="row" style="padding: 0 10px;">
<div class="col-md-9 col-no-padding">
<div ng-repeat="item in vm.movieTopList">
<div data-ng-if="$index != 0 && $index % 2 == 0" class="clearfix visible-xs-block"></div>
<div data-ng-if="$index != 0 && $index % 3 == 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-xs-6 col-sm-4 col-md-3 col-small-padding">
<div class="thumbnail torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{item.torrent_img}}" alt="{{item.torrent_title}}"
class="img-responsive">
</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 torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{item.torrent_img}}" alt="{{item.torrent_title}}"
class="img-responsive">
<div class="torrent-user-info">
<table>
<tr>
<td class="text-left">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
<span>{{item.torrent_seeds}}</span>
</td>
<td class="text-center">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
<span>{{item.torrent_leechers}}</span>
</td>
<td class="text-right">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
<span>{{item.torrent_finished}}</span>
</td>
</tr>
</table>
</div>
<div class="torrent-user-info">
<ul class="list-unstyled list-inline">
<li title="{{ 'TITLE_ALT.SEEDS' | translate}}"><span
class="glyphicon glyphicon-arrow-up torrent-up"></span><span>{{item.torrent_seeds}}</span></li>
<li title="{{ 'TITLE_ALT.LEECHERS' | translate}}"><span
class="glyphicon glyphicon-arrow-down torrent-down"></span><span>{{item.torrent_leechers}}</span></li>
<li title="{{ 'TITLE_ALT.FINISHED' | translate}}" class="pull-right"><span
class="glyphicon glyphicon-ok torrent-finished"></span><span>{{item.torrent_finished}}</span></li>
</ul>
</div>
<div class="torrent-tmdb-info">
<ul class="list-unstyled">
<li>
<span class="release-date">{{item.torrent_release}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span>
</li>
</ul>
</div>
<div class="caption">
<ul class="list-unstyled">
<li style="white-space: nowrap; overflow:hidden; text-overflow: ellipsis;">
<strong>{{item.torrent_title}}</strong>
<li><span class="release-date">{{item.torrent_release}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span></li>
</ul>
</div>
<div class="caption">
<ul class="list-unstyled">
<li class="text-long">
<strong>{{item.torrent_title}}</strong>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-small-padding" style="padding-left: 15px;">
<div class="panel panel-default panel-newest-list">
<div class="panel-heading"><h5>Newest Movie Torrents</h5></div>
<table class="table">
<tr ng-repeat="nt in vm.movieNewList" mouse-enter-toggle-class="show-big" base-class="hide-big" ng-class="$index > 0 ? 'hide-big' : 'show-big'">
<td>
<div class="newest-item-big">
<img ng-src="{{vm.tmdbConfig.backdrop_img_base_url_300}}{{nt.torrent_backdrop_img}}"
on-error-src="/./modules/torrents/client/img/default_backdrop_300.jpg">
<div class="newest-user-info">
<table>
<tr>
<td class="text-left">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
<span>{{nt.torrent_seeds}}</span>
</td>
<td class="text-center">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
<span>{{nt.torrent_leechers}}</span>
</td>
<td class="text-right">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
<span>{{nt.torrent_finished}}</span>
</td>
</tr>
</table>
</div>
<div class="newest-info">
<div class="text-long">
{{$index + 1}}. {{nt.torrent_title}}
</div>
</div>
</div>
<div class="newest-item-small text-long">
{{$index + 1}}. {{nt.torrent_title}}
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@@ -1,21 +1,40 @@
<section class="container padding-top-10" ng-controller="TorrentsController as vm" ng-init="vm.getMovieTopInfo();vm.torrentBuildPager();">
<div class="row">
<div class="row" style="padding: 0 10px;">
<div ng-repeat="item in vm.movieTopInfo">
<div data-ng-if="$index != 0 && $index % 2 == 0" class="clearfix visible-xs-block"></div>
<div data-ng-if="$index != 0 && $index % 3 == 0" class="clearfix visible-sm-block"></div>
<div data-ng-if="$index != 0 && $index % 6 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<div class="col-sm-4 col-md-2">
<div class="col-xs-6 col-sm-4 col-md-2 col-small-padding">
<div class="thumbnail torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{item.torrent_img}}" alt="{{item.torrent_title}}"
class="img-responsive">
<div class="torrent-user-info small-info">
<ul class="list-unstyled list-inline">
<li title="{{ 'TITLE_ALT.SEEDS' | translate}}"><span
class="glyphicon glyphicon-arrow-up torrent-up"></span><span>{{item.torrent_seeds}}</span></li>
<li title="{{ 'TITLE_ALT.LEECHERS' | translate}}"><span
class="glyphicon glyphicon-arrow-down torrent-down"></span><span>{{item.torrent_leechers}}</span></li>
<li title="{{ 'TITLE_ALT.FINISHED' | translate}}" class="pull-right"><span
class="glyphicon glyphicon-ok torrent-finished"></span><span>{{item.torrent_finished}}</span></li>
<div class="torrent-user-info">
<table>
<tr>
<td class="text-left">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
<span>{{item.torrent_seeds}}</span>
</td>
<td class="text-center">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
<span>{{item.torrent_leechers}}</span>
</td>
<td class="text-right">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
<span>{{item.torrent_finished}}</span>
</td>
</tr>
</table>
</div>
<div class="torrent-tmdb-info">
<ul class="list-unstyled">
<li>
<span class="release-date">{{item.torrent_release}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span>
</li>
</ul>
</div>
@@ -23,9 +42,6 @@
<ul class="list-unstyled">
<li class="text-long">
<strong>{{item.torrent_title}}</strong>
<li><span class="release-date">{{item.torrent_release}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span>
</li>
</ul>
</div>

View File

@@ -406,10 +406,13 @@ exports.list = function (req, res) {
var status = 'reviewed';
var rlevel = 'none';
var stype = 'movie';
var newest = false;
var release = undefined;
var tagsA = [];
var keysA = [];
var sort = 'torrent_recommended -createdat';
if (req.query.skip !== undefined) {
skip = parseInt(req.query.skip, 10);
}
@@ -428,6 +431,10 @@ exports.list = function (req, res) {
if (req.query.torrent_release !== undefined) {
release = req.query.torrent_release;
}
if (req.query.newest !== undefined) {
newest = (req.query.newest === 'true');
}
if (req.query.torrent_tags !== undefined) {
var tagsS = req.query.torrent_tags + '';
var tagsT = tagsS.split(',');
@@ -479,6 +486,9 @@ exports.list = function (req, res) {
console.log(JSON.stringify(condition));
if (newest) {
sort = '-createdat';
}
var countQuery = function (callback) {
Torrent.count(condition, function (err, count) {
@@ -492,7 +502,7 @@ exports.list = function (req, res) {
var findQuery = function (callback) {
Torrent.find(condition)
.sort('torrent_recommended -createdat')
.sort(sort)
.populate('user', 'displayName')
.skip(skip)
.limit(limit)