Add render code for data

This commit is contained in:
Nathan Chapman 2018-10-18 07:25:03 -07:00
parent edd5396500
commit 7cf1b3ddfb
17 changed files with 790 additions and 3729 deletions

577
data.json
View File

@ -1,11 +1,580 @@
{ [
"collection": "sandwiches", {
"id": 0,
"title": "sandwich",
"collections": [
{
"id": 0,
"title": "Sandwiches", "title": "Sandwiches",
"additions": "◆ Add a cup of soup for $4 ◆",
"options": "Can be made with Gluten Free bread",
"entrees": [ "entrees": [
{ {
"id": 0,
"name": "Bánh Mì", "name": "Bánh Mì",
"description": "Slow roasted pork belly, with fresh pickled carrots, onion and cucumbers with jalapeños, red peppers and cilantro on panini bread with sweet chili mayo.", "description": "Slow roasted pork belly, with fresh pickled carrots, onion and cucumbers with jalapeños, red peppers and cilantro on panini bread with sweet chili mayo.",
"price": 14 "price": "14",
"options": ""
},
{
"id": 1,
"name": "Club",
"description": "Turkey, ham, bacon, Havarti, sriracha mayo, lettuce & tomato on toasted sourdough.",
"price": "7.50 half / 13 whole",
"options": ""
},
{
"id": 2,
"name": "Grilled Reuben",
"description": "Pastrami, Swiss, sauerkraut & our homemade sauce on Rye",
"price": "7.50 half / 13 whole",
"options": ""
},
{
"id": 3,
"name": "Grilled Rachel",
"description": "Turkey, Swiss, sauerkraut & our homemade sauce on Rye",
"price": "7.50 half / 13 whole",
"options": ""
},
{
"id": 4,
"name": "Grilled Veggie",
"description": "Grilled portobello, zucchini, peppers & onions with fresh greens & our homemade feta sauce on rye",
"price": "7.50 half / 13 whole",
"options": ""
},
{
"id": 5,
"name": "Pulled Pork",
"description": "Our pulled pork, pepper jack cheese, sliced red onion & our homemade barbecue sauce on panini bread",
"price": "13",
"options": ""
},
{
"id": 6,
"name": "Grilled Ham & Cheese",
"description": "Ham, Swiss, mayo, Dijon & dill pickle on sourdough",
"price": "7 half / 12 whole",
"options": ""
},
{
"id": 7,
"name": "Spicy Ham Melt",
"description": "Ham, Havarti, sriracha mayo & red bell peppers on wheat",
"price": "7 half / 12 whole",
"options": ""
},
{
"id": 8,
"name": "Tuna Melt",
"description": "Our freshly made tuna salad with cheddar on sourdough",
"price": "7 half / 12 whole",
"options": ""
},
{
"id": 9,
"name": "Cold Veggie",
"description": "Cucumbers, carrots, red onions, red bell peppers, lettuce & tomato with provolone on seedy wheat with hummus",
"price": "7 half / 12 whole",
"options": ""
},
{
"id": 10,
"name": "Basic Sandwich",
"description": "Choice of: Ham or Turkey; with cheddar, mayo, Dijon, lettuce, and tomato on sourdough",
"price": "7 half / 12 whole",
"options": ""
} }
] ]
} }
]
},
{
"id": 1,
"title": "burger",
"collections": [
{
"id": 0,
"title": "Burgers",
"additions": "◆ Add a cup of soup for $4 ◆",
"options": "Served on panini bread but can be made with Gluten Free bread",
"entrees": [
{
"id": 0,
"name": "Big Burger",
"description": "Local grass-fed beef, bacon, blue cheese, tomato, lettuce & special sauce",
"price": "14",
"options": ""
},
{
"id": 1,
"name": "Big Lamb Köfte",
"description": "Grass-fed lamb, tomato, cucumber, red onions & feta sauce",
"price": "14",
"options": ""
},
{
"id": 2,
"name": "Chicken Burger",
"description": "Organic chicken breast, bacon, provolone, pesto, garlic aioli, lettuce & tomato",
"price": "14",
"options": ""
},
{
"id": 3,
"name": "Big Classic",
"description": "Local grass-fed beef & house made pork sausage, with bacon, sun-dried tomato pesto, grilled onions & provolone",
"price": "14",
"options": ""
},
{
"id": 4,
"name": "Portobello Burger",
"description": "Grilled portobello, marinated red onions, jalapeños, red peppers & fresh greens on panini bread with sun-dried tomato pest & caper aioli",
"price": "14",
"options": ""
}
]
},
{
"id": 1,
"title": "Sliders",
"additions": "◆ Add a cup of soup for $4 ◆",
"options": "Served on our homemade buttermilk biscuit but can be made with Gluten Free bread",
"entrees": [
{
"id": 0,
"name": "House",
"description": "Local grass-fed beef, bacon, tomato & special sauce",
"price": "7.50",
"options": ""
},
{
"id": 1,
"name": "Lamb Köfte",
"description": "Grass-fed lamb, tomato, cucumber, red onions & tiziki sauce",
"price": "7.50",
"options": ""
},
{
"id": 2,
"name": "Portobello",
"description": "Marinated portobello, provolone, tomato, lettuce & balsamic mayo",
"price": "7.50",
"options": "Vegetarian"
},
{
"id": 3,
"name": "Little Classic",
"description": "Local grass-fed beef & house made pork sausage with bacon, sun-dried tomato pesto, grilled onions & provolone",
"price": "7.50",
"options": ""
}
]
}
]
},
{
"id": 2,
"title": "salad",
"collections": [
{
"id": 0,
"title": "House Salads",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "Garden Salad",
"description": "Organic greens, cucumber, carrots, red bell peppers, red onion, beets, corn, peas, carrots, sunflower seeds & Balsamic dressing",
"price": "6.50 small / 10 medium / 15 large",
"options": "Add organic Chicken or Shrimp for $9"
},
{
"id": 1,
"name": "Apple Blue Cheese Salad",
"description": "Organic greens, blue cheese crumbles, walnuts, red onions & apples with balsamic dressing",
"price": "6.50 small / 10 medium / 15 large",
"options": ""
}
]
},
{
"id": 1,
"title": "Taco Salads",
"additions": "",
"options": "Gluten Free",
"entrees": [
{
"id": 0,
"name": "Beef / Chicken / Veggie",
"description": "Organic greens, black beans, corn, olives, tomatoes, green chillies, avocado, salsa, sour cream & our homemade chips",
"price": "16",
"options": "Veggie includes grilled zucchini & onions"
},
{
"id": 1,
"name": "Pork Carnitas Taco Salad",
"description": "Organic greens, pinto beans, sweet potatoes, avocado, mango chipotle sauce, salsa, sour cream & our homemade chips",
"price": "16",
"options": ""
}
]
},
{
"id": 2,
"title": "Tacos",
"additions": "",
"options": "Gluten Free",
"entrees": [
{
"id": 0,
"name": "Shrimp Tacos",
"description": "Slaw, mango chipotle sauce, corn tortillas rice & beans",
"price": "15",
"options": ""
},
{
"id": 1,
"name": "Pork Carnitas Tacos",
"description": "Chimmichurri sauce, corn tortillas rice & beans",
"price": "15",
"options": ""
}
]
}
]
},
{
"id": 3,
"title": "burrito",
"collections": [
{
"id": 0,
"title": "Kebabs",
"additions": "",
"options": "Can be made Gluten Free with corn tortillas",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 1,
"title": "Burritos",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 2,
"title": "Nachos",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 3,
"title": "Soup",
"additions": "◆ Served with a buttermilk biscuit ◆",
"options": "Gluten Free / Vegan",
"entrees": [
{
"id": 0,
"name": "Daily (look to the chalkboard)",
"description": "",
"price": "5 cup / 7 bowl",
"options": ""
}
]
}
]
},
{
"id": 4,
"title": "vegan",
"collections": [
{
"id": 0,
"title": "Buddha Bowls",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 2,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 3,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 1,
"title": "Salads & Wraps",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 2,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 3,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 2,
"title": "Sandwiches",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 2,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 3,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 3,
"title": "◈ Served After 5pm ◈",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 4,
"title": "Pasta",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 2,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 3,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
}
]
},
{
"id": 5,
"title": "evening",
"collections": [
{
"id": 0,
"title": "◈ Served After 5pm ◈",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
},
{
"id": 1,
"title": "◈ Served After 5pm ◈",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
}
]
},
{
"id": 6,
"title": "dessert",
"collections": [
{
"id": 0,
"title": "Desserts",
"additions": "",
"options": "",
"entrees": [
{
"id": 0,
"name": "",
"description": "",
"price": "",
"options": ""
},
{
"id": 1,
"name": "",
"description": "",
"price": "",
"options": ""
}
]
}
]
}
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

