better form UX

This commit is contained in:
Max Ogden
2011-07-13 20:45:48 -07:00
parent 5778874562
commit 7591f0155b
3 changed files with 30 additions and 30 deletions

View File

@@ -83,6 +83,11 @@ app.after = {
exportActions: removalist.handleMenuClick,
columnActions: removalist.handleMenuClick,
signIn: function() {
$('.dialog-content #username-input').focus();
$('.dialog-content').find('#sign-in-form').submit(function(e) {
$('.dialog-content .okButton').click();
return false;
})
$('.dialog-content .cancelButton').click(function(e) {
util.hide('dialog');
})
@@ -97,6 +102,8 @@ app.after = {
couch.login(credentials).then(function(response) {
util.notify("Signed in");
util.render('controls', 'project-controls', {text: "Sign out"});
}, function(error) {
if (error.statusText === "error") util.notify(JSON.parse(error.responseText).reason);
})
})
},

View File

@@ -123,16 +123,6 @@ var util = function() {
$('.persist').each(function(i, el) {
localStorage.removeItem($(el).attr('id'));
})
},
init: function() {
if (Modernizr.localstorage) {
util.persist.restore();
$('.persist').keyup(function(e) {
var inputId = $(e.target).attr('id');
util.persist.save(inputId);
})
}
}
}