click the movie tag can join into searchTags list and reload the search result

This commit is contained in:
OldHawk
2017-04-06 17:39:14 +08:00
parent 4b76d37774
commit 006ef5eeb1
6 changed files with 114 additions and 19 deletions

View File

@@ -71,8 +71,8 @@
TABLE_FIELDS: {
INFO: '种子信息',
SIZE: '大小',
SEEDS_LEECHERS_FINISHED: '做种/下/完',
PUBLISHER: 'Publisher',
SEEDS_LEECHERS_FINISHED: '/下/完',
PUBLISHER: '发布者',
LIFETIME: '存活时间',
VOTES: '评分'
},

View File

@@ -137,6 +137,18 @@
}
}
.list-user-info {
.torrent-up {
color: #33CC00;
}
.torrent-down {
color: #FF3300;
}
.torrent-finished {
color: #0366d6;
}
}
.btn-tag {
width: 100px;
&,
@@ -226,4 +238,7 @@
cursor: pointer;
color: #f00;
}
&:active {
color: #0366d6;
}
}

View File

@@ -5,10 +5,10 @@
.module('torrents')
.controller('TorrentsController', TorrentsController);
TorrentsController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'Notification', 'TorrentsService', 'TMDBConfig',
TorrentsController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService', 'TMDBConfig',
'ResourcesTagsConfig'];
function TorrentsController($scope, $state, $translate, Authentication, Notification, TorrentsService, TMDBConfig, ResourcesTagsConfig) {
function TorrentsController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, TMDBConfig, ResourcesTagsConfig) {
var vm = this;
vm.user = Authentication.user;
vm.tmdbConfig = TMDBConfig.tmdbConfig;
@@ -25,6 +25,9 @@
$state.go('authentication.signin');
}
/**
* getMovieTopInfo
*/
vm.getMovieTopInfo = function () {
TorrentsService.query({
limit: vm.topNumber
@@ -37,6 +40,11 @@
});
};
/**
* onRadioTagClicked
* @param event
* @param n: tag name
*/
vm.onRadioTagClicked = function (event, n) {
var e = angular.element(event.currentTarget);
@@ -57,6 +65,11 @@
vm.getMoviePageInfo(1);
};
/**
* onCheckboxTagClicked
* @param event
* @param n: tag name
*/
vm.onCheckboxTagClicked = function (event, n) {
var e = angular.element(event.currentTarget);
@@ -68,13 +81,20 @@
vm.getMoviePageInfo(1);
};
/**
* onKeysKeyDown
* @param evt
*/
vm.onKeysKeyDown = function (evt) {
if (evt.keyCode === 13) {
vm.getMoviePageInfo(1);
}
};
/**
* getMoviePageInfo
* @param p: page number
*/
vm.getMoviePageInfo = function (p) {
vm.currPageNumber = p;
@@ -85,7 +105,7 @@
}
TorrentsService.query({
skip: (p - 1) * vm.pageNumber + skip,
skip: (p - 1) * vm.pageNumber + 0,
limit: p * vm.pageNumber,
keys: vm.searchKey,
torrent_status: 'reviewed',
@@ -102,6 +122,11 @@
});
};
/**
* getTagTitle
* @param tag: tag name
* @returns {*}
*/
vm.getTagTitle = function (tag) {
var tmp = tag;
var find = false;
@@ -126,6 +151,9 @@
return tmp;
};
/**
* clearAllCondition
*/
vm.clearAllCondition = function () {
vm.searchKey = '';
vm.searchTags = [];
@@ -133,5 +161,15 @@
vm.getMoviePageInfo(1);
};
/**
* onTagClicked
* @param tag: tag name
*/
vm.onTagClicked = function (tag) {
$timeout(function () {
angular.element('#tag_' + tag).trigger('click');
}, 100);
};
}
}());

View File

