模板分隔符改为"{% %}"

develop
ouqiang 2018-01-28 15:48:37 +08:00
parent 50638e6dfa
commit 4c940c2088
24 changed files with 284 additions and 292 deletions

View File

@ -142,16 +142,8 @@ func RegisterMiddleware(m *macaron.Macaron) {
} }
m.Use(macaron.Static(StaticDir)) m.Use(macaron.Static(StaticDir))
m.Use(macaron.Renderer(macaron.RenderOptions{ m.Use(macaron.Renderer(macaron.RenderOptions{
Directory: "templates",
Extensions: []string{".html"},
// 模板语法分隔符,默认为 ["{{", "}}"] // 模板语法分隔符,默认为 ["{{", "}}"]
Delims: macaron.Delims{"{{{", "}}}"}, Delims: macaron.Delims{"{%", "%}"},
// 追加的 Content-Type 头信息,默认为 "UTF-8"
Charset: "UTF-8",
// 渲染具有缩进格式的 JSON默认为不缩进
IndentJSON: true,
// 渲染具有缩进格式的 XML默认为不缩进
IndentXML: true,
Funcs: []template.FuncMap{map[string]interface{}{ Funcs: []template.FuncMap{map[string]interface{}{
"HostFormat": func(index int) bool { "HostFormat": func(index int) bool {
return (index+1)%3 == 0 return (index+1)%3 == 0

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<title>{{{.Title}}}</title> <title>{%.Title%}</title>
<link type="text/css" rel="stylesheet" href="/resource/css/framework.css" /> <link type="text/css" rel="stylesheet" href="/resource/css/framework.css" />
<link type="text/css" rel="stylesheet" href="/resource/css/main.css" /> <link type="text/css" rel="stylesheet" href="/resource/css/main.css" />
<link type="text/css" rel="stylesheet" href="/resource/sweetalert/sweetalert.css" /> <link type="text/css" rel="stylesheet" href="/resource/sweetalert/sweetalert.css" />
@ -29,29 +29,29 @@
</head> </head>
<body> <body>
<div class="page"> <div class="page">
{{{if not .DisableNav}}} {%if not .DisableNav%}
<!--header begin--> <!--header begin-->
<header> <header>
<div class="bigcontainer"> <div class="bigcontainer">
<div id="logo"> <div id="logo">
{{{.AppName}}} {%.AppName%}
</div> </div>
<div class="user"> <div class="user">
<div class="ui inline labeled icon top right pointing dropdown"> <div class="ui inline labeled icon top right pointing dropdown">
{{{if not .LoginUsername}}} {%if not .LoginUsername%}
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
<a class="item" href="/user/login"><i class="sign in icon"></i></a> <a class="item" href="/user/login"><i class="sign in icon"></i></a>
</div> </div>
{{{else}}} {%else%}
{{{.LoginUsername}}} {%.LoginUsername%}
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
<a href="/user/editMyPassword" class="item"><i class="edit icon"></i></a> <a href="/user/editMyPassword" class="item"><i class="edit icon"></i></a>
<a class="item" href="/user/logout"><i class="sign out icon"></i>退</a> <a class="item" href="/user/logout"><i class="sign out icon"></i>退</a>
</div> </div>
{{{end}}} {%end%}
</div> </div>
</div> </div>
</div> </div>
@ -60,13 +60,13 @@
<div class="ui teal inverted menu"> <div class="ui teal inverted menu">
<div class="bigcontainer"> <div class="bigcontainer">
<div class="right menu"> <div class="right menu">
<a class="item {{{if or (eq .Controller "task") (eq .Controller "delaytask")}}}active{{{end}}}" href="/task"><i class="tasks icon"></i></a> <a class="item {%if or (eq .Controller "task") (eq .Controller "delaytask")%}active{%end%}" href="/task"><i class="tasks icon"></i></a>
<a class="item {{{if eq .Controller "host"}}}active{{{end}}}" href="/host"><i class="linux icon"></i></a> <a class="item {%if eq .Controller "host"%}active{%end%}" href="/host"><i class="linux icon"></i></a>
{{{if .IsAdmin}}} {%if .IsAdmin%}
<a class="item {{{if eq .Controller "user"}}}active{{{end}}}" href="/user"><i class="user icon"></i></a> <a class="item {%if eq .Controller "user"%}active{%end%}" href="/user"><i class="user icon"></i></a>
<a class="item {{{if eq .Controller "manage"}}}active{{{end}}}" href="/manage/slack/edit"><i class="settings icon"></i></a> <a class="item {%if eq .Controller "manage"%}active{%end%}" href="/manage/slack/edit"><i class="settings icon"></i></a>
{{{end}}} {%end%}
</div> </div>
</div> </div>
</div> </div>
{{{end}}} {%end%}

View File

@ -1,41 +1,41 @@
{{{if gt .Pagination.Total 0}}} {%if gt .Pagination.Total 0%}
<div class="ui pagination menu"> <div class="ui pagination menu">
{{{if not .Pagination.IsFirst}}} {%if not .Pagination.IsFirst%}
<a class="item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page=1"> <a class="item" href="{%.URI%}?{% .Params.PageParams%}&page=1">
</a> </a>
{{{end}}} {%end%}
{{{if .Pagination.HasPrevious}}} {%if .Pagination.HasPrevious%}
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.Previous}}}"> <a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.Previous%}">
<i class="icon left arrow"></i> <i class="icon left arrow"></i>
</a> </a>
{{{end}}} {%end%}
{{{range .Pagination.Pages}}} {%range .Pagination.Pages%}
{{{if eq .Num -1}}} {%if eq .Num -1%}
<div class="disabled item"> <div class="disabled item">
... ...
</div> </div>
{{{else}}} {%else%}
<a class="icon {{{if .IsCurrent}}}active{{{end}}} item" href="{{{$.URI}}}?{{{ $.Params.PageParams}}}&page={{{.Num}}}"> <a class="icon {%if .IsCurrent%}active{%end%} item" href="{%$.URI%}?{% $.Params.PageParams%}&page={%.Num%}">
{{{.Num}}} {%.Num%}
</a> </a>
{{{end}}} {%end%}
{{{end}}} {%end%}
{{{if .Pagination.HasNext}}} {%if .Pagination.HasNext%}
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.Next}}}"> <a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.Next%}">
<i class="icon right arrow"></i> <i class="icon right arrow"></i>
</a> </a>
{{{end}}} {%end%}
{{{if not .Pagination.IsLast}}} {%if not .Pagination.IsLast%}
<a class="icon item" href="{{{.URI}}}?{{{ .Params.PageParams}}}&page={{{.Pagination.TotalPages}}}"> <a class="icon item" href="{%.URI%}?{% .Params.PageParams%}&page={%.Pagination.TotalPages%}">
</a> </a>
{{{end}}} {%end%}
<div class="item">{{{.Pagination.Total}}}/{{{.Pagination.TotalPages}}}</div> <div class="item">{%.Pagination.Total%}/{%.Pagination.TotalPages%}</div>
</div> </div>
{{{end}}} {%end%}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<script> <script>
swal({ swal({
title: "404 - NOT FOUND", title: "404 - NOT FOUND",
@ -9,4 +9,4 @@
location.href = "/" location.href = "/"
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<script> <script>
swal({ swal({
title: "500 - INTERNAL SERVER ERROR", title: "500 - INTERNAL SERVER ERROR",
@ -8,4 +8,4 @@
confirmButtonText: "确定" confirmButtonText: "确定"
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,3 +1,3 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,7 +1,7 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "host/menu" . }}} {% template "host/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
@ -14,24 +14,24 @@
</div> </div>
</div> </div>
<form class="ui form fluid vertical segment"> <form class="ui form fluid vertical segment">
<input type="hidden" name="id" value="{{{.Host.Id}}}"> <input type="hidden" name="id" value="{%.Host.Id%}">
<div class="four fields"> <div class="four fields">
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="name" value="{{{.Host.Name}}}" placeholder="127.0.0.1"> <input type="text" name="name" value="{%.Host.Name%}" placeholder="127.0.0.1">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="port" value="{{{.Host.Port}}}" placeholder="5921"> <input type="text" name="port" value="{%.Host.Port%}" placeholder="5921">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="alias" value="{{{.Host.Alias}}}" <input type="text" name="alias" value="{%.Host.Alias%}"
placeholder="节点名称如web"> placeholder="节点名称如web">
</div> </div>
</div> </div>
@ -40,7 +40,7 @@
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<textarea rows="7" name="remark" >{{{.Host.Remark}}}</textarea> <textarea rows="7" name="remark" >{%.Host.Remark%}</textarea>
</div> </div>
</div> </div>
</div> </div>
@ -113,4 +113,4 @@
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,10 +1,10 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "host/menu" . }}} {% template "host/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
{{{if .IsAdmin}}} {%if .IsAdmin%}
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
@ -17,14 +17,14 @@
</h3> </h3>
</div> </div>
</div> </div>
{{{end}}} {%end%}
<form class="ui form"> <form class="ui form">
<div class="three fields"> <div class="three fields">
<div class="field"> <div class="field">
<input type="text" placeholder="ID" name="id" value="{{{if gt .Params.Id 0}}}{{{.Params.Id}}}{{{end}}}"> <input type="text" placeholder="ID" name="id" value="{%if gt .Params.Id 0%}{%.Params.Id%}{%end%}">
</div> </div>
<div class="field"> <div class="field">
<input type="text" placeholder="主机名" name="name" value="{{{.Params.Name}}}"> <input type="text" placeholder="主机名" name="name" value="{%.Params.Name%}">
</div> </div>
<div class="field"> <div class="field">
<button class="ui linkedin submit button"></button> <button class="ui linkedin submit button"></button>
@ -43,30 +43,30 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{{range $i, $v := .Hosts}}} {%range $i, $v := .Hosts%}
<tr> <tr>
<td>{{{.Id}}}</td> <td>{%.Id%}</td>
<td>{{{.Name}}}</td> <td>{%.Name%}</td>
<td>{{{.Alias}}}</td> <td>{%.Alias%}</td>
<td>{{{.Port}}}</td> <td>{%.Port%}</td>
<td>{{{.Remark}}}</td> <td>{%.Remark%}</td>
<td class="operation"> <td class="operation">
{{{if $.IsAdmin}}} {%if $.IsAdmin%}
<a class="ui purple button" href="/host/edit/{{{.Id}}}"></a> <a class="ui purple button" href="/host/edit/{%.Id%}"></a>
<button class="ui positive button" onclick="util.removeConfirm('/host/remove/{{{.Id}}}')"></button><br> <button class="ui positive button" onclick="util.removeConfirm('/host/remove/{%.Id%}')"></button><br>
{{{end}}} {%end%}
<div style="margin-top: 5px;"> <div style="margin-top: 5px;">
<a class="ui twitter button" href="/task?host_id={{{.Id}}}"></a> <a class="ui twitter button" href="/task?host_id={%.Id%}"></a>
{{{if $.IsAdmin}}} {%if $.IsAdmin%}
<button class="ui blue button" @click="ping({{{.Id}}})"></button> <button class="ui blue button" @click="ping({%.Id%})"></button>
{{{end}}} {%end%}
</div> </div>
</td> </td>
</tr> </tr>
{{{end}}} {%end%}
</tbody> </tbody>
</table> </table>
{{{ template "common/pagination" .}}} {% template "common/pagination" .%}
</div> </div>
</div> </div>
@ -83,4 +83,4 @@
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,7 +1,7 @@
<div class="four wide column"> <div class="four wide column">
<div class="verticalMenu"> <div class="verticalMenu">
<div class="ui vertical pointing menu fluid"> <div class="ui vertical pointing menu fluid">
<a class="{{{if eq .URI "/host"}}}active teal{{{end}}} item" href="/host"> <a class="{%if eq .URI "/host"%}active teal{%end%} item" href="/host">
<i class="linux icon"></i> <i class="linux icon"></i>
</a> </a>
</div> </div>

View File

@ -1,7 +1,7 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "install/menu" . }}} {% template "install/menu" . %}
<div class="ten wide column"> <div class="ten wide column">
<form class="ui form"> <form class="ui form">
<div class="ui blue center aligned segment"> <div class="ui blue center aligned segment">
@ -186,4 +186,4 @@
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,7 +1,7 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "manage/menu" . }}} {% template "manage/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
@ -22,18 +22,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{{range $i, $v := .LoginLogs}}} {%range $i, $v := .LoginLogs%}
<tr> <tr>
<td>{{{.Username}}}</td> <td>{%.Username%}</td>
<td>{{{.Ip}}}</td> <td>{%.Ip%}</td>
<td>{{{.Created}}}</td> <td>{%.Created%}</td>
</tr> </tr>
{{{end}}} {%end%}
</tbody> </tbody>
</table> </table>
{{{ template "common/pagination" .}}} {% template "common/pagination" .%}
</div> </div>
</div> </div>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,12 +1,12 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{template "manage/menu" .}}} {%template "manage/menu" .%}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
<div class="content"> <div class="content">
{{{.Title}}} {%.Title%}
</div> </div>
</h3> </h3>
</div> </div>
@ -19,7 +19,7 @@
SMTP SMTP
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="host" value="{{{.Mail.Host}}}"> <input type="text" name="host" value="{%.Mail.Host%}">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
@ -27,7 +27,7 @@
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="port" value="{{{if gt .Mail.Port 0}}}{{{.Mail.Port}}}{{{end}}}"> <input type="text" name="port" value="{%if gt .Mail.Port 0%}{%.Mail.Port%}{%end%}">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
@ -35,7 +35,7 @@
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="user" value="{{{.Mail.User}}}"> <input type="text" name="user" value="{%.Mail.User%}">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
@ -43,25 +43,25 @@
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="password" value="{{{.Mail.Password}}}"> <input type="text" name="password" value="{%.Mail.Password%}">
</div> </div>
</div> </div>
</div> </div>
<button class="ui primary button"></button> <button class="ui primary button"></button>
{{{if .Mail.Host}}} {%if .Mail.Host%}
<a class="ui green button" onclick="clearMailServer()"></a> <a class="ui green button" onclick="clearMailServer()"></a>
{{{end}}} {%end%}
<br><br><br> <br><br><br>
<div> <div>
<div class="content"></div><p></p> <div class="content"></div><p></p>
<div class="fields"> <div class="fields">
{{{range $i, $v := .Mail.MailUsers}}} {%range $i, $v := .Mail.MailUsers%}
<div class="field"> <div class="field">
<div class="ui segment"> <div class="ui segment">
{{{.Username}}}-{{{.Email}}}&nbsp;&nbsp;&nbsp;<div class="ui blue button" onclick="removeMailUser({{{.Id}}})"></div> {%.Username%}-{%.Email%}&nbsp;&nbsp;&nbsp;<div class="ui blue button" onclick="removeMailUser({%.Id%})"></div>
</div> </div>
</div> </div>
{{{end}}} {%end%}
</div> </div>
</div> </div>
</form> </form>
@ -198,4 +198,4 @@
}); });
} }
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,13 +1,13 @@
<div class="three wide column"> <div class="three wide column">
<div class="verticalMenu"> <div class="verticalMenu">
<div class="ui vertical pointing menu fluid"> <div class="ui vertical pointing menu fluid">
<a class="{{{if eq .URI "/manage/slack/edit"}}}active teal{{{end}}} item" href="/manage/slack/edit"> <a class="{%if eq .URI "/manage/slack/edit"%}active teal{%end%} item" href="/manage/slack/edit">
<i class="slack icon"></i> Slack <i class="slack icon"></i> Slack
</a> </a>
<a class="{{{if eq .URI "/manage/mail/edit"}}}active teal{{{end}}} item" href="/manage/mail/edit"> <a class="{%if eq .URI "/manage/mail/edit"%}active teal{%end%} item" href="/manage/mail/edit">
<i class="slack icon"></i> <i class="slack icon"></i>
</a> </a>
<a class="{{{if eq .URI "/manage/login-log"}}}active teal{{{end}}} item" href="/manage/login-log"> <a class="{%if eq .URI "/manage/login-log"%}active teal{%end%} item" href="/manage/login-log">
<i class="slack icon"></i> <i class="slack icon"></i>
</a> </a>
</div> </div>

