Skip to content

Commit

Permalink
Added timeline events are now removable
Browse files Browse the repository at this point in the history
- Updated settlement.json to mark base ones as static
- Fixes #6
  • Loading branch information
LupusUmbrae committed May 29, 2016
1 parent 1c9d788 commit 114d3ba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
11 changes: 9 additions & 2 deletions static/javascript/kdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -155,7 +162,7 @@
var setEvent = $rootScope.addtimeline.event;

console.log(setType)

var ok = true;
var msgs = [];
if (isNaN(setYear) || setYear < 0 || setYear > 40) {
Expand Down Expand Up @@ -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;
Expand Down
42 changes: 28 additions & 14 deletions static/json/settlement.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
"events":[
{
"type":"story",
"eventName":"Returning Survivors"
"eventName":"Returning Survivors",
"static":true
}
]
},
Expand All @@ -141,7 +142,8 @@
"events":[
{
"type":"story",
"eventName":"Endless Screams"
"eventName":"Endless Screams",
"static":true
}
]
},
Expand All @@ -156,7 +158,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - Butcher"
"eventName":"Nemesis Encounter - Butcher",
"static":true
}
]
},
Expand All @@ -165,7 +168,8 @@
"events":[
{
"type":"story",
"eventName":"Hands of Heat"
"eventName":"Hands of Heat",
"static":true
}
]
},
Expand All @@ -174,7 +178,8 @@
"events":[
{
"type":"story",
"eventName":"Armoured Strangers"
"eventName":"Armoured Strangers",
"static":true
}
]
},
Expand All @@ -183,7 +188,8 @@
"events":[
{
"type":"story",
"eventName":"Phoenix Feather"
"eventName":"Phoenix Feather",
"static":true
}
]
},
Expand All @@ -198,7 +204,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - King's Man"
"eventName":"Nemesis Encounter - King's Man",
"static":true
}
]
},
Expand All @@ -213,7 +220,8 @@
"events":[
{
"type":"story",
"eventName":"Regal Visit"
"eventName":"Regal Visit",
"static":true
}
]
},
Expand All @@ -222,7 +230,8 @@
"events":[
{
"type":"story",
"eventName":"Principle: Conviction"
"eventName":"Principle: Conviction",
"static":true
}
]
},
Expand All @@ -249,7 +258,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - "
"eventName":"Nemesis Encounter",
"static":true
}
]
},
Expand All @@ -270,7 +280,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - "
"eventName":"Nemesis Encounter",
"static":true
}
]
},
Expand All @@ -279,7 +290,8 @@
"events":[
{
"type":"story",
"eventName":"Watched"
"eventName":"Watched",
"static":true
}
]
},
Expand All @@ -300,7 +312,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - Level 3"
"eventName":"Nemesis Encounter - Level 3",
"static":true
}
]
},
Expand All @@ -315,7 +328,8 @@
"events":[
{
"type":"nemesis",
"eventName":"Nemesis Encounter - Watcher"
"eventName":"Nemesis Encounter - Watcher",
"static":true
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion static/templates/settlement/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<img src="static/images/nemesis.svg" width="15" height="15" ng-show="event.type == 'nemesis'">
</div>
<div class="col-xs-10">
<small><input type="text" class="noborder fullwidth left-align" readonly ng-model="event.eventName"></small>
<small><span>{{event.eventName}}</span><span ng-hide="event.static" ng-click="removeEvent(kdm.timeline, year, event)">&nbsp;&nbsp;&nbsp;x</span></small>
</div>
</div>
<div ng-hide="year.events.length" class="row">
Expand Down

0 comments on commit 114d3ba

Please sign in to comment.