1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-29 00:58:03 +02:00

Fix react warning for select inputs

This commit is contained in:
Tim Daubenschütz 2015-09-22 14:13:04 +02:00
parent bd5aa266b1
commit 33b8e51aee
2 changed files with 16 additions and 11 deletions

View File

@ -134,7 +134,7 @@ let ContractAgreementForm = React.createClass({
return (
<div>
<p className="text-center">
{getLangText('No private contracts found, please go to the ')}
{getLangText('No contracts uploaded yet, please go to the ')}
<a href="settings">{getLangText('settings page')}</a>
{getLangText(' and create them.')}
</p>

View File

@ -29,12 +29,15 @@ let CopyrightAssociationForm = React.createClass({
},
render() {
let selectedState = -1;
if (this.props.currentUser
&& this.props.currentUser.profile
let selectedState;
let selectDefaultValue = ' -- ' + getLangText('select an association') + ' -- ';
if (this.props.currentUser && this.props.currentUser.profile
&& this.props.currentUser.profile.copyright_association) {
selectedState = AppConstants.copyrightAssociations.indexOf(this.props.currentUser.profile.copyright_association);
selectedState = selectedState !== -1 ? AppConstants.copyrightAssociations[selectedState] : selectDefaultValue;
}
if (this.props.currentUser && this.props.currentUser.email){
return (
<Form
@ -47,17 +50,19 @@ let CopyrightAssociationForm = React.createClass({
className="ascribe-settings-property-collapsible-toggle"
label={getLangText('Copyright Association')}
style={{paddingBottom: 0}}>
<select name="contract">
<option disabled selected={selectedState === -1}>
{' -- ' + getLangText('select an association') + ' -- '}
<select defaultValue={selectedState} name="contract">
<option
name={0}
key={0}
value={selectDefaultValue}>
{selectDefaultValue}
</option>
{AppConstants.copyrightAssociations.map((association, i) => {
return (
<option
name={i}
key={i}
value={ association }
selected={selectedState === i}>
name={i + 1}
key={i + 1}
value={association}>
{ association }
</option>
);