|
|
@ -264,16 +264,21 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
|
|
|
// Home render repository home page
|
|
|
|
// Home render repository home page
|
|
|
|
func Home(ctx *context.Context) {
|
|
|
|
func Home(ctx *context.Context) {
|
|
|
|
if len(ctx.Repo.Repository.Units) > 0 {
|
|
|
|
if len(ctx.Repo.Repository.Units) > 0 {
|
|
|
|
tp := ctx.Repo.Repository.Units[0].Type
|
|
|
|
var firstUnit *models.Unit
|
|
|
|
if tp == models.UnitTypeCode {
|
|
|
|
for _, repoUnit := range ctx.Repo.Repository.Units {
|
|
|
|
|
|
|
|
if repoUnit.Type == models.UnitTypeCode {
|
|
|
|
renderCode(ctx)
|
|
|
|
renderCode(ctx)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unit, ok := models.Units[tp]
|
|
|
|
unit, ok := models.Units[repoUnit.Type]
|
|
|
|
if ok {
|
|
|
|
if ok && (firstUnit == nil || !firstUnit.IsLessThan(unit)) {
|
|
|
|
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/%s%s",
|
|
|
|
firstUnit = &unit
|
|
|
|
ctx.Repo.Repository.FullName(), unit.URI))
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if firstUnit != nil {
|
|
|
|
|
|
|
|
ctx.Redirect(fmt.Sprintf("%s/%s%s", setting.AppSubURL, ctx.Repo.Repository.FullName(), firstUnit.URI))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|