From 5c7a1d6874319a9e87cd238b88a5cdbeb56072c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Sun, 12 Feb 2017 13:26:02 +0100 Subject: [PATCH] Refactor JS Settings K-Psul - change name: Settings -> Config - provide interface `Config` to get/set parameters - `Config` uses global object `window.config` to store key/value - `Config` setters handle types --- kfet/static/kfet/js/kfet.js | 2 +- kfet/templates/kfet/kpsul.html | 89 ++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js index f2e207d2..f09bf347 100644 --- a/kfet/static/kfet/js/kfet.js +++ b/kfet/static/kfet/js/kfet.js @@ -38,7 +38,7 @@ function amountDisplay(amount, is_cof=false, tri='') { } function amountToUKF(amount, is_cof=false) { - var coef_cof = is_cof ? 1 + window.settings['subvention_cof'] / 100 : 1; + var coef_cof = is_cof ? 1 + Config.getAll().subvention_cof / 100 : 1; return Math.round(amount * coef_cof * 10); } diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 1bda6045..9eb93643 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -169,6 +169,50 @@ {% csrf_token %}