From f7ee09470e4f577c595f6e94c4ea116f74c73113 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Sun, 31 May 2020 18:50:00 +0200 Subject: [PATCH] Improved container and item forms and viewers --- app/imports/api/properties/Containers.js | 14 +++- .../ui/properties/forms/ContainerForm.vue | 49 ++++++++------ app/imports/ui/properties/forms/ItemForm.vue | 5 +- .../ui/properties/viewers/ContainerViewer.vue | 66 +++++++++++++------ .../ui/properties/viewers/ItemViewer.vue | 44 ++++++------- .../viewers/shared/PropertyTags.vue | 30 +++++++++ .../viewers/shared/propertyViewerMixin.js | 2 + app/imports/ui/vueSetup.js | 31 ++++++--- 8 files changed, 167 insertions(+), 74 deletions(-) create mode 100644 app/imports/ui/properties/viewers/shared/PropertyTags.vue diff --git a/app/imports/api/properties/Containers.js b/app/imports/api/properties/Containers.js index 45f1ecef..94b36000 100644 --- a/app/imports/api/properties/Containers.js +++ b/app/imports/api/properties/Containers.js @@ -32,4 +32,16 @@ let ContainerSchema = new SimpleSchema({ }, }); -export { ContainerSchema }; +const ComputedOnlyContainerSchema = new SimpleSchema({ + // Weight of all the contents, zero if `contentsWeightless` is true + contentsWeight:{ + type: Number, + optional: true, + }, +}); + +const ComputedContainerSchema = new SimpleSchema() + .extend(ComputedOnlyContainerSchema) + .extend(ContainerSchema); + +export { ContainerSchema, ComputedContainerSchema }; diff --git a/app/imports/ui/properties/forms/ContainerForm.vue b/app/imports/ui/properties/forms/ContainerForm.vue index f8d4183f..3601d81a 100644 --- a/app/imports/ui/properties/forms/ContainerForm.vue +++ b/app/imports/ui/properties/forms/ContainerForm.vue @@ -1,11 +1,22 @@ diff --git a/app/imports/ui/properties/forms/ItemForm.vue b/app/imports/ui/properties/forms/ItemForm.vue index 13082de6..8540208a 100644 --- a/app/imports/ui/properties/forms/ItemForm.vue +++ b/app/imports/ui/properties/forms/ItemForm.vue @@ -41,17 +41,19 @@ hint="The value of the item in gold pieces, using decimals for values less than 1 gp" class="mx-1" style="flex-basis: 300px;" + prepend-inner-icon="$vuetify.icons.two_coins" :value="model.value" :error-messages="errors.value" @change="change('value', ...arguments)" />
- -
- Not carried + +
+
+ + + $vuetify.icons.two_coins + + + +
+
+ + + {{ model.weight }} lb + + + $vuetify.icons.weight + + +
-
- Contents are weightless -
- - diff --git a/app/imports/ui/properties/viewers/ItemViewer.vue b/app/imports/ui/properties/viewers/ItemViewer.vue index 1c91b3f9..ba69bc05 100644 --- a/app/imports/ui/properties/viewers/ItemViewer.vue +++ b/app/imports/ui/properties/viewers/ItemViewer.vue @@ -1,14 +1,9 @@