diff --git a/rpg-docs/Model/Character/TemporaryHitPoints.js b/rpg-docs/Model/Character/TemporaryHitPoints.js
index 96752d4c..02b6e45d 100644
--- a/rpg-docs/Model/Character/TemporaryHitPoints.js
+++ b/rpg-docs/Model/Character/TemporaryHitPoints.js
@@ -5,7 +5,7 @@ Schemas.TemporaryHitPoints = new SimpleSchema({
name: {type: String, optional: true},
maximum: {type: Number, defaultValue: 0},
used: {type: Number, defaultValue: 0},
- deleteOnZero:{type: Boolean, defaultValue: true},
+ deleteOnZero:{type: Boolean, defaultValue: false},
dateAdded: {
type: Date,
autoValue: function() {
diff --git a/rpg-docs/client/globalHelpers/canEditCharacter.js b/rpg-docs/client/globalHelpers/canEditCharacter.js
index 95ba2ec6..2de1b6d6 100644
--- a/rpg-docs/client/globalHelpers/canEditCharacter.js
+++ b/rpg-docs/client/globalHelpers/canEditCharacter.js
@@ -1,6 +1,10 @@
Template.registerHelper("canEditCharacter", function(charId) {
+ return canEditCharacter(charId);
+});
+
+canEditCharacter = function(charId) {
var char = Characters.findOne(charId)
var userId = Meteor.userId();
return char.owner === userId ||
_.contains(char.writers, userId);
-});
+};
diff --git a/rpg-docs/client/views/character/features/features.html b/rpg-docs/client/views/character/features/features.html
index e39dd965..5726c166 100644
--- a/rpg-docs/client/views/character/features/features.html
+++ b/rpg-docs/client/views/character/features/features.html
@@ -95,14 +95,15 @@
+ checked={{enabled}}
+ disabled={{#unless canEditCharacter charId}}true{{/unless}}>
{{/if}}
{{#if description}}
{{evaluateString charId description}}
+ >{{evaluateString charId shortDescription}}
{{/if}}
{{#if hasUses}}
diff --git a/rpg-docs/client/views/character/features/features.js b/rpg-docs/client/views/character/features/features.js
index 3f68a6af..a0b1f329 100644
--- a/rpg-docs/client/views/character/features/features.js
+++ b/rpg-docs/client/views/character/features/features.js
@@ -3,14 +3,19 @@ Template.features.helpers({
var features = Features.find({charId: this._id}, {sort: {color: 1, name: 1}});
return features;
},
+ shortDescription: function() {
+ if (_.isString(this.description)){
+ return this.description.split(/[\n\r]{3,}/)[0];
+ }
+ },
hasUses: function(){
return this.usesValue() > 0;
},
noUsesLeft: function(){
- return this.usesLeft() <= 0;
+ return this.usesLeft() <= 0 || !canEditCharacter(this.charId);
},
usesFull: function(){
- return this.usesLeft() >= this.usesValue();
+ return this.usesLeft() >= this.usesValue() || !canEditCharacter(this.charId);
},
colorClass: function(){
return getColorClass(this.color);
@@ -99,12 +104,12 @@ Template.resource.helpers({
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var base = Characters.calculate.attributeBase(this.char._id, this.name);
var baseBigger = value < base;
- return !baseBigger;
+ return !baseBigger || !canEditCharacter(this.char._id);
},
cantDecrement: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var valuePositive = value > 0;
- return !valuePositive;
+ return !valuePositive || !canEditCharacter(this.char._id);
},
getColor: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html
index fcab2eb0..ff90d82c 100644
--- a/rpg-docs/client/views/character/inventory/inventory.html
+++ b/rpg-docs/client/views/character/inventory/inventory.html
@@ -35,8 +35,7 @@
+ layout horizontal center>
@@ -114,6 +113,7 @@
@@ -152,11 +152,11 @@
+ draggable={{canEditCharacter charId}}>
{{#if ne1 quantity}}{{quantity}} {{/if}}{{pluralName}}
- {{#if settings.showIncrement}}
+ {{#if settings.showIncrement}}{{#if canEditCharacter charId}}
- {{/if}}
+ {{/if}}{{/if}}
diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js
index cde203fa..aaca5e8f 100644
--- a/rpg-docs/client/views/character/inventory/inventory.js
+++ b/rpg-docs/client/views/character/inventory/inventory.js
@@ -48,8 +48,8 @@ Template.inventory.helpers({
{charId: this._id},
{fields: {value : 1}}
).forEach(function(container) {
- if(container.value) worth += container.value;
- })
+ if (container.value) worth += container.value;
+ });
return worth;
},
weightCarried: function(){
diff --git a/rpg-docs/client/views/character/journal/journal.html b/rpg-docs/client/views/character/journal/journal.html
index 1ab6a6ab..6d2a048a 100644
--- a/rpg-docs/client/views/character/journal/journal.html
+++ b/rpg-docs/client/views/character/journal/journal.html
@@ -10,7 +10,8 @@
layout horizontal center>
Experience
{{characterCalculate "experience" _id}} XP
-
+
{{#each experiences}}
@@ -55,7 +56,8 @@
+ icon="add"
+ disabled={{#unless canEditCharacter _id}}true{{/unless}}>
diff --git a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
index 4d31f38e..8bbf52ff 100644
--- a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
+++ b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html
@@ -1,5 +1,5 @@
- {{#baseDialog title=title class=colorClass hideColor="true" hideDelete="true" startEditing=startEditing}}
+ {{#baseDialog title=title class=colorClass hideColor="true" hideDelete="true"}}
{{evaluateString charId value}}
{{> proficiencyViewList charId=charId parentId=charId parentGroup="background"}}
{{else}}
diff --git a/rpg-docs/client/views/character/spells/spells.html b/rpg-docs/client/views/character/spells/spells.html
index da79791e..f6d68b4f 100644
--- a/rpg-docs/client/views/character/spells/spells.html
+++ b/rpg-docs/client/views/character/spells/spells.html
@@ -72,6 +72,7 @@
diff --git a/rpg-docs/client/views/character/spells/spells.js b/rpg-docs/client/views/character/spells/spells.js
index 3ec6e0ea..067160d1 100644
--- a/rpg-docs/client/views/character/spells/spells.js
+++ b/rpg-docs/client/views/character/spells/spells.js
@@ -112,7 +112,7 @@ Template.spells.helpers({
for (i = 0; i < currentSlots; i++){
bubbles.push({
icon: "radio-button-on",
- disabled: i !== currentSlots - 1, //last full slot not disabled
+ disabled: i !== currentSlots - 1 || !canEditCharacter(char._id), //last full slot not disabled
attribute: "level" + this.level + "SpellSlots",
charId: char._id,
});
@@ -120,7 +120,7 @@ Template.spells.helpers({
for (i = 0; i < slotsUsed; i++){
bubbles.push({
icon: "radio-button-off",
- disabled: i !== 0, //first empty slot not disabled
+ disabled: i !== 0 || !canEditCharacter(char._id), //first empty slot not disabled
attribute: "level" + this.level + "SpellSlots",
charId: char._id,
});
diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.html b/rpg-docs/client/views/character/stats/healthCard/healthCard.html
index e31c042c..fb1a2506 100644
--- a/rpg-docs/client/views/character/stats/healthCard/healthCard.html
+++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.html
@@ -6,7 +6,11 @@
hero-id="toolbar" {{detailHero "hitPoints" _id}}
layout vertical center center-justified>
Hit Points
-
+
+
@@ -14,6 +18,7 @@
value={{characterCalculate "attributeValue" _id "hitPoints"}}
max={{characterCalculate "attributeBase" _id "hitPoints"}}
editable pin
+ disabled={{#unless canEditCharacter _id}}true{{/unless}}
role="slider">
diff --git a/rpg-docs/client/views/character/stats/hitDice/hitDice.js b/rpg-docs/client/views/character/stats/hitDice/hitDice.js
index 7399309d..4e49f4b3 100644
--- a/rpg-docs/client/views/character/stats/hitDice/hitDice.js
+++ b/rpg-docs/client/views/character/stats/hitDice/hitDice.js
@@ -2,11 +2,11 @@ Template.hitDice.helpers({
cantIncrement: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var base = Characters.calculate.attributeBase(this.char._id, this.name);
- return value >= base;
+ return value >= base || !canEditCharacter(this.char._id);
},
cantDecrement: function(){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
- return value <= 0;
+ return value <= 0 || !canEditCharacter(this.char._id);
},
conMod: function(){
return signedString(
diff --git a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js
index ee63d033..adf63f76 100644
--- a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js
+++ b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js
@@ -9,20 +9,11 @@ Template.baseDialog.onRendered(function(){
Template.baseDialog.helpers({
editing: function(){
- return Template.instance().editing.get();
+ return Template.instance().editing.get() && canEditCharacter(Template.parentData().charId);
},
showEdit: function() {
if (this.hideEdit) return false;
- var charId = Template.parentData().charId;
- var userId = Meteor.userId();
- if (!userId) return false;
- if (charId){
- var char = Characters.findOne(charId);
- if (char)
- return char.owner === userId ||
- _.contains(char.writers, userId);
- }
- return true;
+ return canEditCharacter(Template.parentData().charId);
},
});