... |
... |
@@ -31,26 +31,45 @@ |
31 |
31 |
})) |
32 |
32 |
#end |
33 |
33 |
|
|
34 |
+#macro (getTemplateExample $inputCard $outputCard) |
|
35 |
+ #set ($templateReference = $services.model.resolveDocument($inputCard.templateReference)) |
|
36 |
+ #if ($xwiki.getDocument($templateReference).isNew()) |
|
37 |
+ #set ($outputCard = { |
|
38 |
+ 'title': $inputCard.title, |
|
39 |
+ 'description': $inputCard.description, |
|
40 |
+ 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Templates+Application/', |
|
41 |
+ 'thumbnail': $inputCard.thumbnail |
|
42 |
+ }) |
|
43 |
+ #else |
|
44 |
+ #set ($outputCard = { |
|
45 |
+ 'title': $inputCard.title, |
|
46 |
+ 'description': $inputCard.description, |
|
47 |
+ 'examples': $inputCard.templateReference, |
|
48 |
+ 'thumbnail': $inputCard.thumbnail |
|
49 |
+ }) |
|
50 |
+ #end |
|
51 |
+#end |
|
52 |
+ |
34 |
34 |
#set ($exampleCards = [{ |
35 |
35 |
'title': 'Article', |
36 |
36 |
'description': 'Article page', |
37 |
|
- 'examples': 'Help.Templates.Article.WebHome', |
38 |
|
- 'thumbnail': 'Help.Templates.Article.WebHome@article.png' |
|
56 |
+ 'templateReference': 'Templates.Article.Template.WebHome', |
|
57 |
+ 'thumbnail': 'Help.Templates.WebHome@article.png' |
39 |
39 |
}, { |
40 |
40 |
'title': 'Encyclopedia', |
41 |
41 |
'description': 'Encyclopedia page', |
42 |
|
- 'examples': 'Help.Templates.Encyclopedia.WebHome', |
43 |
|
- 'thumbnail': 'Help.Templates.Encyclopedia.WebHome@encyclopedia.png' |
|
61 |
+ 'templateReference': 'Templates.Encyclopedia.Template.WebHome', |
|
62 |
+ 'thumbnail': 'Help.Templates.WebHome@encyclopedia.png' |
44 |
44 |
}, { |
45 |
45 |
'title': 'Meeting Report', |
46 |
46 |
'description': 'Agenda and notes', |
47 |
|
- 'examples': 'Help.Templates.Meeting.WebHome', |
48 |
|
- 'thumbnail': 'Help.Templates.Meeting.WebHome@meeting.png' |
|
66 |
+ 'templateReference': 'Templates.Meeting.Template.WebHome', |
|
67 |
+ 'thumbnail': 'Help.Templates.WebHome@meeting.png' |
49 |
49 |
}, { |
50 |
50 |
'title': 'Simple Page', |
51 |
51 |
'description': 'With table of contents', |
52 |
|
- 'examples': 'Help.Templates.Simple.WebHome', |
53 |
|
- 'thumbnail': 'Help.Templates.Simple.WebHome@simple.png' |
|
71 |
+ 'templateReference': 'Templates.SimplePage.Template.WebHome', |
|
72 |
+ 'thumbnail': 'Help.Templates.WebHome@simple.png' |
54 |
54 |
}]) |
55 |
55 |
{{/velocity}} |
56 |
56 |
|
... |
... |
@@ -82,7 +82,9 @@ |
82 |
82 |
<div class="clearfix visible-lg-block"></div> |
83 |
83 |
#end |
84 |
84 |
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"> |
85 |
|
- #helpExampleCard($card) |
|
104 |
+ #set ($outputCard = {}) |
|
105 |
+ #getTemplateExample($card $outputCard) |
|
106 |
+ #helpExampleCard($outputCard) |
86 |
86 |
</div> |
87 |
87 |
#end |
88 |
88 |
</div> |