Implemented very basic value-auditing for skills/abilities

This commit is contained in:
Thaum
2014-11-18 12:01:02 +00:00
parent d0e5a1a378
commit 5c99530077
13 changed files with 251 additions and 68 deletions

View File

@@ -2,7 +2,7 @@
<h2>Saving Throws</h2>
<table class="skillTable">
{{#each saveList}}
<tr>
<tr title={{effectList skill ..}}>
<td><div class="profIcon" style="background-image: url(/png/profIcons/{{profIcon skill}})"></div></td>
{{#if failSkill}}
<td class="fail">fail</td>
@@ -16,7 +16,7 @@
<h2>Skills</h2>
<table class="skillTable">
{{#each skillList}}
<tr>
<tr title={{effectList skill ..}}>
<td><div class="profIcon" style="background-image: url(/png/profIcons/{{profIcon skill}})"></div></td>
{{#if failSkill}}
<td class="fail">fail</td>

View File

@@ -9,11 +9,13 @@ Template.textField.helpers({
},
input: function(){
var text = this.character.strings[this.field];
return Spacebars.SafeString(text);
if (_.isString(text)) return Spacebars.SafeString(text);
return text;
},
output: function(){
var html = evaluateString(this.character, this.character.strings[this.field]);
return Spacebars.SafeString(html);
if (_.isString(html)) return Spacebars.SafeString(html);
return html;
},
outputClass: function(){
if(Template.instance().editing.get()){
@@ -28,6 +30,7 @@ Template.textField.events({
"blur #textInput": function(){
Template.instance().editing.set(false);
var text = $("#textInput").html();
if(!_.isString(text)) text = "";
//TODO sanitise the html
var setter = {};
setter["strings."+this.field] = text;

View File

@@ -2,7 +2,7 @@
{{>loginButtons}}
<div>
{{# each characters}}
<li><a href="{{ pathFor 'character' }} ">{{_id}}</a></li>
<li><a href="{{ pathFor 'character' }} ">{{_id}}</a> <button class="deleteChar">delete</button></li>
{{/each}}
</div>
<input id="addCharacter" type="button" value="Add Character">

View File

@@ -1,8 +1,8 @@
Template.home.events({
"click #addCharacter": function (event, template) {
Characters.insert(new Character(Meteor.userId()));
Characters.insert({});
},
"click #delete": function(event, template){
"click .delete": function(event, template){
Characters.remove(this._id);
}
});