From 114d3ba2f8ad93227d6aa74fa06845db0c1ec18a Mon Sep 17 00:00:00 2001 From: LupusUmbrae Date: Sun, 29 May 2016 23:56:05 +0100 Subject: [PATCH] Added timeline events are now removable - Updated settlement.json to mark base ones as static - Fixes #6 --- static/javascript/kdm.js | 11 ++++-- static/json/settlement.json | 42 +++++++++++++++-------- static/templates/settlement/timeline.html | 2 +- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/static/javascript/kdm.js b/static/javascript/kdm.js index b7f9552..e53c0d1 100644 --- a/static/javascript/kdm.js +++ b/static/javascript/kdm.js @@ -57,6 +57,13 @@ deleteTab($rootScope, tabid); } + $rootScope.removeEvent = function(timeline, year, event) { + var index = timeline[year.year - 1].events.indexOf(event) + if (index >= 0) { + timeline[year.year - 1].events.splice(index, 1) + } + } + $rootScope.inc = function(item, name="value") { if (item[name] === undefined) { item[name] = 0 @@ -155,7 +162,7 @@ var setEvent = $rootScope.addtimeline.event; console.log(setType) - + var ok = true; var msgs = []; if (isNaN(setYear) || setYear < 0 || setYear > 40) { @@ -202,7 +209,7 @@ $(this).dialog("close"); } }, - open : function(event, ui) { + open: function(event, ui) { $rootScope.addtimeline.option = "Story"; $rootScope.addtimeline.year = undefined; $rootScope.addtimeline.event = undefined; diff --git a/static/json/settlement.json b/static/json/settlement.json index 4cf00b0..6a5b3fa 100644 --- a/static/json/settlement.json +++ b/static/json/settlement.json @@ -132,7 +132,8 @@ "events":[ { "type":"story", - "eventName":"Returning Survivors" + "eventName":"Returning Survivors", + "static":true } ] }, @@ -141,7 +142,8 @@ "events":[ { "type":"story", - "eventName":"Endless Screams" + "eventName":"Endless Screams", + "static":true } ] }, @@ -156,7 +158,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - Butcher" + "eventName":"Nemesis Encounter - Butcher", + "static":true } ] }, @@ -165,7 +168,8 @@ "events":[ { "type":"story", - "eventName":"Hands of Heat" + "eventName":"Hands of Heat", + "static":true } ] }, @@ -174,7 +178,8 @@ "events":[ { "type":"story", - "eventName":"Armoured Strangers" + "eventName":"Armoured Strangers", + "static":true } ] }, @@ -183,7 +188,8 @@ "events":[ { "type":"story", - "eventName":"Phoenix Feather" + "eventName":"Phoenix Feather", + "static":true } ] }, @@ -198,7 +204,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - King's Man" + "eventName":"Nemesis Encounter - King's Man", + "static":true } ] }, @@ -213,7 +220,8 @@ "events":[ { "type":"story", - "eventName":"Regal Visit" + "eventName":"Regal Visit", + "static":true } ] }, @@ -222,7 +230,8 @@ "events":[ { "type":"story", - "eventName":"Principle: Conviction" + "eventName":"Principle: Conviction", + "static":true } ] }, @@ -249,7 +258,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - " + "eventName":"Nemesis Encounter", + "static":true } ] }, @@ -270,7 +280,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - " + "eventName":"Nemesis Encounter", + "static":true } ] }, @@ -279,7 +290,8 @@ "events":[ { "type":"story", - "eventName":"Watched" + "eventName":"Watched", + "static":true } ] }, @@ -300,7 +312,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - Level 3" + "eventName":"Nemesis Encounter - Level 3", + "static":true } ] }, @@ -315,7 +328,8 @@ "events":[ { "type":"nemesis", - "eventName":"Nemesis Encounter - Watcher" + "eventName":"Nemesis Encounter - Watcher", + "static":true } ] }, diff --git a/static/templates/settlement/timeline.html b/static/templates/settlement/timeline.html index be99145..f630a51 100644 --- a/static/templates/settlement/timeline.html +++ b/static/templates/settlement/timeline.html @@ -26,7 +26,7 @@
- + {{event.eventName}}   x