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 38 39 40 41 42 43
| {% import ( "{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/util" "{{{ .Package }}}/views/components" "{{{ .Package }}}/views/layout" ) %}
{% code type Debug struct { layout.Basic } %}
{% func (p *Debug) Body(as *app.State, ps *cutil.PageState) %} <div class="card"> <h3>{%= components.SVGIcon(util.Choose(ps.DefaultNavIcon == ``, `graph`, ps.DefaultNavIcon), ps) %} {%s ps.Title %}</h3> {%- if s, ok := ps.Data.(string); ok -%} <div class="overflow full-width"><pre class="mt">{%s s %}</pre></div> {%- else -%} {%- if util.ArrayTest(ps.Data) -%} <div class="overflow full-width"> <table class="mt"> <tbody> {%- code a := util.ArrayFromAny[any](ps.Data) -%} {%- for idx, x := range a -%} {%- if idx < 32 -%} <tr> <th class="shrink">{%d idx + 1 %}</th> <td>{%s= components.JSON(x) %}</td> </tr> {%- endif -%} {%- endfor -%} {%- if len(a) > 32 -%} <tr> <td class="shrink" colspan="2"><em>...and [{%d len(a) - 32 %}] more...</em></td> </tr> {%- endif -%} </tbody> </table> </div> {%- else -%} <div class="mt">{%s= components.JSON(ps.Data) %}</div> {%- endif -%} {%- endif -%} </div> {% endfunc %}
|