1
0
mirror of https://github.com/ascribe/onion.git synced 2024-07-01 06:02:12 +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 ( return (
<div> <div>
<p className="text-center"> <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> <a href="settings">{getLangText('settings page')}</a>
{getLangText(' and create them.')} {getLangText(' and create them.')}
</p> </p>

View File

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