From 16c8c1db81fe9990a0603dd8a9ef0ad4523334af Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 11 Feb 2021 16:16:22 +0200 Subject: [PATCH] Improved descriptions in log entries --- app/imports/api/creature/actions/applyAction.js | 4 ++-- app/imports/api/creature/log/CreatureLogs.js | 4 ++-- app/imports/api/creature/log/LogContentSchema.js | 4 ++++ app/imports/ui/log/LogEntry.vue | 9 +++++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/imports/api/creature/actions/applyAction.js b/app/imports/api/creature/actions/applyAction.js index 6738e4a2..895a01e9 100644 --- a/app/imports/api/creature/actions/applyAction.js +++ b/app/imports/api/creature/actions/applyAction.js @@ -9,14 +9,14 @@ export default function applyAction({prop, log}){ } if (prop.summary){ log.content.push({ - details: embedInlineCalculations( + description: embedInlineCalculations( prop.summary, prop.summaryCalculations ), }); } if (prop.description){ log.content.push({ - details: embedInlineCalculations( + description: embedInlineCalculations( prop.description, prop.descriptionCalculations ), }); diff --git a/app/imports/api/creature/log/CreatureLogs.js b/app/imports/api/creature/log/CreatureLogs.js index d6f7bc76..d0add822 100644 --- a/app/imports/api/creature/log/CreatureLogs.js +++ b/app/imports/api/creature/log/CreatureLogs.js @@ -160,7 +160,7 @@ const logRoll = new ValidatedMethod({ let compiled = parsedResult.compile(creature.variables, rollContext); let compiledString = compiled.toString(); if (!equalIgnoringWhitespace(compiledString, roll)) logContent.push({ - result: roll + details: roll }); logContent.push({ details: compiledString @@ -168,7 +168,7 @@ const logRoll = new ValidatedMethod({ let rolled = compiled.roll(creature.variables, rollContext); let rolledString = rolled.toString(); if (rolledString !== compiledString) logContent.push({ - details: rolled.toString() + result: rolled.toString() }); let result = rolled.reduce(creature.variables, rollContext); let resultString = result.toString(); diff --git a/app/imports/api/creature/log/LogContentSchema.js b/app/imports/api/creature/log/LogContentSchema.js index 824d9133..80c9994b 100644 --- a/app/imports/api/creature/log/LogContentSchema.js +++ b/app/imports/api/creature/log/LogContentSchema.js @@ -27,6 +27,10 @@ let LogContentSchema = new SimpleSchema({ type: String, optional: true, }, + description: { + type: String, + optional: true, + }, context: { type: Object, optional: true, diff --git a/app/imports/ui/log/LogEntry.vue b/app/imports/ui/log/LogEntry.vue index 527f7026..82c5ff18 100644 --- a/app/imports/ui/log/LogEntry.vue +++ b/app/imports/ui/log/LogEntry.vue @@ -30,10 +30,13 @@ v-if="content.result" class="subheading font-weight-bold mx-1" >{{ content.result }} - {{ content.details }} + @@ -59,6 +62,8 @@ export default {