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

@@ -144,7 +144,8 @@
</div> </div>
<div class="dialog-body"> <div class="dialog-body">
<div class="grid-layout layout-tight layout-full"> <div class="grid-layout layout-tight layout-full">
<table id="sign-in-form" class="form-table"> <form name="sign-in-form" id="sign-in-form">
<table class="form-table">
<tbody> <tbody>
<tr> <tr>
<th> <th>
@@ -162,8 +163,10 @@
<input type="password" size="25" id="password-input" name="password"> <input type="password" size="25" id="password-input" name="password">
</td> </td>
</tr> </tr>
<input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px;" hidefocus="true" />
</tbody> </tbody>
</table> </table>
</form>
</div> </div>
</div> </div>
<div class="dialog-footer"> <div class="dialog-footer">

View File

@@ -83,6 +83,11 @@ app.after = {
exportActions: removalist.handleMenuClick, exportActions: removalist.handleMenuClick,
columnActions: removalist.handleMenuClick, columnActions: removalist.handleMenuClick,
signIn: function() { 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) { $('.dialog-content .cancelButton').click(function(e) {
util.hide('dialog'); util.hide('dialog');
}) })
@@ -97,6 +102,8 @@ app.after = {
couch.login(credentials).then(function(response) { couch.login(credentials).then(function(response) {
util.notify("Signed in"); util.notify("Signed in");
util.render('controls', 'project-controls', {text: "Sign out"}); 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) { $('.persist').each(function(i, el) {
localStorage.removeItem($(el).attr('id')); 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);
})
}
} }
} }