The Forum Manager now uses dyntmpl.

The User Manager now uses dyntmpl.
panel_groups.html now uses dyntmpl.

HTMLID is now optional in panel.html
Moved the inline JS in panel_forum_edit.html into panel_forum_edit.js
Removed the legacy indents from panel_analytics_referrers.
This commit is contained in:
Azareal 2019-04-29 18:17:12 +10:00
parent 6bed36b8c6
commit 48a993d067
12 changed files with 34 additions and 91 deletions

View File

@ -0,0 +1,5 @@
(() => {
addInitHook("end_init", () => {
formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access','default','custom']};
});
})();

View File

@ -49,7 +49,7 @@ func Forums(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
}
pi := c.PanelPage{basePage, forumList, nil}
return renderTemplate("panel_forums", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_forums",&pi})
}
func ForumsCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
@ -165,6 +165,7 @@ func ForumsEdit(w http.ResponseWriter, r *http.Request, user c.User, sfid string
if !user.Perms.ManageForums {
return c.NoPermissions(w, r, user)
}
basePage.Header.AddScriptAsync("panel_forum_edit.js")
fid, err := strconv.Atoi(sfid)
if err != nil {
@ -206,7 +207,7 @@ func ForumsEdit(w http.ResponseWriter, r *http.Request, user c.User, sfid string
}
pi := c.PanelEditForumPage{basePage, forum.ID, forum.Name, forum.Desc, forum.Active, forum.Preset, gplist}
return renderTemplate("panel_forum_edit", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_forum_edit",&pi})
}
func ForumsEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, sfid string) c.RouteError {
@ -364,7 +365,7 @@ func ForumsEditPermsAdvance(w http.ResponseWriter, r *http.Request, user c.User,
}
pi := c.PanelEditForumGroupPage{basePage, forum.ID, gid, forum.Name, forum.Desc, forum.Active, forum.Preset, formattedPermList}
return renderTemplate("panel_forum_edit_perms", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_forum_edit_perms",&pi})
}
func ForumsEditPermsAdvanceSubmit(w http.ResponseWriter, r *http.Request, user c.User, paramList string) c.RouteError {

View File

@ -59,7 +59,7 @@ func Groups(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
pageList := c.Paginate(basePage.Stats.Groups, perPage, 5)
pi := c.PanelGroupPage{basePage, groupList, c.Paginator{pageList, page, lastPage}}
return renderTemplate("panel_groups", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_groups",&pi})
}
func GroupsEdit(w http.ResponseWriter, r *http.Request, user c.User, sgid string) c.RouteError {

View File

@ -25,7 +25,7 @@ func Users(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
pageList := c.Paginate(basePage.Stats.Users, perPage, 5)
pi := c.PanelUserPage{basePage, users, c.Paginator{pageList, page, lastPage}}
return renderTemplate("panel_users", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_users",&pi})
}
func UsersEdit(w http.ResponseWriter, r *http.Request, user c.User, suid string) c.RouteError {
@ -75,7 +75,7 @@ func UsersEdit(w http.ResponseWriter, r *http.Request, user c.User, suid string)
}
pi := c.PanelPage{basePage, groupList, targetUser}
return renderTemplate("panel_user_edit", w, r, basePage.Header, &pi)
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_user_edit",&pi})
}
func UsersEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, suid string) c.RouteError {

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main id="{{.HTMLID}}" class="colstack_right {{.ClassNames}}">
<main{{if .HTMLID}} id="{{.HTMLID}}"{{end}} class="colstack_right {{.ClassNames}}">
{{template "panel_before_head.html" . }}
{{dyntmpl .TmplName .Inner .Header}}
</main>

View File

@ -1,15 +1,15 @@
<div class="colstack_item colstack_head">
<div class="rowitem">
<h1>{{lang "panel_statistics_referrers_head"}}</h1>
{{template "panel_analytics_time_range.html" . }}
</div>
</div>
<form id="timeRangeForm" name="timeRangeForm" action="/panel/analytics/referrers/" method="get"></form>
<div id="panel_analytics_referrers" class="colstack_item rowlist">
{{range .ItemList}}
<div class="rowitem panel_compactrow editable_parent">
<a href="/panel/analytics/referrer/{{.Agent}}" class="panel_upshift">{{.Agent}}</a>
<span class="panel_compacttext to_right">{{.Count}}{{lang "panel_statistics_views_suffix"}}</span>
</div>
{{else}}<div class="rowitem passive rowmsg">{{lang "panel_statistics_referrers_no_referrers"}}</div>{{end}}
</div>
<div class="colstack_item colstack_head">
<div class="rowitem">
<h1>{{lang "panel_statistics_referrers_head"}}</h1>
{{template "panel_analytics_time_range.html" . }}
</div>
</div>
<form id="timeRangeForm" name="timeRangeForm" action="/panel/analytics/referrers/" method="get"></form>
<div id="panel_analytics_referrers" class="colstack_item rowlist">
{{range .ItemList}}
<div class="rowitem panel_compactrow editable_parent">
<a href="/panel/analytics/referrer/{{.Agent}}" class="panel_upshift">{{.Agent}}</a>
<span class="panel_compacttext to_right">{{.Count}}{{lang "panel_statistics_views_suffix"}}</span>
</div>
{{else}}<div class="rowitem passive rowmsg">{{lang "panel_statistics_referrers_no_referrers"}}</div>{{end}}
</div>

View File

@ -1,13 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<script type="text/javascript">
var formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access','default','custom']};
</script>
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div>
</div>
@ -65,7 +55,4 @@ var formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access
</div>
</div>
{{end}}
</div>
</main>
</div>
{{template "footer.html" . }}
</div>

View File

@ -1,9 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div>
</div>
@ -26,7 +20,4 @@
<div class="formitem"><button name="panel-button" class="formbutton form_middle_button">{{lang "panel_forum_update_button"}}</button></div>
</div>
</div>
</form>
</main>
</div>
{{template "footer.html" . }}
</form>

View File

@ -1,10 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem">
<h1>{{lang "panel.forums_head"}}</h1>
@ -73,8 +66,4 @@
<div class="formitem"><button name="panel-button" class="formbutton">{{lang "panel.forums_create_button"}}</button></div>
</div>
</form>
</div>
</main>
</div>
{{template "footer.html" . }}
</div>

View File

@ -1,9 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_groups_head"}}</h1></div>
</div>
@ -52,8 +46,4 @@
</div>
</form>
</div>
{{end}}
</main>
</div>
{{template "footer.html" . }}
{{end}}

View File

@ -1,9 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_user_head"}}</h1></div>
</div>
@ -34,8 +28,4 @@
<div class="formitem"><button name="panel-button" class="formbutton">{{lang "panel_user_update_button"}}</button></div>
</div>
</form>
</div>
</main>
</div>
{{template "footer.html" . }}
</div>

View File

@ -1,9 +1,3 @@
{{template "header.html" . }}
<div class="colstack panel_stack">
{{template "panel_menu.html" . }}
<main class="colstack_right">
{{template "panel_before_head.html" . }}
<div class="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_users_head"}}</h1></div>
</div>
@ -21,8 +15,4 @@
</div>
{{end}}
</div>
{{template "paginator.html" . }}
</main>
</div>
{{template "footer.html" . }}
{{template "paginator.html" . }}