Toggle navigation
Log-in
Home
Page Index
User Index
Application Index
Global
Wiki Index
Help
Code
VelocityMacros
Wiki source code of
VelocityMacros
Last modified by eaminov on 2017/06/14 01:05
Show line numbers
{{velocity output="false"}} #set ($discard = $xwiki.ssx.use('Help.Code.VelocityMacros')) #set ($discard = $xwiki.jsx.use('Help.Code.VelocityMacros')) #set ($docextras = []) #macro (helpActionCard $data) <div class="well"> <h3>$escapetool.xml($data.title)</h3> <div class="row"> <div class="col-xs-12 col-md-7"> <p>$data.description</p> <p class="noitems">$data.tip</p> #foreach ($action in $data.actions) #set ($actionType = $action.type) #if ("$!actionType" == '') #set ($actionType = 'default') #end <a href="$action.url" class="btn btn-$actionType"> $escapetool.xml($action.label) </a> #end </div> <div class="col-xs-12 col-md-5"> #helpVideoPopup($data.title $data.thumbnail) </div> </div> </div> #end #macro (helpVideoPopup $title $fileNamePrefix) #set ($id = $stringtool.substringBeforeLast($fileNamePrefix, '.')) <a href="#" data-toggle="modal" data-target="#${id}Modal"> <video class="thumbnail" autoplay loop muted> #helpVideoSources($fileNamePrefix) </video> </a> <div class="modal fade video-modal" id="${id}Modal" tabindex="-1" role="dialog" aria-labelledby="${id}ModalLabel"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="${id}ModalLabel">$!escapetool.xml($title)</h4> </div> <div class="modal-body"> <video controls autoplay> #helpVideoSources($fileNamePrefix) </video> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> #end #macro (helpVideoSources $fileNamePrefix) #set ($attachments = []) #set ($attachment = $doc.getAttachment($fileNamePrefix)) #if ($attachment) #set ($discard = $attachments.add($attachment)) #else #foreach ($attachment in $doc.attachmentList) #if ($stringtool.startsWith($attachment.filename, $fileName)) #set ($discard = $attachments.add($attachment)) #end #end #end #foreach ($attachment in $attachments) <source src="$doc.getAttachmentURL($attachment.filename)" type="$escapetool.xml($attachment.mimeType)" /> #end #end #macro (helpExampleCard $data) #set ($documentationURL = $NULL) #if ($data.documentation) #set ($externalDocumentation = $data.documentation.contains('://')) #if ($externalDocumentation) #set ($documentationURL = $data.documentation) #else #set ($documentationURL = $xwiki.getURL($data.documentation)) #end #end #set ($examplesURL = $NULL) #if ($data.examples) #if ($data.examples.startsWith('/')) ## Relative internal URL #set ($examplesURL = $data.examples) #else ## Page reference #set ($examplesURL = $xwiki.getURL($data.examples)) #end #set ($url = $examplesURL) #else #set ($url = $documentationURL) #end <div class="well"> #if ($data.icon) <span class="icon $data.icon"></span> #end <h6> <a href="$!url"> $escapetool.xml($data.title) </a> </h6> #if ($data.description) <p class="noitems"> $data.description </p> #end #if (($data.examples && $data.documentation) || !$data.thumbnail) <ul class="noitems"> #if ($data.examples) <li> <a href="$examplesURL">See examples</a> </li> #end #if ($data.documentation) <li> <a href="$documentationURL"#if ($externalDocumentation) class="wikiexternallink"#end> Learn more </a> </li> #end </ul> #end #if ($data.thumbnail) <a href="$!url"> #set ($attachmentReference = $services.model.resolveAttachment($data.thumbnail)) <img src="$xwiki.getURL($attachmentReference)" class="thumbnail" alt="$escapetool.xml($attachmentReference.name)" /> </a> #end </div> #end {{/velocity}}