From 6c28618fbe5be934f9fa1da682531bb5e2787e9f Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Thu, 20 Apr 2023 00:02:02 +0200 Subject: [PATCH] metadata: New formatting of the add metadata form --- public/js/metadata.js | 10 ++++++++-- templates/metadata.html.php | 16 +++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/public/js/metadata.js b/public/js/metadata.js index 06f9303..9cf40b1 100644 --- a/public/js/metadata.js +++ b/public/js/metadata.js @@ -119,10 +119,16 @@ var createEventsListener = function() { document.getElementById('form_metadata_add').addEventListener('submit', function(e) { let formData = new FormData(this); addMetadata(formData.get('metadata_key'), ""); + this.classList.add('invisible'); + setTimeout(function() { document.getElementById('form_metadata_add').classList.remove('invisible'); }, 400); this.reset(); e.preventDefault(); - }) - + }); + document.getElementById('input_metadata_value').addEventListener('focus', function(e) { + if(document.getElementById('input_metadata_key').value) { + document.querySelector('#form_metadata_add button').click(); + } + }); document.addEventListener('click', function (event) { if (event.target.closest(".delete-metadata")) { deleteMetadata(event.target) diff --git a/templates/metadata.html.php b/templates/metadata.html.php index 06925d3..13054d5 100644 --- a/templates/metadata.html.php +++ b/templates/metadata.html.php @@ -55,11 +55,17 @@

Liste des métadonnées du PDF

-
-
- - -
+ +
+
+ +
+ + +
+ +
+