From 938e4ef3481237cbe4b9adc6208c480f9f8c20bd Mon Sep 17 00:00:00 2001
From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com>
Date: Mon, 22 Jan 2024 12:41:47 +0100
Subject: [PATCH] Make modals static. Hide some settings. Minor optimizations.
Switch from NPM bach to CDN.
---
.idea/InfantrySkillCalculator.iml | 6 ++++--
.idea/jsLibraryMappings.xml | 6 ------
Dockerfile | 2 +-
static/dialogs.js | 11 ++++++-----
static/index.js | 4 ++--
templates/components/header.html | 12 ++++++------
templates/components/home_player_list.html | 4 ++--
templates/components/opp_player_list.html | 2 +-
templates/modals/add_clan.html | 2 +-
templates/modals/add_player.html | 2 +-
templates/modals/delete_clan.html | 2 +-
templates/modals/delete_player.html | 2 +-
templates/modals/edit_clan.html | 2 +-
templates/modals/edit_player.html | 4 ++--
templates/modals/settings.html | 9 ++++-----
templates/{ => shards}/player_list_item.html | 2 +-
16 files changed, 34 insertions(+), 38 deletions(-)
delete mode 100644 .idea/jsLibraryMappings.xml
rename templates/{ => shards}/player_list_item.html (95%)
diff --git a/.idea/InfantrySkillCalculator.iml b/.idea/InfantrySkillCalculator.iml
index ef9a3ae..ffad0c9 100644
--- a/.idea/InfantrySkillCalculator.iml
+++ b/.idea/InfantrySkillCalculator.iml
@@ -5,9 +5,11 @@
-
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
deleted file mode 100644
index b5285cc..0000000
--- a/.idea/jsLibraryMappings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index cc0f185..0411afb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ WORKDIR /app
COPY . .
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o isc ./cmd
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o isc .
FROM alpine:latest
diff --git a/static/dialogs.js b/static/dialogs.js
index 12551aa..ae641d4 100644
--- a/static/dialogs.js
+++ b/static/dialogs.js
@@ -2,10 +2,11 @@ const swalClasses = {
container: 'text-center',
confirmButton: 'btn btn-lg btn-primary',
cancelButton: 'btn btn-lg btn-secondary ms-3',
+ denyButton: 'btn btn-lg btn-secondary ms-3',
popup: 'border p-5',
title: 'fs-2',
- inputLabel: 'fs-5',
- htmlContainer: 'fs-5'
+ inputLabel: 'fs-5 text-secondary-emphasis',
+ htmlContainer: 'fs-5 text-center text-secondary-emphasis',
};
function showSingleCalcDialog(btn) {
@@ -21,7 +22,7 @@ function showSingleCalcDialog(btn) {
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
- htmx.ajax('POST', '/score/' + result.value, {target: '#' + btn.id, swap: 'none'})
+ let promise = htmx.ajax('POST', '/score/' + result.value, {target: '#' + btn.id, swap: 'none'});
}
});
}
@@ -72,7 +73,7 @@ function confirmAndTrigger(btn) {
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
- htmx.trigger(btn, 'confirmed');
+ htmx.trigger(btn, 'confirmed', null);
}
});
}
@@ -94,7 +95,7 @@ function createCodeDialog(btn) {
}).then((result) => {
if (result.isConfirmed) {
btn.setAttribute('hx-vals', '{"user_role": "' + result.value + '"}');
- htmx.trigger(btn, 'confirmed');
+ htmx.trigger(btn, 'confirmed', null);
}
});
}
\ No newline at end of file
diff --git a/static/index.js b/static/index.js
index 743168b..a1009b0 100644
--- a/static/index.js
+++ b/static/index.js
@@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', function() {
- const tooltipTriggerList = document.querySelectorAll('[config-bs-toggle="tooltip"]');
+ const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
tooltipTriggerList.forEach((elem) => {
new bootstrap.Tooltip(elem);
});
@@ -111,7 +111,7 @@ function loadClans() {
}
function updateSelectedPlayers(sender) {
- const playerList = sender.parentElement.parentElement.parentElement;
+ const playerList = sender.parentElement.parentElement.parentElement.parentElement;
const checkCounter = playerList.parentElement.parentElement.querySelector('span.badge');
let counter = 0;
diff --git a/templates/components/header.html b/templates/components/header.html
index 15e1144..79f3ef9 100644
--- a/templates/components/header.html
+++ b/templates/components/header.html
@@ -1,17 +1,17 @@
{{ define "header" }}
-
+
Infantry Skill Calculator
-
-
-
+
+
+
-
+
-
+
{{ end }}
\ No newline at end of file
diff --git a/templates/components/home_player_list.html b/templates/components/home_player_list.html
index 6cf34c0..6cee9e3 100644
--- a/templates/components/home_player_list.html
+++ b/templates/components/home_player_list.html
@@ -2,7 +2,7 @@
-
@@ -22,7 +22,7 @@
{{ end }}
-
+
0
diff --git a/templates/components/opp_player_list.html b/templates/components/opp_player_list.html
index d28919d..97119e7 100644
--- a/templates/components/opp_player_list.html
+++ b/templates/components/opp_player_list.html
@@ -22,7 +22,7 @@
{{ end }}
-
+
0
diff --git a/templates/modals/add_clan.html b/templates/modals/add_clan.html
index 427e9d8..c0e8a20 100644
--- a/templates/modals/add_clan.html
+++ b/templates/modals/add_clan.html
@@ -1,7 +1,7 @@
{{ define "add_clan" }}
-