Auto-focus on input elements when clicking Update button across various pages.
This commit is contained in:
parent
4cf5ac2c02
commit
72e0fa4156
@ -17,6 +17,13 @@ var account_management = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveEmail: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updateemail'),
|
||||
@ -93,6 +100,8 @@ var account_management = React.createClass({
|
||||
<label for="old">Current password:</label>
|
||||
<input
|
||||
type="password"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.old_password}
|
||||
onChange={function(event) {
|
||||
this.setState({old_password: event.target.value});
|
||||
@ -162,6 +171,8 @@ var account_management = React.createClass({
|
||||
<label for="old">Current password:</label>
|
||||
<input
|
||||
type="password"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.email_password}
|
||||
onChange={function(event) {
|
||||
this.setState({email_password: event.target.value});
|
||||
@ -220,6 +231,8 @@ var account_management = React.createClass({
|
||||
className="inline"
|
||||
maxlength="4"
|
||||
size="4"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_pin}
|
||||
onChange={function(event) {
|
||||
var intRegex = /^\d*$/;
|
||||
|
@ -19,6 +19,13 @@ var api_management = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
scheduleServerInfo: function(servers) {
|
||||
var info = {};
|
||||
|
||||
@ -230,6 +237,8 @@ var api_management = React.createClass({
|
||||
return <input
|
||||
name="name"
|
||||
type="text"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={ this.state.editing_client.name }
|
||||
onChange={function(event) {
|
||||
var client = this.state.editing_client;
|
||||
@ -310,6 +319,8 @@ var api_management = React.createClass({
|
||||
return <input
|
||||
name="uri"
|
||||
type="text"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={ this.state.editing_server.uri }
|
||||
onChange={function(event) {
|
||||
var server = this.state.editing_server;
|
||||
|
@ -17,6 +17,13 @@ var card_management = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
addNewArcade: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('addarcade'),
|
||||
@ -136,6 +143,8 @@ var card_management = React.createClass({
|
||||
return <input
|
||||
name="name"
|
||||
type="text"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={ this.state.editing_arcade.name }
|
||||
onChange={function(event) {
|
||||
var arcade = this.state.editing_arcade;
|
||||
|
@ -20,6 +20,13 @@ var machine_management = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
generateNewMachine: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('generatepcbid'),
|
||||
@ -125,6 +132,8 @@ var machine_management = React.createClass({
|
||||
return <input
|
||||
name="description"
|
||||
type="text"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={ this.state.editing_machine.description }
|
||||
onChange={function(event) {
|
||||
var machine = this.state.editing_machine;
|
||||
|
@ -12,6 +12,13 @@ var news_management = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
deleteExistingNews: function(event, newsid) {
|
||||
$.confirm({
|
||||
escapeKey: 'Cancel',
|
||||
@ -99,6 +106,8 @@ var news_management = React.createClass({
|
||||
<input
|
||||
name="title"
|
||||
type="text"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={ this.state.editing_news.title }
|
||||
onChange={function(event) {
|
||||
var entry = this.state.editing_news;
|
||||
|
@ -33,6 +33,13 @@ var user_management = React.createClass({
|
||||
this.refreshUser();
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
refreshUser: function() {
|
||||
AJAX.get(
|
||||
Link.get('refresh'),
|
||||
@ -204,6 +211,8 @@ var user_management = React.createClass({
|
||||
<input
|
||||
type="text"
|
||||
className="inline"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_username}
|
||||
onChange={function(event) {
|
||||
this.setState({new_username: event.target.value});
|
||||
@ -246,6 +255,8 @@ var user_management = React.createClass({
|
||||
<label htmlFor="new1">New password:</label>
|
||||
<input
|
||||
type="password"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_password1}
|
||||
onChange={function(event) {
|
||||
this.setState({new_password1: event.target.value});
|
||||
@ -306,6 +317,8 @@ var user_management = React.createClass({
|
||||
<input
|
||||
type="text"
|
||||
className="inline"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_email}
|
||||
onChange={function(event) {
|
||||
this.setState({new_email: event.target.value});
|
||||
@ -349,6 +362,8 @@ var user_management = React.createClass({
|
||||
maxlength="4"
|
||||
size="4"
|
||||
className="inline"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_pin}
|
||||
onChange={function(event) {
|
||||
var intRegex = /^\d*$/;
|
||||
|
@ -51,6 +51,13 @@ var arcade_management = React.createClass({
|
||||
this.refreshArcade();
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
refreshArcade: function() {
|
||||
AJAX.get(
|
||||
Link.get('refresh'),
|
||||
@ -245,6 +252,8 @@ var arcade_management = React.createClass({
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
size="8"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_pin}
|
||||
onChange={function(event) {
|
||||
var intRegex = /^\d*$/;
|
||||
|
@ -30,6 +30,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -68,6 +75,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="6"
|
||||
size="6"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var rawvalue = event.target.value;
|
||||
|
@ -38,6 +38,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
setOptionsChanged: function(val) {
|
||||
this.state.options_changed[this.state.version] = val;
|
||||
return this.state.options_changed;
|
||||
@ -176,6 +183,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
size="8"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var value = event.target.value.toUpperCase();
|
||||
@ -247,6 +256,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="5"
|
||||
size="5"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_weight}
|
||||
onChange={function(event) {
|
||||
var value = event.target.value.toUpperCase();
|
||||
|
@ -70,6 +70,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
setMenuChanged: function(val) {
|
||||
this.state.menu_changed[this.state.version] = val;
|
||||
return this.state.menu_changed;
|
||||
@ -219,6 +226,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="6"
|
||||
size="6"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var value = event.target.value.toUpperCase();
|
||||
|
@ -23,6 +23,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -60,6 +67,8 @@ var settings_view = React.createClass({
|
||||
type="text"
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
size="8"
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
|
@ -23,6 +23,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -60,6 +67,8 @@ var settings_view = React.createClass({
|
||||
type="text"
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
size="16"
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
|
@ -23,6 +23,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -61,6 +68,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="6"
|
||||
size="12"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var rawvalue = event.target.value;
|
||||
|
@ -23,6 +23,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -61,6 +68,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
size="16"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var rawvalue = event.target.value;
|
||||
|
@ -23,6 +23,13 @@ var settings_view = React.createClass({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
if (this.focus_element && this.focus_element != this.already_focused) {
|
||||
this.focus_element.focus();
|
||||
this.already_focused = this.focus_element;
|
||||
}
|
||||
},
|
||||
|
||||
saveName: function(event) {
|
||||
AJAX.post(
|
||||
Link.get('updatename'),
|
||||
@ -61,6 +68,8 @@ var settings_view = React.createClass({
|
||||
className="inline"
|
||||
maxlength="8"
|
||||
size="16"
|
||||
autofocus="true"
|
||||
ref={c => (this.focus_element = c)}
|
||||
value={this.state.new_name}
|
||||
onChange={function(event) {
|
||||
var value = event.target.value.toUpperCase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user