@ -17,39 +17,56 @@
<body> <body>
</body> </body>
<h1>Owl Sprit Cafe</h1> <header class="owl">
<p>Delicious Homemade Food</p> <h1>Owl Sprit Cafe</h1>
<p>Delicious Homemade Food</p>
<h3>Fresh Local Food</h3> <section>
<p>We believe in local and oranic food and love to share it with our guests.</p> <h3>Fresh Local Food</h3>
<p>For those who apperciate a cooked meal made from scratch.</p> <p>We believe in local and oranic food and love to share it with our guests.</p>
<p>Treat yourself and your date to homemade goodness when you take the time to enjoy a meal at the Owl Sprit Cafe.</p> <p>For those who apperciate a cooked meal made from scratch.</p>
<p>Treat yourself and your date to homemade goodness when you take the time to enjoy a meal at the Owl Sprit Cafe.</p>
<h4>Hours</h4> <h4>Hours</h4>
<p> <p>
11:00am - 7:30pm<br> 11:00am - 7:30pm<br>
Closed Sundays Closed Sundays
</p> </p>
<h4>Location</h4> <h4>Location</h4>
<address> <address>
218 Polk St<br> 218 Polk St<br>
Port Townsend, WA 98368 Port Townsend, WA 98368
</address> </address>
<h4>Phone</h4> <h4>Phone</h4>
<a href="tel:+13603855275">360.385.5275</a> <a href="tel:+13603855275">360.385.5275</a>
</section>
<div id="container"> </header>
<h3>{{ menu.title }}</h3>
<ul>
<li v-for="item in menu.entrees">
{{ item.name }}: {{ item.description }}
</li>
</ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <main id="container">
<article v-for="spread in spreads" :key="spread.id" v-bind:class="spread.title + ' spread-item'">
<section v-for="collection in spread.collections" :key="collection.id" v-bind:class="collection.title + ' collection-item'">
<h3>{{ collection.title }}</h3>
<p><strong>{{ collection.additions }}</strong></p>
<p><em>{{ collection.options }}</em></p>
<div v-for="entree in collection.entrees" :key="entree.id" v-bind:class="entree.title + ' entree-item'">
<p class="entree-name"><strong>{{ entree.name }}</strong> <span>{{ entree.price }}</span></p>
<small>{{ entree.options }}</small>
<p><em>{{ entree.description }}</em></p>
</div>
</section>
</article>
</main>
<footer>
</footer>
<script src="/scripts/lib/vue.js"></script>
<script src="/scripts/index.js"></script> <script src="/scripts/index.js"></script>
</body> </body>
</html> </html>

