forked from bukalapak/snowboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalpha.html
333 lines (316 loc) · 12.4 KB
/
alpha.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
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{.Title}}</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism-okaidia.min.css" />
<style>
blockquote {
border-left: solid 4px #eee;
padding-left: 8px;
font-style: italic;
margin-left: 0;
padding: 8px;
}
.ui.micro.label {
font-size: .25rem;
}
.ui.transaction.accordion .title {
text-align: center;
}
.ui.transaction.accordion .content {
border-top: solid 1px #ddd !important;
border-bottom: solid 1px #ddd !important;
background-color: rgba(0,0,0,.03);
padding: 0.5em 1em !important;
}
.ui.transaction.accordion .content.active {
margin-top: 0.5em;
}
.ui.basic.label {
text-align: left;
overflow: auto;
}
.resource .ui.sub.header {
text-transform: none;
}
@media only screen and (min-width: 768px) {
.sidewrap {
margin-right: 2rem;
}
.sidenav {
left: 0;
top: 0;
width: inherit;
position: fixed !important;
height: 100% !important;
overflow-y: auto !important;
padding-left: 0.5rem;
}
}
</style>
</head>
<body>
<div class="ui padded grid">
<div class="sidewrap four wide computer five wide tablet sixteen wide mobile column">
<div class="sidenav">
{{template "Navigation" .}}
</div>
</div>
<div class="eleven wide computer ten wide tablet sixteen wide mobile column">
{{template "Introduction" .}}
<div class="ui hidden divider"></div>
{{template "ResourceGroups" .}}
</div>
</div>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/components/accordion.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/components/tab.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/components/transition.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/components/popup.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/components/prism-json.min.js"></script>
<script type="text/javascript">
$(function() {
$('.ui.accordion').accordion({ animateChildren: false, duration: 0 });
$('.content.tabbed').each(function(index) {
$('.ui.tabular .item', $(this)).tab({ context: $(this) });
});
$('.ui.vertical.menu').on('click', '.item', function() {
$('.ui.vertical.menu .item').removeClass('active');
$(this).addClass('active');
});
$('.ui.empty.circular.label').popup();
});
</script>
</body>
</html>
{{define "Navigation"}}
<div class="ui horizontal divider">
<a href="#introduction">Introduction</a>
</div>
<div class="ui fluid secondary vertical menu">
<a class="item" href="#introduction">{{.Title}}</a>
</div>
{{range $groupN, $group := .ResourceGroups}}
{{if $group.Title}}
<div class="ui horizontal divider">
<a href="#{{$group.Title | parameterize}}">{{$group.Title}}</a>
</div>
{{end}}
<div class="ui accordion fluid">
{{range $resourceN, $resource := $group.Resources}}
{{if $resource.Transitions}}
<div class="title {{if eq $resourceN 0}}active{{end}}">
<i class="dropdown icon"></i>
{{if $resource.Title}}
<strong>{{$resource.Title}}</strong>
{{else}}
<strong>{{$resource.Href.Path}}</strong>
{{end}}
</div>
<div class="content {{if eq $resourceN 0}}active{{end}}">
<div class="ui fluid secondary vertical menu">
{{range $transitionN, $transition := $resource.Transitions}}
<a class="item {{$transition.Method | colorize}}" href="#{{$transition.Permalink}}">
<i class="ui {{$transition.Method | colorize}} empty circular label"></i>
{{if $transition.Title}}
<span>{{$transition.Title}}</span>
{{else}}
<span>{{$transition.Method}}</span>
{{end}}
</a>
{{end}}
</div>
</div>
{{end}}
{{end}}
</div>
{{end}}
{{end}}
{{define "Introduction"}}
<div class="ui hidden divider header"></div>
<h1 class="ui huge header" id="introduction">{{.Title}}</h1>
<hr class="ui divider">
<div class="description">
{{.Description | markdownize}}
</div>
{{end}}
{{define "ResourceGroups"}}
{{range $groupN, $group := .ResourceGroups}}
<div class="ui horizontal divider" {{if $group.Title}}id="{{$group.Title | parameterize}}"{{end}}>
{{$group.Title}}
</div>
<div class="ui header center aligned">
<div class="ui sub header">
{{$group.Description | markdownize}}
</div>
</div>
{{range $resourceN, $resource := $group.Resources}}
{{if $resource.Transitions}}
<div class="ui stacked segments">
<div class="ui basic segment resource">
<div class="ui purple huge ribbon label">
{{if $resource.Title}}{{$resource.Title}}{{else}}{{$resource.Href.Path}}{{end}}
</div>
<div class="ui header">
<div class="ui sub header">
{{$resource.Description | markdownize}}
</div>
</div>
</div>
{{range $transitionN, $transition := $resource.Transitions}}
{{template "Divider"}}
<div class="ui basic segment">
<h3 class="ui block center aligned header" id="{{$transition.Permalink}}">
{{if $transition.Title}}{{$transition.Title}}{{else}}{{$transition.Method}}{{end}}
</h3>
<div class="description">{{$transition.Description | markdownize}}</div>
{{range $transactionN, $transaction := $transition.Transactions}}
<h4 class="ui horizontal divider">
REQUEST{{if $transaction.Request.Title}} {{$transaction.Request.Title}}{{end}}
</h4>
<div class="description">{{$transaction.Request.Description | markdownize}}</div>
<div class="fluid ui large labeled button">
<div class="ui {{$transaction.Request.Method | colorize}} large button">
<h3>{{$transaction.Request.Method}}</h3>
</div>
<a class="ui basic fluid {{$transaction.Request.Method | colorize}} label">
<code>{{$transition.URL}}</code>
</a>
</div>
{{ if or (ne (len $transition.Href.Parameters) 0) (ne (len $resource.Href.Parameters) 0)}}
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="4">Parameters</th>
</tr>
<thead>
<tbody>
{{if $transition.Href.Parameters}}
{{template "Parameters" $transition.Href.Parameters}}
{{end}}
{{if $resource.Href.Parameters}}
{{template "Parameters" $resource.Href.Parameters}}
{{end}}
</tbody>
</table>
{{end}}
{{if $transaction.Request.Headers}}
{{template "Headers" $transaction.Request.Headers}}
{{end}}
{{if ne $transaction.Request.Body.Body ""}}
<div class="ui stacked segment">
<div class="ui fluid transaction accordion">
<div class="title">
<code>{{$transaction.Request.Body.ContentType}}</code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-{{alias $transaction.Request.Body.ContentType}}">{{$transaction.Request.Body.Body}}</code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json">{{$transaction.Request.Schema.Body}}</code>
</pre>
</div>
</div>
</div>
</div>
{{end}}
<h4 class="ui horizontal divider">RESPONSE</h4>
<div class="description">{{$transaction.Response.Description | markdownize}}</div>
{{template "Headers" $transaction.Response.Headers}}
<div class="ui stacked {{$transaction.Response.StatusCode | colorize}} segment">
<div class="ui fluid transaction accordion">
<div class="title center aligned">
<a class="ui {{$transaction.Response.StatusCode | colorize}} circular label">
{{$transaction.Response.StatusCode}}
</a>
<code>{{$transaction.Response.Body.ContentType}}</code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-{{alias $transaction.Response.Body.ContentType}}">{{$transaction.Response.Body.Body}}</code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json">{{$transaction.Response.Schema.Body}}</code>
</pre>
</div>
</div>
</div>
</div>
{{end}}
</div>
{{end}}
</div>
<div class="ui hidden divider"></div>
{{end}}
{{end}}
{{end}}
{{end}}
{{define "Headers"}}
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="2">Headers</th>
</tr>
</thead>
<tbody>
{{range $index, $header := .}}
<tr>
<td class="four wide">{{.Key}}</td>
<td><code>{{.Value}}</code></td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
{{define "Parameters"}}
{{range $index, $param := .}}
<tr>
<td class="center aligned one wide">
<i class="ui empty circular label {{if eq .Required true}}black{{else}}grey{{end}}" data-content="{{if eq .Required true}}required{{else}}optional{{end}}" data-position="top center"></i>
</td>
<td><code>{{.Key}}</code></td>
<td class="center aligned">
<code>{{.Kind}}</code>
{{if .Value}}<code class="ui label">{{.Value}}</code>{{end}}
{{if .Default}}<div class="ui violet image label">Default<div class="detail">{{.Default}}</div></div>{{end}}
</td>
<td class="eight wide">
{{if .Description}}{{.Description | markdownize}}{{else}}-{{end}}
{{if .Members}}
<ul class="ui bulleted list">
{{range .Members}}
<li class="item">{{.}}</li>
{{end}}
</ul>
{{end}}
</td>
</tr>
{{end}}
{{end}}
{{define "Divider"}}
<div class="ui grey horizontal small divider header">
<i class="ui grey micro circular label"></i>
<i class="ui pink micro circular label"></i>
<i class="ui grey micro circular label"></i>
</div>
{{end}}