Código fuente wiki de form-elements

Versión 2.25 por Jip-jan Alunkel el marzo 24, 18:03

Ocultar los últimos autores
Jip-jan Alunkel 1.2 1 {{velocity}}
Jip-jan Alunkel 2.24 2 #*
Jip-jan Alunkel 2.7 3 #set($localitySelectElement = {
Jip-jan Alunkel 1.3 4 "id" : "locality",
5 "type" : "select",
6 "required" : true,
7 "label" : "Locality of the main complaint",
8 "aria-label" : "Select the locality",
9 "data-error-response-type" : "use_label_defined_1",
10 "data-set-space" : "true",
11 "placeholder" : "cases.word.locality_select.placeholder",
Jip-jan Alunkel 2.2 12 "space-reference" : "cases",
Jip-jan Alunkel 1.3 13 "help-block" : "In which physiological or psychological epicenter can the main complaint be placed? Select the best fitting option from this list."
Jip-jan Alunkel 2.7 14 })
Jip-jan Alunkel 2.24 15 *#
Jip-jan Alunkel 2.25 16 halloo
Jip-jan Alunkel 2.23 17 #macro(createFormElement $elementDataObj)
18 #set($elementType = $elementDataObj.type)
19 #if($elementType == "select")
20 #createSelectElement($elementDataObj)
21 #end
22 #end
Jip-jan Alunkel 1.3 23
Jip-jan Alunkel 2.23 24 #macro(createSelectElement $O_elementData)
Jip-jan Alunkel 2.22 25 {{html}}
Jip-jan Alunkel 1.3 26 #set($requiredAttributes = 'aria-required="false"')
Jip-jan Alunkel 2.23 27 #if($O_elementData.required == true)
Jip-jan Alunkel 1.3 28 #set($requiredAttributes = 'aria-required="true" required="required"')
Jip-jan Alunkel 1.2 29 <p class="required">
Jip-jan Alunkel 1.3 30 #end
Jip-jan Alunkel 2.23 31 <label for="${O_elementData.id}_select">
32 $O_elementData.label
Jip-jan Alunkel 1.2 33 <span class="input-wrap select-wrap">
Jip-jan Alunkel 2.23 34 <select class="form-select form-control" aria-label="${O_elementData.aria-label}" aria-describedby="${O_elementData.id}_helpBlock" $requiredAttributes data-error-response-type="${O_elementData.data-error-response-type}" data-set-space="${O_elementData.data-set-space}" name="${O_elementData.id}_select" id="${O_elementData.id}_select">
35 <option value="" disabled="" selected="" hidden="hidden">$services.localization.render(${O_elementData.placeholder})</option>
Jip-jan Alunkel 2.16 36 #set($query = $services.query.xwql("from doc.object(AppWithinMinutes.MetadataClass) met where doc.space like :space and doc.space <> :spaceExclude order by met.dataSpaceName asc"))
Jip-jan Alunkel 2.23 37 #set ($spaceLikeRef = $O_elementData.space-reference.replaceAll('([%_!])', '!$1').concat('.%'))
38 #set ($spaceExcludeRef = $O_elementData.space-reference.replaceAll('([%_!])', '!$1').concat('.Code'))
Jip-jan Alunkel 2.16 39 #set($query = $query.bindValue('space', $spaceLikeRef))
Jip-jan Alunkel 2.20 40 #set($query = $query.bindValue('spaceExclude', $spaceExcludeRef))
Jip-jan Alunkel 2.13 41 #set($results = $query.addFilter('unique').execute())
Jip-jan Alunkel 1.2 42 #foreach ($item in $results)
43 #set ($document = $xwiki.getDocument($item))
44 <option value="$document.space">$document.getTitle()</option>
45 #end
46 </select>
Jip-jan Alunkel 2.23 47 <span id="${O_elementData.id}_helpBlock" class="help-block">${O_elementData.help-block}</span>
48 #if($O_elementData.required == true)
Jip-jan Alunkel 1.2 49 <span class="required-input-field" title="Required input"></span>
50 <span role="alert" class="form-not-valid-tip"></span>
Jip-jan Alunkel 1.3 51 #end
Jip-jan Alunkel 1.2 52 </span>
53 </label>
Jip-jan Alunkel 2.23 54 #if($O_elementData.required == true)
Jip-jan Alunkel 1.2 55 </p>
Jip-jan Alunkel 1.3 56 #end
Jip-jan Alunkel 2.22 57 {{/html}}
Jip-jan Alunkel 1.2 58 #end
Jip-jan Alunkel 1.4 59
Jip-jan Alunkel 2.24 60 ##createFormElement($localitySelectElement)
Jip-jan Alunkel 1.2 61 {{/velocity}}
62