support search task

This commit is contained in:
MaysWind 2016-05-28 22:20:42 +08:00
parent 2c50e31fbe
commit 8173e5ec27
7 changed files with 107 additions and 67 deletions

View file

@ -34,6 +34,7 @@
</a>
<nav class="navbar navbar-static-top" role="navigation">
<div class="navbar-toolbar">
<ul class="nav navbar-nav">
<li>
<a class="toolbar" title="{{'New' | translate}}">
@ -100,6 +101,17 @@
</ul>
</li>
</ul>
</div>
<div class="navbar-searchbar hidden-xs">
<ul class="nav navbar-nav">
<li>
<input class="form-control" placeholder="{{('Search' | translate)}}" ng-model="searchContext.text" />
<div class="form-control-icon">
<span class="fa fa-search form-control-feedback"></span>
</div>
</li>
</ul>
</div>
</nav>
</header>

View file

@ -12,6 +12,7 @@
"Pause": "暂停下载任务",
"Delete": "删除下载任务",
"Display Order": "显示顺序",
"Search": "搜索",
"Default": "默认",
"By File Name": "按文件名",
"By File Size": "按文件大小",

View file

@ -85,6 +85,18 @@
$scope.titleWidth = getTitleWidth();
$scope.filterByTaskName = function (task) {
if (!task || !angular.isString(task.taskName)) {
return false;
}
if (!$scope.searchContext || !$scope.searchContext.text) {
return true;
}
return (task.taskName.toLowerCase().indexOf($scope.searchContext.text.toLowerCase()) >= 0);
};
$scope.getOrderType = function () {
return ariaNgSettingService.getDisplayOrder();
};

View file

@ -26,6 +26,10 @@
refreshGlobalStat();
$scope.searchContext = {
text: ''
};
$scope.changeDisplayOrder = function (type, autoSetReverse) {
var oldType = utils.parseOrderType(ariaNgSettingService.getDisplayOrder());
var newType = utils.parseOrderType(type);

View file

@ -16,6 +16,7 @@
'Pause': 'Pause',
'Delete': 'Delete',
'Display Order': 'Display Order',
'Search': 'Search',
'Default': 'Default',
'By File Name': 'By File Name',
'By File Size': 'By File Size',

View file

@ -43,6 +43,16 @@
color: #0080ff;
}
.skin-aria-ng .main-header .navbar .navbar-searchbar {
padding-top: 8px;
padding-right: 20px;
float: right;
}
.skin-aria-ng .main-header .navbar .navbar-searchbar .form-control-icon {
color: #999999;
}
@media (max-width: 767px) {
.skin-aria-ng .main-header .navbar {
padding-left: 20px;

View file

@ -35,7 +35,7 @@
</div>
</div>
<div class="task-table-body">
<div class="row" ng-repeat="task in downloadTasks | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
<div class="row" ng-repeat="task in downloadTasks | filter: filterByTaskName | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
<div class="col-sm-8">
<span class="task-name" ng-bind="task.taskName | substring: (titleWidth / 20)" title="{{task.taskName}}"></span>
<div class="task-files">