Commit 72e5bf59 authored by Tom Quirk's avatar Tom Quirk

Clean up oauth buttons on sign in/up

Replicate the UI from the sign in
page on the sign up page.

Changelog: changed
parent 3d1fac55
...@@ -20,7 +20,7 @@ export default class OAuthRememberMe { ...@@ -20,7 +20,7 @@ export default class OAuthRememberMe {
toggleRememberMe(event) { toggleRememberMe(event) {
const rememberMe = $(event.target).is(':checked'); const rememberMe = $(event.target).is(':checked');
$('.oauth-login', this.container).each((i, element) => { $('.js-oauth-login', this.container).each((i, element) => {
const $form = $(element).parent('form'); const $form = $(element).parent('form');
const href = $form.attr('action'); const href = $form.attr('action');
......
...@@ -26,14 +26,6 @@ ...@@ -26,14 +26,6 @@
} }
} }
.omniauth-btn {
width: 48%;
@include media-breakpoint-down(md) {
width: 100%;
}
}
.decline-page { .decline-page {
width: 350px; width: 350px;
} }
......
...@@ -99,11 +99,6 @@ ...@@ -99,11 +99,6 @@
padding: 0; padding: 0;
border: 0; border: 0;
background: none; background: none;
margin-bottom: $gl-padding;
}
.omniauth-btn {
width: 100%;
} }
} }
......
...@@ -264,12 +264,6 @@ fieldset:disabled a.btn { ...@@ -264,12 +264,6 @@ fieldset:disabled a.btn {
.d-flex { .d-flex {
display: flex !important; display: flex !important;
} }
.flex-wrap {
flex-wrap: wrap !important;
}
.justify-content-between {
justify-content: space-between !important;
}
.align-items-center { .align-items-center {
align-items: center !important; align-items: center !important;
} }
...@@ -280,9 +274,6 @@ fieldset:disabled a.btn { ...@@ -280,9 +274,6 @@ fieldset:disabled a.btn {
left: 0; left: 0;
z-index: 1030; z-index: 1030;
} }
.ml-2 {
margin-left: 0.5rem !important;
}
.mt-3 { .mt-3 {
margin-top: 1rem !important; margin-top: 1rem !important;
} }
...@@ -349,6 +340,15 @@ fieldset:disabled a.btn { ...@@ -349,6 +340,15 @@ fieldset:disabled a.btn {
font-size: 0.875rem; font-size: 0.875rem;
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.gl-button.gl-button .gl-button-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-top: 1px;
padding-bottom: 1px;
margin-top: -1px;
margin-bottom: -1px;
}
.gl-button.gl-button .gl-button-icon { .gl-button.gl-button .gl-button-icon {
height: 1rem; height: 1rem;
width: 1rem; width: 1rem;
...@@ -637,10 +637,6 @@ svg { ...@@ -637,10 +637,6 @@ svg {
padding: 0; padding: 0;
border: 0; border: 0;
background: none; background: none;
margin-bottom: 16px;
}
.login-page .omniauth-container .omniauth-btn {
width: 100%;
} }
.login-page .new-session-tabs { .login-page .new-session-tabs {
display: flex; display: flex;
...@@ -768,24 +764,18 @@ svg { ...@@ -768,24 +764,18 @@ svg {
.gl-display-block { .gl-display-block {
display: block; display: block;
} }
.gl-align-items-center { .gl-flex-wrap {
align-items: center; flex-wrap: wrap;
} }
.gl-w-full { .gl-w-full {
width: 100%; width: 100%;
} }
.gl-p-2 {
padding: 0.25rem;
}
.gl-p-4 { .gl-p-4 {
padding: 0.75rem; padding: 0.75rem;
} }
.gl-mt-2 { .gl-mt-2 {
margin-top: 0.25rem; margin-top: 0.25rem;
} }
.gl-mb-2 {
margin-bottom: 0.25rem;
}
.gl-mb-3 { .gl-mb-3 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
...@@ -797,9 +787,6 @@ svg { ...@@ -797,9 +787,6 @@ svg {
margin-top: 0; margin-top: 0;
} }
} }
.gl-text-left {
text-align: left;
}
@import "startup/cloaking"; @import "startup/cloaking";
@include cloak-startup-scss(none); @include cloak-startup-scss(none);
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.d-flex.justify-content-between.flex-wrap .d-flex.justify-content-between.flex-wrap
- providers.each do |provider| - providers.each do |provider|
- has_icon = provider_has_icon?(provider) - has_icon = provider_has_icon?(provider)
= button_to omniauth_authorize_path(:user, provider), id: "oauth-login-#{provider}", class: "btn gl-button btn-default omniauth-btn oauth-login #{qa_class_for_provider(provider)}", form: { class: 'gl-w-full' } do = button_to omniauth_authorize_path(:user, provider), id: "oauth-login-#{provider}", class: "btn gl-button btn-default gl-w-full js-oauth-login #{qa_class_for_provider(provider)}", form: { class: 'gl-w-full gl-mb-3' } do
- if has_icon - if has_icon
= provider_image_tag(provider) = provider_image_tag(provider)
%span.gl-button-text %span.gl-button-text
......
%label.label-bold.d-block %label.label-bold.d-block
= _("Create an account using:") = _("Create an account using:")
.d-flex.justify-content-between.flex-wrap .gl-display-flex.gl-justify-content-between.gl-flex-wrap
- providers.each do |provider| - providers.each do |provider|
= link_to omniauth_authorize_path(:user, provider), method: :post, class: "btn gl-button btn-default gl-display-flex gl-align-items-center gl-text-left gl-mb-2 gl-p-2 omniauth-btn oauth-login #{qa_class_for_provider(provider)}", id: "oauth-login-#{provider}" do = link_to omniauth_authorize_path(:user, provider), method: :post, class: "btn gl-button btn-default gl-w-full gl-mb-3 js-oauth-login #{qa_class_for_provider(provider)}", id: "oauth-login-#{provider}" do
- if provider_has_icon?(provider) - if provider_has_icon?(provider)
= provider_image_tag(provider) = provider_image_tag(provider)
%span.ml-2 %span.gl-button-text
= label_for_provider(provider) = label_for_provider(provider)
...@@ -264,12 +264,6 @@ fieldset:disabled a.btn { ...@@ -264,12 +264,6 @@ fieldset:disabled a.btn {
.d-flex { .d-flex {
display: flex !important; display: flex !important;
} }
.flex-wrap {
flex-wrap: wrap !important;
}
.justify-content-between {
justify-content: space-between !important;
}
.align-items-center { .align-items-center {
align-items: center !important; align-items: center !important;
} }
...@@ -280,9 +274,6 @@ fieldset:disabled a.btn { ...@@ -280,9 +274,6 @@ fieldset:disabled a.btn {
left: 0; left: 0;
z-index: 1030; z-index: 1030;
} }
.ml-2 {
margin-left: 0.5rem !important;
}
.mt-3 { .mt-3 {
margin-top: 1rem !important; margin-top: 1rem !important;
} }
...@@ -349,6 +340,15 @@ fieldset:disabled a.btn { ...@@ -349,6 +340,15 @@ fieldset:disabled a.btn {
font-size: 0.875rem; font-size: 0.875rem;
border-radius: 0.25rem; border-radius: 0.25rem;
} }
.gl-button.gl-button .gl-button-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-top: 1px;
padding-bottom: 1px;
margin-top: -1px;
margin-bottom: -1px;
}
.gl-button.gl-button .gl-button-icon { .gl-button.gl-button .gl-button-icon {
height: 1rem; height: 1rem;
width: 1rem; width: 1rem;
...@@ -637,10 +637,6 @@ svg { ...@@ -637,10 +637,6 @@ svg {
padding: 0; padding: 0;
border: 0; border: 0;
background: none; background: none;
margin-bottom: 16px;
}
.login-page .omniauth-container .omniauth-btn {
width: 100%;
} }
.login-page .new-session-tabs { .login-page .new-session-tabs {
display: flex; display: flex;
...@@ -768,24 +764,18 @@ svg { ...@@ -768,24 +764,18 @@ svg {
.gl-display-block { .gl-display-block {
display: block; display: block;
} }
.gl-align-items-center { .gl-flex-wrap {
align-items: center; flex-wrap: wrap;
} }
.gl-w-full { .gl-w-full {
width: 100%; width: 100%;
} }
.gl-p-2 {
padding: 0.25rem;
}
.gl-p-4 { .gl-p-4 {
padding: 0.75rem; padding: 0.75rem;
} }
.gl-mt-2 { .gl-mt-2 {
margin-top: 0.25rem; margin-top: 0.25rem;
} }
.gl-mb-2 {
margin-bottom: 0.25rem;
}
.gl-mb-3 { .gl-mb-3 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
...@@ -797,9 +787,6 @@ svg { ...@@ -797,9 +787,6 @@ svg {
margin-top: 0; margin-top: 0;
} }
} }
.gl-text-left {
text-align: left;
}
@import "startup/cloaking"; @import "startup/cloaking";
@include cloak-startup-scss(none); @include cloak-startup-scss(none);
<div id="oauth-container"> <div id="oauth-container">
<input id="remember_me" type="checkbox"> <input id="remember_me" type="checkbox" />
<form method="post" action="http://example.com/"> <form method="post" action="http://example.com/">
<button class="oauth-login twitter" type="submit"> <button class="js-oauth-login twitter" type="submit">
<span>Twitter</span> <span>Twitter</span>
</button> </button>
</form> </form>
<form method="post" action="http://example.com/"> <form method="post" action="http://example.com/">
<button class="oauth-login github" type="submit"> <button class="js-oauth-login github" type="submit">
<span>GitHub</span> <span>GitHub</span>
</button> </button>
</form> </form>
<form method="post" action="http://example.com/?redirect_fragment=L1">
<button class="oauth-login facebook" type="submit">
<span>Facebook</span>
</button>
</form>
<form method="post" action="http://example.com/?redirect_fragment=L1">
<button class="js-oauth-login facebook" type="submit">
<span>Facebook</span>
</button>
</form>
</div> </div>
...@@ -3,7 +3,7 @@ import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me'; ...@@ -3,7 +3,7 @@ import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me';
describe('OAuthRememberMe', () => { describe('OAuthRememberMe', () => {
const findFormAction = (selector) => { const findFormAction = (selector) => {
return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action'); return $(`#oauth-container .js-oauth-login${selector}`).parent('form').attr('action');
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -44,7 +44,7 @@ describe('preserve_url_fragment', () => { ...@@ -44,7 +44,7 @@ describe('preserve_url_fragment', () => {
}); });
it('when "remember-me" is present', () => { it('when "remember-me" is present', () => {
$('.omniauth-btn') $('.js-oauth-login')
.parent('form') .parent('form')
.attr('action', (i, href) => `${href}?remember_me=1`); .attr('action', (i, href) => `${href}?remember_me=1`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment