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} 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 { 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 { if !user.Perms.ManageForums {
return c.NoPermissions(w, r, user) return c.NoPermissions(w, r, user)
} }
basePage.Header.AddScriptAsync("panel_forum_edit.js")
fid, err := strconv.Atoi(sfid) fid, err := strconv.Atoi(sfid)
if err != nil { 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} 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 { 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} 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 { 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) pageList := c.Paginate(basePage.Stats.Groups, perPage, 5)
pi := c.PanelGroupPage{basePage, groupList, c.Paginator{pageList, page, lastPage}} 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 { 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) pageList := c.Paginate(basePage.Stats.Users, perPage, 5)
pi := c.PanelUserPage{basePage, users, c.Paginator{pageList, page, lastPage}} 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 { 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} 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 { func UsersEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, suid string) c.RouteError {

View File

@ -1,7 +1,7 @@
{{template "header.html" . }} {{template "header.html" . }}
<div class="colstack panel_stack"> <div class="colstack panel_stack">
{{template "panel_menu.html" . }} {{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" . }} {{template "panel_before_head.html" . }}
{{dyntmpl .TmplName .Inner .Header}} {{dyntmpl .TmplName .Inner .Header}}
</main> </main>

View File

@ -1,15 +1,15 @@
<div class="colstack_item colstack_head"> <div class="colstack_item colstack_head">
<div class="rowitem"> <div class="rowitem">
<h1>{{lang "panel_statistics_referrers_head"}}</h1> <h1>{{lang "panel_statistics_referrers_head"}}</h1>
{{template "panel_analytics_time_range.html" . }} {{template "panel_analytics_time_range.html" . }}
</div> </div>
</div> </div>
<form id="timeRangeForm" name="timeRangeForm" action="/panel/analytics/referrers/" method="get"></form> <form id="timeRangeForm" name="timeRangeForm" action="/panel/analytics/referrers/" method="get"></form>
<div id="panel_analytics_referrers" class="colstack_item rowlist"> <div id="panel_analytics_referrers" class="colstack_item rowlist">
{{range .ItemList}} {{range .ItemList}}
<div class="rowitem panel_compactrow editable_parent"> <div class="rowitem panel_compactrow editable_parent">
<a href="/panel/analytics/referrer/{{.Agent}}" class="panel_upshift">{{.Agent}}</a> <a href="/panel/analytics/referrer/{{.Agent}}" class="panel_upshift">{{.Agent}}</a>
<span class="panel_compacttext to_right">{{.Count}}{{lang "panel_statistics_views_suffix"}}</span> <span class="panel_compacttext to_right">{{.Count}}{{lang "panel_statistics_views_suffix"}}</span>
</div> </div>
{{else}}<div class="rowitem passive rowmsg">{{lang "panel_statistics_referrers_no_referrers"}}</div>{{end}} {{else}}<div class="rowitem passive rowmsg">{{lang "panel_statistics_referrers_no_referrers"}}</div>{{end}}
</div> </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="colstack_item colstack_head">
<div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div> <div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div>
</div> </div>
@ -66,6 +56,3 @@ var formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access
</div> </div>
{{end}} {{end}}
</div> </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="colstack_item colstack_head">
<div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div> <div class="rowitem"><h1>{{.Name}}{{lang "panel_forum_head_suffix"}}</h1></div>
</div> </div>
@ -27,6 +21,3 @@
</div> </div>
</div> </div>
</form> </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="colstack_item colstack_head">
<div class="rowitem"> <div class="rowitem">
<h1>{{lang "panel.forums_head"}}</h1> <h1>{{lang "panel.forums_head"}}</h1>
@ -74,7 +67,3 @@
</div> </div>
</form> </form>
</div> </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="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_groups_head"}}</h1></div> <div class="rowitem"><h1>{{lang "panel_groups_head"}}</h1></div>
</div> </div>
@ -53,7 +47,3 @@
</form> </form>
</div> </div>
{{end}} {{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="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_user_head"}}</h1></div> <div class="rowitem"><h1>{{lang "panel_user_head"}}</h1></div>
</div> </div>
@ -35,7 +29,3 @@
</div> </div>
</form> </form>
</div> </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="colstack_item colstack_head">
<div class="rowitem"><h1>{{lang "panel_users_head"}}</h1></div> <div class="rowitem"><h1>{{lang "panel_users_head"}}</h1></div>
</div> </div>
@ -22,7 +16,3 @@
{{end}} {{end}}
</div> </div>
{{template "paginator.html" . }} {{template "paginator.html" . }}
</main>
</div>
{{template "footer.html" . }}