Help

/views/layout/Help.html (1.1 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{% import (
"strings"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
) %}

{% func Help(as *app.State, ps *cutil.PageState) %}
{%- if as.Services.Help != nil -%}
{%- if hlp := as.Services.Help.Entry(ps.Action); hlp != nil -%}
{%- code
title := hlp.Title
if title == "" {
title = ps.Title
}
if title == "" {
title = util.AppName
}
-%}
<a class="help-link" title="Help for this page" data-key="{%s strings.TrimSuffix(ps.Action, `.action`) %}" href="#help">{%= components.SVGRef(`question`, 24, 24, ``, ps) %}</a>
<div id="help" class="modal" style="display: none;">
<a class="backdrop" href="#"></a>
<div class="modal-content">
<div class="modal-header">
<a href="#" class="modal-close">×</a>
<h3>{%= components.SVGRefIcon(`question`, ps) %}Help: {%s title %}</h3>
</div>
<div class="modal-body">
{%s= hlp.HTML %}
</div>
</div>
</div>
{%- endif -%}
{%- endif -%}
{% endfunc %}