Added a missing panel_ prefix for a template and added a couple more error phrases.

This commit is contained in:
Azareal 2018-10-02 17:20:55 +10:00
parent 0039b9c851
commit a365e42dcf
3 changed files with 15 additions and 11 deletions

View File

@ -96,7 +96,10 @@
"register_password_mismatch":"The two passwords don't match.",
"register_username_unavailable":"This username isn't available. Try another.",
"register_username_too_long_prefix":"The username is too long, max: ",
"register_email_fail":"We were unable to send the email for you to confirm that this email address belongs to you. You may not have access to some functionality until you do so. Please ask an administrator for assistance."
"register_email_fail":"We were unable to send the email for you to confirm that this email address belongs to you. You may not have access to some functionality until you do so. Please ask an administrator for assistance.",
"panel_groups_cannot_edit_admin":"You need the EditGroupAdmin permission to edit an admin group.",
"panel_groups_cannot_edit_supermod":"You need the EditGroupSuperMod permission to edit a super-mod group."
},
"PageTitles": {

View File

@ -24,6 +24,7 @@ func renderTemplate(tmplName string, w http.ResponseWriter, r *http.Request, use
if common.RunPreRenderHook("pre_render_"+tmplName, w, r, &user, pi) {
return nil
}
// TODO: Prepend this with panel_?
err := common.Templates.ExecuteTemplate(w, tmplName+".html", pi)
if err != nil {
return common.InternalError(err, w, r)

View File

@ -86,10 +86,10 @@ func GroupsEdit(w http.ResponseWriter, r *http.Request, user common.User, sgid s
}
if group.IsAdmin && !user.Perms.EditGroupAdmin {
return common.LocalError("You need the EditGroupAdmin permission to edit an admin group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, user)
}
if group.IsMod && !user.Perms.EditGroupSuperMod {
return common.LocalError("You need the EditGroupSuperMod permission to edit a super-mod group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, user)
}
var rank string
@ -108,7 +108,7 @@ func GroupsEdit(w http.ResponseWriter, r *http.Request, user common.User, sgid s
disableRank := !user.Perms.EditGroupGlobalPerms || (group.ID == 6)
pi := common.PanelEditGroupPage{basePage, group.ID, group.Name, group.Tag, rank, disableRank}
return renderTemplate("group_edit", w, r, user, pi)
return renderTemplate("panel_group_edit", w, r, user, pi)
}
//routePanelGroupsEditPerms
@ -135,10 +135,10 @@ func GroupsEditPerms(w http.ResponseWriter, r *http.Request, user common.User, s
}
if group.IsAdmin && !user.Perms.EditGroupAdmin {
return common.LocalError("You need the EditGroupAdmin permission to edit an admin group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, user)
}
if group.IsMod && !user.Perms.EditGroupSuperMod {
return common.LocalError("You need the EditGroupSuperMod permission to edit a super-mod group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, user)
}
// TODO: Load the phrases in bulk for efficiency?
@ -188,7 +188,7 @@ func GroupsEditPerms(w http.ResponseWriter, r *http.Request, user common.User, s
addGlobalPerm("UploadFiles", group.Perms.UploadFiles)
pi := common.PanelEditGroupPermsPage{basePage, group.ID, group.Name, localPerms, globalPerms}
return renderTemplate("group_edit_perms", w, r, user, pi)
return renderTemplate("panel_group_edit_perms", w, r, user, pi)
}
//routePanelGroupsEditSubmit
@ -215,10 +215,10 @@ func GroupsEditSubmit(w http.ResponseWriter, r *http.Request, user common.User,
}
if group.IsAdmin && !user.Perms.EditGroupAdmin {
return common.LocalError("You need the EditGroupAdmin permission to edit an admin group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, user)
}
if group.IsMod && !user.Perms.EditGroupSuperMod {
return common.LocalError("You need the EditGroupSuperMod permission to edit a super-mod group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, user)
}
gname := r.FormValue("group-name")
@ -305,10 +305,10 @@ func GroupsEditPermsSubmit(w http.ResponseWriter, r *http.Request, user common.U
}
if group.IsAdmin && !user.Perms.EditGroupAdmin {
return common.LocalError("You need the EditGroupAdmin permission to edit an admin group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, user)
}
if group.IsMod && !user.Perms.EditGroupSuperMod {
return common.LocalError("You need the EditGroupSuperMod permission to edit a super-mod group.", w, r, user)
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, user)
}
var pmap = make(map[string]bool)