From 73b43574eeb1c585b7975613cf8d3adfc68c6afd Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Mon, 29 Jul 2019 12:49:19 +0200 Subject: [PATCH] Added spell and spell list forms --- .../api/creature/properties/SpellLists.js | 2 +- app/imports/api/creature/properties/Spells.js | 32 +-- app/imports/ui/forms/SpellForm.vue | 199 ++++++++++++++++++ app/imports/ui/forms/SpellListForm.vue | 56 +++++ .../ui/forms/components/propertyFormIndex.js | 4 + 5 files changed, 277 insertions(+), 16 deletions(-) create mode 100644 app/imports/ui/forms/SpellForm.vue create mode 100644 app/imports/ui/forms/SpellListForm.vue diff --git a/app/imports/api/creature/properties/SpellLists.js b/app/imports/api/creature/properties/SpellLists.js index c6246335..9089ddc1 100644 --- a/app/imports/api/creature/properties/SpellLists.js +++ b/app/imports/api/creature/properties/SpellLists.js @@ -24,7 +24,6 @@ let SpellListSchema = schema({ type: String, regEx: VARIABLE_NAME_REGEX, min: 3, - defaultValue: 'newAttribute', }, description: { type: String, @@ -72,3 +71,4 @@ const updateSpellList = new ValidatedMethod({ }); export default SpellLists; +export { SpellListSchema } diff --git a/app/imports/api/creature/properties/Spells.js b/app/imports/api/creature/properties/Spells.js index 553e1d4d..298723e4 100644 --- a/app/imports/api/creature/properties/Spells.js +++ b/app/imports/api/creature/properties/Spells.js @@ -12,14 +12,14 @@ import propagateInheritanceUpdateMixin from '/imports/api/creature/mixins/propag import updateSchemaMixin from '/imports/api/creature/mixins/updateSchemaMixin.js'; const magicSchools = [ - 'Abjuration', - 'Conjuration', - 'Divination', - 'Enchantment', - 'Evocation', - 'Illusion', - 'Necromancy', - 'Transmutation', + 'abjuration', + 'conjuration', + 'divination', + 'enchantment', + 'evocation', + 'illusion', + 'necromancy', + 'transmutation', ]; let Spells = new Mongo.Collection('spells'); @@ -33,7 +33,7 @@ let SpellSchema = schema({ // prepared in a spell list, and enabled should be true alwaysPrepared: { type: Boolean, - defaultValue: false, + optional: true, }, // Spell lists that this spell appears on spellLists: { @@ -63,31 +63,33 @@ let SpellSchema = schema({ }, verbal: { type: Boolean, - defaultValue: false + optional: true, }, somatic: { type: Boolean, - defaultValue: false + optional: true, }, concentration: { type: Boolean, - defaultValue: false + optional: true, }, material: { type: String, - optional: true + optional: true, }, ritual: { type: Boolean, - defaultValue: false, + optional: true, }, level: { type: SimpleSchema.Integer, defaultValue: 1, + max: 9, + min: 0, }, school: { type: String, - defaultValue: 'Abjuration', + defaultValue: 'abjuration', allowedValues: magicSchools, }, }); diff --git a/app/imports/ui/forms/SpellForm.vue b/app/imports/ui/forms/SpellForm.vue new file mode 100644 index 00000000..082d1ddf --- /dev/null +++ b/app/imports/ui/forms/SpellForm.vue @@ -0,0 +1,199 @@ + + + + + diff --git a/app/imports/ui/forms/SpellListForm.vue b/app/imports/ui/forms/SpellListForm.vue new file mode 100644 index 00000000..2f9c699c --- /dev/null +++ b/app/imports/ui/forms/SpellListForm.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/app/imports/ui/forms/components/propertyFormIndex.js b/app/imports/ui/forms/components/propertyFormIndex.js index 45c1125d..1cafcdcc 100644 --- a/app/imports/ui/forms/components/propertyFormIndex.js +++ b/app/imports/ui/forms/components/propertyFormIndex.js @@ -11,6 +11,8 @@ import NoteForm from '/imports/ui/forms/NoteForm.vue'; import ProficiencyForm from '/imports/ui/forms/ProficiencyForm.vue'; import RollForm from '/imports/ui/forms/RollForm.vue'; import SkillForm from '/imports/ui/forms/SkillForm.vue'; +import SpellListForm from '/imports/ui/forms/SpellListForm.vue'; +import SpellForm from '/imports/ui/forms/SpellForm.vue'; export default { action: ActionForm, @@ -26,4 +28,6 @@ export default { proficiency: ProficiencyForm, roll: RollForm, skill: SkillForm, + spellList: SpellListForm, + spell: SpellForm, };