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

     1  <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     2  {% import "github.com/kyleu/dbaudit/views/components" %}
     3  
     4  {% func File(key string, id string, label string, value string, placeholder ...string) %}{% stripspace %}
     5    {% if id == "" %}
     6      <label><input type="file" name="{%s key %}" value="{%s value %}" {%= components.PlaceholderFor(placeholder) %}/>{%s label %}</label>
     7    {% else %}
     8      <label><input id="{%s id %}" type="file" name="{%s key %}" value="{%s value %}" {%= components.PlaceholderFor(placeholder) %}/>{%s label %}</label>
     9    {% endif %}
    10  {% endstripspace %}{% endfunc %}
    11  
    12  {% func FileTable(key string, id string, title string, label string, value string) %}{% stripspace %}
    13    <tr>
    14      <th class="shrink"><label for="{%s id %}">{%s title %}</label></th>
    15      <td>
    16        {%= File(key, id, label, value) %}
    17      </td>
    18    </tr>
    19  {% endstripspace %}{% endfunc %}
    20  
    21  {% func FileMultiple(key string, id string, label string, value string, placeholder ...string) %}{% stripspace %}
    22    {% if id == "" %}
    23      <label><input type="file" name="{%s key %}" value="{%s value %}" multiple="multiple" {%= components.PlaceholderFor(placeholder) %}/>{%s label %}</label>
    24    {% else %}
    25      <label><input id="{%s id %}" type="file" name="{%s key %}" value="{%s value %}" multiple="multiple" {%= components.PlaceholderFor(placeholder) %}/>{%s label %}</label>
    26    {% endif %}
    27  {% endstripspace %}{% endfunc %}
    28  
    29  {% func FileMultipleTable(key string, id string, title string, label string, value string) %}{% stripspace %}
    30    <tr>
    31      <th class="shrink"><label for="{%s id %}">{%s title %}</label></th>
    32      <td>
    33        {%= FileMultiple(key, id, label, value) %}
    34      </td>
    35    </tr>
    36  {% endstripspace %}{% endfunc %}
    37