summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-10-04 11:42:18 -0400
committerJules Laplace <jules@okfoc.us>2016-10-04 11:42:18 -0400
commit7e525bc4ae191bde7cb40de2c489250cb3e0af0f (patch)
tree343781681d1af4b94e90e6498f9f72301c6fc7b0
parent51d15907484032cf47d5e7b5beffede4d9a1f791 (diff)
adding triple-captioned-image-listv0.2.1
-rw-r--r--examples/db.json41
-rw-r--r--examples/index.js39
-rw-r--r--package.json2
-rw-r--r--themes/okadmin/templates/partials/inputs.liquid38
4 files changed, 99 insertions, 21 deletions
diff --git a/examples/db.json b/examples/db.json
index 5f8554f..d037d2b 100644
--- a/examples/db.json
+++ b/examples/db.json
@@ -233,7 +233,6 @@
"flagged": true
}
],
- "flour": [],
"card": [
{
"id": "1",
@@ -284,5 +283,45 @@
"__index": 1,
"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"
+ }
]
} \ No newline at end of file
diff --git a/examples/index.js b/examples/index.js
index 58a2314..ad57a09 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -13,14 +13,14 @@ var app = okcms.createApp({
admin: {
theme: 'okadmin',
- dashboard: {
- resources: {
- card: {
- groupBy: 'stack',
- descending: true
- }
- }
- },
+// dashboard: {
+// resources: {
+// card: {
+// groupBy: 'stack',
+// descending: true
+// }
+// }
+// },
},
schemas: {
@@ -48,16 +48,17 @@ var app = okcms.createApp({
id: {type: 'string', hidden: true},
title: {type: 'string'},
image: {type: 'image'},
+ images: {type: 'triple-captioned-image-list'},
},
- card: {
- id: {type: 'string', hidden: true},
- title: {type: 'string'},
- stack: {type: 'foreign-key', key: 'stack'},
- },
- stack: {
- id: {type: 'string', hidden: true},
- title: {type: 'string'},
- }
+// card: {
+// id: {type: 'string', hidden: true},
+// title: {type: 'string'},
+// stack: {type: 'foreign-key', key: 'stack'},
+// },
+// stack: {
+// id: {type: 'string', hidden: true},
+// title: {type: 'string'},
+// }
},
resources: [
@@ -66,8 +67,8 @@ var app = okcms.createApp({
{ type: 'bread' },
{ type: 'test' },
{ type: 'flour' },
- { type: 'card' },
- { type: 'stack' },
+// { type: 'card' },
+// { type: 'stack' },
],
services: {
diff --git a/package.json b/package.json
index a1bbf4f..019cfcb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "okcms",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "The dopest CMS on the planet.",
"main": "app/index.js",
"scripts": {
diff --git a/themes/okadmin/templates/partials/inputs.liquid b/themes/okadmin/templates/partials/inputs.liquid
index 19aa3a1..4750630 100644
--- a/themes/okadmin/templates/partials/inputs.liquid
+++ b/themes/okadmin/templates/partials/inputs.liquid
@@ -344,6 +344,44 @@
{% endfor %}
</ol>
</div>
+ {% elsif type == 'triple-captioned-image-list' %}
+ <div class="image-list group loaded">
+ <div class="fields">
+ <div class="add-image-button">
+ <input type="file" accept="image/*" multiple>
+ <button>+ Add images</button>
+ </div>
+ <input class="add-url" type="text" placeholder="+ Add URL">
+ </div>
+
+ <script type="text/html" class="image-template">
+ <li class="image-element">
+ <img>
+ <button class="remove">x</button>
+ <input class="uri" type="hidden" name="{{name}}[][uri]" value="">
+ <input type="hidden" name="{{name}}[][width]" class="image-width">
+ <input type="hidden" name="{{name}}[][height]" class="image-height">
+ <input class="caption" name="{{name}}[][label]" placeholder="Label">
+ <input class="caption" name="{{name}}[][caption]" placeholder="Caption">
+ <input class="caption" name="{{name}}[][code]" placeholder="Code">
+ </li>
+ </script>
+
+ <ol>
+ {% for image in spec.value %}
+ <li class="image-element">
+ <img src="{{image.uri}}" alt="{{image.caption | strip_html}}">
+ <button class="remove">x</button>
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][uri]" value="{{image.uri}}">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][width]" value="{{image.width}}" class="image-width">
+ <input type="hidden" name="{{name}}[{{forloop.index0}}][height]" value="{{image.height}}" class="image-height">
+ <input class="caption" name="{{name}}[{{forloop.index0}}][label]" value="{{image.label | escape}}" placeholder="Label">
+ <input class="caption" name="{{name}}[{{forloop.index0}}][caption]" value="{{image.caption | escape}}" placeholder="Caption">
+ <input class="caption" name="{{name}}[{{forloop.index0}}][code]" value="{{image.code | escape}}" placeholder="Code">
+ </li>
+ {% endfor %}
+ </ol>
+ </div>
{% elsif type == 'meta' %}
<input class="hidden" type="hidden" name="{{name}}" value="{{spec.value}}">
{% else %}