Changes for page homeopathsSheet
Last modified by Jip-jan Alunkel on March 26, 17:31
From version 3.165
edited by Jip-jan Alunkel
on March 11, 15:12
on March 11, 15:12
Change comment:
Rollback to version 1.38
To version 3.166
edited by Jip-jan Alunkel
on March 11, 17:09
on March 11, 17:09
Change comment:
Rollback to version 1.38
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -5,9 +5,7 @@ 5 5 #set($discard = $services.localization.use('document', 'assets.pagemaker.translations')) 6 6 #set($discard = $xwiki.ssx.use('assets.pagemaker.WebHome', {'minify': false})) 7 7 #set($discard = $xwiki.jsx.use('assets.pagemaker.WebHome', {'minify': false, 'language': $context.language, 'myParameter': 'value'})) 8 -#set($docName = $doc.getFullName()) 9 9 #set($subjectTitle = $doc.getFullName().split('\.')[0]) 10 -$subjectTitle 11 11 ## Find the correct class name. This is if the class name starts with the name of the top parent space (referenced here by $subjectTitle). 12 12 ## Specify a class name below to override this. 13 13 #set($theClass = "") ... ... @@ -21,6 +21,32 @@ 21 21 #end 22 22 #set($theDocObj = $doc.getObject($theClass, true)) 23 23 #set($hasRight = !$isGuest && ($theDocObj.getProperty('doc_owner').value == $context.getUser() || $hasAdmin)) 22 +## ADDRESS: Prepare object to provide hidden values to the address input. The keys are equal to the class property names. 23 +## The entries will be filled by the class property values. 24 +#set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''}) 25 +#foreach($item in $xa.keySet()) 26 + #if($theDocObj.getProperty("$item")) 27 + #set($xa["$item"] = $theDocObj.getProperty("$item").value) 28 + #end 29 +#end 30 +## The classProperties Map has to be in the order of how you want the form elements to appear in the form. 31 +## 'disabled': 1 --> Will not show up in the form at all. 32 +## 'extraAttributes': {"disabled": "disabled"} --> Will show up in the form as a disabled input. 33 +#set($classProperties = { 34 + 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}}, 35 + 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "pmLatlong": "$xa['pmLatlong']", "pmCountry": "$xa['pmCountry']", "pmState": "$xa['pmState']", "pmCounty": "$xa['pmCounty']", "pmPostcode": "$xa['pmPostcode']", "pmCity": "$xa['pmCity']", "pmStreet": "$xa['pmStreet']", "pmHousenumber": "$xa['pmHousenumber']", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass", "help-block" : 'Input street and number, then select the address of your practice.'}}, 36 + 'practiceName': {'type': 'text', 'disabled': 1, 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}}, 37 + 'pmStreet': {'type': 'text', 'disabled': 1}, 38 + 'pmHousenumber': {'type': 'text', 'disabled': 1}, 39 + 'pmPostcode': {'type': 'text', 'disabled': 1}, 40 + 'pmCity': {'type': 'text', 'disabled': 1}, 41 + 'pmCounty': {'type': 'text', 'disabled': 1}, 42 + 'pmState': {'type': 'text', 'disabled': 1}, 43 + 'pmCountry': {'type': 'text', 'disabled': 1}, 44 + 'nrOfHomeopaths': {'type': 'number'}, 45 + 'certification': {'type': 'checkbox', 'opener': 1}, 46 + 'certificationFrom': {'type': 'text', 'parent': 'certification'} 47 +}) 24 24 $doc.getTranslatedDocument().getContent() 25 25 {{html wiki="true" clean="false"}} 26 26 #if(!$isGuest) ... ... @@ -40,30 +40,6 @@ 40 40 #if($xcontext.action == "view") 41 41 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2> 42 42 <div id="${subjectTitle}" class="sheet_properties inline-data-summary"> 43 - ## ADDRESS: Prepare object to provide hidden values to the address input 44 - #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''}) 45 - #foreach($item in $xa.keySet()) 46 - #if($theDocObj.getProperty("$item")) 47 - #set($xa["$item"] = $theDocObj.getProperty("$item").value) 48 - #end 49 - #end 50 -## The classProperties Map has to be in the order of how you want the form elements to appear in the form. 51 -## disabled = Will not show up as input/select/textarea in the form. 52 - #set($classProperties = { 53 - 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}}, 54 - 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "pmLatlong": "$xa['pmLatlong']", "pmCountry": "$xa['pmCountry']", "pmState": "$xa['pmState']", "pmCounty": "$xa['pmCounty']", "pmPostcode": "$xa['pmPostcode']", "pmCity": "$xa['pmCity']", "pmStreet": "$xa['pmStreet']", "pmHousenumber": "$xa['pmHousenumber']", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass", "help-block" : 'Input street and number, then select the address of your practice.'}}, 55 - 'practiceName': {'type': 'text', 'disabled': 1, 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}}, 56 - 'pmStreet': {'type': 'text', 'disabled': 1}, 57 - 'pmHousenumber': {'type': 'text', 'disabled': 1}, 58 - 'pmPostcode': {'type': 'text', 'disabled': 1}, 59 - 'pmCity': {'type': 'text', 'disabled': 1}, 60 - 'pmCounty': {'type': 'text', 'disabled': 1}, 61 - 'pmState': {'type': 'text', 'disabled': 1}, 62 - 'pmCountry': {'type': 'text', 'disabled': 1}, 63 - 'nrOfHomeopaths': {'type': 'number'}, 64 - 'certification': {'type': 'checkbox', 'opener': 1}, 65 - 'certificationFrom': {'type': 'text', 'parent': 'certification'} 66 - }) 67 67 #createAddress($theClass 1) 68 68 #set($properties = ['nrOfHomeopaths','certification','certificationFrom']) 69 69 #foreach($property in $properties) ... ... @@ -118,7 +118,7 @@ 118 118 #set($checkBool = ["false","true"]) 119 119 #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) 120 120 #set($value = $theDocObj.getProperty($propertyName).value) 121 - #if($item.type == "checkbox") 121 + #if($item.type == "checkbox" || $item.type == "radio") 122 122 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]") 123 123 #end 124 124 #else ... ... @@ -129,7 +129,18 @@ 129 129 #end 130 130 #end 131 131 #end 132 - #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}")) 132 + #if($item.type != "checkbox" && $item.type != "radio" && !$item.containsKey("disabled")) 133 + #set($translatedProperties = { 134 + 'aria_label': 'data-aria-label', 135 + 'placeholder': 'placeholder', 136 + 'help_block': 'help-block' 137 + }) 138 + #end 139 + #set($translatedProperties['label'] = 'label') 140 + #foreach($translatedPropertyKey in $translatedProperties.keySet()) 141 + #set($translatedPropertyEntry = $services.localization.render("homeopaths.classproperty.${propertyName}.${translatedPropertyKey}")) 142 + $item.extraAttributes.put("$translatedProperties[$translatedPropertyKey]", $translatedPropertyEntry) 143 + #end 133 133 #if($item.containsKey("classless")) 134 134 #set($newElem = { 135 135 "id" : "$propertyName",