better form UX
This commit is contained in:
parent
5778874562
commit
7591f0155b
@ -144,26 +144,29 @@
|
||||
</div>
|
||||
<div class="dialog-body">
|
||||
<div class="grid-layout layout-tight layout-full">
|
||||
<table id="sign-in-form" class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="username">Username</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" size="25" id="username-input" name="username">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="password">Password</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="password" size="25" id="password-input" name="password">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<form name="sign-in-form" id="sign-in-form">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="username">Username</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" size="25" id="username-input" name="username">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="password">Password</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="password" size="25" id="password-input" name="password">
|
||||
</td>
|
||||
</tr>
|
||||
<input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px;" hidefocus="true" />
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
|
||||
@ -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);
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@ -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);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user