Description fields should now show calculation errors

This commit is contained in:
Stefan Zermatten
2021-02-12 11:43:13 +02:00
parent b9e0475d07
commit a078ce3d5d
13 changed files with 84 additions and 2 deletions

View File

@@ -24,6 +24,7 @@
:hint="actionTypeHints[model.actionType]"
@change="change('actionType', ...arguments)"
/>
<text-field
v-if="attackForm"
label="Roll bonus"
@@ -31,6 +32,8 @@
:error-messages="errors.rollBonus"
@change="change('rollBonus', ...arguments)"
/>
<calculation-error-list :errors="model.rollBonusErrors" />
<text-area
label="Summary"
hint="This will appear in the action card in the character sheet"
@@ -38,6 +41,8 @@
:error-messages="errors.summary"
@change="change('summary', ...arguments)"
/>
<calculation-error-list :calculations="model.summaryCalculations" />
<text-area
label="Description"
hint="The rest of the description that doesn't fit in the summary goes here"
@@ -45,6 +50,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-sections>
<form-section name="Resources">
<resources-form
@@ -81,6 +88,7 @@
:error-messages="errors.uses"
@change="change('uses', ...arguments)"
/>
<calculation-error-list :errors="model.usesErrors" />
<text-field
label="Uses used"
type="number"
@@ -110,12 +118,14 @@
import FormSection, {FormSections} from '/imports/ui/properties/forms/shared/FormSection.vue';
import ResourcesForm from '/imports/ui/properties/forms/ResourcesForm.vue';
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
FormSection,
FormSections,
ResourcesForm,
CalculationErrorList,
},
mixins: [propertyFormMixin],
props: {

View File

@@ -61,6 +61,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-section
name="Advanced"
standalone

View File

@@ -13,6 +13,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<!-- Duration not implemented yet
<text-field
label="Duration"
@@ -44,8 +46,12 @@
<script>
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
CalculationErrorList,
},
mixins: [propertyFormMixin],
props: {
parentTarget: {

View File

@@ -27,6 +27,7 @@
@change="change('variableName', ...arguments)"
/>
</div>
<text-area
label="Description"
hint="A brief description of what this class level gives a character"
@@ -34,6 +35,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<text-field
label="Condition"
hint="A caclulation to determine if this can be added to the character"
@@ -56,8 +59,12 @@
<script>
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
CalculationErrorList,
},
mixins: [propertyFormMixin],
};
</script>

View File

@@ -51,6 +51,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-section
name="Advanced"
standalone
@@ -80,10 +82,12 @@
<script>
import FormSection from '/imports/ui/properties/forms/shared/FormSection.vue';
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
FormSection,
CalculationErrorList,
},
mixins: [propertyFormMixin],
}

View File

@@ -14,6 +14,8 @@
:error-messages="errors.summary"
@change="change('summary', ...arguments)"
/>
<calculation-error-list :calculations="model.summaryCalculations" />
<text-area
label="Description"
hint="The rest of the description that doesn't fit in the summary goes here"
@@ -21,6 +23,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<smart-combobox
label="Tags"
multiple
@@ -35,8 +39,12 @@
<script>
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
CalculationErrorList,
},
mixins: [propertyFormMixin],
data(){ return{
enabledOptions: [

View File

@@ -75,6 +75,8 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-section
name="Advanced"
standalone
@@ -121,10 +123,12 @@
<script>
import FormSection from '/imports/ui/properties/forms/shared/FormSection.vue';
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
FormSection,
CalculationErrorList,
},
mixins: [propertyFormMixin],
}

View File

@@ -34,12 +34,15 @@
:menu-props="{auto: true, lazy: true}"
@change="change('skillType', ...arguments)"
/>
<text-area
label="Description"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-section
name="Advanced"
standalone

View File

@@ -15,12 +15,15 @@
:error-messages="errors.name"
@change="change('name', ...arguments)"
/>
<text-area
label="Description"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<text-field
label="Picture URL"
hint="A link to an image representing this property"
@@ -69,8 +72,12 @@
<script>
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import PROPERTIES from '/imports/constants/PROPERTIES.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
CalculationErrorList,
},
mixins: [propertyFormMixin],
data(){
let slotTypes = [];

View File

@@ -44,12 +44,15 @@
@change="change('slotCondition', ...arguments)"
/>
<calculation-error-list :errors="model.slotConditionErrors" />
<text-area
label="Description"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<form-section
name="Advanced"
standalone

View File

@@ -96,12 +96,15 @@
:error-messages="errors.duration"
@change="change('duration', ...arguments)"
/>
<text-area
label="Description"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<smart-combobox
label="Tags"
multiple
@@ -128,12 +131,14 @@
import FormSection, { FormSections } from '/imports/ui/properties/forms/shared/FormSection.vue';
import ActionForm from '/imports/ui/properties/forms/ActionForm.vue'
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
components: {
FormSections,
FormSection,
ActionForm,
CalculationErrorList,
},
mixins: [propertyFormMixin],
data(){return {

View File

@@ -17,12 +17,15 @@
@change="change('variableName', ...arguments)"
/>
</div>
<text-area
label="Description"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
<text-field
label="Maximum prepared spells"
:value="model.maxPrepared"
@@ -31,6 +34,7 @@
@change="change('maxPrepared', ...arguments)"
/>
<calculation-error-list :errors="model.maxPreparedErrors" />
<smart-combobox
label="Tags"
multiple

View File

@@ -1,6 +1,6 @@
<template lang="html">
<div
v-if="errors && errors.length"
v-if="computedErrors.length"
class="error-list"
>
<v-slide-x-transition
@@ -8,7 +8,7 @@
hide-on-leave
>
<v-alert
v-for="error in errors"
v-for="error in computedErrors"
:key="error.message"
:value="true"
:icon="errorIcon(error.type)"
@@ -28,6 +28,25 @@ export default {
type: Array,
default: undefined,
},
calculations: {
type: Array,
default: undefined,
},
},
computed: {
computedErrors(){
if (this.errors) {
return this.errors;
} else if (this.calculations){
let errors = [];
this.calculations.forEach(calc => {
if (calc.errors) errors.push(...calc.errors)
});
return errors;
} else {
return [];
}
},
},
methods: {
errorIcon(type){