Changed item detail to a detail view with the option to edit

This commit is contained in:
Thaum
2015-04-16 09:00:48 +00:00
parent 690eea4f29
commit 638209719e
9 changed files with 194 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
<template name="effectView">
<div class="effectView" layout horizontal center>
{{#with statName}}
<div flex>{{statName}}</div>
<div flex>{{this}}</div>
{{else}}
<div flex>{{sourceName}}</div>
{{/with}}

View File

@@ -71,10 +71,10 @@ var stats = {
};
var operations = {
base: {name: "Base Value"},
base: {name: "Base Value"},
proficiency: {name: "Proficiency"},
add: {name: "Add"},
mul: {name: "Multiply"},
add: {name: "+"},
mul: {name: "x"},
min: {name: "Min"},
max: {name: "Max"},
advantage: {name: "Advantage"},
@@ -100,16 +100,16 @@ Template.effectView.helpers({
case "Characters":
return Characters.findOne(this.charId, {fields: {race: 1}}).race;
default:
return "Inate"
return "Inate";
}
},
statName: function(){
return stats[this.stat] && stats[this.stat].name || "No Stat"
return stats[this.stat] && stats[this.stat].name || "No Stat";
},
operationName: function(){
if(this.operation === "proficiency") return null;
if(stats[this.stat].group === "Weakness/Resistance") return null;
return operations[this.operation] && operations[this.operation].name || "No Operation"
return operations[this.operation] && operations[this.operation].name || "No Operation";
},
statValue: function(){
if(this.operation === "advantage" ||

View File

@@ -1,6 +1,6 @@
<!--needs to be given charId, (parentId or stat) and type-->
<template name="effectsViewList">
{{#if effects}}
{{#if effects.count}}
<hr style="margin: 16px 0 16px 0;">
<div id="effects">
<h2>Effects</h2>

View File

@@ -1,7 +1,7 @@
Template.effectsViewList.helpers({
effects: function(){
if(this.parentId){
return Effects.find({"parent.id": this.parentId, type: this.type, charId: this.charId}, {fields: {parent: 0}});
return Effects.find({"parent.id": this.parentId, charId: this.charId}, {fields: {parent: 0}});
} else if(this.stat){
return Effects.find({charId: this.charId, stat: this.stat});
}