-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_label.vm
51 lines (30 loc) · 1.27 KB
/
add_label.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
47
48
49
50
51
## Macro title: Add label
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: PF
## @noparams
<script type="text/javascript">;
AJS.toInit(function ($) {
//every label checkbox on the page
jQuery(".custom_label_to_add").click(function(){
//call the add label ajax request
jQuery.post(contextPath+"/json/addlabelactivity.action", {"entityIdString": "$content.id", "labelString": jQuery(this).val(), "atl_token": jQuery("#atlassian-token").attr("content") } ,function(){
alert("label added to page");
});
});
});
</script>;
#set($containerManagerClass=$action.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager=$getInstanceMethod.invoke(null,null))
#set($containerContext=$containerManager.containerContext)
#set($labelManager=$containerContext.getComponent('labelManager'))
Popular Labels
#foreach( $popularLabelResult in $labelManager.getMostPopularLabels() )
<br>
<input type="checkbox" class="custom_label_to_add" value="$popularLabelResult.label.name"> $popularLabelResult.label.name
#end