From aba6e13663fc6e64b0b0253fdc1ad3a8fc1469ed Mon Sep 17 00:00:00 2001 From: Patryk Hegenberg Date: Thu, 14 Dec 2023 20:00:10 +0100 Subject: [PATCH] backend: frontend: added calculation for save values --- handlers/skill_calculation_handler.go | 7 ++ templates/monsterForm.html | 65 +--------------- templates/skills.html | 107 +++++++++++++++++++++----- 3 files changed, 96 insertions(+), 83 deletions(-) diff --git a/handlers/skill_calculation_handler.go b/handlers/skill_calculation_handler.go index a26866f..b7bc109 100644 --- a/handlers/skill_calculation_handler.go +++ b/handlers/skill_calculation_handler.go @@ -45,6 +45,7 @@ func SkillCalculationHandler(content embed.FS) http.HandlerFunc { int := parseFieldValue(r.FormValue("int")) cha := parseFieldValue(r.FormValue("cha")) wis := parseFieldValue(r.FormValue("wis")) + con := parseFieldValue(r.FormValue("con")) cr := parseFieldValue(r.FormValue("cr")) crBonus := calcBonus(cr) @@ -67,6 +68,12 @@ func SkillCalculationHandler(content embed.FS) http.HandlerFunc { "sleightOfHand": strconv.Itoa(calcAbilityScore(dex) + crBonus), "stealth": strconv.Itoa(calcAbilityScore(dex) + crBonus), "survival": strconv.Itoa(calcAbilityScore(wis) + crBonus), + "saveStr": strconv.Itoa(calcAbilityScore(str)), + "saveWis": strconv.Itoa(calcAbilityScore(wis)), + "saveCon": strconv.Itoa(calcAbilityScore(con)), + "saveInt": strconv.Itoa(calcAbilityScore(int)), + "saveCha": strconv.Itoa(calcAbilityScore(cha)), + "saveDex": strconv.Itoa(calcAbilityScore(dex)), } // Execute template with skill values. diff --git a/templates/monsterForm.html b/templates/monsterForm.html index ca69873..ba8212b 100644 --- a/templates/monsterForm.html +++ b/templates/monsterForm.html @@ -219,70 +219,7 @@ -
-
-

- Save -

-
-
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
-
-
+
{{ template "skills" }}
diff --git a/templates/skills.html b/templates/skills.html index 35cb72b..9946793 100644 --- a/templates/skills.html +++ b/templates/skills.html @@ -1,4 +1,71 @@ {{ define "skills" }} +
+
+
+

+ Save +

+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+

Skill @@ -9,7 +76,7 @@

- +
@@ -18,7 +85,7 @@
- +
@@ -27,7 +94,7 @@
- +
@@ -38,7 +105,7 @@
- +
@@ -47,7 +114,7 @@
- +
@@ -56,7 +123,7 @@
- +
@@ -67,7 +134,7 @@
- +
@@ -76,7 +143,7 @@
- +
@@ -85,7 +152,7 @@
- +
@@ -96,7 +163,7 @@
- +
@@ -105,7 +172,7 @@
- +
@@ -114,7 +181,7 @@
- +
@@ -125,7 +192,7 @@
- +
@@ -134,7 +201,7 @@
- +
@@ -143,7 +210,7 @@
- +
@@ -154,7 +221,7 @@
- +
@@ -163,7 +230,7 @@
- +
@@ -172,7 +239,7 @@
- +
@@ -182,4 +249,6 @@
-{{ end }} \ No newline at end of file +
+
+{{ end }}