Newer
Older
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Copyright 2017 Google Inc. -->
<html>
<head>
<title>Gruyere: Snippets</title>
[[include:base.css]][[/include:base.css]]
<script src="/{{_unique_id}}/lib.js" text="text/javascript">
</script>
</head>
<body>
{{# With a valid uid parameter this renders another user's snippets.
# We detect that case by checking if:_db.*uid. Without a uid specified,
# it renders the logged in user's snippets and includes links to delete
# individual snippets.
}}
[[include:menubar.gtl]][[/include:menubar.gtl]]
<div>
<h2 class='has-refresh' id="user_name">
[[if:uid]]
[[if:_db.*uid]]{{_db.*uid.name:text}}[[/if:_db.*uid]][[if:!_db.*uid]]{{uid.0}}[[/if:!_db.*uid]]
[[if:_db.*uid.icon]]<img alt='' height='32' width='32' src='{{_db.*uid.icon:text}}'>[[/if:_db.*uid.icon]]
[[/if:uid]]
[[if:!uid]]
My Snippets
[[if:_profile.icon]]<img alt='' height='32' width='32' src='{{_profile.icon:text}}'>[[/if:_profile.icon]]
[[/if:!uid]]
</h2>
<div class='refresh'><a class='button'
onclick='_refreshSnippets("{{_unique_id}}", "[[if:uid]]{{uid.0}}[[/if:uid]][[if:!uid]]{{_cookie.uid}}[[/if:!uid]]")'
href='#'>Refresh</a></div>
<div class='content'>
{{# Someone else's snippets}}
[[if:uid]]
[[if:!_db.*uid.is_author]]
[[if:_db.*uid]]{{_db.*uid.name:text}}[[/if:_db.*uid]]
The requested author is unknown.
[[/if:!_db.*uid.is_author]]
[[if:_db.*uid.is_author]]
[[if:!_db.*uid.snippets.0]]
No snippets.
[[/if:!_db.*uid.snippets.0]]
[[if:_db.*uid.snippets.0]]
<table>
<tr><td colspan='2'><b>All snippets:</b></td></tr>
[[for:_db.*uid.snippets]]
<tr>
<td valign='top'>
<script>document.write({{_key}} + 1)</script>
</td>
<td valign='top'>
<div id='{{_key}}'>
{{_this:html}}
</div>
</td>
</tr>
[[/for:_db.*uid.snippets]]
</table>
<br>
<a href='{{_db.*uid.web_site:text}}'>[[if:_db.*uid]]{{_db.*uid.name:text}}[[/if:_db.*uid]][[if:!_db.*uid]]{{uid.0}}[[/if:!_db.*uid]]'s site</a>
[[/if:_db.*uid.snippets.0]]
[[/if:_db.*uid.is_author]]
[[/if:uid]]
{{# Your snippets }}
[[if:!uid]]
[[if:!_profile.is_author]]
You are not an author.
[[/if:!_profile.is_author]]
[[if:_profile.is_author]]
[[if:!_profile.snippets.0]]
No snippets.
[[/if:!_profile.snippets.0]]
[[if:_profile.snippets.0]]
<br>
<table>
<tr><td colspan='2'><b>All snippets:</b></td></tr>
[[for:_profile.snippets]]
<tr>
<td valign='top'>
<script>document.write({{_key}} + 1)</script>
</td>
<td valign='top'>
<a href='/{{_unique_id}}/deletesnippet?index={{_key}}'>[X]</a>
</td>
<td valign='top'>
<div id='{{_key}}'>
{{_this:html}}
</div>
</td>
</tr>
[[/for:_profile.snippets]]
</table>
[[/if:_profile.snippets.0]]
[[/if:_profile.is_author]]
<br>
<a href='{{_profile.web_site:text}}'>My site</a>
[[/if:!uid]]
</div>
</body>
</html>