diff options
author | Romain <romdum@users.noreply.github.com> | 2021-02-11 17:32:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 17:32:27 +0100 |
commit | c69c01d2b6b08a89448b5596fd2233fa4e802ac3 (patch) | |
tree | 16d461903abbd5bd29ae4905b8506a752d632619 /routers | |
parent | ac97ea573c1b10d03e72775e8f74b9fe5453bfc8 (diff) | |
download | gitea-c69c01d2b6b08a89448b5596fd2233fa4e802ac3.tar.gz gitea-c69c01d2b6b08a89448b5596fd2233fa4e802ac3.zip |
Sort / Move project boards (#14634)
Sort Project board (#14533)
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) |