Skip to content

Commit

Permalink
apply shift clicking to WEs lists in ManageTags as well (closes #438)
Browse files Browse the repository at this point in the history
  • Loading branch information
boogheta committed Mar 10, 2022
1 parent ba3705c commit 253cd9e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hyphe_frontend/app/views/manageTags.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ <h1>
md-colors="{
'background': webentity.selected ? 'default-accent-100' : 'default-background-100'
}"
ng-click="shiftCheck($event, $index, webentity)"
>
<md-checkbox ng-model="webentity.selected"></md-checkbox>
<md-checkbox ng-checked="webentity.selected" ng-click="shiftCheck($event, $index, webentity)"></md-checkbox>
<p flex layout="row">
<a
ng-show="webentity.homepage"
Expand Down
22 changes: 22 additions & 0 deletions hyphe_frontend/app/views/manageTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ angular.module('hyphe.manageTagsController', [])
$scope.allCheckedIndeterminate = false
$scope.searchQuery
$scope.displayCategory
$scope.displayedEntitiesList = ""

$scope.network

Expand Down Expand Up @@ -87,7 +88,24 @@ angular.module('hyphe.manageTagsController', [])
updateTags()
}

$scope.lastClicked = null
$scope.shiftCheck = function($event, $index, webentity){
webentity.selected = !webentity.selected
if ($event.shiftKey && $scope.lastClicked !== null && webentity.id !== $scope.lastClicked) {
var first = $index, last = $scope.lastClicked;
if (first > last) {
first = $scope.lastClicked
last = $index
}
$scope.displayedEntities.slice(first, last).forEach(function(we){
we.selected = webentity.selected
})
}
$scope.lastClicked = $index
}

$scope.toggleCheckAll = function() {
$scope.lastClicked = null
if ($scope.allChecked) {
// Uncheck all
$scope.displayedEntities.forEach(function(webentity){
Expand Down Expand Up @@ -210,6 +228,9 @@ angular.module('hyphe.manageTagsController', [])
$scope.$watch('searchQuery', updateDisplayedEntities)
$scope.$watch('displayedEntities', updateNetwork)
$scope.$watch('checkedList', updateNetwork)
$scope.$watch('displayedEntitiesList', function(){
$scope.lastClicked = null
})

$scope.addTagToSelection = function(tagValue, tagCat, webentities) {
$scope.status = {message: 'Adding tags'}
Expand Down Expand Up @@ -252,6 +273,7 @@ angular.module('hyphe.manageTagsController', [])
else if (a.name > b.name) return 1;
return 0;
})
$scope.displayedEntitiesList = $scope.displayedEntities.map(function(we){ return we.id }).join("|")
}

function updateTags() {
Expand Down

0 comments on commit 253cd9e

Please sign in to comment.