Skip to content

Commit

Permalink
Finished version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toantran committed Mar 16, 2012
1 parent 4674fae commit 326e731
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
26 changes: 14 additions & 12 deletions coffee/public/js/recover.coffee
Expand Up @@ -5,18 +5,20 @@ jQuery ($) ->
$.post('/account/recover', {email: email})
.success (data) ->
if data?.success
$('<div>A reset password instruction email has been sent to your email account.</div>')
.dialog
autoOpen: true
buttons:
'Ok': ->
$(@).dialog 'close'
$('#recover-ok-dlg').modal 'show'
# $('<div>A reset password instruction email has been sent to your email account.</div>')
# .dialog
# autoOpen: true
# buttons:
# 'Ok': ->
# $(@).dialog 'close'
else
$("<div>An error has occurred while trying to send your reset password email. Please try again later.</div>")
.dialog
autoOpen: true
buttons:
'Ok': ->
$(@).dialog 'close'
$('#recover-failed-dlg').modal 'show'
# $("<div>An error has occurred while trying to send your reset password email. Please try again later.</div>")
# .dialog
# autoOpen: true
# buttons:
# 'Ok': ->
# $(@).dialog 'close'

return false;
18 changes: 2 additions & 16 deletions public/js/recover.js
Expand Up @@ -9,23 +9,9 @@
email: email
}).success(function(data) {
if (data != null ? data.success : void 0) {
return $('<div>A reset password instruction email has been sent to your email account.</div>').dialog({
autoOpen: true,
buttons: {
'Ok': function() {
return $(this).dialog('close');
}
}
});
return $('#recover-ok-dlg').modal('show');
} else {
return $("<div>An error has occurred while trying to send your reset password email. Please try again later.</div>").dialog({
autoOpen: true,
buttons: {
'Ok': function() {
return $(this).dialog('close');
}
}
});
return $('#recover-failed-dlg').modal('show');
}
});
return false;
Expand Down
17 changes: 17 additions & 0 deletions views/account/recover.jade
Expand Up @@ -11,4 +11,21 @@ link(rel="stylesheet/less", type="text/css", href="/stylesheets/recover.less")
input#form-login-username(maxlength='255', name='email', size='25', type='text', required, placeholder='Enter your email address')
.message!= partial('../messages')
button.btn.btn-primary(type='submit') Submit

#recover-ok-dlg.modal.hide
.modal-header
a.close(data-dismiss='modal') x
h4 OK
.modal-body
p A reset password instruction email has been sent to your email account.
.modal-footer
a.btn.btn-success.pull-right(data-dismiss='modal') OK
#recover-failed-dlg.modal.hide
.modal-header
a.close(data-dismiss='modal') x
h4 Failed
.modal-body
p An error has occurred while trying to send your reset password email. Please try again later.
.modal-footer
a.btn.btn-success.pull-right(data-dismiss='modal') OK
script(type='text/javascript', src='/js/recover.js')

0 comments on commit 326e731

Please sign in to comment.