{namespace JIRA.Templates.Links}
/**
* Server side soy template that renders a help link from a HelpPath object.
* Usage:
* Obtain the HelpPath object on server side and add it into the context:
* context.put("helpPath", HelpUtil.getInstance().getHelpPath("configcustomfield");
* In soy, just call this template with the object
* {call JIRA.Templates.Links.helpLinkFromHelpPath}
* {param helpPath: $helpPath /}
* {/call}
*
* @param helpPath the HelpPath object corresponding to the help link
* @param? fragmentIdentifier the fragment, if any
*/
{template .helpLinkFromHelpPath}
{call .helpLink}
{param isLocal: $helpPath.local /}
{param title: $helpPath.title /}
{param description: $helpPath.alt /}
{param url: $helpPath.url /}
{param fragmentIdentifier}
{if $fragmentIdentifier}{$fragmentIdentifier}{/if}
{/param}
{/call}
{/template}
/**
* Render a link to a help document.
* Note: aria-label is generated only if there is no "description" provided and we are not rendering "onlyOpeningTag".
* If you provide either "description" or "onlyOpeningTag" parameter it's your responsibility to use proper a11y content.
* "description" should be descriptive/specific one, not "generic" one like "get help!".
* Html markup used when providing "onlyOpeningTag" should also be a11y friendly.
* @param isLocal
* @param url the relative or absolute URL to the help document.
* @param title the name of the help document you will be linking to.
* @param? id
* @param? description optional longer descriptive text.
* @param? fragmentIdentifier the ID of an anchor or section in the help document you are linking to. Be sure to include the hash (#) character.
* @param? extraClasses
* @param? extraAttributes
* @param? onlyOpeningTag if true the template returns opening tag without description and closing tag
*/
{template .helpLink}
{let $linkTitle}{if $isLocal}{getText('local.help.for.topic',$title)|id}{else}{getText('online.help.for.topic',$title)|id}{/if}{/let}
{let $ariaLabel}{if $description or $onlyOpeningTag==true}{else}{$linkTitle}{/if}{/let}
{/if}
{/template}
/**
* Link button
* @param url the URL for the link.
*/
{template .button}
{call aui.buttons.button data="all"}
{param tagName: 'a'/}
{param extraAttributes}href="{$url}"{/param}
{/call}
{/template}
/**
* Render a basic help link without any icons.
* @param url the relative or absolute URL to the help document.
* @param desc the description that would be displayed on the help link.
* @param isLocal Is help local within JIRA or external/
* @param? title the tile of the help link.
*/
{template .basicHelpLink}
{let $dataHelpLink: $isLocal ? 'local' : 'online' /}
{let $linkTarget: $isLocal ? '_self' : '_jirahelp' /}
{let $linkTitle: isNonnull($title) ? $title : '' /}
{call aui.buttons.button data="all"}
{param extraClasses: 'help-lnk'/}
{param type: 'link'/}
{param tagName: 'a'/}
{param text: $desc/}
{param extraAttributes: [
'href': $url,
'title': $linkTitle,
'target': $linkTarget,
'data-helplink': $dataHelpLink ] /}
{/call}
{/template}