Skip to content

Commit

Permalink
add movie detail info subtitles/users badge number
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Apr 20, 2017
1 parent 10b28b3 commit fd3f7e1
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 56 deletions.
47 changes: 0 additions & 47 deletions modules/announce/server/controllers/announces.server.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,53 +378,6 @@ exports.announce = function (req, res) {
done(null);
},

/*---------------------------------------------------------------
mongodb write
---------------------------------------------------------------*/

//function (done) {
// if (req.currentPeer !== undefined) {
// req.currentPeer.save(function (err) {
// if (err) {
// console.error('************ SAVE ERROR: 182');
// console.error(err);
// done(182);
// return;
// } else {
// done(null);
// }
// });
// } else {
// done(null);
// }
//},
//
//function (done) {
// req.torrent.save(function (err) {
// if (err) {
// console.error('************ SAVE ERROR: 183');
// console.error(err);
// done(183);
// return;
// } else {
// done(null);
// }
// });
//},
//
//function (done) {
// req.passkeyuser.save(function (err) {
// if (err) {
// console.error('************ SAVE ERROR: 184');
// console.error(err);
// done(184);
// return;
// } else {
// done(null);
// }
// });
//},

/*---------------------------------------------------------------
sendPeers
compact mode
Expand Down
36 changes: 36 additions & 0 deletions modules/core/client/less/badge.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import (reference) "../../../../public/lib/bootstrap/less/variables.less";

@badge-margin: 2px;

.badge_info {
margin: 0 @badge-margin;
background-color: @brand-info;
}
.badge_primary {
margin: 0 @badge-margin;
background-color: @brand-primary;
}
.badge_success {
margin: 0 @badge-margin;
background-color: @brand-success;
}
.badge_warning {
margin: 0 @badge-margin;
background-color: @brand-warning;
}
.badge_danger {
margin: 0 @badge-margin;
background-color: @brand-danger;
}
.badge_seeder {
margin: 0 @badge-margin;
background-color: #33CC00;
}
.badge_leecher {
margin: 0 @badge-margin;
background-color: #FF3300;
}
.badge_finished {
margin: 0 @badge-margin;
background-color: #0366d6;
}
58 changes: 50 additions & 8 deletions modules/torrents/client/controllers/torrents.client.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@
vm.pageNumber = 50;
vm.releaseYear = undefined;

vm.torrentTabs = [
{title: $translate.instant('TAB_VIDEO_INFO'), templateUrl: 'videoInfo.html'},
{title: $translate.instant('TAB_USER_SUBTITLE'), templateUrl: 'subtitleInfo.html'},
{title: $translate.instant('TAB_USER_INFO'), templateUrl: 'userInfo.html'},
{title: $translate.instant('TAB_OTHER_TORRENTS'), templateUrl: 'otherTorrents.html'},
{title: $translate.instant('TAB_MY_PANEL'), templateUrl: 'myPanel.html'},
{title: $translate.instant('TAB_ADMIN_PANEL'), templateUrl: 'adminPanel.html'}
];
vm.torrentTabs = [];

// If user is not signed in then redirect back home
if (!Authentication.user) {
Expand Down Expand Up @@ -252,6 +245,55 @@
$('.backdrop').css('backgroundImage', 'url(' + vm.tmdbConfig.backdrop_img_base_url + res.torrent_backdrop_img + ')');
}
vm.initInfo(res.torrent_tmdb_id);

vm.torrentTabs.push(
{
title: $translate.instant('TAB_VIDEO_INFO'),
templateUrl: 'videoInfo.html',
ng_show: true,
badges: []
},
{
title: $translate.instant('TAB_USER_SUBTITLE'),
templateUrl: 'subtitleInfo.html',
ng_show: true,
badges: [
{
value: vm.torrentLocalInfo._subtitles.length,
class: 'badge_info'
}
]
},
{
title: $translate.instant('TAB_USER_INFO'),
templateUrl: 'userInfo.html',
ng_show: true,
badges: [
{
value: '↑ ' + vm.torrentLocalInfo.torrent_seeds + ' ↓ ' + vm.torrentLocalInfo.torrent_leechers + ' √ ' + vm.torrentLocalInfo.torrent_finished,
class: 'badge_info'
}
]
},
{
title: $translate.instant('TAB_OTHER_TORRENTS'),
templateUrl: 'otherTorrents.html',
ng_show: true,
badges: []
},
{
title: $translate.instant('TAB_MY_PANEL'),
templateUrl: 'myPanel.html',
ng_show: vm.torrentLocalInfo.isCurrentUserOwner,
badges: []
},
{
title: $translate.instant('TAB_ADMIN_PANEL'),
templateUrl: 'adminPanel.html',
ng_show: vm.user.roles.indexOf('admin') >= 0,
badges: []
}
);
});

console.log(vm.torrentLocalInfo);
Expand Down
5 changes: 4 additions & 1 deletion modules/torrents/client/views/view-torrent.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@

<div class="container">
<uib-tabset>
<uib-tab index="$index" ng-repeat="tab in vm.torrentTabs" heading="{{tab.title}}" disabled="tab.disabled">
<uib-tab index="$index" ng-repeat="tab in vm.torrentTabs" disabled="tab.disabled" ng-show="tab.ng_show">
<uib-tab-heading>
{{tab.title}} <span class="badge {{b.class}}" ng-repeat="b in tab.badges">{{b.value}}</span>
</uib-tab-heading>
<div ng-include="tab.templateUrl">
</div>
</uib-tab>
Expand Down

0 comments on commit fd3f7e1

Please sign in to comment.