mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-08-30 19:52:29 +00:00
140 lines
4.5 KiB
Plaintext
140 lines
4.5 KiB
Plaintext
|
|
//- @pugdoc
|
|
name: input
|
|
description: A generic mixin to create an input. The mixin will replace spaces in the attribute name with underscores and will add a title property if one isn't supplied that will inform the user what the attribute call for the attribute is.
|
|
arguments:
|
|
- {object} inputObj - An object describing the properties of the input just like they would be in a PUG or HTML element declaration, but in JS Object syntax. May also include a trigger property
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+input({name:'my attribute',type:'text',class:'some-class',trigger:{affects:['other_attribute']}})
|
|
mixin input(obj)
|
|
- checkKUse();
|
|
- obj.class = obj.class ? replaceProblems(obj.class) : undefined;
|
|
- obj.name = attrName(obj.name);
|
|
- obj.title = obj.title || attrTitle(obj.name);
|
|
- obj.name = `attr_${obj.name}`;
|
|
- const elementObj = makeElementObj(obj);
|
|
- addFieldToFieldsetObj(obj);
|
|
- storeTrigger(obj);
|
|
input&attributes(elementObj)&attributes(attributes)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: text
|
|
description: An alias for {@link input} that specifies the input type as text. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+text({name:'my attribute',class:'some-class',trigger:{affects:['other_attribute']}})
|
|
mixin text(obj)
|
|
- obj.type = 'text';
|
|
+input(obj)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: checkbox
|
|
description: An alias for {@link input} that specifies the input type as checkbox. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
mixin checkbox(obj)
|
|
- obj.type = 'checkbox';
|
|
+input(obj)&attributes(attributes)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: collapse
|
|
description: Alias for {@link checkbox} that creates a checkbox for us in collapse/expanding a section. Sets the checkbox to unchecked with a checked value of `1` and a class of `collapse`. Additional classes/ids can be applied by applying them inline to the mixin call.
|
|
arguments:
|
|
- {string} [name=collapse] - The name to use for the collapse element. Defaults to `collapse`
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+collapse()
|
|
mixin collapse(name='collapse',isCollapsed)
|
|
- const checkObj = {name,value:1,class:'collapse'}
|
|
if isCollapsed
|
|
- checkObj.checked = '';
|
|
+checkbox(checkObj)&attributes(attributes)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: radio
|
|
description: Alias for {@link input} that specifies `radio` as the input type. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
mixin radio(obj)
|
|
- obj.type = 'radio';
|
|
+input(obj)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: number
|
|
description: Alias for {@link input} that makes a number input. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+number({name:'my number',class:'some-class',trigger:{affects:['other_attribute']}})
|
|
mixin number(obj)
|
|
- obj.type = 'number';
|
|
+input(obj)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: range
|
|
description: Alias for {@link input} that makes a range input. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+range({name:'my range',class:'some-class'})
|
|
mixin range(obj)
|
|
- obj.type = 'range';
|
|
+input(obj)
|
|
//-End Mixin
|
|
|
|
//- @pugdoc
|
|
name: hidden
|
|
description: Alias for {@link input} that makes a hidden input. See {@link input} for arguments.
|
|
arguments:
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+hidden({name:'my hidden attribute',class:'some-class',trigger:{triggeredFuncs:['someFunction']}})
|
|
mixin hidden(obj)
|
|
- obj.type = 'hidden';
|
|
+input(obj)
|
|
//-End Mixin
|
|
|
|
mixin radioGroup(objArray)
|
|
each obj in objArray
|
|
- obj.class = obj.class ? replaceProblems(obj.class) : undefined;
|
|
- obj.type='radio';
|
|
+input(obj)
|
|
|
|
//- @pugdoc
|
|
name: textarea
|
|
description: A mixin to create K-scaffold compatible textareas.
|
|
arguments:
|
|
- {object} textObj - See {@link input} for information on valid properties of the textObj.
|
|
attributes:
|
|
example: |
|
|
include _htmlelements.pug
|
|
+textarea({name:'my textarea',class:'some-class',trigger:{affects:['an_attribute']}})
|
|
mixin textarea(obj)
|
|
- checkKUse();
|
|
- obj.class = obj.class ? replaceProblems(obj.class) : undefined;
|
|
- obj.name = attrName(obj.name);
|
|
- obj.title = obj.title || attrTitle(obj.name);
|
|
- obj.name = `attr_${obj.name}`;
|
|
- addFieldToFieldsetObj(obj);
|
|
- storeTrigger(obj);
|
|
- const elementObj = makeElementObj(obj);
|
|
textarea&attributes(elementObj)
|
|
//-End Mixin |