diff options
| -rw-r--r-- | examples/index.js | 2 | ||||
| -rw-r--r-- | themes/okadmin/public/css/main.css | 6 | ||||
| -rw-r--r-- | themes/okadmin/templates/partials/inputs.liquid | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/examples/index.js b/examples/index.js index 8846e3a..56693ce 100644 --- a/examples/index.js +++ b/examples/index.js @@ -14,7 +14,7 @@ var app = okcms.createApp({ type: {type: 'string', id: true}, title: {type: 'string'}, description: {type: 'text'}, - color: {type: 'enum', fields: ["red","blue","green"]} + color: {type: 'enum', options: ["red","blue","green"]} } }, diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css index 1c02066..c5694eb 100644 --- a/themes/okadmin/public/css/main.css +++ b/themes/okadmin/public/css/main.css @@ -134,7 +134,8 @@ label { } .main.resource form input, -.main.resource form textarea { +.main.resource form textarea, +.main.resource form select { display: block; float: left; width: 20em; @@ -150,6 +151,9 @@ label { padding: 0.5em; height: 15em; } +.main.resource form select { + margin-top: 0.5em; +} .main.resource form button { float: left; padding: 0.5em; diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid index ad5beab..551a66c 100644 --- a/themes/okadmin/templates/partials/inputs.liquid +++ b/themes/okadmin/templates/partials/inputs.liquid @@ -5,26 +5,27 @@ <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}}"> - {% else if type == 'text' %} + {% elsif type == 'text' %} <textarea {% if spec.disabled %} disabled="true" {% endif %} name="{{name}}">{{spec.value}}</textarea> - {% else if type == 'enum' %} + {% elsif type == 'enum' %} <select {% if spec.disabled %} disabled="true" {% endif %} name="{{name}}"> - {% for option in spec.values %} - {{spec.value}} + {% for option in spec.options %} + <option value="{{option}}" {% if option == spec.value %}selected{% endif %}>{{option}}</option> {% endfor %} </select> {% else %} |
