diff --git a/maloja/web/jinja/track.jinja b/maloja/web/jinja/track.jinja
index dfc5815..561dc68 100644
--- a/maloja/web/jinja/track.jinja
+++ b/maloja/web/jinja/track.jinja
@@ -27,6 +27,7 @@
{% include 'icons/edit.jinja' %}
{% include 'icons/merge.jinja' %}
{% include 'icons/merge_mark.jinja' %}
+ {% include 'icons/merge_cancel.jinja' %}
{% endif %}
{% endblock %}
diff --git a/maloja/web/static/css/grisons.css b/maloja/web/static/css/grisons.css
index 625b877..797fced 100644
--- a/maloja/web/static/css/grisons.css
+++ b/maloja/web/static/css/grisons.css
@@ -156,5 +156,5 @@ input:focus {
.hide {
- display:none;
+ display:none !important;
}
diff --git a/maloja/web/static/js/edit.js b/maloja/web/static/js/edit.js
index b108fbb..d9c674a 100644
--- a/maloja/web/static/js/edit.js
+++ b/maloja/web/static/js/edit.js
@@ -108,6 +108,38 @@ function doneEditing() {
// MERGING
+function showValidMergeIcons() {
+ const lcst = window.sessionStorage;
+ var key = "marked_for_merge_" + entity_type;
+ var current_stored = (lcst.getItem(key) || '').split(",");
+ current_stored = current_stored.filter((x)=>x).map((x)=>parseInt(x));
+
+ var mergeicon = document.getElementById('mergeicon');
+ var mergemarkicon = document.getElementById('mergemarkicon');
+ var mergecancelicon = document.getElementById('mergecancelicon');
+
+ mergeicon.classList.add('hide');
+ mergemarkicon.classList.add('hide');
+ mergecancelicon.classList.add('hide');
+
+ if (current_stored.length == 0) {
+ mergemarkicon.classList.remove('hide');
+ }
+ else {
+ mergecancelicon.classList.remove('hide');
+
+ if (current_stored.includes(entity_id)) {
+
+ }
+ else {
+ mergemarkicon.classList.remove('hide');
+ mergeicon.classList.remove('hide');
+ }
+ }
+
+}
+
+
function markForMerge() {
const lcst = window.sessionStorage;
var key = "marked_for_merge_" + entity_type;
@@ -117,6 +149,7 @@ function markForMerge() {
current_stored = [...new Set(current_stored)];
lcst.setItem(key,current_stored); //this already formats it correctly
notify("Success","Marked " + entity_name + " for merge, currently " + current_stored.length + " marked!")
+ showValidMergeIcons();
}
function merge() {
@@ -147,3 +180,10 @@ function merge() {
lcst.removeItem(key);
}
+
+function cancelMerge() {
+ const lcst = window.sessionStorage;
+ var key = "marked_for_merge_" + entity_type;
+ lcst.setItem(key,[]);
+ showValidMergeIcons();
+}