feat(torrents): hide vip torrents in normal list page

This commit is contained in:
OldHawk
2017-09-21 13:18:29 +08:00
parent a64adb20e5
commit 7eea910b10
7 changed files with 76 additions and 3 deletions

View File

@@ -207,6 +207,7 @@
CA_KEYWORD: 'Keyword',
CA_TORRENT_STATUS: 'Torrent status',
CA_TORRENT_HNR: 'Hit and Run',
CA_TORRENT_VIP: 'VIP resources',
CA_RESOURCE_TYPE: 'Resource type',
PH_KEYWORD: 'Search keyword',
CLEAR_ALL_CONDITION: 'Clear All Condition',

View File

@@ -207,6 +207,7 @@
CA_KEYWORD: '关键字',
CA_TORRENT_STATUS: '种子状态',
CA_TORRENT_HNR: 'Hit and Run',
CA_TORRENT_VIP: 'VIP 资源',
CA_RESOURCE_TYPE: '资源类型',
PH_KEYWORD: '搜索关键字',
CLEAR_ALL_CONDITION: '清空所有条件',

View File

@@ -614,7 +614,7 @@ body {
min-width: 90px;
}
.td-admin-cmd {
min-width: 140px;
min-width: 143px;
}
}
@@ -741,6 +741,22 @@ body {
}
}
.label-vip-info {
color: @mt-base-color;
font-weight: bold;
background-color: #f1f8ff;
&:hover {
cursor: pointer;
color: #f00;
}
&:active {
color: #0366d6;
}
&.used {
background-color: #c9e4ff !important;
}
}
.label-se-info {
color: @mt-base-color;
background-color: #f1f8ff;
@@ -800,6 +816,14 @@ body {
}
}
.checkbox-vip {
margin-top: 0;
margin-bottom: 0;
input[type="checkbox"] {
margin-top: 8px;
}
}
.incline-block-valign {
display: inline-block;
vertical-align: middle;

View File

@@ -25,6 +25,7 @@
vm.searchKey = '';
vm.releaseYear = undefined;
vm.filterHnR = false;
vm.filterVIP = false;
vm.torrentStatus = 'reviewed';
vm.torrentRLevel = 'none';
@@ -187,7 +188,8 @@
torrent_type: vm.selectedType,
torrent_release: vm.releaseYear,
torrent_tags: vm.searchTags,
torrent_hnr: vm.filterHnR
torrent_hnr: vm.filterHnR,
torrent_vip: vm.filterVIP
}, function (items) {
if (items.length === 0) {
Notification.error({
@@ -279,6 +281,17 @@
vm.torrentBuildPager();
};
/**
* onVIPClicked, onVIPChanged
*/
vm.onVIPClicked = function () {
vm.filterVIP = !vm.filterVIP;
vm.torrentBuildPager();
};
vm.onVIPChanged = function () {
vm.torrentBuildPager();
};
/**
* onRLevelClicked
* @param y

View File

@@ -148,6 +148,19 @@
});
};
/**
* toggleVIP
*/
vm.toggleVIP = function () {
vm.torrentLocalInfo.$toggleVIPStatus(function (res) {
mtDebug.info(res);
vm.torrentLocalInfo = res;
NotifycationService.showSuccessNotify('TORRENT_TOGGLE_VIP_SUCCESSFULLY');
}, function (res) {
NotifycationService.showErrorNotify(res.data.message, 'TORRENT_TOGGLE_VIP_FAILED');
});
};
/**
* doScrape
*/

View File

@@ -51,6 +51,15 @@
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_HNR' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-vip">
<label>
<input type="checkbox" ng-model="vm.filterVIP" ng-change="vm.onVIPChanged();"> {{ 'CA_TORRENT_VIP' | translate}}
</label>
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_STATUS' | translate}}:</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
@@ -201,6 +210,9 @@
<span class="label label-hnr-info" ng-if="item.torrent_hnr"
ng-click="vm.onHnRClicked(); $event.stopPropagation();">H&R</span>
<span class="label label-vip-info" ng-if="item.torrent_vip" ng-class="{'used': vm.filterVIP}"
ng-click="vm.onVIPClicked(); $event.stopPropagation();">VIP</span>
<span ng-repeat="t in item.torrent_tags">
<span class="label label-tag" ng-class="{'used': vm.searchTags.indexOf(t) !== -1}"
ng-click="vm.onTagClicked(t); $event.stopPropagation();">

View File

@@ -824,6 +824,7 @@ exports.list = function (req, res) {
var stype = 'movie';
var newest = false;
var hnr = false;
var vip = undefined;
var release = undefined;
var userid = undefined;
var tagsA = [];
@@ -852,6 +853,9 @@ exports.list = function (req, res) {
if (req.query.torrent_hnr !== undefined) {
hnr = req.query.torrent_hnr;
}
if (req.query.torrent_vip !== undefined) {
vip = req.query.torrent_vip;
}
if (req.query.newest !== undefined) {
newest = (req.query.newest === 'true');
}
@@ -896,6 +900,11 @@ exports.list = function (req, res) {
if (hnr === 'true') {
condition.torrent_hnr = hnr;
}
if (vip === 'true') {
condition.torrent_vip = true;
} else if (vip === undefined) {
condition.torrent_vip = false;
}
if (tagsA.length > 0) {
condition.torrent_tags = {$all: tagsA};
@@ -1114,7 +1123,7 @@ exports.torrentByID = function (req, res, next, id) {
mtDebug.debugGreen(condition);
var fields = 'user torrent_filename torrent_tags torrent_seeds torrent_leechers torrent_finished torrent_seasons torrent_episodes torrent_size torrent_sale_status torrent_type torrent_hnr torrent_sale_expires createdat';
var fields = 'user torrent_filename torrent_tags torrent_seeds torrent_leechers torrent_finished torrent_seasons torrent_episodes torrent_size torrent_sale_status torrent_type torrent_hnr torrent_vip torrent_sale_expires createdat';
Torrent.find(condition, fields)
.sort('-createdat')