From 393ec0f24c08eab5b4fb3576b2376af4f66e64e1 Mon Sep 17 00:00:00 2001 From: Chatewgne Date: Tue, 13 Aug 2024 17:16:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20[IMPR]=20Allow=20use=20Annotatio?= =?UTF-8?q?n=20Categories=20on=20annotations=20other=20than=20Points=20(re?= =?UTF-8?q?fs=20#4032)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 6 +++++- geotrek/common/static/common/js/annotations.js | 13 ++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2ab286e3ba..e5ec377961 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,13 +5,17 @@ CHANGELOG 2.109.0+dev (XXXX-XX-XX) ---------------------------- +**Improvements** + +- Allow use of Annotation Categories on annotations other than Points (#4032)" + 2.109.0 (2024-08-08) ---------------------------- **New features** -- Add Annotation Categories to improve annotations on HD Views(refs #4032) +- Add Annotation Categories to improve annotations on HD Views (#4032) **Improvements** diff --git a/geotrek/common/static/common/js/annotations.js b/geotrek/common/static/common/js/annotations.js index 71c5041e46..f8c889ab04 100644 --- a/geotrek/common/static/common/js/annotations.js +++ b/geotrek/common/static/common/js/annotations.js @@ -248,19 +248,18 @@ function initAnnotationsWidget(map) { entry.find('#label_input').on('blur', () => update_edited_label(entry)); entry.find('#label_input').on('keydown', (key) => update_edited_label_on_enter(entry, key)); - if (annotation.type() === 'point') { - var category_selector = $('#id_annotation_category').clone(); - category_selector.attr('for-annotation', id); - category_selector.on("change", update_annotation_category_event) - entry.find('.entry-validate').before(category_selector); - } + var category_selector = $('#id_annotation_category').clone(); + category_selector.attr('for-annotation', id); + category_selector.on("change", update_annotation_category_event) + entry.find('.entry-validate').before(category_selector); entry.find('.entry-name').text(annotation.name()); + if (query.editing == id) { entry.find('.entry-adjust').hide(); entry.find('.entry-validate').show(); } $('#annotationlist').append(entry); - if (annotation.type() === 'point' & $("#div_id_annotations_categories textarea").val() !== "") { + if ($("#div_id_annotations_categories textarea").val() !== "") { var annotations_categories = JSON.parse($("#div_id_annotations_categories textarea").val()); previous_category = annotations_categories[id] if (typeof previous_category !== 'undefined') {