diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/projects.go | 12 | ||||
-rw-r--r-- | routers/routes/web.go | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/routers/repo/projects.go b/routers/repo/projects.go index 49bcfef0ce..4aa03e9efc 100644 --- a/routers/repo/projects.go +++ b/routers/repo/projects.go @@ -403,7 +403,7 @@ func DeleteProjectBoard(ctx *context.Context) { // AddBoardToProjectPost allows a new board to be added to a project. func AddBoardToProjectPost(ctx *context.Context) { - form := web.GetForm(ctx).(*auth.EditProjectBoardTitleForm) + form := web.GetForm(ctx).(*auth.EditProjectBoardForm) if !ctx.Repo.IsOwner() && !ctx.Repo.IsAdmin() && !ctx.Repo.CanAccess(models.AccessModeWrite, models.UnitTypeProjects) { ctx.JSON(403, map[string]string{ "message": "Only authorized users are allowed to perform this action.", @@ -481,9 +481,9 @@ func checkProjectBoardChangePermissions(ctx *context.Context) (*models.Project, return project, board } -// EditProjectBoardTitle allows a project board's title to be updated -func EditProjectBoardTitle(ctx *context.Context) { - form := web.GetForm(ctx).(*auth.EditProjectBoardTitleForm) +// EditProjectBoard allows a project board's to be updated +func EditProjectBoard(ctx *context.Context) { + form := web.GetForm(ctx).(*auth.EditProjectBoardForm) _, board := checkProjectBoardChangePermissions(ctx) if ctx.Written() { return @@ -493,6 +493,10 @@ func EditProjectBoardTitle(ctx *context.Context) { board.Title = form.Title } + if form.Sorting != 0 { + board.Sorting = form.Sorting + } + if err := models.UpdateProjectBoard(board); err != nil { ctx.ServerError("UpdateProjectBoard", err) return diff --git a/routers/routes/web.go b/routers/routes/web.go index 1f860a6239..9e3e690fb9 100644 --- a/routers/routes/web.go +++ b/routers/routes/web.go @@ -853,7 +853,7 @@ func RegisterRoutes(m *web.Route) { m.Get("/new", repo.NewProject) m.Post("/new", bindIgnErr(auth.CreateProjectForm{}), repo.NewProjectPost) m.Group("/{id}", func() { - m.Post("", bindIgnErr(auth.EditProjectBoardTitleForm{}), repo.AddBoardToProjectPost) + m.Post("", bindIgnErr(auth.EditProjectBoardForm{}), repo.AddBoardToProjectPost) m.Post("/delete", repo.DeleteProject) m.Get("/edit", repo.EditProject) @@ -861,7 +861,7 @@ func RegisterRoutes(m *web.Route) { m.Post("/{action:open|close}", repo.ChangeProjectStatus) m.Group("/{boardID}", func() { - m.Put("", bindIgnErr(auth.EditProjectBoardTitleForm{}), repo.EditProjectBoardTitle) + m.Put("", bindIgnErr(auth.EditProjectBoardForm{}), repo.EditProjectBoard) m.Delete("", repo.DeleteProjectBoard) m.Post("/default", repo.SetDefaultProjectBoard) |