automatically setup checkboxes via js utility

This commit is contained in:
Felix Hamann 2019-04-07 22:17:38 +02:00
parent 0b62845a8d
commit d48b335cb2
4 changed files with 11 additions and 7 deletions

View File

@ -66,7 +66,7 @@ headedRowSelector toExternal fromExternal attrs colonnade tdata = do
-- TODO: move this to a *.hamlet file -- TODO: move this to a *.hamlet file
[whamlet| [whamlet|
<label style="display: block"> <label style="display: block">
<input type=checkbox uw-checkbox name=#{name} value=#{toPathPiece extId} *{attributes} :isRight val:checked> <input type=checkbox name=#{name} value=#{toPathPiece extId} *{attributes} :isRight val:checked>
|] |]
selectionIdent <- newFormIdent selectionIdent <- newFormIdent

View File

@ -76,6 +76,10 @@
} }
if (utilInstance) { if (utilInstance) {
if (DEBUG_MODE > 2) {
console.info('Got utility instance for utility "' + util.name + '"', { utilInstance });
}
activeUtilInstances.push(utilInstance); activeUtilInstances.push(utilInstance);
} }
}); });

View File

@ -130,16 +130,16 @@
* Checkbox Utility * Checkbox Utility
* wraps native checkbox * wraps native checkbox
* *
* Attribute: uw-checkbox * Attribute: (none)
* (element must be an input of type='checkbox') * (element must be an input of type="checkbox")
* *
* Example usage: * Example usage:
* <input type='checkbox' uw-checkbox> * <input type="checkbox">
* *
*/ */
var CHECKBOX_UTIL_NAME = 'checkbox'; var CHECKBOX_UTIL_NAME = 'checkbox';
var CHECKBOX_UTIL_SELECTOR = 'input[type="checkbox"][uw-checkbox]'; var CHECKBOX_UTIL_SELECTOR = 'input[type="checkbox"]';
var CHECKBOX_CLASS = 'checkbox'; var CHECKBOX_CLASS = 'checkbox';
var CHECKBOX_INITIALIZED_CLASS = 'checkbox--initialized'; var CHECKBOX_INITIALIZED_CLASS = 'checkbox--initialized';

View File

@ -6,7 +6,7 @@ $newline never
<li> <li>
<div .file-container> <div .file-container>
<label for=#{fuiHtmlId}>#{fuiTitle} <label for=#{fuiHtmlId}>#{fuiTitle}
<input type=checkbox uw-checkbox id=#{fuiHtmlId} name=#{fieldName} :fuiChecked:checked value=#{toPathPiece fuiId}> <input type=checkbox id=#{fuiHtmlId} name=#{fieldName} :fuiChecked:checked value=#{toPathPiece fuiId}>
<div .file-input__info> <div .file-input__info>
_{MsgPreviouslyUploadedDeletionInfo} _{MsgPreviouslyUploadedDeletionInfo}
@ -21,7 +21,7 @@ $# new files
<div .file-input__unpack> <div .file-input__unpack>
<label for=#{fieldId}_zip>ZIPs automatisch entpacken <label for=#{fieldId}_zip>ZIPs automatisch entpacken
<input type=checkbox uw-checkbox id=#{fieldId}_zip name=#{fieldName} value=#{unpackZips}> <input type=checkbox id=#{fieldId}_zip name=#{fieldName} value=#{unpackZips}>
<div class="tooltip"> <div class="tooltip">
<div class="tooltip__handle"> <div class="tooltip__handle">
<div class="tooltip__content">Entpackt hochgeladene Zip-Dateien (*.zip) automatisch und fügt den Inhalt dem Stamm-Verzeichnis der Abgabe hinzu. <div class="tooltip__content">Entpackt hochgeladene Zip-Dateien (*.zip) automatisch und fügt den Inhalt dem Stamm-Verzeichnis der Abgabe hinzu.