View File

@ -1,12 +1,12 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{template "manage/menu" .}}} {%template "manage/menu" .%}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
<div class="content"> <div class="content">
{{{.Title}}} {%.Title%}
</div> </div>
</h3> </h3>
</div> </div>
@ -18,7 +18,7 @@
<div class="content">Slack WebHook URL</div> <div class="content">Slack WebHook URL</div>
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" id="url" value="{{{.Slack.Url}}}"> <input type="text" id="url" value="{%.Slack.Url%}">
</div> </div>
</div> </div>
<div class="ui primary button" @click="updateUrl"></div> <div class="ui primary button" @click="updateUrl"></div>
@ -27,13 +27,13 @@
<div> <div>
<div class="content">Slack Channel(Channel)</div><p></p> <div class="content">Slack Channel(Channel)</div><p></p>
<div class="fields"> <div class="fields">
{{{range $i, $v := .Slack.Channels}}} {%range $i, $v := .Slack.Channels%}
<div class="field"> <div class="field">
<div class="ui segment"> <div class="ui segment">
{{{.Name}}}&nbsp;&nbsp;&nbsp;<div class="ui blue button" @click="removeChannel({{{.Id}}})"></div> {%.Name%}&nbsp;&nbsp;&nbsp;<div class="ui blue button" @click="removeChannel({%.Id%})"></div>
</div> </div>
</div> </div>
{{{end}}} {%end%}
</div> </div>
</div> </div>
<div class="ui facebook button" @click="createChannel">Channel</div> <div class="ui facebook button" @click="createChannel">Channel</div>
@ -85,4 +85,4 @@
} }
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,8 +1,8 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{template "task/menu" .}}} {%template "task/menu" .%}
<div class="twelve wide column"> <div class="twelve wide column">
{{{if .IsAdmin}}} {%if .IsAdmin%}
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
@ -15,40 +15,40 @@
</h3> </h3>
</div> </div>
</div> </div>
{{{end}}} {%end%}
<form class="ui form"> <form class="ui form">
<div class="six fields search"> <div class="six fields search">
<div class="one wide field"> <div class="one wide field">
<input type="text" placeholder="任务ID" name="id" value="{{{if gt .Params.Id 0}}}{{{.Params.Id}}}{{{end}}}"> <input type="text" placeholder="任务ID" name="id" value="{%if gt .Params.Id 0%}{%.Params.Id%}{%end%}">
</div> </div>
<div class="field"> <div class="field">
<input type="text" placeholder="任务名称" name="name" value="{{{.Params.Name}}}"> <input type="text" placeholder="任务名称" name="name" value="{%.Params.Name%}">
</div> </div>
<div class="field"> <div class="field">
<input type="text" placeholder="标签名称" name="tag" value="{{{.Params.Tag}}}"> <input type="text" placeholder="标签名称" name="tag" value="{%.Params.Tag%}">
</div> </div>
</div> </div>
<div class="six fields search"> <div class="six fields search">
<div class="field"> <div class="field">
<select name="host_id" id="hostId"> <select name="host_id" id="hostId">
<option value=""></option> <option value=""></option>
{{{range $i, $v := .Hosts}}} {%range $i, $v := .Hosts%}
<option value="{{{.Id}}}" {{{if eq $.Params.HostId .Id }}} selected {{{end}}} >{{{.Alias}}}-{{{.Name}}}</option> <option value="{%.Id%}" {%if eq $.Params.HostId .Id %} selected {%end%} >{%.Alias%}-{%.Name%}</option>
{{{end}}} {%end%}
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<select name="protocol" id="protocol"> <select name="protocol" id="protocol">
<option value="0"></option> <option value="0"></option>
<option value="2" {{{if eq .Params.Protocol 2}}}selected{{{end}}} data-match="host_id" data-validate-type="selectProtocol">SHELL</option> <option value="2" {%if eq .Params.Protocol 2%}selected{%end%} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
<option value="1" {{{if eq .Params.Protocol 1}}}selected{{{end}}}>HTTP</option> <option value="1" {%if eq .Params.Protocol 1%}selected{%end%}>HTTP</option>
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<select name="status"> <select name="status">
<option value="0"></option> <option value="0"></option>
<option value="1" {{{if eq .Params.Status 0}}}selected{{{end}}} ></option> <option value="1" {%if eq .Params.Status 0%}selected{%end%} ></option>
<option value="2" {{{if eq .Params.Status 1}}}selected{{{end}}}></option> <option value="2" {%if eq .Params.Status 1%}selected{%end%}></option>
</select> </select>
</div> </div>
<div class="field"> <div class="field">
@ -56,7 +56,7 @@
</div> </div>
</div> </div>
</form> </form>
{{{if .IsAdmin}}} {%if .IsAdmin%}
<div class="field"> <div class="field">
<select id="batch-operation"> <select id="batch-operation">
<option value="0"></option> <option value="0"></option>
@ -65,16 +65,16 @@
<option value="3"></option> <option value="3"></option>
</select> </select>
</div> </div>
{{{end}}} {%end%}
<br> <br>
<table class="ui celled table task-list"> <table class="ui celled table task-list">
<thead> <thead>
<tr> <tr>
{{{if .IsAdmin}}} {%if .IsAdmin%}
<th> <th>
<input type="checkbox" onclick="checkAll(this)" style="width:25px;height: 25px;"> <input type="checkbox" onclick="checkAll(this)" style="width:25px;height: 25px;">
</th> </th>
{{{end}}} {%end%}
<th>ID</th> <th>ID</th>
<th></th> <th></th>
<th></th> <th></th>
@ -90,58 +90,58 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{{range $i, $v := .Tasks}}} {%range $i, $v := .Tasks%}
<tr> <tr>
{{{if $.IsAdmin}}} {%if $.IsAdmin%}
<td> <td>
<input type="checkbox" <input type="checkbox"
class="sub-check" class="sub-check"
data-id="{{{.Id}}}" data-id="{%.Id%}"
style="width:25px;height: 25px;"> style="width:25px;height: 25px;">
</td> </td>
{{{end}}} {%end%}
<td>{{{.Id}}}</td> <td>{%.Id%}</td>
<td>{{{.Name}}}</td> <td>{%.Name%}</td>
<td>{{{if eq .Level 1}}}{{{else}}}{{{end}}}</td> <td>{%if eq .Level 1%}{%else%}{%end%}</td>
<td>{{{.Tag}}}</td> <td>{%.Tag%}</td>
<td>{{{.Spec}}}</td> <td>{%.Spec%}</td>
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SHELL {{{end}}}</td> <td>{%if eq .Protocol 1%} HTTP {%else if eq .Protocol 2%} SHELL {%end%}</td>
<td>{{{if eq .Timeout -1}}}{{{else if gt .Timeout 0}}}{{{.Timeout}}}{{{else}}}{{{end}}}</td> <td>{%if eq .Timeout -1%}{%else if gt .Timeout 0%}{%.Timeout%}{%else%}{%end%}</td>
<td>{{{.RetryTimes}}}</td> <td>{%.RetryTimes%}</td>
<td>{{{if gt .Multi 0}}}{{{else}}}{{{end}}}</td> <td>{%if gt .Multi 0%}{%else%}{%end%}</td>
<td> <td>
{{{range $k, $h := .Hosts}}} {%range $k, $h := .Hosts%}
{{{$h.Alias}}}<br> {%$h.Alias%}<br>
{{{end}}} {%end%}
</td> </td>
<td> <td>
{{{if eq .Level 1}}} {%if eq .Level 1%}
{{{if eq .Status 1}}}<span><i class="checkmark big icon"></i></span>{{{else}}}<span><i class="minus big icon"></i><span>{{{end}}} {%if eq .Status 1%}<span><i class="checkmark big icon"></i></span>{%else%}<span><i class="minus big icon"></i><span>{%end%}
{{{end}}} {%end%}
</td> </td>
<td> <td>
<div class="ui buttons operation"> <div class="ui buttons operation">
{{{if $.IsAdmin}}} {%if $.IsAdmin%}
<a href="/task/edit/{{{.Id}}}" ><i class="edit big icon" title="编辑"></i></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="/task/edit/{%.Id%}" ><i class="edit big icon" title="编辑"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
{{{if eq .Level 1}}} {%if eq .Level 1%}
{{{if eq .Status 1}}} {%if eq .Status 1%}
<a href="javascript:void(0);" @click="changeStatus({{{.Id}}},{{{.Status}}})"><i class="pause circle big icon" title="停止"></i></a>&nbsp;&nbsp; <a href="javascript:void(0);" @click="changeStatus({%.Id%},{%.Status%})"><i class="pause circle big icon" title="停止"></i></a>&nbsp;&nbsp;
{{{else}}} {%else%}
<a href="javascript:void(0);" @click="changeStatus({{{.Id}}},{{{.Status}}})"><i class="play big icon" title="激活"></i></a>&nbsp;&nbsp; <a href="javascript:void(0);" @click="changeStatus({%.Id%},{%.Status%})"><i class="play big icon" title="激活"></i></a>&nbsp;&nbsp;
{{{end}}} {%end%}
{{{end}}} {%end%}
<a href="javascript:void(0);" @click="remove({{{.Id}}})"><i class="remove big icon" title="删除"></i></a> <a href="javascript:void(0);" @click="remove({%.Id%})"><i class="remove big icon" title="删除"></i></a>
<a href="javascript:void(0);" @click="run({{{.Id}}})"><i class="rocket big icon" title="手动执行"></i></a>&nbsp;&nbsp; <a href="javascript:void(0);" @click="run({%.Id%})"><i class="rocket big icon" title="手动执行"></i></a>&nbsp;&nbsp;
{{{end}}} {%end%}
<a href="/task/log?task_id={{{.Id}}}"><i class="bar chart icon big" title="查看日志"></i></a> <a href="/task/log?task_id={%.Id%}"><i class="bar chart icon big" title="查看日志"></i></a>
</div> </div>
</td> </td>
</tr> </tr>
{{{end}}} {%end%}
</tbody> </tbody>
</table> </table>
{{{ template "common/pagination" .}}} {% template "common/pagination" .%}
</div> </div>
</div> </div>
@ -239,4 +239,4 @@
} }
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<style type="text/css"> <style type="text/css">
pre { pre {
white-space: pre-wrap; white-space: pre-wrap;
@ -10,10 +10,10 @@
</style> </style>
<div class="ui grid"> <div class="ui grid">
<!--the vertical menu--> <!--the vertical menu-->
{{{ template "task/menu" . }}} {% template "task/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
{{{if .IsAdmin}}} {%if .IsAdmin%}
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
@ -23,26 +23,26 @@
</h3> </h3>
</div> </div>
</div> </div>
{{{end}}} {%end%}
<form class="ui form"> <form class="ui form">
<div class="six fields search"> <div class="six fields search">
<div class="field"> <div class="field">
<input type="text" placeholder="任务ID" name="task_id" value="{{{if gt .Params.TaskId 0}}}{{{.Params.TaskId}}}{{{end}}}"> <input type="text" placeholder="任务ID" name="task_id" value="{%if gt .Params.TaskId 0%}{%.Params.TaskId%}{%end%}">
</div> </div>
<div class="field"> <div class="field">
<select name="protocol" id="protocol"> <select name="protocol" id="protocol">
<option value="0"></option> <option value="0"></option>
<option value="2" {{{if eq .Params.Protocol 2}}}selected{{{end}}} data-match="host_id" data-validate-type="selectProtocol">SHELL</option> <option value="2" {%if eq .Params.Protocol 2%}selected{%end%} data-match="host_id" data-validate-type="selectProtocol">SHELL</option>
<option value="1" {{{if eq .Params.Protocol 1}}}selected{{{end}}}>HTTP</option> <option value="1" {%if eq .Params.Protocol 1%}selected{%end%}>HTTP</option>
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<select name="status"> <select name="status">
<option value="0"></option> <option value="0"></option>
<option value="1" {{{if eq .Params.Status 0}}}selected{{{end}}} ></option> <option value="1" {%if eq .Params.Status 0%}selected{%end%} ></option>
<option value="2" {{{if eq .Params.Status 1}}}selected{{{end}}}></option> <option value="2" {%if eq .Params.Status 1%}selected{%end%}></option>
<option value="3" {{{if eq .Params.Status 2}}}selected{{{end}}}></option> <option value="3" {%if eq .Params.Status 2%}selected{%end%}></option>
<option value="4" {{{if eq .Params.Status 3}}}selected{{{end}}}></option> <option value="4" {%if eq .Params.Status 3%}selected{%end%}></option>
</select> </select>
</div> </div>
<div class="field"> <div class="field">
@ -65,54 +65,54 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{{range $i, $v := .Logs}}} {%range $i, $v := .Logs%}
<tr> <tr>
<td><a href="/task?id={{{.TaskId}}}">{{{.TaskId}}}</a></td> <td><a href="/task?id={%.TaskId%}">{%.TaskId%}</a></td>
<td>{{{.Name}}}</td> <td>{%.Name%}</td>
<td>{{{.Spec}}}</td> <td>{%.Spec%}</td>
<td>{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SHELL {{{end}}}</td> <td>{%if eq .Protocol 1%} HTTP {%else if eq .Protocol 2%} SHELL {%end%}</td>
<td>{{{.RetryTimes}}}</td> <td>{%.RetryTimes%}</td>
<td>{{{unescape .Hostname}}}</td> <td>{%unescape .Hostname%}</td>
<td> <td>
{{{if and (ne .Status 3) (ne .Status 4)}}} {%if and (ne .Status 3) (ne .Status 4)%}
{{{if gt .TotalTime 0}}}{{{.TotalTime}}}{{{else}}}1{{{end}}}<br> {%if gt .TotalTime 0%}{%.TotalTime%}{%else%}1{%end%}<br>
: {{{.StartTime.Format "2006-01-02 15:04:05" }}}<br> : {%.StartTime.Format "2006-01-02 15:04:05" %}<br>
{{{if ne .Status 1}}} {%if ne .Status 1%}
: {{{.EndTime.Format "2006-01-02 15:04:05" }}} : {%.EndTime.Format "2006-01-02 15:04:05" %}
{{{end}}} {%end%}
{{{end}}} {%end%}
</td> </td>
<td> <td>
{{{if eq .Status 2}}} {%if eq .Status 2%}
{{{else if eq .Status 1}}} {%else if eq .Status 1%}
<span style="color:green"></span> <span style="color:green"></span>
{{{else if eq .Status 0}}} {%else if eq .Status 0%}
<span style="color:red"></span> <span style="color:red"></span>
{{{else if eq .Status 3}}} {%else if eq .Status 3%}
<span style="color:#4499EE"></span> <span style="color:#4499EE"></span>
{{{end}}} {%end%}
</td> </td>
<td> <td>
{{{if or (eq .Status 2) (eq .Status 0)}}} {%if or (eq .Status 2) (eq .Status 0)%}
<button class="ui small primary button" <button class="ui small primary button"
onclick="showResult('{{{.Name}}}', '{{{.Command}}}', '{{{.Result}}}')" onclick="showResult('{%.Name%}', '{%.Command%}', '{%.Result%}')"
> >
</button> </button>
{{{end}}} {%end%}
{{{if $.IsAdmin}}} {%if $.IsAdmin%}
{{{if and (eq .Status 1) (eq .Protocol 2) }}} {%if and (eq .Status 1) (eq .Protocol 2) %}
<button class="ui small blue button" onclick="stopTask({{{.Id}}}, {{{.TaskId}}})"></button> <button class="ui small blue button" onclick="stopTask({%.Id%}, {%.TaskId%})"></button>
{{{end}}} {%end%}
{{{end}}} {%end%}
</td> </td>
</tr> </tr>
{{{end}}} {%end%}
</tbody> </tbody>
</table> </table>
{{{ template "common/pagination" .}}} {% template "common/pagination" .%}
</div> </div>
</div> </div>
@ -171,4 +171,4 @@
}); });
} }
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,10 +1,10 @@
<div class="three wide column"> <div class="three wide column">
<div class="verticalMenu"> <div class="verticalMenu">
<div class="ui vertical pointing menu fluid"> <div class="ui vertical pointing menu fluid">
<a class="{{{if eq .URI "/task"}}}active teal{{{end}}} item" href="/task"> <a class="{%if eq .URI "/task"%}active teal{%end%} item" href="/task">
<i class="tasks icon"></i> <i class="tasks icon"></i>
</a> </a>
<a class="item {{{if eq .URI "/task/log"}}}active teal{{{end}}} " href="/task/log"> <a class="item {%if eq .URI "/task/log"%}active teal{%end%} " href="/task/log">
<i class="bar chart icon"></i> <i class="bar chart icon"></i>
</a> </a>
</div> </div>

