Wiki source code of Templates
Last modified by Martin Výlet on 19.03.2025 21:26
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{include reference="Help.Code.VelocityMacros" /}} |
2 | |||
3 | {{velocity output="false"}} | ||
![]() |
2.1 | 4 | #set ($featuresPrefix = 'https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features') |
5 | #set ($exoPrefix = 'https://extensions.xwiki.org/xwiki/bin/view/Extension') | ||
![]() |
1.1 | 6 | #set ($actionCards = [{ |
![]() |
2.1 | 7 | 'title': $services.localization.render('help.templates.useTemplates.title'), |
8 | 'description': $services.localization.render('help.templates.useTemplates.description'), | ||
9 | 'tip': $services.localization.render('help.templates.useTemplates.tip', | ||
10 | ["<a href='$featuresPrefix/DocumentLifecycle#HCreate' class='wikiexternallink'>",'</a>']), | ||
![]() |
1.1 | 11 | 'thumbnail': 'Template', |
12 | 'actions': [{ | ||
![]() |
2.1 | 13 | 'label': $services.localization.render('help.try.label'), |
![]() |
1.1 | 14 | 'type': 'success', |
15 | 'url': $xwiki.getURL('Sandbox.WebHome', 'create', $escapetool.url({ | ||
16 | 'title': "New Page $datetool.get('dd MMM yyyy, HH:mm')" | ||
17 | })) | ||
18 | }] | ||
19 | }, { | ||
![]() |
2.1 | 20 | 'title': $services.localization.render('help.templates.create.title'), |
21 | 'description': $services.localization.render('help.templates.create.description'), | ||
22 | 'tip': $services.localization.render('help.templates.create.tip', | ||
23 | ["<a href='$exoPrefix/Administration+Application#HCreatetheTemplateProvider' class='wikiexternallink'>",'</a>']), | ||
![]() |
1.1 | 24 | 'thumbnail': 'Administration', |
25 | 'actions': [{ | ||
![]() |
2.1 | 26 | 'label': $services.localization.render('help.more.label'), |
27 | 'url': "$exoPrefix/Administration+Application#HCreatetheTemplateProvider" | ||
![]() |
1.1 | 28 | }] |
29 | }]) | ||
30 | |||
31 | #if ($hasAdmin) | ||
32 | #set ($discard = $actionCards[1].actions.add(0, { | ||
![]() |
2.1 | 33 | 'label': $services.localization.render('help.browse.label'), |
![]() |
1.1 | 34 | 'url': $xwiki.getURL('XWiki.XWikiPreferences', 'admin', 'editor=globaladmin§ion=Templates') |
35 | })) | ||
36 | #end | ||
37 | |||
![]() |
2.1 | 38 | #macro (getTemplateExample $inputCard $outputCard) |
39 | #set ($templateReference = $services.model.resolveDocument($inputCard.templateReference)) | ||
40 | #if ($xwiki.getDocument($templateReference).isNew()) | ||
41 | #set ($outputCard = { | ||
42 | 'title': $inputCard.title, | ||
43 | 'description': $inputCard.description, | ||
44 | 'documentation': "$exoPrefix/Templates+Application/", | ||
45 | 'thumbnail': $inputCard.thumbnail | ||
46 | }) | ||
47 | #else | ||
48 | #set ($outputCard = { | ||
49 | 'title': $inputCard.title, | ||
50 | 'description': $inputCard.description, | ||
51 | 'examples': $inputCard.templateReference, | ||
52 | 'thumbnail': $inputCard.thumbnail | ||
53 | }) | ||
54 | #end | ||
55 | #end | ||
56 | |||
![]() |
1.1 | 57 | #set ($exampleCards = [{ |
![]() |
2.1 | 58 | 'title': $services.localization.render('help.templates.article.title'), |
59 | 'description':$services.localization.render('help.templates.article.description'), | ||
60 | 'templateReference': 'Templates.Article.Template.WebHome', | ||
61 | 'thumbnail': 'Help.Templates.WebHome@article.png' | ||
![]() |
1.1 | 62 | }, { |
![]() |
2.1 | 63 | 'title': $services.localization.render('help.templates.encyclopedia.title'), |
64 | 'description': $services.localization.render('help.templates.encyclopedia.description'), | ||
65 | 'templateReference': 'Templates.Encyclopedia.Template.WebHome', | ||
66 | 'thumbnail': 'Help.Templates.WebHome@encyclopedia.png' | ||
![]() |
1.1 | 67 | }, { |
![]() |
2.1 | 68 | 'title': $services.localization.render('help.templates.meeting.title'), |
69 | 'description': $services.localization.render('help.templates.meeting.description'), | ||
70 | 'templateReference': 'Templates.Meeting.Template.WebHome', | ||
71 | 'thumbnail': 'Help.Templates.WebHome@meeting.png' | ||
![]() |
1.1 | 72 | }, { |
![]() |
2.1 | 73 | 'title': $services.localization.render('help.templates.simple.title'), |
74 | 'description': $services.localization.render('help.templates.simple.description'), | ||
75 | 'templateReference': 'Templates.SimplePage.Template.WebHome', | ||
76 | 'thumbnail': 'Help.Templates.WebHome@simple.png' | ||
![]() |
1.1 | 77 | }]) |
78 | {{/velocity}} | ||
79 | |||
80 | {{velocity}} | ||
81 | {{html clean="false"}} | ||
![]() |
3.1 | 82 | <ul class="card-list two-cols"> |
![]() |
1.1 | 83 | #foreach ($card in $actionCards) |
![]() |
3.1 | 84 | <li class="card"> |
![]() |
1.1 | 85 | #helpActionCard($card) |
![]() |
3.1 | 86 | </li> |
![]() |
1.1 | 87 | #end |
![]() |
3.1 | 88 | </ul> |
![]() |
2.1 | 89 | <h3 id="HExamples">$services.localization.render('help.templates.examples.title')</h3> |
90 | <p>$services.localization.render('help.templates.examples.description')</p> | ||
![]() |
3.1 | 91 | <ul class="card-list"> |
![]() |
1.1 | 92 | #foreach ($card in $exampleCards) |
![]() |
3.1 | 93 | <li class="card"> |
![]() |
2.1 | 94 | #set ($outputCard = {}) |
95 | #getTemplateExample($card $outputCard) | ||
96 | #helpExampleCard($outputCard) | ||
![]() |
3.1 | 97 | </li> |
![]() |
1.1 | 98 | #end |
![]() |
3.1 | 99 | </ul> |
![]() |
2.1 | 100 | <p><a href="$exoPrefix/Templates+Application/" class="wikiexternallink">$services.localization.render('help.templates.more')</a></p> |
![]() |
1.1 | 101 | {{/html}} |
102 | {{/velocity}} |