diff --git a/models/repo/repo.go b/models/repo/repo.go index 9353e813bccec..672bf63ebe786 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -111,6 +111,7 @@ type Repository struct { IsEmpty bool `xorm:"INDEX"` IsArchived bool `xorm:"INDEX"` IsMirror bool `xorm:"INDEX"` + IsPinned bool *Mirror `xorm:"-"` Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"` diff --git a/modules/structs/repo.go b/modules/structs/repo.go index b1a3781d0585e..7fd595fcea714 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -93,6 +93,8 @@ type Repository struct { AvatarURL string `json:"avatar_url"` Internal bool `json:"internal"` MirrorInterval string `json:"mirror_interval"` + Pinned bool `json:"pinned"` + PinnedOrder int `json:"pinned_order"` } // CreateRepoOption options when creating repository @@ -180,6 +182,10 @@ type EditRepoOption struct { Archived *bool `json:"archived,omitempty"` // set to a string like `8h30m0s` to set the mirror interval time MirrorInterval *string `json:"mirror_interval,omitempty"` + // pins the repo on the start of the user home page + Pinned *bool `json:"pinned"` + // defines in which order the repo will shown up at the pinned list + PinnedOrder *int `json:"pinned_order"` } // GenerateRepoOption options when creating repository using a template diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 4486e33fe87e4..1b055372d37c7 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -575,6 +575,7 @@ func GetByID(ctx *context.APIContext) { ctx.JSON(http.StatusOK, convert.ToRepo(repo, perm.AccessMode)) } +//TODO pin repo // Edit edit repository properties func Edit(ctx *context.APIContext) { // swagger:operation PATCH /repos/{owner}/{repo} repository repoEdit diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 5a4c8ace69324..9e403d7e95f33 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -48,6 +48,15 @@ + + +
+
+ + +
+
+