From 96d3b84593362eecc2e8f1d5b4f13b7779efcbcd Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Thu, 9 Apr 2015 12:46:44 -0400 Subject: Update app manifest to use one schema --- site/db.json | 3 +- site/index.js | 71 +++++++++++++++++++++++++++---------------- site/templates/index.liquid | 24 ++++++++++----- site/templates/project.liquid | 20 ++++++------ 4 files changed, 72 insertions(+), 46 deletions(-) diff --git a/site/db.json b/site/db.json index 14f8724..8107c6d 100644 --- a/site/db.json +++ b/site/db.json @@ -1,8 +1,9 @@ { "meta": [], - "retail": [ + "project": [ { "id": "diesel-ss15", + "category": "retail", "title": "DIESEL JOGG JEANS SS15 DENIM CAMPAIGN", "shortname": "DIESEL SS15", "description": "Sed posuere consectetur est at lobortis. Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Donec sed odio dui. \r\n\r\nVestibulum id ligula porta felis euismod semper. Vestibulum id ligula porta felis euismod semper. Vestibulum id ligula porta felis euismod semper. Aenean lacinia bibendum nulla sed consectetur. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. \r\n\r\nCurabitur blandit tempus porttitor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit tempus porttitor. Maecenas sed diam eget risus varius blandit sit amet non magna.", diff --git a/site/index.js b/site/index.js index d36778f..55752e5 100644 --- a/site/index.js +++ b/site/index.js @@ -1,14 +1,5 @@ var okcms = require('..'); -var projectSchema = { - id: {type: 'string', id: true}, - title: {type: 'string'}, - shortname: {type: 'string'}, - description: {type: 'text'}, - video: {type: 'video'}, - images: {type: 'captioned-image-list'} -} - var app = okcms.createApp({ root: 'public', @@ -20,19 +11,26 @@ var app = okcms.createApp({ body: {type: 'text'}, image: {type: 'string'} }, - retail: projectSchema, - advertising: projectSchema, - experiential: projectSchema, - content: projectSchema, + project: { + id: {type: 'string', id: true}, + title: {type: 'string'}, + shortname: {type: 'string'}, + description: {type: 'text'}, + video: {type: 'video'}, + images: {type: 'captioned-image-list'}, + category: {type: 'enum', options: [ + 'retail', + 'advertising', + 'experiential', + 'content'] + } + } }, resources: [ { type: 'page', static: {id: 'about'}}, { type: 'page', static: {id: 'contact'}}, - { type: 'retail' }, - { type: 'advertising' }, - { type: 'experiential' }, - { type: 'content' }, + { type: 'project' } ], services: { @@ -46,11 +44,7 @@ var app = okcms.createApp({ views: { '/': { data: [ - {type: 'retail', query: '*'}, - {type: 'advertising', query: '*'}, - {type: 'experiential', query: '*'}, - {type: 'content', query: '*'}, - {type: 'page', query: '*'} + {type: 'project', query: '*'}, ] }, '/about': { @@ -60,20 +54,43 @@ var app = okcms.createApp({ data: {type: 'page', query: 'contact'} }, '/retail/:id': { - data: {type: 'retail', query: ':id'}, + data: { + type: 'project', + query: { + category: 'retail', + id: ':id' + } + }, template: 'project' }, '/advertising/:id': { - data: {type: 'advertising', query: ':id'}, + data: { + type: 'project', + query: { + category: 'advertising', + id: ':id' + } + }, template: 'project' }, '/experiential/:id': { - data: {type: 'experiential', query: ':id'}, + data: { + type: 'project', + query: { + category: 'experiential', + id: ':id' + } + }, template: 'project' }, '/content/:id': { - data: {type: 'content', query: ':id'}, - template: 'project' + data: { + type: 'project', + query: { + category: 'content', + id: ':id' + } + } } } diff --git a/site/templates/index.liquid b/site/templates/index.liquid index 8797f25..41de3e2 100644 --- a/site/templates/index.liquid +++ b/site/templates/index.liquid @@ -87,26 +87,34 @@ WEBSITE BY OKFOCUS, http://okfoc.us, Internet Legends.
RETAIL
- {% for project in retail %} - {{ project.shortname }} + {% for project in projects %} + {% if project.category == 'retail' %} + {{ project.shortname }} + {% endif %} {% endfor %}
advertising
- {% for project in advertising %} - {{ project.shortname || project.title }} + {% for project in projects %} + {% if project.category == 'advertising' %} + {{ project.shortname || project.title }} + {% endif %}} {% endfor %}
experiential
- {% for project in experiential %} - {{ project.shortname || project.title }} + {% for project in projects %} + {% if project.category == 'experiential' %} + {{ project.shortname || project.title }} + {% endif %}} {% endfor %}
content
- {% for project in content %} - {{ project.shortname || project.title }} + {% for project in projects %} + {% if project.category == 'content' %} + {{ project.shortname || project.title }} + {% endif %}} {% endfor %}
diff --git a/site/templates/project.liquid b/site/templates/project.liquid index 5e6bc84..583cb09 100644 --- a/site/templates/project.liquid +++ b/site/templates/project.liquid @@ -1,22 +1,22 @@
- {{post.title}} - + {{project.title}} +
- {{ post.description }} + {{ project.description }}
- - + +
-
-
\ No newline at end of file + + -- cgit v1.2.3-70-g09d2