diff --git a/public/panel_forum_edit.js b/public/panel_forum_edit.js new file mode 100644 index 00000000..ffccc207 --- /dev/null +++ b/public/panel_forum_edit.js @@ -0,0 +1,5 @@ +(() => { + addInitHook("end_init", () => { + formVars = {'perm_preset': ['can_moderate','can_post','read_only','no_access','default','custom']}; + }); +})(); \ No newline at end of file diff --git a/routes/panel/forums.go b/routes/panel/forums.go index 357561da..d9658d76 100644 --- a/routes/panel/forums.go +++ b/routes/panel/forums.go @@ -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 { diff --git a/routes/panel/groups.go b/routes/panel/groups.go index 000e8afd..d658e591 100644 --- a/routes/panel/groups.go +++ b/routes/panel/groups.go @@ -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 { diff --git a/routes/panel/users.go b/routes/panel/users.go index 77ac63e5..5be1b27b 100644 --- a/routes/panel/users.go +++ b/routes/panel/users.go @@ -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 { diff --git a/templates/panel.html b/templates/panel.html index 759a8e0b..ce525405 100644 --- a/templates/panel.html +++ b/templates/panel.html @@ -1,7 +1,7 @@ {{template "header.html" . }}