mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Add units to team (#947)
* add units to team * fix lint * finish team setting backend * finished permission controll on routes * fix import blank line * add unit check on ssh/http pull and push and fix test failed * fix fixtures data * remove unused code
This commit is contained in:
parent
5db5e16ab6
commit
fd6034aaf2
18 changed files with 366 additions and 113 deletions
|
@ -252,6 +252,25 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
|||
|
||||
// Home render repository home page
|
||||
func Home(ctx *context.Context) {
|
||||
if len(ctx.Repo.Repository.Units) > 0 {
|
||||
tp := ctx.Repo.Repository.Units[0].Type
|
||||
if tp == models.UnitTypeCode {
|
||||
renderCode(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
unit, ok := models.Units[tp]
|
||||
if ok {
|
||||
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/%s%s",
|
||||
ctx.Repo.Repository.FullName(), unit.URI))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Handle(404, "Home", fmt.Errorf(ctx.Tr("units.error.no_unit_allowed_repo")))
|
||||
}
|
||||
|
||||
func renderCode(ctx *context.Context) {
|
||||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue