Library attribute insert form complete

This commit is contained in:
Stefan Zermatten
2019-07-02 17:28:07 +02:00
parent 4abb5edbf3
commit 93d8a8d33e
9 changed files with 152 additions and 79 deletions

View File

@@ -26,11 +26,14 @@ let AttributeSchema = schema({
name: {
type: String,
optional: true,
defaultValue: 'New Attribute',
},
// The technical, lowercase, single-word name used in formulae
variableName: {
type: String,
regEx: VARIABLE_NAME_REGEX,
min: 3,
defaultValue: 'newAttribute',
},
// How it is displayed and computed is determined by type
type: {
@@ -46,6 +49,7 @@ let AttributeSchema = schema({
'spellSlot', // Level 1, 2, 3... spell slots
'utility', // Aren't displayed, Jump height, Carry capacity
],
defaultValue: 'stat',
index: 1,
},
// The starting value, before effects

View File

@@ -65,10 +65,7 @@ function assertNodeEditPermission(node, userId){
const insertNode = new ValidatedMethod({
name: 'LibraryNodes.methods.insert',
mixins: [
simpleSchemaMixin,
],
schema: LibraryNodeSchema,
validate: null,
run(libraryNode) {
assertNodeEditPermission(libraryNode, this.userId);
return LibraryNodes.insert(libraryNode);