diff options
| -rw-r--r-- | examples/index.js | 3 | ||||
| -rwxr-xr-x | install.sh | 5 | ||||
| -rw-r--r-- | themes/okadmin/templates/partials/inputs.liquid | 12 | ||||
| -rw-r--r-- | themes/okadmin/templates/resource.liquid | 2 |
4 files changed, 19 insertions, 3 deletions
diff --git a/examples/index.js b/examples/index.js index 669715d..8846e3a 100644 --- a/examples/index.js +++ b/examples/index.js @@ -13,7 +13,8 @@ var app = okcms.createApp({ bread: { type: {type: 'string', id: true}, title: {type: 'string'}, - description: {type: 'text'} + description: {type: 'text'}, + color: {type: 'enum', fields: ["red","blue","green"]} } }, diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..e0a43c4 --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +cd app/node_modules ; for i in * ; do cd $i ; npm install; cd .. ; done ; cd ../.. +npm install +cd examples +node index + diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid index 2726473..ad5beab 100644 --- a/themes/okadmin/templates/partials/inputs.liquid +++ b/themes/okadmin/templates/partials/inputs.liquid @@ -16,7 +16,17 @@ {% if spec.disabled %} disabled="true" {% endif %} - name="{{name}}" rows="40" cols="80">{{spec.value}}</textarea> + name="{{name}}">{{spec.value}}</textarea> + {% else if type == 'enum' %} + <select + {% if spec.disabled %} + disabled="true" + {% endif %} + name="{{name}}"> + {% for option in spec.values %} + {{spec.value}} + {% endfor %} + </select> {% else %} <p><pre style="color: red">Admin template doesn't support '{{type}}' properties!</pre></p> {% endif %} diff --git a/themes/okadmin/templates/resource.liquid b/themes/okadmin/templates/resource.liquid index 2a6d2ce..26d62f2 100644 --- a/themes/okadmin/templates/resource.liquid +++ b/themes/okadmin/templates/resource.liquid @@ -5,7 +5,7 @@ </nav> <section class="resource main"> - <h2>EDIT {{ resource.type }} {{ resource.spec.title.id }}</h2> + <h2>EDIT {{ resource.type }} '{{ resource.spec.title.id }}'</h2> <form action="." method="POST"> <input type="hidden" name="_method" value="PUT"> {% include 'partials/inputs' %} |