View File

@ -1,25 +1,25 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{template "task/menu" .}}} {%template "task/menu" .%}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
<div class="segment"> <div class="segment">
<h3 class="ui dividing header"> <h3 class="ui dividing header">
<div class="content"> <div class="content">
{{{.Title}}} {%.Title%}
</div> </div>
</h3> </h3>
</div> </div>
</div> </div>
<form class="ui form fluid vertical segment"> <form class="ui form fluid vertical segment">
<input type="hidden" name="id" value="{{{.Task.Id}}}"> <input type="hidden" name="id" value="{%.Task.Id%}">
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label> <label>
<div class="content"></div> <div class="content"></div>
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="name" placeholder="任务名称" value="{{{.Task.Name}}}"> <input type="text" name="name" placeholder="任务名称" value="{%.Task.Name%}">
</div> </div>
</div> </div>
@ -28,7 +28,7 @@
<div class="content"></div> <div class="content"></div>
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="tag" placeholder="标签用于任务分类" value="{{{.Task.Tag}}}"> <input type="text" name="tag" placeholder="标签用于任务分类" value="{%.Task.Tag%}">
</div> </div>
</div> </div>
</div> </div>
@ -41,9 +41,9 @@
</div> </div>
</label> </label>
<select name="level" id="level" {{{if .Task}}}disabled="disabled"{{{end}}}> <select name="level" id="level" {%if .Task%}disabled="disabled"{%end%}>
<option value="1" {{{if .Task}}} {{{if eq .Task.Level 1}}}selected{{{end}}} {{{end}}}></option> <option value="1" {%if .Task%} {%if eq .Task.Level 1%}selected{%end%} {%end%}></option>
<option value="2" {{{if .Task}}} {{{if eq .Task.Level 2}}}selected{{{end}}} {{{end}}}></option> <option value="2" {%if .Task%} {%if eq .Task.Level 2%}selected{%end%} {%end%}></option>
</select> </select>
</div> </div>
</div> </div>
@ -58,8 +58,8 @@
</div> </div>
</label> </label>
<select name="dependency_status" id="dependency_status"> <select name="dependency_status" id="dependency_status">
<option value="1" {{{if .Task}}} {{{if eq .Task.DependencyStatus 1}}}selected{{{end}}} {{{end}}}></option> <option value="1" {%if .Task%} {%if eq .Task.DependencyStatus 1%}selected{%end%} {%end%}></option>
<option value="2" {{{if .Task}}} {{{if eq .Task.DependencyStatus 2}}}selected{{{end}}} {{{end}}}></option> <option value="2" {%if .Task%} {%if eq .Task.DependencyStatus 2%}selected{%end%} {%end%}></option>
</select> </select>
</div> </div>
<div class="field"> <div class="field">
@ -71,7 +71,7 @@
</div> </div>
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="dependency_task_id" placeholder="可选" value="{{{.Task.DependencyTaskId}}}"> <input type="text" name="dependency_task_id" placeholder="可选" value="{%.Task.DependencyTaskId%}">
</div> </div>
</div> </div>
</div> </div>
@ -83,7 +83,7 @@
</div> </div>
</label> </label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="spec" value="{{{.Task.Spec}}}" placeholder="秒 分 时 天 月 周"/> <input type="text" name="spec" value="{%.Task.Spec%}" placeholder="秒 分 时 天 月 周"/>
</div> </div>
</div> </div>
</div> </div>
@ -92,9 +92,9 @@
<div class="field"> <div class="field">
<label></label> <label></label>
<select name="protocol" id="protocol"> <select name="protocol" id="protocol">
<option value="2" {{{if .Task}}} {{{if eq .Task.Protocol 2}}}selected{{{end}}} {{{end}}} <option value="2" {%if .Task%} {%if eq .Task.Protocol 2%}selected{%end%} {%end%}
data-validate-type="selectProtocol">SHELL</option> data-validate-type="selectProtocol">SHELL</option>
<option value="1" {{{if .Task}}} {{{if eq .Task.Protocol 1}}}selected{{{end}}} {{{end}}}>HTTP</option> <option value="1" {%if .Task%} {%if eq .Task.Protocol 1%}selected{%end%} {%end%}>HTTP</option>
</select> </select>
</div> </div>
</div> </div>
@ -102,12 +102,12 @@
<div class="field"> <div class="field">
<label></label> <label></label>
<div id="hostId"> <div id="hostId">
{{{range $i, $v := .Hosts}}} {%range $i, $v := .Hosts%}
<label> <label>
<input type="checkbox" value="{{{.Id}}}" {{{if $.Task}}}{{{if $v.Selected}}} checked {{{end}}}{{{end}}} style="width:25px;height: 25px;">{{{.Alias}}}-{{{.Name}}} <input type="checkbox" value="{%.Id%}" {%if $.Task%}{%if $v.Selected%} checked {%end%}{%end%} style="width:25px;height: 25px;">{%.Alias%}-{%.Name%}
{{{if (HostFormat $i) }}}<br>{{{end}}} {%if (HostFormat $i) %}<br>{%end%}
</label> </label>
{{{end}}} {%end%}
</div> &nbsp; <br> <a class="ui blue button" href="/host/create" target="_blank"></a> </div> &nbsp; <br> <a class="ui blue button" href="/host/create" target="_blank"></a>
</div> </div>
@ -116,8 +116,8 @@
<div class="field"> <div class="field">
<label></label> <label></label>
<select name="http_method"> <select name="http_method">
<option value="1" {{{if .Task}}} {{{if eq .Task.HttpMethod 1}}}selected{{{end}}} {{{end}}}>GET</option> <option value="1" {%if .Task%} {%if eq .Task.HttpMethod 1%}selected{%end%} {%end%}>GET</option>
<option value="2" {{{if .Task}}} {{{if eq .Task.HttpMethod 2}}}selected{{{end}}} {{{end}}} <option value="2" {%if .Task%} {%if eq .Task.HttpMethod 2%}selected{%end%} {%end%}
data-validate-type="selectProtocol">POST</option> data-validate-type="selectProtocol">POST</option>
</select> </select>
</div> </div>
@ -125,19 +125,19 @@
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label></label> <label></label>
<textarea rows="5" name="command" placeholder="请输入系统命令" id="command">{{{.Task.Command}}}</textarea> <textarea rows="5" name="command" placeholder="请输入系统命令" id="command">{%.Task.Command%}</textarea>
</div> </div>
</div> </div>
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label>(, 0-86400)</label> <label>(, 0-86400)</label>
<input type="text" name="timeout" placeholder="默认0, 不限制" value="{{{if .Task}}} {{{.Task.Timeout}}} {{{else}}}0{{{end}}}"> <input type="text" name="timeout" placeholder="默认0, 不限制" value="{%if .Task%} {%.Task.Timeout%} {%else%}0{%end%}">
</div> </div>
<div class="field"> <div class="field">
<label></label> <label></label>
<select name="multi"> <select name="multi">
<option value="2" {{{if .Task}}} {{{if eq .Task.Multi 0}}}selected{{{end}}} {{{end}}}></option> <option value="2" {%if .Task%} {%if eq .Task.Multi 0%}selected{%end%} {%end%}></option>
<option value="1"{{{if .Task}}} {{{if eq .Task.Multi 1}}}selected{{{end}}} {{{end}}}></option> <option value="1"{%if .Task%} {%if eq .Task.Multi 1%}selected{%end%} {%end%}></option>
</select> </select>
</div> </div>
</div> </div>
@ -145,11 +145,11 @@
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label> (0-10)</label> <label> (0-10)</label>
<input type="text" name="retry_times" placeholder="默认0, 不重试" value="{{{if .Task}}} {{{.Task.RetryTimes}}} {{{else}}}0{{{end}}}"> <input type="text" name="retry_times" placeholder="默认0, 不重试" value="{%if .Task%} {%.Task.RetryTimes%} {%else%}0{%end%}">
</div> </div>
<div class="field"> <div class="field">
<label> (, 0-3600)</label> <label> (, 0-3600)</label>
<input type="text" name="retry_interval" placeholder="默认0, 执行默认重试策略" value="{{{if .Task}}} {{{.Task.RetryInterval}}} {{{else}}}0{{{end}}}"> <input type="text" name="retry_interval" placeholder="默认0, 执行默认重试策略" value="{%if .Task%} {%.Task.RetryInterval%} {%else%}0{%end%}">
</div> </div>
</div> </div>
@ -157,9 +157,9 @@
<div class="field"> <div class="field">
<label></label> <label></label>
<select name="notify_status" id="task-status"> <select name="notify_status" id="task-status">
<option value="1"{{{if .Task}}} {{{if eq .Task.NotifyStatus 0}}}selected{{{end}}} {{{end}}}></option> <option value="1"{%if .Task%} {%if eq .Task.NotifyStatus 0%}selected{%end%} {%end%}></option>
<option value="2" {{{if .Task}}} {{{if eq .Task.NotifyStatus 1}}}selected{{{end}}} {{{end}}}></option> <option value="2" {%if .Task%} {%if eq .Task.NotifyStatus 1%}selected{%end%} {%end%}></option>
<option value="3" {{{if .Task}}} {{{if eq .Task.NotifyStatus 2}}}selected{{{end}}} {{{end}}}></option> <option value="3" {%if .Task%} {%if eq .Task.NotifyStatus 2%}selected{%end%} {%end%}></option>
</select> </select>
</div> </div>
</div> </div>
@ -167,9 +167,9 @@
<div class="field" > <div class="field" >
<label></label> <label></label>
<select name="notify_type"> <select name="notify_type">
<option value="1"{{{if .Task}}} {{{if eq .Task.NotifyType 0}}}selected{{{end}}} {{{end}}}></option> <option value="1"{%if .Task%} {%if eq .Task.NotifyType 0%}selected{%end%} {%end%}></option>
<option value="2" {{{if .Task}}} {{{if eq .Task.NotifyType 1}}}selected{{{end}}} {{{end}}}></option> <option value="2" {%if .Task%} {%if eq .Task.NotifyType 1%}selected{%end%} {%end%}></option>
<option value="3" {{{if .Task}}} {{{if eq .Task.NotifyType 2}}}selected{{{end}}} {{{end}}}>Slack</option> <option value="3" {%if .Task%} {%if eq .Task.NotifyType 2%}selected{%end%} {%end%}>Slack</option>
</select> </select>
</div> </div>
</div> </div>
@ -177,7 +177,7 @@
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
<label></label> <label></label>
<textarea rows="5" name="remark" placeholder="任务备注信息">{{{.Task.Remark}}}</textarea> <textarea rows="5" name="remark" placeholder="任务备注信息">{%.Task.Remark%}</textarea>
</div> </div>
</div> </div>
<div class="ui primary submit button"></div> <a class="ui button" onclick="location.href='/task';"></a> <div class="ui primary submit button"></div> <a class="ui button" onclick="location.href='/task';"></a>
@ -256,11 +256,11 @@
} }
function showNotify() { function showNotify() {
var notifyStatus = {{{.Task.NotifyStatus}}}; var notifyStatus = {%.Task.NotifyStatus%};
if (notifyStatus > 0) { if (notifyStatus > 0) {
$('#task-notify-type').show(); $('#task-notify-type').show();
} }
var notifyReceiverIds = '{{{.Task.NotifyReceiverId}}}'.split(','); var notifyReceiverIds = '{%.Task.NotifyReceiverId%}'.split(',');
changeNotify(notifyReceiverIds); changeNotify(notifyReceiverIds);
} }
@ -465,4 +465,4 @@
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui small modal"> <div class="ui small modal">
<div class="header"></div> <div class="header"></div>
<div class="content"> <div class="content">
@ -70,4 +70,4 @@
inline : true inline : true
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui small modal"> <div class="ui small modal">
<div class="header"></div> <div class="header"></div>
<div class="content"> <div class="content">
@ -25,7 +25,7 @@
$('.ui.form').form( $('.ui.form').form(
{ {
onSuccess: function(event, fields) { onSuccess: function(event, fields) {
util.post('/user/editPassword/{{{.Id}}}', fields, function(code, message) { util.post('/user/editPassword/{%.Id%}', fields, function(code, message) {
swal("操作成功", '', 'success'); swal("操作成功", '', 'success');
location.href = "/user" location.href = "/user"
}); });
@ -55,4 +55,4 @@
inline : true inline : true
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,7 +1,7 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "user/menu" . }}} {% template "user/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
@ -28,30 +28,30 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{{range $i, $v := .Users}}} {%range $i, $v := .Users%}
<tr> <tr>
<td>{{{.Id}}}</td> <td>{%.Id%}</td>
<td>{{{.Name}}}</td> <td>{%.Name%}</td>
<td>{{{.Email}}}</td> <td>{%.Email%}</td>
<td>{{{if .IsAdmin}}}{{{else}}}{{{end}}}</td> <td>{%if .IsAdmin%}{%else%}{%end%}</td>
<td>{{{if .Status}}}{{{else}}}{{{end}}}</td> <td>{%if .Status%}{%else%}{%end%}</td>
<td class="operation"> <td class="operation">
<a class="ui purple button" href="/user/edit/{{{.Id}}}"></a> <a class="ui purple button" href="/user/edit/{%.Id%}"></a>
{{{if eq .Status 1}}} {%if eq .Status 1%}
<button class="ui button red" onclick="changeStatus({{{.Id}}},{{{.Status}}})"></button>&nbsp;&nbsp; <button class="ui button red" onclick="changeStatus({%.Id%},{%.Status%})"></button>&nbsp;&nbsp;
{{{else}}} {%else%}
<button class="ui button twitter" onclick="changeStatus({{{.Id}}},{{{.Status}}})"></button>&nbsp;&nbsp; <button class="ui button twitter" onclick="changeStatus({%.Id%},{%.Status%})"></button>&nbsp;&nbsp;
{{{end}}} {%end%}
<a href="/user/editPassword/{{{.Id}}}"> <a href="/user/editPassword/{%.Id%}">
<button class="ui button facebook"></button> <button class="ui button facebook"></button>
</a> </a>
<button class="ui positive button" onclick="util.removeConfirm('/user/remove/{{{.Id}}}')"></button> <button class="ui positive button" onclick="util.removeConfirm('/user/remove/{%.Id%}')"></button>
</td> </td>
</tr> </tr>
{{{end}}} {%end%}
</tbody> </tbody>
</table> </table>
{{{ template "common/pagination" .}}} {% template "common/pagination" .%}
</div> </div>
</div> </div>
@ -70,4 +70,4 @@
} }
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,4 +1,4 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui small modal"> <div class="ui small modal">
<div class="header"></div> <div class="header"></div>
<div class="content"> <div class="content">
@ -15,7 +15,7 @@
</div> </div>
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
{{{.Captcha.CreateHtml}}} {%.Captcha.CreateHtml%}
<input type="text" name="captcha" placeholder="验证码"> <input type="text" name="captcha" placeholder="验证码">
</div> </div>
</div> </div>
@ -71,4 +71,4 @@
inline : true inline : true
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}

