summaryrefslogtreecommitdiff
path: root/themes/okadmin/templates/partials/inputs.liquid
blob: 551a66ceca7f50db7d83f9a68d5c85bade499dd6 (plain)
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
{% for pair in resource.spec %}
  {% assign name = pair[0] %}
  {% assign spec = pair[1] %}
  {% assign type = spec.type %}

  <div class="property">
    <label for="{{name}}">{{name | capitalize}}</label>

    {% if type == 'string' %}
      <input
        {% if spec.disabled %}
          disabled="true"
        {% endif %}
          name="{{name}}" type="text" value="{{spec.value}}">
    {% elsif type == 'text' %}
      <textarea
        {% if spec.disabled %}
          disabled="true"
        {% endif %}
        name="{{name}}">{{spec.value}}</textarea>
    {% elsif type == 'enum' %}
      <select
        {% if spec.disabled %}
          disabled="true"
        {% endif %}
        name="{{name}}">
        {% for option in spec.options %}
          <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option}}</option>
        {% endfor %}
      </select>
    {% else %}
      <p><pre style="color: red">Admin template doesn't support '{{type}}' properties!</pre></p>
    {% endif %}
  </div>

{% endfor %}