mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-07 07:33:03 +02:00
add Torrents movie list view,controller
This commit is contained in:
@@ -63,6 +63,9 @@
|
||||
TITLE_FINISHED: '完成下载数',
|
||||
TITLE_IMDB_VOTES: 'IMDB 评分',
|
||||
|
||||
//TorrentsController & views
|
||||
MOVIE_PAGE_INFO_ERROR: '获取电影分页列表失败',
|
||||
|
||||
//TorrentsUploadsController
|
||||
TORRENTS_UPLOAD_SUCCESSFULLY: '文件上传成功',
|
||||
TORRENTS_UPLOAD_FAILED: '文件上传失败',
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
TITLE_FINISHED: 'Finished users',
|
||||
TITLE_IMDB_VOTES: 'IMDB Votes',
|
||||
|
||||
//TorrentsController & views
|
||||
MOVIE_PAGE_INFO_ERROR: 'Get movie page info faild',
|
||||
|
||||
//TorrentsUploadsController & views
|
||||
TORRENTS_UPLOAD_SUCCESSFULLY: 'Successfully uploads file',
|
||||
TORRENTS_UPLOAD_FAILED: 'Failed to uploads file',
|
||||
|
||||
80
modules/core/client/less/margin.less
Normal file
80
modules/core/client/less/margin.less
Normal file
@@ -0,0 +1,80 @@
|
||||
.margin-top-10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.margin-top-20 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.margin-top-30 {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.margin-top-40 {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.margin-top-50 {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.margin-bottom-10 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.margin-bottom-20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.margin-bottom-30 {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.margin-bottom-40 {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.margin-bottom-50 {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.padding-top-10 {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.padding-top-20 {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.padding-top-30 {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.padding-top-40 {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
.padding-top-50 {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.padding-bottom-10 {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.padding-bottom-20 {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.padding-bottom-30 {
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
.padding-bottom-40 {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.padding-bottom-50 {
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@import (reference) "../../../../public/lib/bootstrap/less/variables.less";
|
||||
|
||||
.bodysize {
|
||||
background-color: #fff;
|
||||
min-height: 600px;
|
||||
@@ -59,9 +61,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.post-info-img {
|
||||
.torrent-post-info {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: #efefef;
|
||||
background-color: rgba(224, 224, 224, .3);
|
||||
}
|
||||
> img {
|
||||
@@ -121,4 +124,15 @@
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,9 @@
|
||||
<!--<dd class="h-line">${{vm.movieinfo.revenue}}</dd>-->
|
||||
|
||||
<dt class="h-line">{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}:</dt>
|
||||
<dd class="h-line"><span class="torrent-votes"><kbd>IMDB</kbd></span> {{vm.movieinfo.vote_average}} / {{vm.movieinfo.vote_count}} {{ 'TMDB_FIELDS.VOTE_UNIT' | translate}}</dd>
|
||||
<dd class="h-line"><span
|
||||
class="torrent-votes"><kbd>IMDB</kbd></span> {{vm.movieinfo.vote_average}} / {{vm.movieinfo.vote_count}} {{ 'TMDB_FIELDS.VOTE_UNIT' | translate}}
|
||||
</dd>
|
||||
|
||||
<!--<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}}"-->
|
||||
@@ -133,16 +135,18 @@
|
||||
<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">
|
||||
<div class="thumbnail torrent-post-info">
|
||||
<img ng-src="{{vm.tmdbConfig.poster_img_base_url}}{{item.torrent_img}}" alt="{{item.torrent_title}}"
|
||||
class="img-responsive">
|
||||
|
||||
<div class="torrent-user-info">
|
||||
<ul class="list-unstyled list-inline">
|
||||
<li title="{{ 'TITLE_SEEDS' | translate}}"><span class="glyphicon glyphicon-arrow-up torrent-up"></span><span>356</span></li>
|
||||
<li title="{{ 'TITLE_LEECHERS' | translate}}"><span class="glyphicon glyphicon-arrow-down torrent-down"></span><span>24</span></li>
|
||||
<li title="{{ 'TITLE_SEEDS' | translate}}"><span
|
||||
class="glyphicon glyphicon-arrow-up torrent-up"></span><span>{{item.torrent_seeds}}</span></li>
|
||||
<li title="{{ 'TITLE_LEECHERS' | translate}}"><span
|
||||
class="glyphicon glyphicon-arrow-down torrent-down"></span><span>{{item.torrent_leechers}}</span></li>
|
||||
<li title="{{ 'TITLE_FINISHED' | translate}}" class="pull-right"><span
|
||||
class="glyphicon glyphicon-ok torrent-finished"></span><span>1622</span></li>
|
||||
class="glyphicon glyphicon-ok torrent-finished"></span><span>{{item.torrent_finished}}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -150,8 +154,9 @@
|
||||
<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_IMDB_VOTES' | translate}}"
|
||||
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span></li>
|
||||
<li><span class="release-date">{{item.torrent_release}}</span>
|
||||
<span title="{{ 'TITLE_IMDB_VOTES' | translate}}"
|
||||
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
url: '/torrents',
|
||||
template: '<ui-view/>'
|
||||
})
|
||||
.state('torrents.movie', {
|
||||
url: '/torrents/movie',
|
||||
templateUrl: '/modules/torrents/client/views/movie-list.client.view.html'
|
||||
})
|
||||
.state('torrents.uploads', {
|
||||
url: '/torrents/uploads',
|
||||
templateUrl: '/modules/torrents/client/views/uploads-torrents.client.view.html'
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('torrents')
|
||||
.controller('TorrentsController', TorrentsController);
|
||||
|
||||
TorrentsController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'Notification', 'TorrentsService', 'TMDBConfig'];
|
||||
|
||||
function TorrentsController($scope, $state, $translate, Authentication, Notification, TorrentsService, TMDBConfig) {
|
||||
var vm = this;
|
||||
vm.user = Authentication.user;
|
||||
vm.tmdbConfig = TMDBConfig.tmdbConfig;
|
||||
vm.topNumber = 6;
|
||||
vm.pageNumber = 50;
|
||||
|
||||
// If user is not signed in then redirect back home
|
||||
if (!Authentication.user) {
|
||||
$state.go('authentication.signin');
|
||||
}
|
||||
|
||||
vm.getMovieTopInfo = function () {
|
||||
TorrentsService.query({
|
||||
limit: vm.topNumber
|
||||
}, function (items) {
|
||||
vm.movieTopInfo = items;
|
||||
}, function (err) {
|
||||
Notification.error({
|
||||
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
vm.getMoviePageInfo = function (p) {
|
||||
TorrentsService.query({
|
||||
skip: (p - 1) * vm.pageNumber + vm.topNumber,
|
||||
limit: p * vm.pageNumber
|
||||
}, function (items) {
|
||||
vm.moviesPageInfo = items;
|
||||
}, function (err) {
|
||||
Notification.error({
|
||||
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('MOVIE_PAGE_INFO_ERROR')
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
}());
|
||||
34
modules/torrents/client/views/movie-list.client.view.html
Normal file
34
modules/torrents/client/views/movie-list.client.view.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<section class="container padding-top-10" ng-controller="TorrentsController as vm" ng-init="vm.getMovieTopInfo();vm.getMoviePageInfo(1);">
|
||||
<div class="row">
|
||||
<div ng-repeat="item in vm.movieTopInfo">
|
||||
<div class="col-sm-4 col-md-2">
|
||||
<div class="thumbnail torrent-post-info">
|
||||
<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_SEEDS' | translate}}"><span
|
||||
class="glyphicon glyphicon-arrow-up torrent-up"></span><span>666</span></li>
|
||||
<li title="{{ 'TITLE_LEECHERS' | translate}}"><span
|
||||
class="glyphicon glyphicon-arrow-down torrent-down"></span><span>666</span></li>
|
||||
<li title="{{ 'TITLE_FINISHED' | translate}}" class="pull-right"><span
|
||||
class="glyphicon glyphicon-ok torrent-finished"></span><span>6666</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_IMDB_VOTES' | translate}}"
|
||||
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.torrent_imdb_votes}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -263,6 +263,9 @@ exports.list = function (req, res) {
|
||||
if (req.query.limit !== undefined) {
|
||||
limit = req.query.limit;
|
||||
}
|
||||
if (req.query.status !== undefined) {
|
||||
status = req.query.status;
|
||||
}
|
||||
|
||||
Torrent.find({'torrent_status': status}).sort('-createdat').populate('user', 'displayName').skip(skip).limit(limit).exec(function (err, torrents) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user