summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-06-26 17:01:46 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-06-26 17:03:54 +0200
commitaf761ab0025ac901300b2e8e177828a52a3f4a2f (patch)
tree0626631a94d20253c0389a3c38f1f08427389de4
parent9e69e9f9ed31cc3b58bbd6957547e1ef383bfee6 (diff)
downloadIshtar-af761ab0025ac901300b2e8e177828a52a3f4a2f.tar.bz2
Ishtar-af761ab0025ac901300b2e8e177828a52a3f4a2f.zip
🐛 forms - unit input: fix float display
-rw-r--r--changelog/en/changelog_2022-06-15.md1
-rw-r--r--changelog/fr/changelog_2023-01-25.md1
-rw-r--r--ishtar_common/templates/widgets/UnitWidget.html4
3 files changed, 5 insertions, 1 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md
index 00afabce6..a7b2a0d3e 100644
--- a/changelog/en/changelog_2022-06-15.md
+++ b/changelog/en/changelog_2022-06-15.md
@@ -8,6 +8,7 @@ v4.0.50 - 2999-12-31
### Bug fixes ###
- Operation form: the operation code field (Patriarche) is no longer optional
+- forms - unit input: fix round float display
- fix crash on qrcode generation for base finds
v4.0.49 - 2023-06-21
diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md
index 78392e53e..65ab2fdc1 100644
--- a/changelog/fr/changelog_2023-01-25.md
+++ b/changelog/fr/changelog_2023-01-25.md
@@ -8,6 +8,7 @@ v4.0.50 - 2999-12-31
### Corrections de dysfonctionnements ###
- Formulaire opération : le champ code opération (Patriarche) n'est plus facultatif
+- Formulaires - champ unité : correction des arrondis des flottants
- Correction d'erreur lors de la génération de qrcode pour le mobilier d'origine
diff --git a/ishtar_common/templates/widgets/UnitWidget.html b/ishtar_common/templates/widgets/UnitWidget.html
index 1e6451708..4cd2d5728 100644
--- a/ishtar_common/templates/widgets/UnitWidget.html
+++ b/ishtar_common/templates/widgets/UnitWidget.html
@@ -8,9 +8,11 @@
</div>
<script type="text/javascript">{% localize off %}
function evaluate_{{safe_id}}(){
- value = parseFloat($("#{{id}}").val());
+ value = parseFloat($("#{{id}}").val().replace(",", "."));
if(!isNaN(value)){
value = value/{{factor}};
+ {% if factor > 1 %}value = value.toFixed("{{factor}}".length);
+ {% else %}value = value.toFixed(0);{% endif %}
} else {
value = 0;
}