-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
117 lines (96 loc) · 3.75 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Using Google Spreadsheets with Underscore Templates</title>
<meta content="Pulling information from Google Docs" name="description">
<!-- Open Graph -->
<meta content="Google Doc to JSON"><!-- CSS -->
<link href=
"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel=
"stylesheet"><!-- JavaScript -->
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
var key = "1c6NgduBK8Wh6z_K5vEUj28e2C8tU17vJurCrlxtJ27Q";
var sheet = "od6";
var url = "https://spreadsheets.google.com/feeds/list/KEY/SHEET/public/values?alt=json"
.replace('KEY',key).replace('SHEET',sheet);
</script>
<script src="main.js"></script>
</head>
<body>
<!-- Template for Using Tables -->
<script id="table_template" type="text/template">
<table class="table">
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>URL</th>
</tr>
<% _.each(rows, function(row, index) { %>
<tr>
<td><%= row.id %></td>
<td><%= row.title %></td>
<td><%= row.description %></td>
<td><%= row.imageurl %></td>
</tr>
<% }); %>
</table>
</script>
<!-- Template for Using Linear Sections -->
<script id="section_template" type="text/template">
<% _.each(rows, function(row, index) { %>
<div class="row">
<h2><%= row.id %>. <%= row.title %></h2>
<img src="<%= row.imageurl %>" class="img-responsive" alt="<%=row.title %>" width="10%">
<p>
<%= row.description %>
</p>
</div>
<% }); %>
</script>
<!-- Template for Using Bootstrap Grids -->
<script id="grid_template" type="text/template">
<% _.each(rows, function(row, index) { %>
<!-- We start a new row at every third item -->
<% if(index % 3 == 0) { %>
<div class="row">
<% } %>
<div class="col-md-4 same-height-column">
<p>Index: <%= index %></p>
<h3><%= row.id %>. <%= row.title %></h3>
<img src="<%= row.imageurl %>" class="img-responsive" alt="<%=row.title %>" height="50%">
<div class="caption">
<p>
<%= row.description %>
</p>
</div>
</div>
<% if(index % 3 == 2) { %>
</div>
<% } %>
<% }); %>
</script>
<header></header>
<main>
<div class="container">
<h1>Using Google Spreadsheets with Underscore Templates</h1>
<p>This is a demo of creating web pages pulling data from a google
spreadsheet. The following table and sections pull from
<a href="https://docs.google.com/spreadsheets/d/1c6NgduBK8Wh6z_K5vEUj28e2C8tU17vJurCrlxtJ27Q/edit?usp=sharing">
this google spreadsheet</a>.
<h2>Sample Table</h2>
<div id="myTable"></div>
<h2>Sample (Responsive) Grid</h2>
<div id="myGrid"></div>
<h2>Sample Sections</h2>
<div id="mySection"></div>
</div>
</main>
<footer></footer>
</body>
</html>