Skip to content

Commit

Permalink
fix add button (did nothing when no doc selected at right) ; add clic…
Browse files Browse the repository at this point in the history
…kable label on "copy meta" ckbox
  • Loading branch information
jygaulier committed Nov 14, 2023
1 parent ac65885 commit 7f46a12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function addElement(Request $request, $file_id)
$recordId = $request->request->get('record_id');
/** @var LazaretFile $lazaretFile */
$metadatasToSet = [];
if(!!$request->request->get('copy_meta', false)) {
if($recordId !== "" && !!$request->request->get('copy_meta', false)) {

$substitutedRecord = null;

Expand Down
24 changes: 12 additions & 12 deletions templates/web/prod/upload/lazaret.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,25 @@
$("button.add-lazaret", scope).bind('click', function () {
const that = $(this);
const $elementRow = that.closest(".lazaretElement");
if(!$elementRow.attr("hasSelected")) {
return false;
}
var lazaretId = getLazaretId(that);
let $form = $("FORM", $elementRow);
const lazaretId = getLazaretId(that);
let $selectedProposals = $(".record-proposal .selected");
if($selectedProposals.length !== 1) {
if($selectedProposals.length > 1) {
alert(language.onlyOneRecord);
return false;
}
let recordId = $selectedProposals.first().attr("data-record_id");
let $form = $("FORM", $elementRow);
$(".record_id", $form).val(recordId);
if($selectedProposals.length === 1) {
let recordId = $selectedProposals.first().attr("data-record_id");
$(".record_id", $form).val(recordId);
}
else {
$(".record_id", $form).val('');
}
var destinationCollectionId = getDestinationId(that);
var container = $(this).closest('.wrapper-item');
/*fix POST on firefox*/
data = $form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
Expand Down Expand Up @@ -582,7 +581,8 @@
</div>
<h5 class="copy_meta disabled-if-no-selection" style="border-top: 1px solid black; margin-top:5px;">
<input type="checkbox" name="copy_meta" />&nbsp;{{ 'upload:: Copy meta' | trans }}
<input type="checkbox" id="copy_meta" name="copy_meta" />&nbsp;
<label for="copy_meta" style="color:revert; display:revert;">{{ 'upload:: Copy meta' | trans }}</label>
</h5>
</div>
Expand Down

0 comments on commit 7f46a12

Please sign in to comment.