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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
extends layout
mixin get_name(link, prefix, i)
- var name = typeof link.name == 'string' ? link.name : undefined
- var prompt = typeof link.prompt == 'string' ? link.prompt : undefined
- var prefix = typeof prefix == 'string' ? prefix + ': ' : ''
|#{prefix + (name || prompt || '#' + i)}
block href
if typeof href != 'string'
div: i no href
else
div
a(href=urlgenerator.render(href)) #{href}
| (opens in explorer)
block link
- var href = link.href
div
a(class='btn btn-primary btn-mini', href=urlgenerator.render(href)) Explore
|
a(class='btn btn-primary btn-mini', href=href) Raw
dl
dt href
dd
block href
dt rel
dd
if urlgenerator.isUrl(link.rel)
a(href=link.rel) #{link.rel}
else
| #{link.rel}
dt name
dd
if link.name
| #{link.name}
else
i Not set
dt prompt
dd
if link.prompt
| #{link.prompt}
else
i Not set
if link.render == 'image'
dt
dd: img(src=link.href, alt=link.name, title=link.name)
block meta
div(class='row-fluid')
div(class='span12')
- var href=collection.href
dl
dt version
dd
if collection.version
| #{collection.version}
else
i Not set
dt href
dd: block href
div(class='row-fluid')
div(class='span12')
p
if href
a(class='btn btn-primary', href=urlgenerator.render(href)) Explore
|
a(class='btn btn-primary', href=href) Raw
|
a(class='btn btn-danger', href=urlgenerator.delete(url, href)) Delete
|
form(action='http://redbot.org')
input(type='text', name='uri', value=url, type='hidden')
input(type='text', name='req_hdr', value='Accept: application/vnd.collection+json', type='hidden')
button(class='btn btn-primary', type='submit') Check with redbot.org
if collection.links.length > 0
h2 Collection Links
each link, i in collection.links
- var title = link.prompt || link.name
- title = title ? ': ' + title : ''
h3(id='link-#{i + 1}') Collection Link ##{i}#{title}
block link
block next_prev
- var next = root.findLinkByRel('next');
- var prev = root.findLinkByRel('prev');
if next || prev
div(class='fluid-row')
div(class='span12')
if prev
a(class='btn btn-primary btn-mini', href=urlgenerator.render(next.href) + '#items') Previous
|
if next
a(class='btn btn-primary btn-mini', href=urlgenerator.render(next.href) + '#items') Next
// TODO: If the collection has prev/next links, add buttons to
// automaticaly navigate those.
// TODO: Add ability to show the raw part of the collection.
block items
if collection.items.length == 0
p Collection has no items.
else
block next_prev
each item, i in collection.items
- var href=item.href
h2(id='item-#{i+1}') Item ##{i+1}
if href
div(class='fluid-row')
div(class='span12')
p
a(class='btn btn-primary btn-mini', href=urlgenerator.render(href)) Explore
|
a(class='btn btn-primary btn-mini', href=href) Raw
|
a(class='btn btn-danger btn-mini', href=urlgenerator.delete(url, href)) Delete
dl
dt href
dd: block href
if item.links.length > 0
h3 Item Links
each link, i in item.links
h4 Item Link ##{i}
block link
h3 Data
dl(class='dl-horizontal')
each data in item.data
dt #{data.name}
dd #{data.value}
block next_prev
block queries
if collection.queries.length == 0
p Collection has no queries.
else
each query, i in collection.queries
- var name = query.prompt || query.name || 'Unnamed query'
h2(id='query-#{i + 1}')= name
div(class='row-fluid')
div(class='span12')
form(action='/render', class='well form-horizontal')
input(type='hidden', name='url', value=query.href)
fieldset
each data in query.data
- var value = params[data.name] || data.value
div(class='control-group')
label(class='control-label', for=data.name) #{data.name}
div(class='controls')
input(type='text', name='param-' + data.name, value=value, class='input-xlarge')
div(class='control-group')
div(class='controls')
input(type='submit') Execute
block error
div(class='row-fluid')
if typeof collection.error == 'undefined'
p Collection didn't include an error condition.
else
dl
dt title
dd
if collection.error.title
| #{collection.error.title}
else
i Not set
dt code
dd
if collection.error.code
| #{collection.error.code}
else
i Not set
dt message
dd
if collection.error.message
| #{collection.error.message}
else
i Not set
block httpResponse
div(class='row-fluid')
dl
dt URL
dd: a(href=urlgenerator.render(url)) #{url}
if typeof referer != 'undefined'
dt Referer
dd: a(href=urlgenerator.render(referer)) #{referer}
pre
table
tr
td(colspan='2') #{httpResponse.statusCode} #{httpResponse.status}
each value, key in httpResponse.headers
tr
td #{key}:
td #{value}
|
| #{httpResponse.body}
block navbar
div(class='navbar navbar-fixed-top')
div(class='navbar-inner')
div(class='container')
a(class='btn btn-navbar', data-toggle='collapse', data-target='.nav-collapse')
span(class='icon-bar')
//
span(class='icon-bar')
span(class='icon-bar')
span(class='icon-bar')
span(class='icon-bar')
span(class='icon-bar')
a(class='brand', href='/') Collection+JSON Explorer
div(class='nav-collapse')
ul(class='nav')
//
li(class='active'): a(href='#meta') Meta
li: a(href='#items') Items
li: a(href='#queries') Queries
li: a(href='#headers') Headers
li: a(href='#formatted-body') Formatted Body
li: a(href='#raw-body') Raw Body
block sidebar
div(id='navbar', class='sidebar-nav sidebar-nav-fixed')
ul(class='nav nav-list')
if typeof err != 'undefined'
li(class='nav-header'): a(href='#server-error') Server Error
if typeof collection != 'undefined'
li(class='nav-header active'): a(href='#meta') Meta
each link, i in collection.links
li: a(href='#link-' + (i + 1))
mixin get_name(link, 'Link', i)
li(class='nav-header'): a(href='#items') Items
each item, i in collection.items
li: a(href='#item-' + (i + 1)) ##{i + 1}
li(class='nav-header'): a(href='#queries') Queries
each query, i in collection.queries
li: a(href='#query-' + (i + 1))
mixin get_name(query, 'Query', i)
li(class='nav-header'): a(href='#error') Error
li(class='nav-header'): a(href='#formatted-body') Formatted Body
if typeof httpResponse != 'undefined'
li(class='nav-header'): a(href='#http-response') HTTP Response
block inner_content
if typeof err != 'undefined'
section(id='server-error')
div(class='page-header')
h1 Server Error
div(class='row-fluid')
p Error rendering: #{url}
a(class='btn btn-primary btn-mini', href=urlgenerator.render(url)) Retry
p= err
if typeof collection != 'undefined'
section(id='meta')
div(class='page-header')
h1 Meta
block meta
section(id='items')
div(class='page-header')
h1 Items
if collection.items.length > 1
span(class='badge') #{collection.items.length}
if root.findLinkByRel('next')
|+
block items
section(id='queries')
div(class='page-header')
h1 Queries
block queries
section(id='error')
div(class='page-header')
h1 Error
block error
section(id='formatted-body')
div(class='page-header')
h1 Formatted Body
div(class='row-fluid')
div(class='span12')
pre= formattedBody
if typeof httpResponse != 'undefined'
section(id='http-response')
div(class='page-header')
h1 HTTP Response
block httpResponse
block content
- var collection = root.collection
div(class='row-fluid')
div(class='span3')
block sidebar
div(class='span9')
block inner_content
|