forked from pentaho-nbaker/pentaho-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
154 lines (121 loc) · 3.98 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pentaho Cookbook - out of the Mom's Basement into your kitchen</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
</style>
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script src="underscore.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="backbone-min.js"></script>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" >
var pentahoRecipeBook = {
recipes: []
};
var RecipeBook = Backbone.Model.extend({
recipies: [],
initialize: function() {
}
});
var Recipe = Backbone.Model.extend({
author: "Anonymous",
title: "Unknown",
description: "Unknown",
ingredients: [],
steps: [],
initialize: function() {
}
});
var Ingredient = Backbone.Model.extend({
quantity: -1,
name: "Unknown"
});
var Step = Backbone.Model.extend({
description: "Unknown"
});
var RecipeBookView = Backbone.View.extend({
tagName: 'div',
render: function(){
var curRowEle;
for(var i=0, len=this.model.get('recipes').length; i<len; i++){
if(i%3 ==0){
curRowEle = document.createElement("div");
curRowEle.className = "row";
$("#gridContainer").append(curRowEle);
}
curRowEle.appendChild(new RecipeView({model : this.model.get('recipes')[i]}).render().el);
}
return this;
}
});
var RecipeView = Backbone.View.extend({
tagName: 'div',
className: "span4",
render: function(){
$(this.el).html(Handlebars.compile($("#recipe-template").html())(this.model));
return this;
}
});
$(document).ready(function(){
var book = new RecipeBook(pentahoRecipeBook);
(new RecipeBookView({model: book})).render();
})
</script>
<!-- TODO: Externalize -->
<script id="recipe-template" type="text/x-handlebars-template">
<h2>{{title}}</h2>
<p>{{description}}</p>
<p>
<h3>Ingredients:</h3>
<ol>
{{#each ingredients}}
<li>{{quantity}} {{name}}</li>
{{/each}}
</ol>
<h3>Steps:</h3>
<ol>
{{#each steps}}
<li>{{.}}</li>
{{/each}}
</ol>
<p><a class="btn" href="#" onclick="alert('Not Yet Implemented')">Share »</a></p>
</p>
<hr/>
</script>
<!-- links to receipe JSON definitions -->
<script type="text/javascript" src="recipes/rhubarb-pie.js"></script>
<script type="text/javascript" src="recipes/rhubarb-pie2.js"></script>
<script type="text/javascript" src="recipes/carne-asada.js"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="hero-unit">
<h1>Pentaho Cookbook</h1>
<p>-Unique recipes from 'unique' people</p>
</div>
<div class="container" id="gridContainer">
<!-- this is where the grid of recipes is inserted -->
</div>
<hr>
<footer>
<p>© Pentaho Corp. 2012</p>
</footer>
</div> <!-- /container -->
</body>
</html>