github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/components/edit/UUID.html (about)

     1  <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     2  {% import (
     3    "github.com/google/uuid"
     4  
     5    "github.com/kyleu/dbaudit/app/controller/cutil"
     6    "github.com/kyleu/dbaudit/views/components"
     7  ) %}
     8  
     9  {% func UUID(key string, id string, value *uuid.UUID, placeholder ...string) %}{% stripspace %}
    10    {%- code
    11      v := ""
    12      if value != nil {
    13        v = value.String()
    14      }
    15    -%}
    16    {%= String(key, id, v, placeholder...) %}
    17  {% endstripspace %}{% endfunc %}
    18  
    19  {% func UUIDVertical(key string, id string, title string, value *uuid.UUID, indent int, help ...string) %}{% stripspace %}
    20    {%- code id = cutil.CleanID(key, id) -%}
    21    <div class="mb expanded">
    22      {%= components.Indent(true, indent + 1) %}
    23      <label for="{%s id %}"><em class="title">{%s title %}</em></label>
    24      {%= components.Indent(true, indent + 1) %}
    25      <div class="mt">{%= UUID(key, id, value, help...) %}</div>
    26    {%= components.Indent(true, indent) %}
    27    </div>
    28  {% endstripspace %}{% endfunc %}
    29  
    30  {% func UUIDTable(key string, id string, title string, value *uuid.UUID, indent int, help ...string) %}{% stripspace %}
    31    {%- code id = cutil.CleanID(key, id) -%}
    32    <tr>
    33      {%= components.Indent(true, indent + 1) %}
    34      <th class="shrink"><label for="{%s id %}"{%= components.TitleFor(help) %}>{%s title %}</label></th>
    35      {%= components.Indent(true, indent + 1) %}
    36      <td>{%= UUID(key, id, value, help...) %}</td>
    37    {%= components.Indent(true, indent) %}
    38    </tr>
    39  {% endstripspace %}{% endfunc %}