Skip to content

Commit

Permalink
fix batch add people to image
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebuson committed Feb 2, 2022
1 parent 5993e99 commit 8c737f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,15 @@
</span>
</button>
<span ng-class="{'image-info--multiple': ctrl.selectedImages.size > 0}"
editable-text="ctrl.peopleInSelectedImages"
editable-text="ctrl.metadata.peopleInImage"
ng-hide="peopleInImageEditForm.$visible"
onbeforesave="ctrl.updateMetadataField('peopleInImage', $data)"
e:form="peopleInImageEditForm"
e:ng-class="{'image-info__editor--error': $error,
'image-info__editor--saving': peopleInImageEditForm.$waiting,
'text-input': true}">

<ui-list-editor-info-panel
<ui-list-editor-info-panel
images="ctrl.selectedImages"
add-to-images="ctrl.addPersonToImages"
remove-from-images="ctrl.removePersonFromImages"
Expand Down Expand Up @@ -595,6 +595,7 @@
</dl>
</div>


<div class="image-info">
<dl class="image-info__group">
<dt class="flex-container">
Expand Down
15 changes: 4 additions & 11 deletions kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ module.controller('grImageMetadataCtrl', [
inject$($scope, Rx.Observable.fromPromise(selectedUsageCategory(ctrl.usageRights)), ctrl, 'usageCategory');
ctrl.rawMetadata = rawMetadata();
ctrl.metadata = displayMetadata();
ctrl.peopleInSelectedImages = selectedPeople();
ctrl.extraInfo = extraInfo();
if (ctrl.singleImage) {
updateSingleImage();
Expand Down Expand Up @@ -97,7 +96,10 @@ module.controller('grImageMetadataCtrl', [

ctrl.updateMetadataField = function (field, value) {
var imageArray = Array.from(ctrl.selectedImages);

if (field === 'peopleInImage') {
ctrl.addPersonToImages(imageArray, value);
return;
}
return editsService.batchUpdateMetadataField(
imageArray,
field,
Expand Down Expand Up @@ -297,15 +299,6 @@ module.controller('grImageMetadataCtrl', [
return imageList.getOccurrences(labels);
}

function selectedPeople() {
let peopleInSelectedImages = [];
ctrl.selectedImages.map((image) => {
const currentPeopleInImage = ctrl.peopleAccessor(image);
peopleInSelectedImages = peopleInSelectedImages.concat(currentPeopleInImage);
});
return [... new Set(peopleInSelectedImages)];
}

function selectedUsageRights() {
return ctrl.selectedImages.map(image => {
return {
Expand Down

0 comments on commit 8c737f8

Please sign in to comment.