forked from googleglass/mirror-quickstart-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
221 lines (194 loc) · 7.29 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!--
Copyright (C) 2012 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glassware Starter Project</title>
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"
media="screen">
<style>
.button-icon {
max-width: 75px;
}
.tile {
border-left: 1px solid #444;
padding: 5px;
list-style: none;
}
.btn {
width: 100%;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Glassware Starter Project: Go Edition</a>
<div class="nav-collapse collapse">
<form class="navbar-form pull-right" action="/signout" method="post">
<button type="submit" class="btn">Sign out</button>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Your Recent Timeline</h1>
{{ if .Message }}
<span class="label label-warning">Message: {{ .Message }}</span>
{{ end }}
<div style="margin-top: 5px;">
{{ range $item := .TimelineItems }}
<ul class="span3 tile">
<li><strong>ID: </strong> {{ $item.Id }}
</li>
<li>
<strong>Text: </strong> {{ $item.Text }}
</li>
<li>
<strong>HTML: </strong> {{ $item.Html }}
</li>
<li>
<strong>Attachments: </strong>
{{ range $item.Attachments }}
{{ if HasPrefix .ContentType "image" }}
<img src="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}" width="150">
{{ else }}
<a href="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}">Download</a>
{{ end }}
{{ end }}
</li>
<li>
<form action="/" method="post">
<input type="hidden" name="itemId" value="{{ $item.Id }}">
<input type="hidden" name="operation" value="deleteTimelineItem">
<button class="btn" type="submit">Delete Item</button>
</form>
</li>
</ul>
{{ end }}
</div>
<div style="clear:both;"></div>
</div>
<!-- Example row of columns -->
<div class="row">
<div class="span4">
<h2>Timeline</h2>
<p>When you first sign in, this Glassware inserts a welcome message. Use
these controls to insert more items into your timeline. Learn more about
the timeline APIs
<a href="https://developers.google.com/glass/timeline">here</a></p>
<form action="/" method="post">
<input type="hidden" name="operation" value="insertItem">
<textarea name="message">Hello World!</textarea><br/>
<button class="btn" type="submit">The above message</button>
</form>
<form action="/" method="post">
<input type="hidden" name="operation" value="insertItem">
<input type="hidden" name="message"
value="A solar eclipse of Saturn. Earth is also in this photo. Can you find it?">
<input type="hidden" name="imageUrl"
value="/static/images/saturn-eclipse.jpg">
<input type="hidden" name="contentType" value="image/jpeg">
<button class="btn" type="submit">A picture
<img class="button-icon"
src="/static/images/saturn-eclipse.jpg">
</button>
</form>
<form action="/" method="post">
<input type="hidden" name="operation" value="insertItemWithAction">
<button class="btn" type="submit">A card you can reply to</button>
</form>
<hr>
<form action="/" method="post">
<input type="hidden" name="operation" value="insertItemAllUsers">
<button class="btn" type="submit">A card to all users</button>
</form>
</div>
<div class="span4">
<h2>Contacts</h2>
<p>By default, this project inserts a single contact that accepts
all content types. Learn more about contacts
<a href="https://developers.google.com/glass/contacts">here</a>.</p>
{{ if .Contact }}
<form class="span3" action="/"
method="post">
<input type="hidden" name="operation" value="deleteContact">
<input type="hidden" name="id" value="Go Quick Start">
<button class="btn" type="submit">Delete Go Quick Start Contact
</button>
</form>
{{ else }}
<form class="span3" action="/"
method="post">
<input type="hidden" name="operation" value="insertContact">
<input type="hidden" name="imageUrl"
value="/static/images/gopher.png">
<input type="hidden" name="name"
value="Go Quick Start">
<button class="btn" type="submit">Insert Go Quick Start Contact
</button>
</form>
{{ end }}
</div>
<div class="span4">
<h2>Subscriptions</h2>
<p>By default a subscription is inserted for changes to the
<code>timeline</code> collection. Learn more about subscriptions
<a href="https://developers.google.com/glass/subscriptions">here</a></p>
<p class="label label-info">Note: Subscriptions require SSL. <br>They will not work on localhost.</p>
{{ if .TimelineSubscriptionExists }}
<form action="/"
method="post">
<input type="hidden" name="subscriptionId" value="timeline">
<input type="hidden" name="operation" value="deleteSubscription">
<button class="btn" type="submit" class="delete">Unsubscribe from
timeline updates
</button>
</form>
{{ else }}
<form action="/" method="post">
<input type="hidden" name="operation" value="insertSubscription">
<input type="hidden" name="collection" value="timeline">
<button class="btn" type="submit">Subscribe to timeline updates</button>
</form>
{{ end }}
{{ if .LocationSubscriptionExists }}
<form action="/"
method="post">
<input type="hidden" name="subscriptionId" value="locations">
<input type="hidden" name="operation" value="deleteSubscription">
<button class="btn" type="submit" class="delete">Unsubscribe from
location updates
</button>
</form>
{{ else }}
<form action="/" method="post">
<input type="hidden" name="operation" value="insertSubscription">
<input type="hidden" name="collection" value="locations">
<button class="btn" type="submit">Subscribe to location updates</button>
</form>
{{ end }}
</div>
</div>
</div>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>