service/DocTpl.html

217 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{.title}}</title>
<style>
html {
overflow: auto;
height: 100%;
}
body {
margin: 0;
padding: 10px;
background: #fff;
color: #333;
font-size: 16px;
overflow: hidden;
display: flex;
margin: 0;
padding: 0;
height: 100%;
}
.nav {
overflow-x: hidden;
overflow-y: auto;
flex: 1;
background: #333;
color: #fff;
height: 100%;
padding: 10px 0;
box-sizing: border-box;
}
.navItem {
width: 100%;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 4px 10px;
cursor: pointer;
user-select: none;
color: #fff;
text-decoration: none;
}
.navItem:hover {
background: #99ccff;
}
.navItem .memo {
font-weight: normal;
font-size: 12px;
color: #ccc;
}
.apiBox {
overflow: auto;
flex: 3;
padding: 8px;
height: 100%;
}
header {
border-bottom: #ddd 1px solid;
margin-bottom: 5px;
background: #333;
color: #fff;
padding: 12px;
display: flex;
align-items: baseline;
}
header > span {
font-weight: bold;
margin-right: 10px;
}
header > span.memo {
font-weight: normal;
font-size: 14px;
color: #faebd7;
}
label {
display: inline-block;
margin-right: 10px;
padding: 4px 8px;
font-size: 12px;
background: #ccc;
color: #000;
font-weight: bold;
border-radius: 4px;
}
label.authLevel {
background: #f90;
color: #000;
}
label.authLevel0 {
background: #ccc;
color: #000;
}
label.type {
background: #9cf;
color: #000;
}
section {
margin-bottom: 40px;
white-space: nowrap;
font-size: 12px;
}
header.Action, section.Action {
margin-left: 20px;
}
section > table {
width: 50%;
display: inline-table;
border-collapse: collapse;
vertical-align: top;
font-size: 16px;
}
section > table:last-child {
border-left: 1px solid #ddd;
}
tr:nth-child(even) {
background: #f9f9f9;
}
th {
padding: 8px;
}
td {
padding: 6px 12px;
white-space: pre-wrap;
}
td:last-child {
color: #666;
}
</style>
</head>
<body>
<div class="nav">
{{range .api}}
<a href="#{{.Path}}" class="navItem">
<span>{{.Path}}</span>
<span class="memo">{{.Memo}}</span>
</a>
{{end}}
</div>
<div class="apiBox">
{{range .api}}
<a name="{{.Path}}"></a>
<div style="height: 16px"></div>
<header class="{{.Type}}">
<span>{{.Path}}</span>
<span class="memo">{{.Memo}}</span>
{{if ne .Method ""}}<label>{{.Method}}</label>{{end}}
<label title="Auth Level" class="authLevel authLevel{{.AuthLevel}}">{{.AuthLevel}}</label>
{{if ne .Type "Web"}}<label class="type">{{.Type}}</label>{{end}}
</header>
<section class="{{.Type}}">
<table>
{{if isMap .In}}
<tr>
<th colspan="2">Request</th>
</tr>
{{range $k, $v := .In}}
<tr>
<td width="30%">{{$k}}</td>
<td width="70%">{{toText $v}}</td>
</tr>
{{end}}
{{else}}
<tr>
<td colspan="2">{{.In}}</td>
</tr>
{{end}}
</table>
<table>
{{if isMap .Out}}
<tr>
<th colspan="2">Response</th>
</tr>
{{range $k, $v := .Out}}
<tr>
<td width="30%">{{$k}}</td>
<td width="70%">{{toText $v}}</td>
</tr>
{{end}}
{{else}}
<tr>
<td colspan="2">{{.Out}}</td>
</tr>
{{end}}
</table>
</section>
{{else}}
<div><strong>no document</strong></div>
{{end}}
<div style="height: 800px"></div>
</div>
</body>
</html>