diff --git a/routers/routers.go b/routers/routers.go index a6fc443..e1a664c 100644 --- a/routers/routers.go +++ b/routers/routers.go @@ -142,16 +142,8 @@ func RegisterMiddleware(m *macaron.Macaron) { } m.Use(macaron.Static(StaticDir)) m.Use(macaron.Renderer(macaron.RenderOptions{ - Directory: "templates", - Extensions: []string{".html"}, // 模板语法分隔符,默认为 ["{{", "}}"] - Delims: macaron.Delims{"{{{", "}}}"}, - // 追加的 Content-Type 头信息,默认为 "UTF-8" - Charset: "UTF-8", - // 渲染具有缩进格式的 JSON,默认为不缩进 - IndentJSON: true, - // 渲染具有缩进格式的 XML,默认为不缩进 - IndentXML: true, + Delims: macaron.Delims{"{%", "%}"}, Funcs: []template.FuncMap{map[string]interface{}{ "HostFormat": func(index int) bool { return (index+1)%3 == 0 diff --git a/templates/common/header.html b/templates/common/header.html index af6e849..98d265f 100644 --- a/templates/common/header.html +++ b/templates/common/header.html @@ -4,7 +4,7 @@ - {{{.Title}}} + {%.Title%} @@ -29,29 +29,29 @@
- {{{if not .DisableNav}}} + {%if not .DisableNav%}
@@ -60,13 +60,13 @@ - {{{end}}} \ No newline at end of file + {%end%} \ No newline at end of file diff --git a/templates/common/pagination.html b/templates/common/pagination.html index c7d9242..081302e 100644 --- a/templates/common/pagination.html +++ b/templates/common/pagination.html @@ -1,41 +1,41 @@ -{{{if gt .Pagination.Total 0}}} +{%if gt .Pagination.Total 0%} -{{{end}}} \ No newline at end of file +{%end%} \ No newline at end of file diff --git a/templates/error/404.html b/templates/error/404.html index 8900dc0..98b2095 100644 --- a/templates/error/404.html +++ b/templates/error/404.html @@ -1,4 +1,4 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %} -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/error/500.html b/templates/error/500.html index b9414e9..f7749a3 100644 --- a/templates/error/500.html +++ b/templates/error/500.html @@ -1,4 +1,4 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %} -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/home/index.html b/templates/home/index.html index f624d18..7b7af01 100644 --- a/templates/home/index.html +++ b/templates/home/index.html @@ -1,3 +1,3 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %} -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/host/host_form.html b/templates/host/host_form.html index cdde8c1..cd0af08 100644 --- a/templates/host/host_form.html +++ b/templates/host/host_form.html @@ -1,7 +1,7 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{ template "host/menu" . }}} + {% template "host/menu" . %}
- +
- +
- +
-
@@ -40,7 +40,7 @@
- +
@@ -113,4 +113,4 @@ }); -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/host/index.html b/templates/host/index.html index 5056f77..6248d0a 100644 --- a/templates/host/index.html +++ b/templates/host/index.html @@ -1,10 +1,10 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{ template "host/menu" . }}} + {% template "host/menu" . %}
- {{{if .IsAdmin}}} + {%if .IsAdmin%} - {{{end}}} + {%end%}
- +
- +
@@ -43,30 +43,30 @@ - {{{range $i, $v := .Hosts}}} + {%range $i, $v := .Hosts%} - {{{.Id}}} - {{{.Name}}} - {{{.Alias}}} - {{{.Port}}} - {{{.Remark}}} + {%.Id%} + {%.Name%} + {%.Alias%} + {%.Port%} + {%.Remark%} - {{{if $.IsAdmin}}} - 编辑 -
- {{{end}}} + {%if $.IsAdmin%} + 编辑 +
+ {%end%}
- - {{{if $.IsAdmin}}} - - {{{end}}} + + {%if $.IsAdmin%} + + {%end%}
- {{{end}}} + {%end%} - {{{ template "common/pagination" .}}} + {% template "common/pagination" .%}
@@ -83,4 +83,4 @@ }); -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/host/menu.html b/templates/host/menu.html index 4973c54..fb64932 100644 --- a/templates/host/menu.html +++ b/templates/host/menu.html @@ -1,7 +1,7 @@
diff --git a/templates/install/create.html b/templates/install/create.html index b6927b1..26e3d61 100644 --- a/templates/install/create.html +++ b/templates/install/create.html @@ -1,7 +1,7 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{ template "install/menu" . }}} + {% template "install/menu" . %}
@@ -186,4 +186,4 @@ -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/manage/login_log.html b/templates/manage/login_log.html index f50c44c..4791a7f 100644 --- a/templates/manage/login_log.html +++ b/templates/manage/login_log.html @@ -1,7 +1,7 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{ template "manage/menu" . }}} + {% template "manage/menu" . %}
-{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/manage/mail.html b/templates/manage/mail.html index 103909a..8387f00 100644 --- a/templates/manage/mail.html +++ b/templates/manage/mail.html @@ -1,12 +1,12 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{template "manage/menu" .}}} + {%template "manage/menu" .%}
@@ -27,7 +27,7 @@ 端口
- +
@@ -35,7 +35,7 @@ 用户名
- +
@@ -43,25 +43,25 @@ 密码
- +
- {{{if .Mail.Host}}} + {%if .Mail.Host%} 删除 - {{{end}}} + {%end%}


