Enabled editing of attribute damage in library forms

This commit is contained in:
Stefan Zermatten
2021-06-18 10:43:27 +02:00
parent e3fc56a844
commit 81d52a1847
3 changed files with 16 additions and 5 deletions

View File

@@ -113,13 +113,14 @@
},
reactiveProvide: {
name: 'context',
include: ['editPermission'],
include: ['editPermission', 'isLibraryForm'],
},
data(){return {
editing: !!this.startInEditTab,
// CurrentId lags behind Id by one tick so that events fired by destroying
// forms keyed to the old ID are applied before the new ID overwrites it
currentId: undefined,
isLibraryForm: true,
}},
watch: {
_id: {

View File

@@ -58,7 +58,7 @@ export default {
},
reactiveProvide: {
name: 'context',
include: ['debounceTime'],
include: ['debounceTime', 'isLibraryForm'],
},
data(){return {
model: {
@@ -67,6 +67,7 @@ export default {
schema: undefined,
validationContext: undefined,
debounceTime: 0,
isLibraryForm: true,
};},
watch: {
type(newType){

View File

@@ -62,7 +62,7 @@
@change="change('description', ...arguments)"
/>
<calculation-error-list :calculations="model.descriptionCalculations" />
{{ cntxt }}
<form-section
name="Advanced"
standalone
@@ -94,7 +94,7 @@
class="damage-field text-center"
style="max-width: 300px;"
hint="The attribute's final value is reduced by this amount"
disabled
:disabled="!context.isLibraryForm"
:value="model.damage"
:error-messages="errors.damage"
@change="change('damage', ...arguments)"
@@ -124,6 +124,9 @@
import CalculationErrorList from '/imports/ui/properties/forms/shared/CalculationErrorList.vue';
export default {
inject: {
context: { default: {} }
},
components: {
FormSection,
CalculationErrorList,
@@ -179,6 +182,12 @@
});
return data;
},
computed: {
cntxt(){
console.log(this.context);
return this.context;
}
},
watch: {
'model.attributeType': function(newVal, oldVal){
if (newVal === 'hitDice' && !this.model.hitDiceSize){
@@ -187,7 +196,7 @@
this.$emit('change', {path: ['hitDiceSize'], value: undefined});
}
},
},
}
};
</script>