diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-10-24 17:27:36 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-10-24 17:27:36 -0400 |
| commit | 073b2af3e21edccb35dad6b5bfdda2772f164abf (patch) | |
| tree | 4621ce5a3a282b30b59d55cb770672a5b681aa24 | |
| parent | bc38a56567c20f3205b89dae710d131655b0220d (diff) | |
fix issue with empty schemasv0.2.4
| -rw-r--r-- | app/node_modules/okschema/index.js | 3 | ||||
| -rw-r--r-- | examples/db.json | 43 | ||||
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | themes/okadmin/templates/index.liquid | 21 |
4 files changed, 17 insertions, 52 deletions
diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js index 0048fc5..39845ea 100644 --- a/app/node_modules/okschema/index.js +++ b/app/node_modules/okschema/index.js @@ -30,7 +30,8 @@ var types = { parent: {type: 'string'}, assertValid: function(spec, value) { value = value || ''; - if (spec.options.indexOf(value.trim()) === -1) { + if ( (spec.options.length && spec.options.indexOf(value.trim()) === -1) || + (! spec.options.length && Object.keys(spec.options).indexOf(value.trim()) === -1)) { throw [{ constraint: 'enum', actual: value, diff --git a/examples/db.json b/examples/db.json index d037d2b..ed60f22 100644 --- a/examples/db.json +++ b/examples/db.json @@ -122,7 +122,7 @@ "title": "About Us", "body": "Just a small bakery", "id": "about", - "__index": "1", + "__index": 1, "links": [], "dateCreated": "" }, @@ -284,44 +284,5 @@ "dateCreated": "Fri, 02 Sep 2016 16:41:10 GMT" } ], - "flour": [ - { - "id": "test", - "title": "Test", - "image": { - "uri": "", - "caption": "", - "width": "", - "height": "" - }, - "images": [ - { - "uri": "https://ltho.s3.amazonaws.com/okcms-example/07ad6a70-8a49-11e6-80c3-41900948e24c.png", - "width": "463", - "height": "606", - "label": "1", - "caption": "2", - "code": "3" - }, - { - "uri": "https://ltho.s3.amazonaws.com/okcms-example/07ad1c50-8a49-11e6-80c3-41900948e24c.png", - "width": "515", - "height": "441", - "label": "13", - "caption": "23", - "code": "33" - }, - { - "uri": "https://ltho.s3.amazonaws.com/okcms-example/07aa3620-8a49-11e6-80c3-41900948e24c.png", - "width": "566", - "height": "329", - "label": "14", - "caption": "25", - "code": "36" - } - ], - "__index": 0, - "dateCreated": "Tue, 04 Oct 2016 15:41:52 GMT" - } - ] + "flour": [] }
\ No newline at end of file diff --git a/package.json b/package.json index 74cf612..66f4a41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "okcms", - "version": "0.2.3", + "version": "0.2.4", "description": "The dopest CMS on the planet.", "main": "app/index.js", "scripts": { diff --git a/themes/okadmin/templates/index.liquid b/themes/okadmin/templates/index.liquid index d2ae557..9a46455 100644 --- a/themes/okadmin/templates/index.liquid +++ b/themes/okadmin/templates/index.liquid @@ -49,15 +49,18 @@ {% endfor %} {% endfor %} {% else %} - <ol class="resource-list"> - {% for data in resource.data %} - <a href="{{resource.type}}/{{data.id}}/" {% if data.disabled %}class="disabled"{% endif %}> - {{data.title}} - <input class="resource-input" type="hidden" name="{{resource.type}}[{{forloop.index0}}]" - value='{{data | stringify | escape_once}}'> - </a> - {% endfor %} - </ol> + {% assign resourceJSON = resource.data[0] | stringify %} + {% if resourceJSON != "[]" %} + <ol class="resource-list"> + {% for data in resource.data %} + <a href="{{resource.type}}/{{data.id}}/" {% if data.disabled %}class="disabled"{% endif %}> + {{data.title}} + <input class="resource-input" type="hidden" name="{{resource.type}}[{{forloop.index0}}]" + value='{{data | stringify | escape_once}}'> + </a> + {% endfor %} + </ol> + {% endif %} <footer> <nav> <a class="btn cancel-btn" href="#">cancel</a> |
