2018-01-06 03:26:57 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
class MetadataInputs extends React.Component {
|
|
|
|
constructor (props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
2018-01-08 18:39:59 +01:00
|
|
|
showInputs : false,
|
2018-01-06 03:26:57 +01:00
|
|
|
};
|
|
|
|
this.toggleShowInputs = this.toggleShowInputs.bind(this);
|
2018-01-08 18:39:59 +01:00
|
|
|
this.handleInput = this.handleInput.bind(this);
|
2018-01-09 02:06:31 +01:00
|
|
|
this.handleSelection = this.handleSelection.bind(this);
|
2018-01-06 03:26:57 +01:00
|
|
|
}
|
|
|
|
toggleShowInputs () {
|
|
|
|
if (this.state.showInputs) {
|
|
|
|
this.setState({'showInputs': false});
|
|
|
|
} else {
|
|
|
|
this.setState({'showInputs': true});
|
|
|
|
}
|
|
|
|
}
|
2018-01-08 18:39:59 +01:00
|
|
|
handleInput (event) {
|
|
|
|
event.preventDefault();
|
2018-01-09 02:06:31 +01:00
|
|
|
const target = event.target;
|
|
|
|
const name = target.name;
|
|
|
|
const value = target.type === 'checkbox' ? target.checked : target.value;
|
2018-01-08 18:39:59 +01:00
|
|
|
this.props.updateUploaderState(name, value);
|
|
|
|
}
|
2018-01-09 02:06:31 +01:00
|
|
|
handleSelection (event) {
|
|
|
|
const selectedOption = event.target.selectedOptions[0].value;
|
|
|
|
this.props.updateUploaderState('', value);
|
|
|
|
}
|
|
|
|
|
2018-01-06 03:26:57 +01:00
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="row row--padded row--no-top row--no-bottom row--wide">
|
|
|
|
<div className="column column--10">
|
2018-01-08 18:39:59 +01:00
|
|
|
<a className="label link--primary" id="publish-details-toggle" href="#" onClick={this.toggleShowInputs}>{this.state.showInputs ? '[less]' : '[more]'}</a>
|
|
|
|
</div>
|
|
|
|
{this.state.showInputs && (
|
|
|
|
<div id="publish-details" className="row row--padded row--wide">
|
|
|
|
|
|
|
|
<div className="row row--no-top">
|
|
|
|
<div className="column column--3 column--med-10 align-content-top">
|
|
|
|
<label htmlFor="publish-license" className="label">Description:</label>
|
|
|
|
</div><div className="column column--7 column--sml-10">
|
2018-01-09 02:06:31 +01:00
|
|
|
<textarea rows="1" id="publish-description" className="textarea textarea--primary textarea--full-width" name="description" placeholder="Optional description" value={this.props.description} onChange={this.handleInput} />
|
2018-01-08 18:39:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="row row--no-top">
|
|
|
|
<div className="column column--3 column--med-10">
|
|
|
|
<label htmlFor="publish-license" className="label">License:</label>
|
|
|
|
</div><div className="column column--7 column--sml-10">
|
2018-01-09 02:06:31 +01:00
|
|
|
<select type="text" name="license" id="publish-license" className="select select--primary" onSelect={this.handleSelection}>
|
2018-01-08 18:39:59 +01:00
|
|
|
<option value=" ">Unspecified</option>
|
|
|
|
<option value="Public Domain">Public Domain</option>
|
|
|
|
<option value="Creative Commons">Creative Commons</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="row row--no-top">
|
|
|
|
<div className="column column--3">
|
|
|
|
<label htmlFor="publish-nsfw" className="label">Mature:</label>
|
|
|
|
</div><div className="column column--7">
|
2018-01-09 02:06:31 +01:00
|
|
|
<input className="input-checkbox" type="checkbox" id="publish-nsfw" name="nsfw" checked={this.props.nsfw} onChange={this.handleInput} />
|
2018-01-08 18:39:59 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-01-06 03:26:57 +01:00
|
|
|
</div>
|
2018-01-08 18:39:59 +01:00
|
|
|
)}
|
2018-01-06 03:26:57 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = MetadataInputs;
|