diff --git a/index.html b/index.html index b307cf2..83f8841 100644 --- a/index.html +++ b/index.html @@ -342,11 +342,35 @@
Acessar com:
Facebook Google + - Cadastrar + Cadastrar + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ diff --git a/js/main.js b/js/main.js index f69c721..f7aec7e 100644 --- a/js/main.js +++ b/js/main.js @@ -640,6 +640,38 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F }); e.preventDefault(); }); + + $(document).on('click', '.new-user', function(e) { + var loginForm = $(this).parents('#login-form'); + loginForm.hide(); + loginForm.siblings('#signup-form').show(); + loginForm.find('.message').hide(); + e.preventDefault(); + }) + + $(document).on('click', '.cancel-signup', function(e) { + var signupForm = $(this).parents('#signup-form'); + signupForm.hide(); + signupForm.siblings('#login-form').show(); + e.preventDefault(); + }); + + $(document).on('click', '.confirm-signup', function(e) { + var message = $('.signup .message'); + message.hide(); + message.text(''); + $.ajax({ + type: 'post', + url: host + '/api/v1/register', + data: $(this).parents('.signup').serialize(), + }).done(function(data) { + Main.loginCallback(true, data.private_token); + }).fail(function( /*data*/ ) { + message.show(); + message.text('Não foi possível efetuar o cadastro'); + }); + e.preventDefault(); + }); }); window.addEventListener("message", function(ev) { diff --git a/sass/_proposal_detail.scss b/sass/_proposal_detail.scss index 6439270..ecde649 100644 --- a/sass/_proposal_detail.scss +++ b/sass/_proposal_detail.scss @@ -602,6 +602,35 @@ width: 50%; } + form.signup { + .password, .password-confirmation { + width: 47%; + display: inline-block; + } + .password { + margin-left: 15px; + } + .actions { + margin: 20px 0 0 0; + float: none; + width: 100%; + .confirm-signup { + background: #00a9bd; + border-radius: 7px; + color: #fff; + padding: 10px 15px; + margin: 0 0 0 8px; + } + .cancel-signup { + @extend .confirm-signup; + } + .message { + float: left; + margin-top: -8px; + } + } + } + .actions > a.login-action{ background: $color; -webkit-border-radius: 7px; -- libgit2 0.21.2