邮箱用户

- {{{range $i, $v := .Mail.MailUsers}}} + {%range $i, $v := .Mail.MailUsers%}
- {{{.Username}}}-{{{.Email}}}   
删除
+ {%.Username%}-{%.Email%}   
删除
- {{{end}}} + {%end%}
@@ -198,4 +198,4 @@ }); } -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/manage/menu.html b/templates/manage/menu.html index 583f957..ec3b35c 100644 --- a/templates/manage/menu.html +++ b/templates/manage/menu.html @@ -1,13 +1,13 @@
diff --git a/templates/manage/slack.html b/templates/manage/slack.html index 96ac870..22984a7 100644 --- a/templates/manage/slack.html +++ b/templates/manage/slack.html @@ -1,12 +1,12 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{template "manage/menu" .}}} + {%template "manage/menu" .%}
保存
@@ -27,13 +27,13 @@
Slack Channel(配置任务通知时,可选择多Channel)

- {{{range $i, $v := .Slack.Channels}}} + {%range $i, $v := .Slack.Channels%}
- {{{.Name}}}   
删除
+ {%.Name%}   
删除
- {{{end}}} + {%end%}
@@ -85,4 +85,4 @@ } }); -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/task/index.html b/templates/task/index.html index 8c12c77..8daab5c 100644 --- a/templates/task/index.html +++ b/templates/task/index.html @@ -1,8 +1,8 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{template "task/menu" .}}} + {%template "task/menu" .%}
- {{{if .IsAdmin}}} + {%if .IsAdmin%} - {{{end}}} + {%end%}
- {{{if .IsAdmin}}} + {%if .IsAdmin%}
- {{{end}}} + {%end%}
- {{{if .IsAdmin}}} + {%if .IsAdmin%} - {{{end}}} + {%end%} @@ -90,58 +90,58 @@ - {{{range $i, $v := .Tasks}}} + {%range $i, $v := .Tasks%} - {{{if $.IsAdmin}}} + {%if $.IsAdmin%} - {{{end}}} - - - - - - - - - + {%end%} + + + + + + + + + - {{{end}}} + {%end%}
任务ID 任务名称 任务类型
{{{.Id}}}{{{.Name}}}{{{if eq .Level 1}}}主任务{{{else}}}子任务{{{end}}}{{{.Tag}}}{{{.Spec}}}{{{if eq .Protocol 1}}} HTTP {{{else if eq .Protocol 2}}} SHELL {{{end}}}{{{if eq .Timeout -1}}}后台运行{{{else if gt .Timeout 0}}}{{{.Timeout}}}秒{{{else}}}不限制{{{end}}}{{{.RetryTimes}}}{{{if gt .Multi 0}}}否{{{else}}}是{{{end}}}{%.Id%}{%.Name%}{%if eq .Level 1%}主任务{%else%}子任务{%end%}{%.Tag%}{%.Spec%}{%if eq .Protocol 1%} HTTP {%else if eq .Protocol 2%} SHELL {%end%}{%if eq .Timeout -1%}后台运行{%else if gt .Timeout 0%}{%.Timeout%}秒{%else%}不限制{%end%}{%.RetryTimes%}{%if gt .Multi 0%}否{%else%}是{%end%} - {{{range $k, $h := .Hosts}}} - {{{$h.Alias}}}
- {{{end}}} + {%range $k, $h := .Hosts%} + {%$h.Alias%}
+ {%end%}
- {{{if eq .Level 1}}} - {{{if eq .Status 1}}}{{{else}}}{{{end}}} - {{{end}}} + {%if eq .Level 1%} + {%if eq .Status 1%}{%else%}{%end%} + {%end%}
- {{{if $.IsAdmin}}} -      - {{{if eq .Level 1}}} - {{{if eq .Status 1}}} -    - {{{else}}} -    - {{{end}}} - {{{end}}} - -    - {{{end}}} + {%if $.IsAdmin%} +      + {%if eq .Level 1%} + {%if eq .Status 1%} +    + {%else%} +    + {%end%} + {%end%} + +    + {%end%} - +
- {{{ template "common/pagination" .}}} + {% template "common/pagination" .%}
@@ -239,4 +239,4 @@ } -{{{ template "common/footer" . }}} +{% template "common/footer" . %} diff --git a/templates/task/log.html b/templates/task/log.html index ab95772..761fb27 100644 --- a/templates/task/log.html +++ b/templates/task/log.html @@ -1,4 +1,4 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{ template "task/menu" . }}} + {% template "task/menu" . %}
- {{{if .IsAdmin}}} + {%if .IsAdmin%} - {{{end}}} + {%end%}
@@ -171,4 +171,4 @@ }); } -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/task/menu.html b/templates/task/menu.html index 4b0a210..30e59f5 100644 --- a/templates/task/menu.html +++ b/templates/task/menu.html @@ -1,10 +1,10 @@
diff --git a/templates/task/task_form.html b/templates/task/task_form.html index 914c493..411b066 100644 --- a/templates/task/task_form.html +++ b/templates/task/task_form.html @@ -1,25 +1,25 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}
- {{{template "task/menu" .}}} + {%template "task/menu" .%}
- +
- +
@@ -28,7 +28,7 @@
标签名称
- +
@@ -41,9 +41,9 @@ 任务类型新增后不能变更
- + +
@@ -58,8 +58,8 @@
@@ -71,7 +71,7 @@
- +
@@ -83,7 +83,7 @@
- +
@@ -92,9 +92,9 @@
@@ -102,12 +102,12 @@
- {{{range $i, $v := .Hosts}}} + {%range $i, $v := .Hosts%} - {{{end}}} + {%end%}
 
添加节点
@@ -116,8 +116,8 @@
@@ -125,19 +125,19 @@
- +
- +
@@ -145,11 +145,11 @@
- +
- +
@@ -157,9 +157,9 @@
@@ -167,9 +167,9 @@
@@ -177,7 +177,7 @@
- +
保存
取消 @@ -256,11 +256,11 @@ } function showNotify() { - var notifyStatus = {{{.Task.NotifyStatus}}}; + var notifyStatus = {%.Task.NotifyStatus%}; if (notifyStatus > 0) { $('#task-notify-type').show(); } - var notifyReceiverIds = '{{{.Task.NotifyReceiverId}}}'.split(','); + var notifyReceiverIds = '{%.Task.NotifyReceiverId%}'.split(','); changeNotify(notifyReceiverIds); } @@ -465,4 +465,4 @@ }); -{{{ template "common/footer" . }}} \ No newline at end of file +{% template "common/footer" . %} \ No newline at end of file diff --git a/templates/user/editMyPassword.html b/templates/user/editMyPassword.html index 145f485..589fb18 100644 --- a/templates/user/editMyPassword.html +++ b/templates/user/editMyPassword.html @@ -1,4 +1,4 @@ -{{{ template "common/header" . }}} +{% template "common/header" . %}