diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-12-31 06:08:08 +0100 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-12-31 06:08:08 +0100 |
| commit | f0a10a321316475fd05e2ee3a40e35c57b66b0a7 (patch) | |
| tree | 871b82c59b14da01e32df55592854d6075d04410 | |
| parent | fe31b3ad482c959deb5b4fa447e3d73c042e982c (diff) | |
display certain types as lists of images
| -rw-r--r-- | app/index.js | 2 | ||||
| -rw-r--r-- | app/node_modules/okadminview/index.js | 1 | ||||
| -rw-r--r-- | examples/db.json | 42 | ||||
| -rw-r--r-- | examples/index.js | 3 | ||||
| -rw-r--r-- | themes/okadmin/public/css/main.css | 9 | ||||
| -rw-r--r-- | themes/okadmin/templates/index.liquid | 3 |
6 files changed, 55 insertions, 5 deletions
diff --git a/app/index.js b/app/index.js index f59f760..899848e 100644 --- a/app/index.js +++ b/app/index.js @@ -305,7 +305,7 @@ OKCMS.prototype._createQueries = function(queryConfig, resourceCache) { as: config.as, sortBy: config.sortBy, descending: config.descending, - groupBy: config.groupBy + groupBy: config.groupBy, }); }); }; diff --git a/app/node_modules/okadminview/index.js b/app/node_modules/okadminview/index.js index 1121852..1fc4116 100644 --- a/app/node_modules/okadminview/index.js +++ b/app/node_modules/okadminview/index.js @@ -376,6 +376,7 @@ function fetchIndexTemplateData(meta, queries, dashboardConfig) { data: result, groupBy: groupBy, descending: descending, + display: dashConf.display, } } return acc diff --git a/examples/db.json b/examples/db.json index ed60f22..8c32037 100644 --- a/examples/db.json +++ b/examples/db.json @@ -284,5 +284,45 @@ "dateCreated": "Fri, 02 Sep 2016 16:41:10 GMT" } ], - "flour": [] + "flour": [ + { + "id": "test", + "title": "Test", + "image": { + "uri": "https://ltho.s3.amazonaws.com/okcms-example/1d4e4e00-cf16-11e6-bf3b-17f7318de7f4.png", + "caption": "", + "width": "397", + "height": "285" + }, + "__index": 0, + "dateCreated": "Sat, 31 Dec 2016 05:00:59 GMT", + "images": [] + }, + { + "id": "test-2", + "title": "Test #2", + "image": { + "uri": "https://ltho.s3.amazonaws.com/okcms-example/2bb54930-cf16-11e6-bf3b-17f7318de7f4.jpg", + "caption": "", + "width": "500", + "height": "500" + }, + "__index": 1, + "dateCreated": "Sat, 31 Dec 2016 05:01:23 GMT", + "images": [] + }, + { + "id": "circles", + "title": "Circles", + "image": { + "uri": "https://ltho.s3.amazonaws.com/okcms-example/f99042b0-cf16-11e6-914f-214dd525ee03.gif", + "caption": "", + "width": "400", + "height": "400" + }, + "__index": 2, + "dateCreated": "Sat, 31 Dec 2016 05:07:09 GMT", + "images": [] + } + ] }
\ No newline at end of file diff --git a/examples/index.js b/examples/index.js index 8918043..c03550a 100644 --- a/examples/index.js +++ b/examples/index.js @@ -25,7 +25,6 @@ var app = okcms.createApp({ resources: { flour: { display: 'image', - field: 'image', } } } @@ -103,6 +102,7 @@ var app = okcms.createApp({ lib: require("./lib/okdumpfm"), }, +/* push: { lib: require("./lib/okpush"), mongodbUrl: "mongodb://localhost/okpush_example", @@ -127,6 +127,7 @@ var app = okcms.createApp({ }, } }, +*/ }, views: { diff --git a/themes/okadmin/public/css/main.css b/themes/okadmin/public/css/main.css index 3aec0ac..354c46c 100644 --- a/themes/okadmin/public/css/main.css +++ b/themes/okadmin/public/css/main.css @@ -34,6 +34,15 @@ a {} cursor: pointer; } +.main.index .resource-list a div.image { + width: 20vw; + height: 16vw; + margin: 10px; + background-size: contain; + background-repeat: no-repeat; + background-position: center; +} + .main.index .resource-list a:before { counter-increment: start; content: counter(start, decimal-leading-zero) ".\00a0\00a0"; diff --git a/themes/okadmin/templates/index.liquid b/themes/okadmin/templates/index.liquid index d47eb2e..c73feda 100644 --- a/themes/okadmin/templates/index.liquid +++ b/themes/okadmin/templates/index.liquid @@ -55,7 +55,7 @@ {% for data in resource.data %} <a href="{{resource.type}}/{{data.id}}/" {% if data.disabled %}class="disabled"{% endif %}> {% if resource.display == 'image' %} - <div class="image" style="background-image:url('{{data.title}}')"></div> + <div class="image" style="background-image:url('{{data.image.uri}}')"></div> {% else %} {{data.title}} {% endif %} @@ -65,7 +65,6 @@ {% endfor %} </ol> {% endif %} - {% endif %} <footer> <nav> <a class="btn cancel-btn" href="#">cancel</a> |
