Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add People to Info panel and Upload page #3083

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions kahuna/public/js/components/gr-info-panel/gr-info-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,40 @@
</span>
</dd>

<dt ng-if="ctrl.rawMetadata.peopleInImage || ctrl.userCanEdit" class="image-info__wrap metadata-line metadata-line__key image-info__group--dl__key--panel">People</dt>
<dd ng-if="ctrl.rawMetadata.peopleInImage || ctrl.userCanEdit" class="image-info__wrap metadata-line metadata-line__info image-info__group--dl__value--panel">
<button class="image-info__edit"
ng-if="ctrl.userCanEdit"
ng-click="peopleInImageEditForm.$show()"
ng-hide="peopleInImageEditForm.$visible"
>✎</button>
<span ng-class="{'image-info--multiple': ctrl.hasMultipleValues(ctrl.rawMetadata.peopleInImage)}"
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}">

<span class="metadata-line__info" ng-if="ctrl.hasMultipleValues(ctrl.rawMetadata.peopleInImage) && ctrl.userCanEdit">
Multiple people (click ✎ to edit <strong>all</strong>)
</span>

<span class="metadata-line__info" ng-if="ctrl.hasMultipleValues(ctrl.rawMetadata.peopleInImage) && !ctrl.userCanEdit">
Multiple people
</span>

<span class="metadata-line__info" ng-if="!ctrl.hasMultipleValues(ctrl.rawMetadata.peopleInImage)">
<span ng:repeat="person in ctrl.metadata.peopleInImage">
<a ui:sref="search.results({query: (person | queryFilter:'person')})">{{person}}</a><span ng-if="ctrl.metadata.peopleInImage.length > 1 && $index != ctrl.metadata.peopleInImage.length - 1">
</span>

<span ng-if="!ctrl.metadata.peopleInImage && ctrl.userCanEdit">Unknown (click ✎ to add the people)</span>
</span>
</span>
</dd>

<dt ng-if="ctrl.extraInfo.filename" class="image-info__wrap metadata-line metadata-line__key image-info__group--dl__key--panel">Filename</dt>
<dd ng-if="ctrl.extraInfo.filename" class="image-info__wrap metadata-line metadata-line__info image-info__group--dl__value--panel">
<span ng-if="ctrl.hasMultipleValues(ctrl.extraInfo.filename)">Multiple filenames</span>
Expand Down
20 changes: 20 additions & 0 deletions kahuna/public/js/upload/jobs/required-metadata-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@
ng-click="ctrl.batchApplyMetadata('specialInstructions')"
>⇔</button>
</label>
<label ng-if="ctrl.peopleInImageWasInitiallyThere" class="job-info--editor__field flex-center">
<div class="job-info--editor__label text-small">People</div>
<input
type="text"
name="peopleInImage"
class="text-input job-info--editor__input job-info--editor__input--peopleInImage"
ng-model="ctrl.metadata.peopleInImage"
ng-change="ctrl.save()"
ng-model-options="{updateOn: 'default blur', debounce: { default: ctrl.saveOnTime, blur: 0 }}"
ng-class="{ 'job-info--editor__input--with-batch': ctrl.withBatch }"
/>

<button
class="job-editor__apply-to-all"
title="Apply this field to all your current uploads"
type="button"
ng-if="ctrl.withBatch"
ng-click="ctrl.batchApplyMetadata('peopleInImage')"
>⇔</button>
</label>
</div>
<!-- Angular doesn't submit a form without a submit element, bonza!
see: https://docs.angularjs.org/api/ng/directive/form#submitting-a-form-and-preventing-the-default-action -->
Expand Down
8 changes: 5 additions & 3 deletions kahuna/public/js/upload/jobs/required-metadata-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ jobs.controller('RequiredMetadataEditorCtrl',
ctrl.saving = false;
ctrl.disabled = () => Boolean(ctrl.saving || ctrl.externallyDisabled);
ctrl.saveOnTime = 750; // ms
// We do this check to ensure the copyright field doesn't disappear
// if we set it to "".
// We do this check to ensure the copyright and peopleInImage fields don't disappear
// if we set them to "".
ctrl.copyrightWasInitiallyThere = !!ctrl.originalMetadata.copyright;
ctrl.peopleInImageWasInitiallyThere = !!ctrl.originalMetadata.peopleInImage;

ctrl.save = function() {
ctrl.saving = true;
Expand Down Expand Up @@ -77,7 +78,8 @@ jobs.controller('RequiredMetadataEditorCtrl',
credit: originalMetadata.credit,
copyright: originalMetadata.copyright,
specialInstructions: originalMetadata.specialInstructions,
description: originalMetadata.description
description: originalMetadata.description,
peopleInImage: originalMetadata.peopleInImage
};
}
}]);
Expand Down