implemented UI for new parenting
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template name="effectView">
|
||||
<div class="effectView" layout horizontal center>
|
||||
{{#if sourceId}}
|
||||
<div>{{sourceName}}</div>
|
||||
{{else}}
|
||||
{{#with statName}}
|
||||
<div flex>{{statName}}</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<div flex>{{sourceName}}</div>
|
||||
{{/with}}
|
||||
<div>{{operationName}}</div>
|
||||
<div>{{statValue}}</div>
|
||||
<br>
|
||||
|
||||
@@ -86,20 +86,20 @@ var operations = {
|
||||
|
||||
Template.effectView.helpers({
|
||||
sourceName: function(){
|
||||
var id = this.sourceId;
|
||||
var id = this.parent.id;
|
||||
if(!id) return;
|
||||
switch(this.type){
|
||||
case "feature":
|
||||
switch(this.parent.collection){
|
||||
case "Features":
|
||||
return "Feature - " + Features.findOne(id, {fields: {name: 1}}).name;
|
||||
case "class":
|
||||
case "Classes":
|
||||
return Classes.findOne(id, {fields: {name: 1}}).name;
|
||||
case "buff":
|
||||
case "Buffs":
|
||||
return "Buff - " + Buffs.findOne(id, {fields: {name: 1}}).name;
|
||||
case "equipment":
|
||||
case "Items":
|
||||
return "Equipment - " + Items.findOne(id, {fields: {name: 1}}).name;
|
||||
case "racial":
|
||||
case "Characters":
|
||||
return Characters.findOne(this.charId, {fields: {race: 1}}).race;
|
||||
case "inate":
|
||||
default:
|
||||
return "Inate"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!--needs to be given charId, sourceId and type-->
|
||||
<!--needs to be given charId, parentId, parentCollection and type-->
|
||||
<template name="effectsEditList">
|
||||
{{#if effects.count}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Template.effectsEditList.helpers({
|
||||
effects: function(){
|
||||
var cursor = Effects.find({sourceId: this.sourceId, type: this.type});
|
||||
var cursor = Effects.find({"parent.id": this.parentId, "parent.collection": this.parentCollection, type: this.type});
|
||||
return cursor;
|
||||
}
|
||||
});
|
||||
@@ -13,7 +13,10 @@ Template.effectsEditList.events({
|
||||
Effects.insert({
|
||||
name: this.name,
|
||||
charId: this.charId,
|
||||
sourceId: this.sourceId,
|
||||
parent: {
|
||||
id: this.parentId,
|
||||
collection: this.parentCollection
|
||||
},
|
||||
operation: "add",
|
||||
type: this.type,
|
||||
enabled: this.enabled
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!--needs to be given charId, sourceId and type-->
|
||||
<!--needs to be given charId, (parentId or stat) and type-->
|
||||
<template name="effectsViewList">
|
||||
{{#if effects}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Template.effectsViewList.helpers({
|
||||
effects: function(){
|
||||
if(this.sourceId){
|
||||
return Effects.find({sourceId: this.sourceId, type: this.type, charId: this.charId}, {fields: {sourceId: 0}});
|
||||
if(this.parentId){
|
||||
return Effects.find({"parent.id": this.parentId, type: this.type, charId: this.charId}, {fields: {parent: 0}});
|
||||
} else if(this.stat){
|
||||
return Effects.find({charId: this.charId, stat: this.stat});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user