Changes for page Templates

Last modified by Leon Poon on 2022/06/05 09:12

From version 1.1
edited by Leon Poon
on 2018/12/16 14:34
Change comment: Install extension [org.xwiki.contrib:application-help-center/1.3]
To version 2.1
edited by Leon Poon
on 2019/04/20 06:15
Change comment: Install extension [org.xwiki.contrib:application-help-center/1.4]

Summary

Details

Page properties
Content
... ... @@ -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>
article.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.CodePowered
Size
... ... @@ -1,0 +1,1 @@
1 +376.1 KB
Content
encyclopedia.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.CodePowered
Size
... ... @@ -1,0 +1,1 @@
1 +331.5 KB
Content
meeting.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.CodePowered
Size
... ... @@ -1,0 +1,1 @@
1 +83.5 KB
Content
simple.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.CodePowered
Size
... ... @@ -1,0 +1,1 @@
1 +180.8 KB
Content