1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-26 09:14:06 +08:00
2019-04-14 14:00:25 +08:00

122 lines
5.2 KiB
Cheetah

{{define "head"}}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
{{range $index, $meta := option . "metas"}}
<meta name="{{index $meta "name"}}" content="{{index $meta "content"}}">
{{end}}
<title>{{option . "componet_name"|meta}}</title>
<link rel="shortcut icon" type="image/ico" href="/static/librarys/{{option . "favicon"|meta}}">
{{range $index, $lib := option . "styles"}}
<link rel="stylesheet" type="text/css" href="/static/librarys/{{$lib}}"></link>
{{end}}
</head>
<body>
<script>
var conf = {
toolkit_view: {{conf . "route" "toolkit_view"}},
bench_data: {{option . "bench_data"}},
}
</script>
{{end}}
{{define "toolkit"}}
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
<div>{{option .Meta "name"}}({{option .Meta "help"}})</div>
</fieldset>
{{end}}
{{define "componet"}}
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
<legend title="{{option .Meta "help"}}">{{option .Meta "name"}}({{option .Meta "help"}})</legend>
{{$msg := .}} {{$form_type := option . "form_type"|meta}}
<form class="option {{option .Meta "componet_name"}}"
data-componet_group="{{option . "componet_group"|meta}}"
data-componet_name="{{option . "componet_name"|meta}}"
{{if eq $form_type "upload"}}
method="POST" action="/upload" enctype="multipart/form-data" target="_blank"
{{end}}>
<input style="display:none"></input>
{{range $index, $input := option . "inputs"}}
<div>{{$type := index $input "type"}} {{$value := index $input "value" | parse $msg}}
{{if index $input "label"}}
<label>{{index $input "label"}} : </label>
{{end}}
{{if eq $type "button"}}
<input type="button" value="{{$value}}">
{{else if eq $type "submit"}}
<input type="submit" value="{{$value}}">
{{else if eq $type "file"}}
<input type="file" name="{{index $input "name"}}">
{{else if eq $type "choice"}} {{$default_value := index $input "value"}}
<select name="{{index $input "name"}}">
{{range $index, $value := index $input "choice"}} {{$val := index $value "value"}}
{{if eq $default_value $val}}
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
{{else}}
<option value="{{index $value "value"}}">{{index $value "name"}}</option>
{{end}}
{{end}}
</select>
{{else if eq $type "password"}}
<input type="password" name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
{{else if eq $type "textarea"}}
<textarea rows="{{index $input "rows"}}" cols="{{index $input "cols"}}"
name="{{index $input "name"}}" class="{{index $input "class"}}">{{$value}}</textarea>
{{else}}
<input name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
{{end}}</div>
{{end}}
<hr/>
</form>
{{if index .Meta "display_append"}} {{option .Meta "display_append"}} {{else}}
<table class="append {{option .Meta "componet_name"}}"> {{$msg := .}}
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
{{range $line := table .}}
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
{{end}}
</table>
{{end}}
{{if index .Meta "display_result"}} {{option .Meta "display_result"}} {{else}}
<code class="result {{option .Meta "componet_name"}}"><pre>{{result .Meta}}</pre></code>
{{end}}
{{if index .Meta "display_div"}} {{option .Meta "display_div"}} {{else}}
<div class="result {{option .Meta "componet_name"}}"></div>
{{end}}
</fieldset>
{{end}}
{{define "mp"}}
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="/static/librarys/wexin.js"></script>
<script>
{{$token := cmd . "context chat js_token"}}
wx.config({
debug: true,
appId: {{append $token "appid"|meta}},
timestamp: {{append $token "timestamp"|meta}},
nonceStr: {{append $token "nonce"|meta}},
signature: {{append $token "signature"|meta}},
jsApiList: [
"scanQRCode",
"chooseImage",
"closeWindow",
"openAddress",
],
})
wx.ready(function(){})
wx.error(function(res){})
</script>
{{end}}
{{define "tail"}}
{{range $index, $lib := option . "scripts"}}
<script src="/static/librarys/{{$lib}}"></script>
{{end}}
</body>
{{end}}