mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-08-30 19:52:29 +00:00
27 lines
1.4 KiB
Plaintext
27 lines
1.4 KiB
Plaintext
//- @pugdoc
|
|
name: compendiumAttributes
|
|
description: Creates a set of compendium drop target attributes. Defaults to creating target attributes for the `Name` and `data` compendium attributes.
|
|
arguments:
|
|
- {string} [prefix] - A prefix to attach to the default attribute names.
|
|
- {array} [lookupAttributes = ['Name','data']] - An array of the lookup attributes to create targets for. The target attributes are named based on the compendium attribute they are for.
|
|
- {string} [triggerAccept = 'Name'] - The compendium attribute that should trigger the sheetworkers to handle the compendium drop.
|
|
- {object} [trigger] - The trigger object.
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
//Using just defaults
|
|
+compendiumAttributes({})
|
|
|
|
//Specifying a prefix
|
|
+compendiumAttributes({prefix:'prefix'})
|
|
|
|
//Specifying lookupAttributes and a prefix
|
|
+compendiumAttributes({lookupAttributes:['Name','data','Category'],prefix:'prefix'})
|
|
mixin compendiumAttributes({prefix,lookupAttributes = ['Name','data'],triggerAccept = 'Name',trigger = {triggeredFuncs:["handleCompendiumDrop"]}})
|
|
- prefix = prefix ? `${prefix} ` : '';
|
|
each accept in lookupAttributes
|
|
- let inputObj = {name:`${prefix}drop ${accept.toLowerCase()}`,accept,value:''};
|
|
if accept === triggerAccept
|
|
- inputObj.trigger = trigger;
|
|
+hidden(inputObj)
|
|
//- End Mixin |