summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-08 19:52:04 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-08 19:52:04 -0400
commit47215a88acb2b4a612b6916f2f7b7a7660770c36 (patch)
tree602f442d5193882721df0865fc3c224539af9470 /examples
parent5f3d47c4bea9c94152a8243c304ee0f43e84ac07 (diff)
Update example
Diffstat (limited to 'examples')
-rw-r--r--examples/db.json30
-rw-r--r--examples/index.js23
-rw-r--r--examples/public/css/main.css19
-rw-r--r--examples/public/images/brown046.jpgbin0 -> 5108 bytes
-rw-r--r--examples/templates/bread.liquid14
-rw-r--r--examples/templates/index.liquid28
-rw-r--r--examples/templates/page.liquid19
-rw-r--r--examples/templates/project.liquid2
8 files changed, 98 insertions, 37 deletions
diff --git a/examples/db.json b/examples/db.json
index bfce252..1d0cba4 100644
--- a/examples/db.json
+++ b/examples/db.json
@@ -1,22 +1,32 @@
{
- "meta": [
+ "meta": [],
+ "bread": [
{
- "project": "great project"
- }
- ],
- "project": [
+ "type": "rye",
+ "description": "really a very tasty bread!",
+ "id": "rye"
+ },
{
- "id": "cool"
+ "type": "bagel",
+ "description": "very good and dense bread",
+ "id": "bagel"
},
{
- "id": "lame"
+ "type": "pumpernickel",
+ "description": "grandma's recipe",
+ "id": "pumpernickel"
}
],
"page": [
{
- "id": "about",
- "title": "so page",
- "body": "we did it"
+ "title": "About Us",
+ "body": "Just a small bakery",
+ "id": "about"
+ },
+ {
+ "title": "contact",
+ "body": "2406 Old Rd, San Juan Bautista",
+ "id": "contact"
}
]
} \ No newline at end of file
diff --git a/examples/index.js b/examples/index.js
index c4fd3be..e55b717 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -6,29 +6,26 @@ var app = okcms.createApp({
schemas: {
page: {
- title: {type: 'string', id: true},
+ id: {type: 'string'},
+ title: {type: 'string'},
body: {type: 'string'}
},
- project: {
- title: {type: 'string', id: true},
- index: {type: 'integer'},
- category: {type: 'enum'},
- body: {type: 'string'},
- videos: [{type: 'uri'}],
- images: [{index: {type: 'string'}, uri: {type: 'uri'}}]
+ bread: {
+ type: {type: 'string', id: true},
+ description: {type: 'string'}
}
},
resources: [
- { type: 'page', data: {title: 'about'}},
- { type: 'page', data: {title: 'contact'}},
- { type: 'project' },
+ { type: 'page', static: {id: 'about'}},
+ { type: 'page', static: {id: 'contact'}},
+ { type: 'bread' },
],
views: {
'/': {
data: [
- {type: 'project', query: '*'},
+ {type: 'bread', query: '*'},
{type: 'page', query: '*'}
]
},
@@ -39,7 +36,7 @@ var app = okcms.createApp({
data: {type: 'page', query: 'contact'}
},
'/:id': {
- data: {type: 'project', query: ':id'}
+ data: {type: 'bread', query: ':id'}
}
}
diff --git a/examples/public/css/main.css b/examples/public/css/main.css
index 55f8e3b..92b2ee7 100644
--- a/examples/public/css/main.css
+++ b/examples/public/css/main.css
@@ -1 +1,18 @@
-/** woo doggy! **/
+html, body {
+ margin: 0;
+ passing: 0;
+ font-family: "Georgia", sans-serif;
+}
+
+body {
+ background-image: url(../images/brown046.jpg);
+}
+
+h1, h2, h3 {
+ color: rgb(12, 145, 14);
+}
+
+.container {
+ padding: 2em;
+ background-color: rgba(255, 255, 255, 0.5);
+}
diff --git a/examples/public/images/brown046.jpg b/examples/public/images/brown046.jpg
new file mode 100644
index 0000000..4b86003
--- /dev/null
+++ b/examples/public/images/brown046.jpg
Binary files differ
diff --git a/examples/templates/bread.liquid b/examples/templates/bread.liquid
new file mode 100644
index 0000000..da36cce
--- /dev/null
+++ b/examples/templates/bread.liquid
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="../css/main.css">
+ </head>
+ <body>
+ <div class="container">
+ <h1>{{bread.type | capitalize}}</h1>
+ <p>
+ {{bread.description}}
+ </p>
+ </div>
+ </body>
+</html>
diff --git a/examples/templates/index.liquid b/examples/templates/index.liquid
index 21d8764..7c12a86 100644
--- a/examples/templates/index.liquid
+++ b/examples/templates/index.liquid
@@ -4,11 +4,27 @@
<link rel="stylesheet" href="css/main.css">
</head>
<body>
- {{meta.project}}
- <ul>
- {% for project in projects %}
- <li>{{project.id}}</li>
- {% endfor %}
- </ul>
+ <div class="container">
+ <header>
+ <h1>Cheryl's Deli and Bakery</h1>
+ </header>
+ <section class="main">
+ <nav>
+ <ul>
+ {% for page in pages %}
+ <li><a href="{{page.id}}">{{page.id | capitalize}}</a></li>
+ {% endfor %}
+ </ul>
+ <nav>
+ <div class="breads">
+ <h2>Great breads:</h2>
+ <ul>
+ {% for bread in breads %}
+ <li><a href="{{bread.id}}">{{bread.id | capitalize}}</a></li>
+ {% endfor %}
+ </ul>
+ </div>
+ </section>
+ </div>
</body>
</html>
diff --git a/examples/templates/page.liquid b/examples/templates/page.liquid
index f7d899f..e90f7ce 100644
--- a/examples/templates/page.liquid
+++ b/examples/templates/page.liquid
@@ -1,5 +1,14 @@
-woop
-<h1>{{page.title}}</h1>
-<p>
- {{page.body}}
-</p>
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="../css/main.css">
+ </head>
+ <body>
+ <div class="container">
+ <h1>{{page.title | capitalize}}</h1>
+ <p>
+ {{page.body}}
+ </p>
+ </div>
+ </body>
+</html>
diff --git a/examples/templates/project.liquid b/examples/templates/project.liquid
deleted file mode 100644
index dac1d8d..0000000
--- a/examples/templates/project.liquid
+++ /dev/null
@@ -1,2 +0,0 @@
-babaganuj
-{{project.id}}