add context menu for file list and peer list in task detail page, add expand/collapse all directories

master
MaysWind 2019-02-28 00:32:37 +08:00
parent 4ce24c0421
commit 61e24f19e2
5 changed files with 129 additions and 3 deletions

View File

@ -30,6 +30,8 @@ Search=搜索
Default=默认
Expand=展开
Collapse=折叠
Expand All=全部展开
Collapse All=全部折叠
Open=打开
Save=保存
Import=导入
@ -42,6 +44,8 @@ By Progress=按进度
By Remain Time=按剩余时间
By Download Speed=按下载速度
By Upload Speed=按上传速度
By Peer Address=按节点地址
By Client Name=按客户端名称
Filters=过滤器
Download=下载
Upload=上传

View File

@ -30,6 +30,8 @@ Search=搜尋
Default=預設
Expand=展開
Collapse=摺疊
Expand All=全部展開
Collapse All=全部摺疊
Open=打開
Save=儲存
Import=匯入
@ -42,6 +44,8 @@ By Progress=依進度
By Remain Time=依剩餘時間
By Download Speed=依下載速度
By Upload Speed=依上傳速度
By Peer Address=依節點位址
By Client Name=依客戶端名
Filters=篩選器
Download=下載
Upload=上傳

View File

@ -34,6 +34,8 @@
'Default': 'Default',
'Expand': 'Expand',
'Collapse': 'Collapse',
'Expand All': 'Expand All',
'Collapse All': 'Collapse All',
'Open': 'Open',
'Save': 'Save',
'Import': 'Import',
@ -46,6 +48,8 @@
'By Remain Time': 'By Remain Time',
'By Download Speed': 'By Download Speed',
'By Upload Speed': 'By Upload Speed',
'By Peer Address': 'By Peer Address',
'By Client Name': 'By Client Name',
'Filters': 'Filters',
'Download': 'Download',
'Upload': 'Upload',

View File

@ -543,14 +543,14 @@
}
};
$scope.collapseDir = function (dirNode, newValue) {
$scope.collapseDir = function (dirNode, newValue, forceRecurse) {
var nodePath = dirNode.nodePath;
if (angular.isUndefined(newValue)) {
newValue = !$scope.context.collapsedDirs[nodePath];
}
if (newValue) {
if (newValue || forceRecurse) {
for (var i = 0; i < dirNode.subDirs.length; i++) {
$scope.collapseDir(dirNode.subDirs[i], newValue);
}
@ -561,6 +561,22 @@
}
};
$scope.collapseAllDirs = function (newValue) {
if (!$scope.task || !$scope.task.files) {
return;
}
for (var i = 0; i < $scope.task.files.length; i++) {
var node = $scope.task.files[i];
if (!node.isDir) {
continue;
}
$scope.collapseDir(node, newValue, true);
}
};
$scope.setSelectedNode = function (dirNode) {
setSelectedNode(dirNode, dirNode.selected);
updateAllDirNodesSelectedStatus();

View File

@ -245,6 +245,7 @@
</div>
<div class="task-table-body">
<div class="row" ng-repeat="file in task.files | fileOrderBy: getFileListOrderType()"
data-toggle="context" data-target="#task-filelist-contextmenu"
ng-if="!context.collapsedDirs[file.relativePath]" data-file-index="{{file.index}}">
<div class="col-sm-10" ng-if="file.isDir" style="{{(task.multiDir ? ('padding-left: ' + (file.level * 16) + 'px') : '')}}">
<i class="icon-dir-expand pointer-cursor fa" ng-click="collapseDir(file)"
@ -313,7 +314,8 @@
</div>
</div>
<div class="task-table-body">
<div class="row" ng-repeat="peer in context.btPeers | peerOrderBy: getPeerListOrderType()">
<div class="row" ng-repeat="peer in context.btPeers | peerOrderBy: getPeerListOrderType()"
data-toggle="context" data-target="#task-peerlist-contextmenu">
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="peer-name-wrapper auto-ellipsis" title="{{(peer.client ? peer.client.info : '') + (peer.seeder ? (peer.client.info ? ', ' : '') + ('Seeding' | translate) : '')}}">
<span ng-bind="peer.name | translate"></span><i class="icon-seeder fa fa-angle-double-up" ng-if="peer && peer.seeder"></i>
@ -372,6 +374,102 @@
</li>
</ul>
</div>
<div id="task-filelist-contextmenu">
<ul class="dropdown-menu" role="menu">
<li ng-if="task.multiDir">
<a tabindex="-1" class="pointer-cursor" title="{{'Expand All' | translate}}" ng-click="collapseAllDirs(false)">
<i class="fa fa-plus fa-fw"></i>
<span translate>Expand All</span>
</a>
</li>
<li ng-if="task.multiDir">
<a tabindex="-1" class="pointer-cursor" title="{{'Collapse All' | translate}}" ng-click="collapseAllDirs(true)">
<i class="fa fa-minus fa-fw"></i>
<span translate>Collapse All</span>
</a>
</li>
<li class="dropdown dropdown-submenu" ng-if="!task.multiDir">
<a tabindex="-1" title="{{'Display Order' | translate}}" href="javascript:void(0);">
<i class="fa fa-sort-alpha-asc fa-fw"></i>
<span translate>Display Order</span>
</a>
<ul class="dropdown-menu" style="right: 160px;">
<li>
<a class="pointer-cursor" ng-click="changeFileListDisplayOrder('default:asc')">
<span translate>Default</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetFileListDisplayOrder('default')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeFileListDisplayOrder('name:asc')">
<span translate>By File Name</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetFileListDisplayOrder('name')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeFileListDisplayOrder('percent:desc')">
<span translate>By Progress</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetFileListDisplayOrder('percent')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeFileListDisplayOrder('size:asc')">
<span translate>By File Size</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetFileListDisplayOrder('size')}"></i>
</a>
</li>
</ul>
</li>
</ul>
</div>
<div id="task-peerlist-contextmenu">
<ul class="dropdown-menu" role="menu">
<li class="dropdown dropdown-submenu">
<a tabindex="-1" title="{{'Display Order' | translate}}" href="javascript:void(0);">
<i class="fa fa-sort-alpha-asc fa-fw"></i>
<span translate>Display Order</span>
</a>
<ul class="dropdown-menu" style="right: 160px;">
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('default:asc')">
<span translate>Default</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('default')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('address:asc')">
<span translate>By Peer Address</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('address')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('client:asc')">
<span translate>By Client Name</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('client')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('percent:desc')">
<span translate>By Progress</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('percent')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('dspeed:desc')">
<span translate>By Download Speed</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('dspeed')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changePeerListDisplayOrder('uspeed:desc')">
<span translate>By Upload Speed</span>
<i class="fa fa-fw" ng-class="{'fa-check': isSetPeerListDisplayOrder('uspeed')}"></i>
</a>
</li>
</ul>
</li>
</ul>
</div>
<div id="custom-choose-file-modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">