diff --git a/templates/repo/clone_panel.tmpl b/templates/repo/clone_panel.tmpl new file mode 100644 index 0000000000..42896c5c13 --- /dev/null +++ b/templates/repo/clone_panel.tmpl @@ -0,0 +1,76 @@ +{{$n := len .TreeNames}} +{{$l := Eval $n "-" 1}} +{{$isHomepage := (eq $n 0)}} +
+ + {{if $isHomepage}} +
+ +
+
+
+
{{svg "octicon-terminal" 16}} Clone
+ {{svg "octicon-x" 16}} +
+
+ + {{if $.CloneButtonShowHTTPS}} +
+ HTTPS +
+ {{end}} + {{if $.CloneButtonShowSSH}} +
+ SSH +
+ {{end}} +
+
+ +
+ {{svg "octicon-copy" 14}} +
+
+
+
+ + {{if not $.DisableDownloadSourceArchives}} +
+ + {{end}} + {{if .CitiationExist}} +
+ {{svg "octicon-cross-reference" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.cite_this_repo"}} + {{end}} +
+
+ {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}} + {{template "repo/cite/cite_modal" .}} +
+ {{end}} + + {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} + + {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} + + {{end}} +
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 62bd3e1766..55ac307571 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -113,79 +113,7 @@ {{end}} -
- - {{if $isHomepage}} -
- -
-
-
-
{{svg "octicon-terminal" 16}} Clone
- {{svg "octicon-x" 16}} -
-
- - {{if $.CloneButtonShowHTTPS}} -
- HTTPS -
- {{end}} - {{if $.CloneButtonShowSSH}} -
- SSH -
- {{end}} -
-
- -
- {{svg "octicon-copy" 14}} -
-
-
-
- - {{if not $.DisableDownloadSourceArchives}} -
- - {{end}} - {{if .CitiationExist}} -
- {{svg "octicon-cross-reference" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.cite_this_repo"}} - {{end}} -
-
- {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}} - {{template "repo/cite/cite_modal" .}} -
- {{end}} - - {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} - - {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} - - {{end}} -
+ {{template "repo/clone_panel" .}} {{if .IsViewFile}} {{template "repo/view_file" .}}