From 4d62354b71571527d4d5d3cc745c1cdc8191be5d Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 10:34:33 +0200 Subject: [PATCH 1/8] Use label instead of icon to describe repository type when repo avatar is set --- options/locale/locale_en-US.ini | 7 +++++++ templates/repo/header.tmpl | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 662ea49acaebe..cb6690cc06ea4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -673,6 +673,13 @@ reactions_more = and %d more unit_disabled = The site administrator has disabled this repository section. language_other = Other +desc.private = Private +desc.public = Public +desc.private_template = Private template +desc.public_template = Public template +desc.internal = Internal +desc.internal_template = Internal template + template.items = Template Items template.git_content = Git Content (Default Branch) template.git_hooks = Git Hooks diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 76102529dfe45..e29ace0ecd5be 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -12,7 +12,29 @@
/
{{.Name}} {{if .RelAvatarLink}} - {{template "repo/header_icon" .}} + + {{if .IsTemplate}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private_template"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal_template"}} + {{else}} + {{$.i18n.Tr "repo.desc.public_template"}} + {{end}} + {{end}} + {{else}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal"}} + {{else}} + {{$.i18n.Tr "repo.desc.public"}} + {{end}} + {{end}} + {{end}} + {{end}} {{if .IsArchived}}{{end}} {{if .IsMirror}}
{{$.i18n.Tr "repo.mirror_from"}} {{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}
{{end}} From 4356125079a998a57d66ea60c420d197623135d4 Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 10:47:08 +0200 Subject: [PATCH 2/8] header_icon is not longer duplicated; move out of separate template --- templates/repo/header.tmpl | 24 +++++++++++++++++++++++- templates/repo/header_icon.tmpl | 23 ----------------------- 2 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 templates/repo/header_icon.tmpl diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index e29ace0ecd5be..5abff4f085c55 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -6,7 +6,29 @@ {{if .RelAvatarLink}} {{else}} - {{template "repo/header_icon" .}} + {{if $.IsTemplate}} + {{if $.IsPrivate}} + {{svg "octicon-repo-template-private" 32}} + {{else}} + {{svg "octicon-repo-template" 32}} + {{end}} + {{else}} + {{if $.IsPrivate}} + {{svg "octicon-lock" 32}} + {{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}} + {{if $.Owner.Visibility.IsPrivate}} + {{svg "octicon-internal-repo" 32}} + {{else}} + {{svg "octicon-repo" 32}} + {{end}} + {{else if $.IsMirror}} + {{svg "octicon-repo-clone" 32}} + {{else if $.IsFork}} + {{svg "octicon-repo-forked" 32}} + {{else}} + {{svg "octicon-repo" 32}} + {{end}} + {{end}} {{end}} {{.Owner.Name}}
/
diff --git a/templates/repo/header_icon.tmpl b/templates/repo/header_icon.tmpl deleted file mode 100644 index 7184734bbff6f..0000000000000 --- a/templates/repo/header_icon.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -{{if $.IsTemplate}} - {{if $.IsPrivate}} - {{svg "octicon-repo-template-private" 32}} - {{else}} - {{svg "octicon-repo-template" 32}} - {{end}} -{{else}} - {{if $.IsPrivate}} - {{svg "octicon-lock" 32}} - {{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}} - {{if $.Owner.Visibility.IsPrivate}} - {{svg "octicon-internal-repo" 32}} - {{else}} - {{svg "octicon-repo" 32}} - {{end}} - {{else if $.IsMirror}} - {{svg "octicon-repo-clone" 32}} - {{else if $.IsFork}} - {{svg "octicon-repo-forked" 32}} - {{else}} - {{svg "octicon-repo" 32}} - {{end}} -{{end}} From d118f764368dcb04796c4056380a1b65774f0dec Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 10:59:15 +0200 Subject: [PATCH 3/8] handle archived case too --- options/locale/locale_en-US.ini | 1 + templates/explore/repo_list.tmpl | 2 +- templates/repo/header.tmpl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index cb6690cc06ea4..47b6b9668d825 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -679,6 +679,7 @@ desc.private_template = Private template desc.public_template = Public template desc.internal = Internal desc.internal_template = Internal template +desc.archived = Archived template.items = Template Items template.git_content = Git Content (Default Branch) diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index 61ef056afc358..d5798dfcbddab 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -7,7 +7,7 @@ {{end}} {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} / {{end}}{{end}}{{.Name}} - {{if .IsArchived}}{{end}} + {{if .IsArchived}}{{$.i18n.Tr "repo.desc.archived"}}{{end}} {{if .IsPrivate}} {{svg "octicon-lock" 16}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 5abff4f085c55..b79f36de9d5c7 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -58,7 +58,7 @@ {{end}} {{end}} - {{if .IsArchived}}{{end}} + {{if .IsArchived}}{{$.i18n.Tr "repo.desc.archived"}}{{end}} {{if .IsMirror}}
{{$.i18n.Tr "repo.mirror_from"}} {{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}
{{end}} {{if .IsFork}}
{{$.i18n.Tr "repo.forked_from"}} {{SubStr .BaseRepo.RelLink 1 -1}}
{{end}} {{if .IsGenerated}}
{{$.i18n.Tr "repo.generated_from"}} {{SubStr .TemplateRepo.RelLink 1 -1}}
{{end}} From f440f22a103da0fadd3098efdd2636d79289cbaa Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 14:44:13 +0200 Subject: [PATCH 4/8] use everywhere --- templates/explore/repo_list.tmpl | 25 +++++++++++---- templates/repo/header.tmpl | 52 ++++++++++++++------------------ 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index d5798dfcbddab..97495e16b72e2 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -7,13 +7,26 @@ {{end}} {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} / {{end}}{{end}}{{.Name}} - {{if .IsArchived}}{{$.i18n.Tr "repo.desc.archived"}}{{end}} - {{if .IsPrivate}} - {{svg "octicon-lock" 16}} - {{else if and (not .IsMirror) (not .IsFork) (.Owner.Visibility.IsPrivate) }} - {{svg "octicon-internal-repo" 16}} - {{else if .IsFork}} + {{if .IsArchived}}{{$.i18n.Tr "repo.desc.archived"}}{{end}} + {{if .IsTemplate}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private_template"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal_template"}} + {{end}} + {{end}} + {{else}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal"}} + {{end}} + {{end}} + {{end}} + {{if .IsFork}} {{svg "octicon-repo-forked" 16}} {{else if .IsMirror}} {{svg "octicon-repo-clone" 16}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index b79f36de9d5c7..25c86d7161594 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -6,24 +6,24 @@ {{if .RelAvatarLink}} {{else}} - {{if $.IsTemplate}} - {{if $.IsPrivate}} + {{if .IsTemplate}} + {{if .IsPrivate}} {{svg "octicon-repo-template-private" 32}} {{else}} {{svg "octicon-repo-template" 32}} {{end}} {{else}} - {{if $.IsPrivate}} + {{if .IsPrivate}} {{svg "octicon-lock" 32}} - {{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}} - {{if $.Owner.Visibility.IsPrivate}} + {{else if and (not .IsMirror) (not .IsFork) ($.Owner)}} + {{if .Owner.Visibility.IsPrivate}} {{svg "octicon-internal-repo" 32}} {{else}} {{svg "octicon-repo" 32}} {{end}} - {{else if $.IsMirror}} + {{else if .IsMirror}} {{svg "octicon-repo-clone" 32}} - {{else if $.IsFork}} + {{else if .IsFork}} {{svg "octicon-repo-forked" 32}} {{else}} {{svg "octicon-repo" 32}} @@ -33,30 +33,22 @@ {{.Owner.Name}}
/
{{.Name}} - {{if .RelAvatarLink}} - - {{if .IsTemplate}} - {{if .IsPrivate}} - {{$.i18n.Tr "repo.desc.private_template"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{$.i18n.Tr "repo.desc.internal_template"}} - {{else}} - {{$.i18n.Tr "repo.desc.public_template"}} - {{end}} - {{end}} - {{else}} - {{if .IsPrivate}} - {{$.i18n.Tr "repo.desc.private"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{$.i18n.Tr "repo.desc.internal"}} - {{else}} - {{$.i18n.Tr "repo.desc.public"}} - {{end}} - {{end}} + {{if .IsTemplate}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private_template"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal_template"}} + {{end}} + {{end}} + {{else}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal"}} {{end}} - + {{end}} {{end}} {{if .IsArchived}}{{$.i18n.Tr "repo.desc.archived"}}{{end}} {{if .IsMirror}}
{{$.i18n.Tr "repo.mirror_from"}} {{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}
{{end}} From 00905c93cac0947d298cdce0772dc2238872ae86 Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 15:21:56 +0200 Subject: [PATCH 5/8] public template -> template --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 47b6b9668d825..e444bfa7c01b0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -676,7 +676,7 @@ language_other = Other desc.private = Private desc.public = Public desc.private_template = Private template -desc.public_template = Public template +desc.public_template = Template desc.internal = Internal desc.internal_template = Internal template desc.archived = Archived From 413237eb21e31ee50f461c0fe38b14a62afa03fe Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 22:25:44 +0200 Subject: [PATCH 6/8] bring back separate icon in better form --- templates/repo/header.tmpl | 24 +----------------------- templates/repo/icon.tmpl | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 templates/repo/icon.tmpl diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 25c86d7161594..5776913d8357b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -6,29 +6,7 @@ {{if .RelAvatarLink}} {{else}} - {{if .IsTemplate}} - {{if .IsPrivate}} - {{svg "octicon-repo-template-private" 32}} - {{else}} - {{svg "octicon-repo-template" 32}} - {{end}} - {{else}} - {{if .IsPrivate}} - {{svg "octicon-lock" 32}} - {{else if and (not .IsMirror) (not .IsFork) ($.Owner)}} - {{if .Owner.Visibility.IsPrivate}} - {{svg "octicon-internal-repo" 32}} - {{else}} - {{svg "octicon-repo" 32}} - {{end}} - {{else if .IsMirror}} - {{svg "octicon-repo-clone" 32}} - {{else if .IsFork}} - {{svg "octicon-repo-forked" 32}} - {{else}} - {{svg "octicon-repo" 32}} - {{end}} - {{end}} + {{template "repo/icon" dict "repo" . "size" 32}} {{end}} {{.Owner.Name}}
/
diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl new file mode 100644 index 0000000000000..2b85502de123b --- /dev/null +++ b/templates/repo/icon.tmpl @@ -0,0 +1,23 @@ +{{if .repo.IsTemplate}} + {{if .repo.IsPrivate}} + {{svg "octicon-repo-template-private" .size}} + {{else}} + {{svg "octicon-repo-template" .size}} + {{end}} +{{else}} + {{if .repo.IsPrivate}} + {{svg "octicon-lock" .size}} + {{else if and (not .repo.IsMirror) (not .repo.IsFork) (.repo.Owner)}} + {{if .repo.Owner.Visibility.IsPrivate}} + {{svg "octicon-internal-repo" .size}} + {{else}} + {{svg "octicon-repo" .size}} + {{end}} + {{else if .repo.IsMirror}} + {{svg "octicon-repo-clone" .size}} + {{else if .repo.IsFork}} + {{svg "octicon-repo-forked" .size}} + {{else}} + {{svg "octicon-repo" .size}} + {{end}} +{{end}} From 38d27275534768dff9391938c756b611d650942c Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 23:05:06 +0200 Subject: [PATCH 7/8] definitely was overthinking this --- templates/repo/header.tmpl | 2 +- templates/repo/header_icon.tmpl | 23 +++++++++++++++++++++++ templates/repo/icon.tmpl | 23 ----------------------- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 templates/repo/header_icon.tmpl delete mode 100644 templates/repo/icon.tmpl diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 5776913d8357b..c08aa2af02056 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -6,7 +6,7 @@ {{if .RelAvatarLink}} {{else}} - {{template "repo/icon" dict "repo" . "size" 32}} + {{template "repo/header_icon" .}} {{end}} {{.Owner.Name}}
/
diff --git a/templates/repo/header_icon.tmpl b/templates/repo/header_icon.tmpl new file mode 100644 index 0000000000000..7cd7d3c5fd3db --- /dev/null +++ b/templates/repo/header_icon.tmpl @@ -0,0 +1,23 @@ +{{if $.IsTemplate}} + {{if $.IsPrivate}} + {{svg "octicon-repo-template-private" 32}} + {{else}} + {{svg "octicon-repo-template" 32}} + {{end}} +{{else}} + {{if $.IsPrivate}} + {{svg "octicon-lock" .size}} + {{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}} + {{if $.Owner.Visibility.IsPrivate}} + {{svg "octicon-internal-repo" 32}} + {{else}} + {{svg "octicon-repo" 32}} + {{end}} + {{else if $.IsMirror}} + {{svg "octicon-repo-clone" 32}} + {{else if $.IsFork}} + {{svg "octicon-repo-forked" 32}} + {{else}} + {{svg "octicon-repo" 32}} + {{end}} +{{end}} diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl deleted file mode 100644 index 2b85502de123b..0000000000000 --- a/templates/repo/icon.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -{{if .repo.IsTemplate}} - {{if .repo.IsPrivate}} - {{svg "octicon-repo-template-private" .size}} - {{else}} - {{svg "octicon-repo-template" .size}} - {{end}} -{{else}} - {{if .repo.IsPrivate}} - {{svg "octicon-lock" .size}} - {{else if and (not .repo.IsMirror) (not .repo.IsFork) (.repo.Owner)}} - {{if .repo.Owner.Visibility.IsPrivate}} - {{svg "octicon-internal-repo" .size}} - {{else}} - {{svg "octicon-repo" .size}} - {{end}} - {{else if .repo.IsMirror}} - {{svg "octicon-repo-clone" .size}} - {{else if .repo.IsFork}} - {{svg "octicon-repo-forked" .size}} - {{else}} - {{svg "octicon-repo" .size}} - {{end}} -{{end}} From 39b3d48048a02574e2b315856201f8523444714f Mon Sep 17 00:00:00 2001 From: CirnoT <1447794+CirnoT@users.noreply.github.com> Date: Mon, 15 Jun 2020 23:06:59 +0200 Subject: [PATCH 8/8] 32 --- templates/repo/header_icon.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/header_icon.tmpl b/templates/repo/header_icon.tmpl index 7cd7d3c5fd3db..7184734bbff6f 100644 --- a/templates/repo/header_icon.tmpl +++ b/templates/repo/header_icon.tmpl @@ -6,7 +6,7 @@ {{end}} {{else}} {{if $.IsPrivate}} - {{svg "octicon-lock" .size}} + {{svg "octicon-lock" 32}} {{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}} {{if $.Owner.Visibility.IsPrivate}} {{svg "octicon-internal-repo" 32}}