View File

@ -8,19 +8,23 @@ function ready(fn) {
} }
ready(function() { ready(function() {
var getFile = function(url, cb) { function renderJSON(json) {
var request = new XMLHttpRequest();
request.open('GET', url, false);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
// Success!
var json = JSON.parse(this.response);
var app = new Vue({ var app = new Vue({
el: '#container', el: '#container',
data: { data: {
menu: json spreads: json
} }
}); });
}
var getFile = function(url, cb) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
// Success!
cb(JSON.parse(this.response));
} else { } else {
console.log("We reached our target server, but it returned an error"); console.log("We reached our target server, but it returned an error");
} }
@ -30,5 +34,5 @@ ready(function() {
}; };
request.send(); request.send();
}; };
var data = getFile('/data.json'); var data = getFile('/data.json', renderJSON);
}); });

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

6
scripts/lib/vue.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -43,11 +43,13 @@ html {
} }
body { body {
background-color: white; background-color: black;
font-family: 'Vollkorn', serif; font-family: 'Vollkorn', serif;
font-weight: 400; font-weight: 400;
line-height: 1.45; line-height: 1.45;
color: #333; color: white;
max-width: 1024px;
margin: auto;
} }
p { p {
@ -86,3 +88,74 @@ small {
/* /*
** Layout ** Layout
*/ */
.spread-item {
display: flex;
color: black;
justify-content: space-around;
flex-wrap: wrap;
}
.entree-name {
display: flex;
justify-content: space-between;
}
/*
** Theme
*/
.owl, .spread-item {
padding: 0;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.owl {
color: white;
text-shadow: 1px 1px 2px black;
}
.owl section {
padding: 2em;
max-width: 35%;
background-color: rgba(0, 0, 0, .8);
}
.spread-item section {
padding: 2em;
max-width: 35%;
background-color: rgba(255, 255, 255, .8);
}
.collection-item h3 {
color: #d04c27;
}
.owl {
background-image: url(/images/img_01_owl.jpg);
}
.sandwich {
background-image: url(/images/img_02_sandwich.jpg);
}
.burger {
background-image: url(/images/img_03_burger.jpg);
}
.salad {
background-image: url(/images/img_04_salad.jpg);
}
.burrito {
background-image: url(/images/img_05_burrito.jpg);
}
.vegan {
background-image: url(/images/img_06_vegan.jpg);
}
.evening {
background-image: url(/images/img_07_evening.jpg);
}
.dessert {
background-image: url(/images/img_08_dessert.jpg);
}

View File

@ -83,7 +83,7 @@
<p><strong>Add a cup of soup for $4</strong></p> <p><strong>Add a cup of soup for $4</strong></p>
<p><em>Served on our homemade buttermilk biscuit but can be made with</em> <strong>Gluten Free</strong> <em>bread</em></p> <p><em>Served on our homemade buttermilk biscuit but can be made with Gluten Free bread</em></p>
<p><strong>House 7.50</strong></p> <p><strong>House 7.50</strong></p>
@ -196,12 +196,16 @@
<p><strong>· Veggie</strong> _ includes grilled zucchini & onions_ <strong>13</strong></p> <p><strong>· Veggie</strong> _ includes grilled zucchini & onions_ <strong>13</strong></p>
</section> </section>
<section> <section>
<h1 id="soup">Soup</h1> <h1 id="soup">Soup</h1>
<p><strong>Served with a buttermilk biscuit</strong></p> <p><strong>Served with a buttermilk biscuit</strong></p>
<p><em>Let us know if you are</em> <strong>Gluten Free</strong> <em>or</em> <strong>Vegan</strong></p> <p><em>Let us know if you are Gluten Free or Vegan</strong></p>
<p><strong>5</strong> <em>cup</em> <strong>7</strong> <em>bowl</em></p> <p><strong>5</strong> <em>cup</em> <strong>7</strong> <em>bowl</em></p>