#230: Add a check all/none button on "quick upload"

This commit is contained in:
Benjamin Gamard 2018-04-11 16:17:37 +02:00
parent 748659e78e
commit dd1c06013b
3 changed files with 17 additions and 1 deletions

View File

@ -98,6 +98,13 @@ angular.module('docs').controller('DocumentDefault', function ($scope, $rootScop
return _.where($scope.files, { checked: true }); return _.where($scope.files, { checked: true });
}; };
// Change checked status
$scope.changeChecked = function (checked) {
_.each($scope.files, function (file) {
file.checked = checked;
})
};
// Add a document with checked files // Add a document with checked files
$scope.addDocument = function () { $scope.addDocument = function () {
$state.go('document.add', { files: _.pluck($scope.checkedFiles(), 'id') }); $state.go('document.add', { files: _.pluck($scope.checkedFiles(), 'id') });

View File

@ -173,7 +173,9 @@
"footer_sismics": "Crafted with <span class=\"fas fa-heart\"></span> by <a href=\"https://www.sismics.com\" target=\"_blank\">Sismics</a>", "footer_sismics": "Crafted with <span class=\"fas fa-heart\"></span> by <a href=\"https://www.sismics.com\" target=\"_blank\">Sismics</a>",
"api_documentation": "API Documentation", "api_documentation": "API Documentation",
"feedback": "Give us a feedback", "feedback": "Give us a feedback",
"workflow_document_list": "Documents assigned to you" "workflow_document_list": "Documents assigned to you",
"select_all": "Select all",
"select_none": "Select none"
}, },
"pdf": { "pdf": {
"export_title": "Export to PDF", "export_title": "Export to PDF",

View File

@ -1,7 +1,14 @@
<div class="well well-3d" style="background-color: #f6f9fc"> <div class="well well-3d" style="background-color: #f6f9fc">
<div class="pull-right" ng-show="files.length > 0">
<a href class="btn btn-default" ng-init="selectAll = true" ng-click="changeChecked(selectAll); selectAll = !selectAll">
<span class="far" ng-class="{ 'fa-check-square': selectAll, 'fa-square': !selectAll }"></span>
{{ selectAll ? 'document.default.select_all' : 'document.default.select_none' | translate }}
</a>
</div>
<h3 class="well-3d-header text-muted"> <h3 class="well-3d-header text-muted">
{{ 'document.default.quick_upload' | translate }} {{ 'document.default.quick_upload' | translate }}
</h3> </h3>
<div class="row upload-zone" <div class="row upload-zone"
ngf-drop="fileDropped($files)" ngf-drop="fileDropped($files)"
ngf-drag-over-class="'bg-success'" ngf-drag-over-class="'bg-success'"