github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vtheme/Edit.html (about)

     1  <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     2  {% import (
     3    "github.com/kyleu/dbaudit/app"
     4    "github.com/kyleu/dbaudit/app/controller/cutil"
     5    "github.com/kyleu/dbaudit/app/lib/theme"
     6    "github.com/kyleu/dbaudit/app/util"
     7    "github.com/kyleu/dbaudit/views/components"
     8    "github.com/kyleu/dbaudit/views/components/edit"
     9    "github.com/kyleu/dbaudit/views/layout"
    10  ) %}
    11  
    12  {% code type Edit struct {
    13    layout.Basic
    14    Theme *theme.Theme
    15    Icon string
    16    Exists bool
    17  } %}
    18  
    19  {% func (p *Edit) Body(as *app.State, ps *cutil.PageState) %}
    20    <form action="/theme/save" method="post">
    21      <input type="hidden" name="originalKey" value="{%s p.Theme.Key %}" />
    22      <div class="card">
    23        <div class="right">
    24          {%- if p.Exists -%}
    25          <a href="/theme/{%s p.Theme.Key %}/remove" class="link-confirm" data-message="Are you sure you wish to delete the [{%s p.Theme.Key %}] theme?"><button type="button">Remove</button></a>
    26          {%- else -%}
    27          <em>built-in</em>
    28          {%- endif -%}
    29          <a href="#modal-theme"><button type="button">JSON</button></a>
    30        </div>
    31        <h3>{% if p.Theme.Key == theme.KeyNew %}New Theme{% else %}Theme Edit{% endif %}</h3>
    32        <div class="overflow full-width">
    33          <table class="mt expanded">
    34            <tbody>
    35              {%= edit.StringTable("key", "", "Key", p.Theme.Key, 5) %}
    36            </tbody>
    37          </table>
    38        </div>
    39      </div>
    40      {%= Editor("Theme [" + p.Theme.Key + "]", util.AppName, p.Theme, p.Icon, as, ps) %}
    41      <div class="card">
    42        <button type="submit">Save All Changes</button>
    43        <a href="/theme/{%u p.Theme.Key %}"><button type="button">Reset</button></a>
    44      </div>
    45    </form>
    46    {%= components.JSONModal("theme", "Theme JSON", p.Theme, 1) %}
    47  {% endfunc %}