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,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>
@ -66,6 +56,3 @@ var formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access
</div>
{{end}}
</div>
</main>
</div>
{{template "footer.html" . }}

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>
@ -27,6 +21,3 @@
</div>
</div>
</form>
</main>
</div>
{{template "footer.html" . }}

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>
@ -74,7 +67,3 @@
</div>
</form>
</div>
</main>
</div>
{{template "footer.html" . }}

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>
@ -53,7 +47,3 @@
</form>
</div>
{{end}}
</main>
</div>
{{template "footer.html" . }}

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>
@ -35,7 +29,3 @@
</div>
</form>
</div>
</main>
</div>
{{template "footer.html" . }}

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>
@ -22,7 +16,3 @@
{{end}}
</div>
{{template "paginator.html" . }}
</main>
</div>
{{template "footer.html" . }}