Skip to content

Commit

Permalink
go-gitea#11160 Add colors column for ProjectBoard
Browse files Browse the repository at this point in the history
  • Loading branch information
romdum committed Aug 6, 2021
1 parent 067d82b commit d7ba3cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/project_board.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ProjectBoard struct {
Title string
Default bool `xorm:"NOT NULL DEFAULT false"` // issues not assigned to a specific board will be assigned to this board
Sorting int8 `xorm:"NOT NULL DEFAULT 0"`
Color string

ProjectID int64 `xorm:"INDEX NOT NULL"`
CreatorID int64 `xorm:"NOT NULL"`
Expand Down Expand Up @@ -173,6 +174,10 @@ func updateProjectBoard(e Engine, board *ProjectBoard) error {
fieldToUpdate = append(fieldToUpdate, "title")
}

if board.Color != "" {
fieldToUpdate = append(fieldToUpdate, "color")
}

_, err := e.ID(board.ID).Cols(fieldToUpdate...).Update(board)

return err
Expand Down
5 changes: 5 additions & 0 deletions routers/web/repo/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ func AddBoardToProjectPost(ctx *context.Context) {
if err := models.NewProjectBoard(&models.ProjectBoard{
ProjectID: project.ID,
Title: form.Title,
Color: form.Color,
CreatorID: ctx.User.ID,
}); err != nil {
ctx.ServerError("NewProjectBoard", err)
Expand Down Expand Up @@ -511,6 +512,10 @@ func EditProjectBoard(ctx *context.Context) {
board.Title = form.Title
}

if form.Color != "" {
board.Color = form.Color
}

if form.Sorting != 0 {
board.Sorting = form.Sorting
}
Expand Down
1 change: 1 addition & 0 deletions services/forms/repo_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ type UserCreateProjectForm struct {
type EditProjectBoardForm struct {
Title string `binding:"Required;MaxSize(100)"`
Sorting int8
Color string `binding:"MaxSize(7)"`
}

// _____ .__.__ __
Expand Down

0 comments on commit d7ba3cf

Please sign in to comment.