Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Add sign-in UI WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Jul 11, 2017
1 parent 46bf87d commit b435633
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/gratipay.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gratipay.init = function() {
Gratipay.warnOffUsersFromDeveloperConsole();
Gratipay.adaptToLongUsernames();
Gratipay.forms.initCSRF();
Gratipay.signIn.wireUpButton();
Gratipay.signIn.wireUp();
Gratipay.signOut();
Gratipay.payments.initSupportGratipay();
Gratipay.tabs.init();
Expand Down
23 changes: 23 additions & 0 deletions js/gratipay/sign-in.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Gratipay.signIn = {};

Gratipay.signIn.wireUp = function() {
Gratipay.signIn.wireUpButton();
Gratipay.signIn.wireUpEmailInput();
}

Gratipay.signIn.wireUpButton = function() {
$('.sign-in button').click(Gratipay.signIn.openSignInOrSignUpModal);
}
Expand All @@ -20,3 +25,21 @@ Gratipay.signIn.replaceTextInModal = function(dataKey) {
$(this).text(textToReplace);
});
}

Gratipay.signIn.wireUpEmailInput = function() {
$('#sign-in-modal form.email-form').submit(function(e) {
e.preventDefault();
jQuery.ajax({
url: '/auth/email/send_link.json',
type: 'POST',
data: {
'email_address': $(this).find('input').val()
},
// contentType: 'application/x-www-form-urlencoded', // avoid a 415 response
success: function() {
alert('success');
},
error: Gratipay.error // TODO: Get notifs above modal
});
});
}
28 changes: 22 additions & 6 deletions scss/components/sign_in.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,15 @@
}
}

.email-form input {
color: $black;
height: auto;
padding: 10px;
}

.auth-links {
margin-top: 5px;
margin-bottom: 10px;
}

.auth-links li {
Expand All @@ -71,14 +78,27 @@
}
}

.auth-links button {
.auth-links button, .email-form button {
text-align: left;
background: $green;
color: white;
padding: 15px 45px 15px 15px;
position: relative;
font: normal 14px $Ideal;

&:hover {
background: $darker-green;
}
}

.email-form button {
padding: 15px 15px 15px 15px;
margin: 15px 0px 20px 0px;
text-align: center;
}

.auth-links button {
padding: 15px 45px 15px 15px; // 30px for icon on the right

span {
vertical-align: middle;
}
Expand All @@ -95,10 +115,6 @@
span.icon.github { @include has-icon("github"); }
span.icon.openstreetmap { @include has-icon("openstreetmap"); }
span.icon.bitbucket { @include has-icon("bitbucket"); }

&:hover {
background: $darker-green;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion scss/elements/elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ textarea {
}

input {
&[type="text"], &[type="number"], &[type="password"] {
&[type="text"], &[type="number"], &[type="password"], &[type="email"] {
@include border-radius(3px);
height: 22px;
border: 1px solid $brown;
Expand Down
14 changes: 14 additions & 0 deletions templates/sign-in-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
</button>
</header>
<section>
<p class="sign-in-togglable"
data-sign-in-to-continue="{{ _('Enter your email to sign-in to Gratipay') }}"
data-sign-in-or-sign-up="{{ _('Enter your email to sign-in or create an account on Gratipay') }}">
{{ _('Enter your email to sign-in or create an account on Gratipay') }}
</p>

<form class="email-form">
<input type="email" placeholder="[email protected]" required/>

<button class="button" type="submit">
{{ _("Email me a link") }}
</button>
</form>

<p class="sign-in-togglable"
data-sign-in-to-continue="{{ _('Please sign in to continue') }}"
data-sign-in-or-sign-up="{{ _('Use a third-party provider to sign in or create an account on Gratipay:') }}">
Expand Down

0 comments on commit b435633

Please sign in to comment.