From bf0c481402f15834de83355e29653b2386924d7a Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 21:48:33 +0200 Subject: [PATCH 1/8] Rework Oauth login buttons --- templates/user/auth/signin_inner.tmpl | 146 ++++++++++++++------------ web_src/css/base.css | 5 + web_src/css/form.css | 30 +----- web_src/css/helpers.css | 1 + 4 files changed, 87 insertions(+), 95 deletions(-) diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index f14bac10eee79..7e254bad96f8d 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -1,78 +1,86 @@ - {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} - {{template "base/alert" .}} - {{end}} -

+{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} +{{template "base/alert" .}} +{{end}} +

+ {{if .LinkAccountMode}} + {{.locale.Tr "auth.oauth_signin_title"}} + {{else}} + {{.locale.Tr "auth.login_userpass"}} + {{end}} +

+
+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{if or (not .DisablePassword) .LinkAccountMode}} +
+ + +
+ {{end}} + {{if not .LinkAccountMode}} +
+ +
+ + +
+
+ {{end}} + + {{template "user/auth/captcha" .}} + +
+ + + {{.locale.Tr "auth.forgot_password"}} +
- {{template "user/auth/captcha" .}} - -
- - - {{.locale.Tr "auth.forgot_password"}} -
- - {{if .ShowRegistrationButton}} - - {{end}} + {{if .ShowRegistrationButton}} + + {{end}} - {{if and .OrderedOAuth2Names .OAuth2Providers}} -
-
-
-
-
-

{{.locale.Tr "sign_in_with"}}

- {{range $key := .OrderedOAuth2Names}} - {{$provider := index $.OAuth2Providers $key}} - - + {{if and .OrderedOAuth2Names .OAuth2Providers}} +
+
+
+
+
+ {{.locale.Tr "sign_in_with"}} +
+ {{end}}
- {{end}} -
+
+ {{end}} + +
diff --git a/web_src/css/base.css b/web_src/css/base.css index ed00b1a295228..cf85f898a5b2b 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -339,6 +339,7 @@ a { } a.muted, +a.silenced, .muted-links a { color: inherit; } @@ -350,6 +351,10 @@ a.muted:hover [class*="color-text"], color: var(--color-primary); } +a.silenced:hover { + color: inherit; +} + .delete-button, .delete-button:hover { color: var(--color-red); diff --git a/web_src/css/form.css b/web_src/css/form.css index 85d1136de8149..a8cce459ab406 100644 --- a/web_src/css/form.css +++ b/web_src/css/form.css @@ -206,32 +206,6 @@ textarea:focus, } } -.signin .oauth2 div { - display: inline-block; -} - -.signin .oauth2 div p { - margin: 10px 5px 0 0; - float: left; -} - -.signin .oauth2 a { - margin-right: 3px; -} - -.signin .oauth2 a:last-child { - margin-right: 0; -} - -.signin .oauth2 img { - width: 32px; - height: 32px; -} - -.signin .oauth2 img.openidConnect { - width: auto; -} - @media (min-width: 768px) { .g-recaptcha-style, .h-captcha-style { @@ -424,6 +398,10 @@ textarea:focus, margin-top: 15px; } +.oauth2 .oauth-login-link img { + object-fit: contain; +} + .repository.new.repo form, .repository.new.migrate form, .repository.new.fork form { diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index 22e18f79269ac..a24e024d356b7 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -73,6 +73,7 @@ Gitea's private styles use `g-` prefix. .gt-whitespace-nowrap { white-space: nowrap !important; } .gt-whitespace-pre { white-space: pre !important; } .gt-whitespace-pre-wrap { white-space: pre-wrap !important; } +.gt-self-center { align-self: center !important; } .gt-overflow-x-auto { overflow-x: auto !important; } .gt-overflow-x-scroll { overflow-x: scroll !important; } From acebe01861200051afbb35f645f5ef6be84053da Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 21:58:26 +0200 Subject: [PATCH 2/8] add gt-object-contain --- templates/user/auth/signin_inner.tmpl | 1 + web_src/css/form.css | 4 ---- web_src/css/helpers.css | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index 7e254bad96f8d..9c85f34e93232 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -69,6 +69,7 @@ {{svg "gitea-gitlab" 40}} {{else}} {{$provider.DisplayName}}{{if eq $provider.Name Date: Mon, 15 May 2023 22:27:24 +0200 Subject: [PATCH 3/8] restart ci From 4322d17fb21367ba83e82339a041c10c7f9e62ba Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 22:30:37 +0200 Subject: [PATCH 4/8] add info comment on link classes --- web_src/css/base.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web_src/css/base.css b/web_src/css/base.css index cf85f898a5b2b..51a081003cf4a 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -338,6 +338,9 @@ a { text-decoration-skip-ink: all; } +/* muted link = uncolored unless hovered */ +/* silenced link = never colored */ + a.muted, a.silenced, .muted-links a { From 4dfbd060ba8eccd6c850a154c5f8d1baf7e6cd4f Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 22:31:22 +0200 Subject: [PATCH 5/8] improve comment --- web_src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 51a081003cf4a..30a9c6313870a 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -338,7 +338,7 @@ a { text-decoration-skip-ink: all; } -/* muted link = uncolored unless hovered */ +/* muted link = only colored when hovered */ /* silenced link = never colored */ a.muted, From 6b1d4b8812c21aae735a8953a436cbde08df9efe Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 22:38:56 +0200 Subject: [PATCH 6/8] replace colored github logo on migrate page --- public/img/svg/gitea-github.svg | 1 - templates/repo/migrate/migrate.tmpl | 8 +++++++- web_src/svg/gitea-github.svg | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 public/img/svg/gitea-github.svg delete mode 100644 web_src/svg/gitea-github.svg diff --git a/public/img/svg/gitea-github.svg b/public/img/svg/gitea-github.svg deleted file mode 100644 index ee3c9fdafcf83..0000000000000 --- a/public/img/svg/gitea-github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl index 44769e60bd423..f0ea0bffe8136 100644 --- a/templates/repo/migrate/migrate.tmpl +++ b/templates/repo/migrate/migrate.tmpl @@ -6,7 +6,13 @@
{{range .Services}} - {{svg (printf "gitea-%s" .Name) 184}} + {{if eq .Name "github"}} + {{svg "octicon-mark-github" 184 "gt-p-4"}} + {{else if eq .Name "gitbucket"}} + {{svg "gitea-gitbucket" 184 "gt-p-4"}} + {{else}} + {{svg (printf "gitea-%s" .Name) 184}} + {{end}}
{{.Title}} diff --git a/web_src/svg/gitea-github.svg b/web_src/svg/gitea-github.svg deleted file mode 100644 index 918a35ecf6bc0..0000000000000 --- a/web_src/svg/gitea-github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 074eb1a0001f0246efc527324ddc8790b853768f Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 23:33:00 +0200 Subject: [PATCH 7/8] update gitlab logo --- public/img/svg/gitea-gitlab.svg | 2 +- templates/repo/migrate/migrate.tmpl | 2 ++ web_src/svg/gitea-gitlab.svg | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/img/svg/gitea-gitlab.svg b/public/img/svg/gitea-gitlab.svg index 2891da094f364..742370ac9ac7c 100644 --- a/public/img/svg/gitea-gitlab.svg +++ b/public/img/svg/gitea-gitlab.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl index f0ea0bffe8136..01245322f8656 100644 --- a/templates/repo/migrate/migrate.tmpl +++ b/templates/repo/migrate/migrate.tmpl @@ -8,6 +8,8 @@ {{if eq .Name "github"}} {{svg "octicon-mark-github" 184 "gt-p-4"}} + {{else if eq .Name "gitlab"}} + {{svg "gitea-gitlab" 184 "gt-p-4"}} {{else if eq .Name "gitbucket"}} {{svg "gitea-gitbucket" 184 "gt-p-4"}} {{else}} diff --git a/web_src/svg/gitea-gitlab.svg b/web_src/svg/gitea-gitlab.svg index 6a9c8a80f4798..e966a4ece5379 100644 --- a/web_src/svg/gitea-gitlab.svg +++ b/web_src/svg/gitea-gitlab.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 44d28d223b604ed18abaf4ac75e361cac221a5e6 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 15 May 2023 23:50:12 +0200 Subject: [PATCH 8/8] add openid svg --- public/img/svg/gitea-openid.svg | 1 + templates/user/auth/signin_inner.tmpl | 2 ++ web_src/svg/gitea-openid.svg | 1 + 3 files changed, 4 insertions(+) create mode 100644 public/img/svg/gitea-openid.svg create mode 100644 web_src/svg/gitea-openid.svg diff --git a/public/img/svg/gitea-openid.svg b/public/img/svg/gitea-openid.svg new file mode 100644 index 0000000000000..f8e313f5159f3 --- /dev/null +++ b/public/img/svg/gitea-openid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index 9c85f34e93232..ceafc257eaefe 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -67,6 +67,8 @@ {{svg "octicon-mark-github" 40}} {{else if eq $provider.Name "gitlab"}} {{svg "gitea-gitlab" 40}} + {{else if eq $provider.Name "openidConnect"}} + {{svg "gitea-openid" 40}} {{else}} \ No newline at end of file