View File

@ -1,7 +1,7 @@
<div class="four wide column"> <div class="four wide column">
<div class="verticalMenu"> <div class="verticalMenu">
<div class="ui vertical pointing menu fluid"> <div class="ui vertical pointing menu fluid">
<a class="{{{if eq .URI "/user"}}}active teal{{{end}}} item" href="/user"> <a class="{%if eq .URI "/user"%}active teal{%end%} item" href="/user">
<i class="user icon"></i> <i class="user icon"></i>
</a> </a>
</div> </div>

View File

@ -1,7 +1,7 @@
{{{ template "common/header" . }}} {% template "common/header" . %}
<div class="ui grid"> <div class="ui grid">
{{{ template "user/menu" . }}} {% template "user/menu" . %}
<div class="twelve wide column"> <div class="twelve wide column">
<div class="pageHeader"> <div class="pageHeader">
@ -14,22 +14,22 @@
</div> </div>
</div> </div>
<form class="ui form fluid vertical segment"> <form class="ui form fluid vertical segment">
<input type="hidden" name="id" value="{{{.User.Id}}}"> <input type="hidden" name="id" value="{%.User.Id%}">
<div class="three fields"> <div class="three fields">
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="name" value="{{{.User.Name}}}" placeholder="请输入用户名"> <input type="text" name="name" value="{%.User.Name%}" placeholder="请输入用户名">
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label></label> <label></label>
<div class="ui small input"> <div class="ui small input">
<input type="text" name="email" value="{{{.User.Email}}}" placeholder="请输入邮箱"> <input type="text" name="email" value="{%.User.Email%}" placeholder="请输入邮箱">
</div> </div>
</div> </div>
</div> </div>
{{{if eq .User.Id 0}}} {%if eq .User.Id 0%}
<div class="three fields"> <div class="three fields">
<div class="field"> <div class="field">
<label></label> <label></label>
@ -41,20 +41,20 @@
<input type="password" name="confirm_password" placeholder="请再次输入密码"> <input type="password" name="confirm_password" placeholder="请再次输入密码">
</div> </div>
</div> </div>
{{{end}}} {%end%}
<div class="three fields"> <div class="three fields">
<div class="field"> <div class="field">
<label></label> <label></label>
<input type="radio" name="is_admin" value="0" {{{if eq .User.IsAdmin 0}}}checked{{{end}}}> <input type="radio" name="is_admin" value="0" {%if eq .User.IsAdmin 0%}checked{%end%}>
<input type="radio" name="is_admin" value="1" {{{if eq .User.IsAdmin 1}}}checked{{{end}}}> <input type="radio" name="is_admin" value="1" {%if eq .User.IsAdmin 1%}checked{%end%}>
</div> </div>
<div class="field"> <div class="field">
<label></label> <label></label>
<input type="radio" name="status" value="1" {{{if eq .User.Status 1}}}checked{{{end}}}> <input type="radio" name="status" value="1" {%if eq .User.Status 1%}checked{%end%}>
<input type="radio" name="status" value="0" <input type="radio" name="status" value="0"
{{{if eq .User.Status 0}}}checked{{{end}}} {%if eq .User.Status 0%}checked{%end%}
> >
</div> </div>
</div> </div>
@ -139,4 +139,4 @@
}); });
</script> </script>
{{{ template "common/footer" . }}} {% template "common/footer" . %}