diff --git a/routers/web/repo/star.go b/routers/web/repo/star.go index 8cfbfefdf14..c93c877d636 100644 --- a/routers/web/repo/star.go +++ b/routers/web/repo/star.go @@ -11,7 +11,7 @@ import ( "code.gitea.io/gitea/services/context" ) -const tplStarUnstar templates.TplName = "repo/star_unstar" +const tplStarUnstar templates.TplName = "repo/header/star" func ActionStar(ctx *context.Context) { err := repo_model.StarRepo(ctx, ctx.Doer, ctx.Repo.Repository, ctx.PathParam("action") == "star") diff --git a/routers/web/repo/watch.go b/routers/web/repo/watch.go index a7fbfc168be..616e1ee89c7 100644 --- a/routers/web/repo/watch.go +++ b/routers/web/repo/watch.go @@ -11,7 +11,7 @@ import ( "code.gitea.io/gitea/services/context" ) -const tplWatchUnwatch templates.TplName = "repo/watch_unwatch" +const tplWatchUnwatch templates.TplName = "repo/header/watch" func ActionWatch(ctx *context.Context) { err := repo_model.WatchRepo(ctx, ctx.Doer, ctx.Repo.Repository, ctx.PathParam("action") == "watch") diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 9ed74d50bc0..9fbe6a9a114 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -57,59 +57,12 @@ {{svg "octicon-rss" 16}} {{end}} - {{template "repo/watch_unwatch" $}} + {{template "repo/header/watch" $}} {{if not $.DisableStars}} - {{template "repo/star_unstar" $}} + {{template "repo/header/star" $}} {{end}} {{if and (not .IsEmpty) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} -
- - {{svg "octicon-repo-forked"}}{{ctx.Locale.Tr "repo.fork"}} - - - {{CountFmt .NumForks}} - -
- + {{template "repo/header/fork" $}} {{end}} {{end}} diff --git a/templates/repo/header/fork.tmpl b/templates/repo/header/fork.tmpl new file mode 100644 index 00000000000..e14851f0684 --- /dev/null +++ b/templates/repo/header/fork.tmpl @@ -0,0 +1,47 @@ +{{$canNotForkOwn := and $.IsSigned (not $.CanSignedUserFork) (not $.UserAndOrgForks)}} +
+ + {{svg "octicon-repo-forked"}}{{ctx.Locale.Tr "repo.fork"}} + + + {{CountFmt $.Repository.NumForks}} + +
+{{if $.ShowForkModal}} + +{{end}} diff --git a/templates/repo/star_unstar.tmpl b/templates/repo/header/star.tmpl similarity index 84% rename from templates/repo/star_unstar.tmpl rename to templates/repo/header/star.tmpl index 7e4c61aa286..d1762bc004e 100644 --- a/templates/repo/star_unstar.tmpl +++ b/templates/repo/header/star.tmpl @@ -1,18 +1,18 @@
{{$buttonText := ctx.Locale.Tr "repo.star"}} {{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}} - + {{CountFmt .Repository.NumStars}} diff --git a/templates/repo/watch_unwatch.tmpl b/templates/repo/header/watch.tmpl similarity index 76% rename from templates/repo/watch_unwatch.tmpl rename to templates/repo/header/watch.tmpl index 1d6daac2522..a00fd01c804 100644 --- a/templates/repo/watch_unwatch.tmpl +++ b/templates/repo/header/watch.tmpl @@ -1,19 +1,19 @@
{{$buttonText := ctx.Locale.Tr "repo.watch"}} {{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}} - - + + {{CountFmt .Repository.NumWatches}}