@@ -31,7 +31,10 @@
$state.go('authentication.signin');
}
//******************** begin upload torrent file *********************
/**
* upload
* @param dataUrl
*/
vm.upload = function (dataUrl) {
//console.log(dataUrl);
@@ -61,6 +64,10 @@
});
};
/**
* onSuccessItem
* @param response
*/
function onSuccessItem(response) {
vm.fileSelected = false;
vm.successfully = true;
@@ -72,6 +79,10 @@
});
}
/**
* onErrorItem
* @param response
*/
function onErrorItem(response) {
vm.fileSelected = false;
vm.successfully = false;
@@ -83,17 +94,28 @@
});
}
//************** begin get tmdb info ***********************************
/**
* onTMDBIDKeyDown
* @param evt
*/
vm.onTMDBIDKeyDown = function (evt) {
if (evt.keyCode === 13) {
vm.getInfo(vm.tmdb_id);
}
};
/**
* onTextClick
* @param $event
*/
vm.onTextClick = function ($event) {
$event.target.select();
};
/**
* getInfo
* @param tmdbid
*/
vm.getInfo = function (tmdbid) {
console.log(tmdbid);
if (tmdbid === null || tmdbid === undefined) {
@@ -127,6 +149,9 @@
});
};
/**
* create
*/
vm.create = function () {
var d = new Date(vm.movieinfo.release_date);
var l = 0;
@@ -193,11 +218,17 @@
}
};
/**
* cancel
*/
vm.cancel = function () {
$state.reload('torrents.uploads');
document.body.scrollTop = document.documentElement.scrollTop = 0;
};
/**
* clearAllCondition
*/
vm.clearAllCondition = function () {
vm.tags = [];
};

View File

@@ -8,11 +8,11 @@
<div class="torrent-user-info small-info">
<ul class="list-unstyled list-inline">
<li title="{{ 'TITLE_SEEDS' | translate}}"><span
<li title="{{ 'TITLE_ALT.SEEDS' | translate}}"><span
class="glyphicon glyphicon-arrow-up torrent-up"></span><span>{{item.torrent_seeds}}</span></li>
<li title="{{ 'TITLE_LEECHERS' | translate}}"><span
<li title="{{ 'TITLE_ALT.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
<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>
@@ -53,7 +53,7 @@
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value"
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onRadioTagClicked($event, sitem.name)">
{{ 'RESOURCESTAGS.' + item.name + '.' + sitem.name | translate}}
@@ -67,7 +67,7 @@
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value"
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onCheckboxTagClicked($event, sitem.name)"
toggle-class="btn-success" base-class="btn-default" onclick="this.blur();">
@@ -120,7 +120,9 @@
<!--<span class="label label-success text-uppercase">{{ item.torrent_type}}</span>-->
<span class="label label-warning">{{ item.torrent_release}}</span>
<span ng-repeat="t in item.torrent_tags">
<span class="label label-tag">{{ 'RESOURCESTAGS.' + vm.getTagTitle(t) + '.' + t | translate}}</span>
<span class="label label-tag" ng-click="vm.onTagClicked(t)">
{{ 'RESOURCESTAGS.' + vm.getTagTitle(t) + '.' + t | translate}}
</span>
</span>
</div>
</div>
@@ -132,12 +134,21 @@
</td>
<td class="col-md-1 td-v-middle">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle">{{item.torrent_size | bytes:2}}</td>
<td class="col-md-1 td-v-middle">
<p class="no-margin-p">{{item.torrent_seeds}}</p>
<td class="col-md-1 td-v-middle list-user-info">
<p class="no-margin-p" title="{{ 'TITLE_ALT.SEEDS' | translate}}">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
{{item.torrent_seeds}}
</p>
<p class="no-margin-p">{{item.torrent_leechers}}</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.LEECHERS' | translate}}">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
{{item.torrent_leechers}}
</p>
<p class="no-margin-p">{{item.torrent_finished}}</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.FINISHED' | translate}}">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
{{item.torrent_finished}}
</p>
</td>
<td class="col-md-1 td-v-middle">{{item.user.displayName}}</td>
</tr>

View File

@@ -41,7 +41,7 @@
</div>
</div>
<div class="row" style="margin-top: 40px;">
<div ng-show="vm.successfully == true" class="row" style="margin-top: 40px;">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="ENTER_TMDB_ID"></legend>
<div class="col-lg-3 col-md-4 col-sm-5 col-xs-6">