From 593f3c445c5e06df3963aa24951825212aa423ec Mon Sep 17 00:00:00 2001 From: LupusUmbrae Date: Sun, 29 May 2016 23:06:06 +0100 Subject: [PATCH] Added inc/dec arrows to number input boxes - This fixes #5 --- .gitignore | 2 ++ static/javascript/kdm.js | 18 ++++++++++++++++++ static/templates/char/armour.html | 6 ++++-- static/templates/char/attributes.html | 2 ++ static/templates/char/brain.html | 6 ++++-- static/templates/char/survival.html | 8 +++++--- static/templates/settlement/name.html | 2 ++ static/templates/settlement/population.html | 4 +++- 8 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a0990bd..58560ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /kdmvenv +*.pyc +/.idea diff --git a/static/javascript/kdm.js b/static/javascript/kdm.js index 6503f7b..8363347 100644 --- a/static/javascript/kdm.js +++ b/static/javascript/kdm.js @@ -53,6 +53,24 @@ $rootScope.deletetab = function(tabid) { deleteTab($rootScope, tabid); } + + $rootScope.inc = function(item, name="value") { + if(item[name] === undefined) { + item[name] = 0 + }else if(typeof item[name] === "string") { + item[name] = Number(item[name]) + } + item[name] += 1; + } + + $rootScope.dec = function(item, name="value") { + if(item[name] === undefined) { + item[name] = 0 + }else if(typeof item[name] === "string") { + item[name] = Number(item[name]) + } + item[name] -= 1; + } $rootScope.tabs = []; diff --git a/static/templates/char/armour.html b/static/templates/char/armour.html index c7b81cd..0f54389 100644 --- a/static/templates/char/armour.html +++ b/static/templates/char/armour.html @@ -1,13 +1,15 @@
-
+
+ +
-
+
diff --git a/static/templates/char/attributes.html b/static/templates/char/attributes.html index 3f8b35f..66391d7 100644 --- a/static/templates/char/attributes.html +++ b/static/templates/char/attributes.html @@ -2,7 +2,9 @@
+ +
diff --git a/static/templates/char/brain.html b/static/templates/char/brain.html index 2d03488..2c43660 100644 --- a/static/templates/char/brain.html +++ b/static/templates/char/brain.html @@ -1,9 +1,11 @@
-
+

+ +
@@ -13,7 +15,7 @@
-
+
Brain diff --git a/static/templates/char/survival.html b/static/templates/char/survival.html index 08f9e8c..291d9e0 100644 --- a/static/templates/char/survival.html +++ b/static/templates/char/survival.html @@ -1,10 +1,12 @@
-
+

+ +
-
+
Survival @@ -21,7 +23,7 @@
-
+
diff --git a/static/templates/settlement/name.html b/static/templates/settlement/name.html index cefb4a1..01adc19 100644 --- a/static/templates/settlement/name.html +++ b/static/templates/settlement/name.html @@ -1,6 +1,8 @@
+ Survival Limit +
diff --git a/static/templates/settlement/population.html b/static/templates/settlement/population.html index 52b25f5..0f81a16 100644 --- a/static/templates/settlement/population.html +++ b/static/templates/settlement/population.html @@ -1,6 +1,8 @@
-
+
+ +