-
Notifications
You must be signed in to change notification settings - Fork 0
/
showpropertyparent.vm
46 lines (30 loc) · 1.15 KB
/
showpropertyparent.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Macro title: ShowPropertyParent
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: PF
## Date created: 21/10/2019
## Installed by: PF
## Remarks: properties with space in the name cause problems
## https://stackoverflow.com/questions/6802765/jquery-dealing-with-a-space-in-the-id-attribute
## not allowing page properties with spaces in it solves it at the source, but you want labels with spaces
## $prop.replace(" ", "")) solved it
## @param PropertyName:title=Property|type=string|desc=Name of the page property of the parent page|Required=true
#set ($parentID = $content.getParent().getIdAsString())
#set ($prop = "$paramPropertyName")
#set ($propid = $prop.replace(" ", ""))
<div id="$propid"></div>
<script type="text/javascript">
jQuery.ajax({
url: "/rest/masterdetail/1.0/detailssummary/lines?cql=id=$parentID&spaceKey=ISMS&headings=$prop&pageIndex=0",
contentType: 'application/json',
dataType: 'json',
type: "GET",
success: function(data){
var props = data;
property = props.detailLines[0].details[0];
$("div[id=$propid]").html(property);
},
});
</script>