modify file selection in task detail page
This commit is contained in:
parent
46b37947f9
commit
be2c3dda41
|
@ -273,6 +273,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isAnyFileSelected = function () {
|
$scope.isAnyFileSelected = function () {
|
||||||
|
if (!$scope.task || !$scope.task.files) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < $scope.task.files.length; i++) {
|
for (var i = 0; i < $scope.task.files.length; i++) {
|
||||||
var file = $scope.task.files[i];
|
var file = $scope.task.files[i];
|
||||||
|
|
||||||
|
@ -284,11 +288,35 @@
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.isAllFileSelected = function () {
|
||||||
|
if (!$scope.task || !$scope.task.files) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < $scope.task.files.length; i++) {
|
||||||
|
var file = $scope.task.files[i];
|
||||||
|
|
||||||
|
if (!file.isDir && !file.selected) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.selectFiles = function (type) {
|
$scope.selectFiles = function (type) {
|
||||||
if (!$scope.task || !$scope.task.files) {
|
if (!$scope.task || !$scope.task.files) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type === 'auto') {
|
||||||
|
if ($scope.isAllFileSelected()) {
|
||||||
|
type = 'none';
|
||||||
|
} else {
|
||||||
|
type = 'all';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < $scope.task.files.length; i++) {
|
for (var i = 0; i < $scope.task.files.length; i++) {
|
||||||
var file = $scope.task.files[i];
|
var file = $scope.task.files[i];
|
||||||
|
|
||||||
|
|
|
@ -199,9 +199,18 @@
|
||||||
<div class="task-table-title" ng-if="context.showChooseFilesToolbar">
|
<div class="task-table-title" ng-if="context.showChooseFilesToolbar">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button class="btn btn-xs btn-primary" ng-click="selectFiles('all')" translate>Select All</button>
|
<div class="btn-group">
|
||||||
<button class="btn btn-xs btn-primary" ng-click="selectFiles('none')" translate>Select None</button>
|
<button type="button" class="btn btn-primary btn-xs" ng-click="selectFiles('auto')"
|
||||||
<button class="btn btn-xs btn-primary" ng-click="selectFiles('reverse')" translate>Select Invert</button>
|
ng-bind="(isAllFileSelected() ? 'Select None' : 'Select All') | translate">Select All</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="javascript:void(0);" ng-click="selectFiles('all')" translate>Select All</a></li>
|
||||||
|
<li><a href="javascript:void(0);" ng-click="selectFiles('none')" translate>Select None</a></li>
|
||||||
|
<li><a href="javascript:void(0);" ng-click="selectFiles('reverse')" translate>Select Invert</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<button class="btn btn-xs btn-default" ng-click="chooseSpecifiedFiles('video')">
|
<button class="btn btn-xs btn-default" ng-click="chooseSpecifiedFiles('video')">
|
||||||
<i class="fa fa-file-video-o"></i>
|
<i class="fa fa-file-video-o"></i>
|
||||||
<span translate>Videos</span>
|
<span translate>Videos</span>
|
||||||
|
|
Reference in a new issue