Commit 0732fc0d authored by alexandre's avatar alexandre

Bouton register dans le formulaire de login

parent ce14cb77
......@@ -2476,12 +2476,14 @@ window.W = window.W || {};
ui: {
'close': '.btn-close',
'submit': '.btn-submit'
'submit': '.btn-submit',
'register': '.js-register',
},
triggers: {
'click @ui.close': 'hide:modal',
'click @ui.submit': 'submit',
'click @ui.register': 'show:register',
},
});
......@@ -2513,6 +2515,33 @@ window.W = window.W || {};
});
W.LoginView = W.BaseModalView.extend({
template: '#login-template',
onSubmit: function (foo, event) {
event.preventDefault();
var model = this.model;
var that = this;
var form = this.$el.find("form");
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(),
success: function(data, textStatus, jqXHR) {
model.fetch();
that.trigger('hide:modal');
},
error: function(xhr, ajaxOptions, thrownError){
alert('login failed - please try again');
},
});
}
});
W.LogoutView = W.BaseModalView.extend({
template: '#logout-template',
......
......@@ -16,14 +16,14 @@
<nav class="main-header__user">
<% if (username) { %>
<%- t('Bienvenue') %> <a href="/compte"><%- username %></a>
<%- t('Bienvenue') %> <a href="/compte"><%- username %></a> <a href="#" class="js-logout">(←)</a>
<% } %>
<ul>
<% if (username) { %>
<li><a href="#" class="js-logout"><%- t('Se déconnecter') %></a></li>
<!-- <li><a href="#" class="js-logout"><%- t('Se déconnecter') %></a></li> -->
<% } else { %>
<li><a href="#" class="js-login"><%- t('Se connecter') %></a> <a href="#" class="js-register"><%- t('S’inscrire') %></a></li>
<li><a href="#" class="js-login"><%- t('Se connecter') %></a> <!--<a href="#" class="js-register"><%- t('S’inscrire') %></a>--></li>
<% } %>
</ul>
</nav>
......
......@@ -17,6 +17,7 @@
</p>
<p style="text-align: right; margin-top: 1em">
<a href="#" class="js-register" style="float: left;"><%- t('S’inscrire') %></a>
<input type="submit" class="btn-submit" value="<%- t('se connecter') %>" />
</p>
</form>
......
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