From ea19c5bb69b4d6c4b01cc1ee3291467c6f409f3f Mon Sep 17 00:00:00 2001 From: modzeleg Date: Thu, 15 Apr 2021 17:08:00 +0200 Subject: [PATCH] Header table now triggers modified status --- .../resources/static/css/commons/r11form.css | 4 ++++ src/main/resources/static/html/mock.html | 4 ---- src/main/resources/static/js/datatransfer.js | 24 +++++++++---------- src/main/resources/static/js/modal.js | 1 - target/classes/static/css/commons/r11form.css | 4 ++++ target/classes/static/html/mock.html | 4 ---- target/classes/static/js/datatransfer.js | 24 +++++++++---------- target/classes/static/js/modal.js | 1 - 8 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/main/resources/static/css/commons/r11form.css b/src/main/resources/static/css/commons/r11form.css index 1aa6319..67188b2 100644 --- a/src/main/resources/static/css/commons/r11form.css +++ b/src/main/resources/static/css/commons/r11form.css @@ -187,6 +187,10 @@ body { pointer-events: none; } +.tile.active .btn-tile { + opacity: 0; +} + .tile .content { position: absolute; left: 0; diff --git a/src/main/resources/static/html/mock.html b/src/main/resources/static/html/mock.html index 38cc38b..98e5c9c 100644 --- a/src/main/resources/static/html/mock.html +++ b/src/main/resources/static/html/mock.html @@ -3,12 +3,8 @@ R11 MockedServices - - - - diff --git a/src/main/resources/static/js/datatransfer.js b/src/main/resources/static/js/datatransfer.js index 94c41f0..9fa3c6e 100644 --- a/src/main/resources/static/js/datatransfer.js +++ b/src/main/resources/static/js/datatransfer.js @@ -1,6 +1,3 @@ -//TODO: Add delete buttons for messages -// TODO: Add function to add row -// TODO: Add remove closest tr function to header rows var clientUUID = ''; var advancedDisplayed = false; var json = {}; @@ -226,10 +223,15 @@ function createLink(uuid, id){ function fillHeaderTable(headers){ var innerHTML = buildHeaderMapHtml(headers); - $('#headerMapTable').html(innerHTML); - $('.tableField').change(function(){setDataModified()}); + refreshHeaderTable(innerHTML); +} + +function refreshHeaderTable(html){ + $('#headerMapTable').html(html); + $('.table-map').change(function(){setDataModified()}); $('.btn-hashmap').click(function(){ $(this).closest('tr').remove(); + setDataModified(); }) } @@ -241,14 +243,11 @@ function buildHeaderMapHtml(headers){ return innerHTML; } -// TODO: Add this click remove closest tr - - function addRow(key, value){ var headerMap = $('#headerMapTable'); var headersMapHtml = headerMap.html(); headersMapHtml += buildRowHtml(key, value); - headerMap.html(headersMapHtml); + refreshHeaderTable(headersMapHtml); } const newRowInput = function(){ @@ -258,6 +257,7 @@ const newRowInput = function(){ addRow(hName.val(), hValue.val()); hName.val(null); hValue.val(null); + setDataModified(); } } @@ -270,8 +270,8 @@ function checkIfInputValid(input){ function buildRowHtml(key, value){ return '' + '' + - '' + - '' + + '' + + '' + '' + ''; } @@ -299,8 +299,6 @@ function fillMessageList(){ }) } - -//TODO: Implement methods where its possible function findJsonById(id){ return json[findJsonIndexById(id)]; } diff --git a/src/main/resources/static/js/modal.js b/src/main/resources/static/js/modal.js index b07de7d..3ea450c 100644 --- a/src/main/resources/static/js/modal.js +++ b/src/main/resources/static/js/modal.js @@ -11,7 +11,6 @@ const dataLossModalYes = dataLossModal.children().eq(2).children().eq(0); const dataLossModalNo = dataLossModal.children().eq(2).children().eq(1); const allModals = $('.modal'); const btnModalClose = $('.modal button'); -//TODO: Implement in datatransfer const closeModals = function() { hideModal(allModals); } diff --git a/target/classes/static/css/commons/r11form.css b/target/classes/static/css/commons/r11form.css index 1aa6319..67188b2 100644 --- a/target/classes/static/css/commons/r11form.css +++ b/target/classes/static/css/commons/r11form.css @@ -187,6 +187,10 @@ body { pointer-events: none; } +.tile.active .btn-tile { + opacity: 0; +} + .tile .content { position: absolute; left: 0; diff --git a/target/classes/static/html/mock.html b/target/classes/static/html/mock.html index 38cc38b..98e5c9c 100644 --- a/target/classes/static/html/mock.html +++ b/target/classes/static/html/mock.html @@ -3,12 +3,8 @@ R11 MockedServices - - - - diff --git a/target/classes/static/js/datatransfer.js b/target/classes/static/js/datatransfer.js index 94c41f0..9fa3c6e 100644 --- a/target/classes/static/js/datatransfer.js +++ b/target/classes/static/js/datatransfer.js @@ -1,6 +1,3 @@ -//TODO: Add delete buttons for messages -// TODO: Add function to add row -// TODO: Add remove closest tr function to header rows var clientUUID = ''; var advancedDisplayed = false; var json = {}; @@ -226,10 +223,15 @@ function createLink(uuid, id){ function fillHeaderTable(headers){ var innerHTML = buildHeaderMapHtml(headers); - $('#headerMapTable').html(innerHTML); - $('.tableField').change(function(){setDataModified()}); + refreshHeaderTable(innerHTML); +} + +function refreshHeaderTable(html){ + $('#headerMapTable').html(html); + $('.table-map').change(function(){setDataModified()}); $('.btn-hashmap').click(function(){ $(this).closest('tr').remove(); + setDataModified(); }) } @@ -241,14 +243,11 @@ function buildHeaderMapHtml(headers){ return innerHTML; } -// TODO: Add this click remove closest tr - - function addRow(key, value){ var headerMap = $('#headerMapTable'); var headersMapHtml = headerMap.html(); headersMapHtml += buildRowHtml(key, value); - headerMap.html(headersMapHtml); + refreshHeaderTable(headersMapHtml); } const newRowInput = function(){ @@ -258,6 +257,7 @@ const newRowInput = function(){ addRow(hName.val(), hValue.val()); hName.val(null); hValue.val(null); + setDataModified(); } } @@ -270,8 +270,8 @@ function checkIfInputValid(input){ function buildRowHtml(key, value){ return '' + '' + - '' + - '' + + '' + + '' + '' + ''; } @@ -299,8 +299,6 @@ function fillMessageList(){ }) } - -//TODO: Implement methods where its possible function findJsonById(id){ return json[findJsonIndexById(id)]; } diff --git a/target/classes/static/js/modal.js b/target/classes/static/js/modal.js index b07de7d..3ea450c 100644 --- a/target/classes/static/js/modal.js +++ b/target/classes/static/js/modal.js @@ -11,7 +11,6 @@ const dataLossModalYes = dataLossModal.children().eq(2).children().eq(0); const dataLossModalNo = dataLossModal.children().eq(2).children().eq(1); const allModals = $('.modal'); const btnModalClose = $('.modal button'); -//TODO: Implement in datatransfer const closeModals = function() { hideModal(allModals); }