1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Change loan form's startdate and enddate props to be camel case

This commit is contained in:
Brett Sun 2015-12-03 13:34:00 +01:00
parent 55bdd4e03f
commit bde1e454ed
5 changed files with 58 additions and 39 deletions

View File

@ -26,8 +26,8 @@ let LoanForm = React.createClass({
loanHeading: React.PropTypes.string,
email: React.PropTypes.string,
gallery: React.PropTypes.string,
startdate: React.PropTypes.object,
enddate: React.PropTypes.object,
startDate: React.PropTypes.object,
endDate: React.PropTypes.object,
showPersonalMessage: React.PropTypes.bool,
showEndDate: React.PropTypes.bool,
showStartDate: React.PropTypes.bool,
@ -36,7 +36,11 @@ let LoanForm = React.createClass({
id: React.PropTypes.object,
message: React.PropTypes.string,
createPublicContractAgreement: React.PropTypes.bool,
handleSuccess: React.PropTypes.func
handleSuccess: React.PropTypes.func,
children: React.PropTypes.oneOfType([
React.PropTypes.object,
React.PropTypes.array
])
},
getDefaultProps() {
@ -214,14 +218,29 @@ let LoanForm = React.createClass({
},
render() {
const {
children,
email,
handleSuccess,
gallery,
loanHeading,
message,
showPersonalMessage,
endDate,
startDate,
showEndDate,
showStartDate,
showPassword,
url } = this.props;
return (
<Form
className={classnames({'ascribe-form-bordered': this.props.loanHeading})}
className={classnames({'ascribe-form-bordered': loanHeading})}
ref='form'
url={this.props.url}
url={url}
getFormData={this.getFormData}
onReset={this.handleOnChange}
handleSuccess={this.props.handleSuccess}
handleSuccess={handleSuccess}
buttons={this.getButtons()}
spinner={
<div className="modal-footer">
@ -229,18 +248,18 @@ let LoanForm = React.createClass({
<AscribeSpinner color='dark-blue' size='md'/>
</p>
</div>}>
<div className={classnames({'ascribe-form-header': true, 'hidden': !this.props.loanHeading})}>
<h3>{this.props.loanHeading}</h3>
<div className={classnames({'ascribe-form-header': true, 'hidden': !loanHeading})}>
<h3>{loanHeading}</h3>
</div>
<AclInformation aim={'form'} verbs={['acl_loan']}/>
<Property
name='loanee'
label={getLangText('Loanee Email')}
editable={!this.props.email}
editable={!email}
onChange={this.handleOnChange}
overrideForm={!!this.props.email}>
overrideForm={!!email}>
<input
value={this.props.email}
value={email}
type="email"
placeholder={getLangText('Email of the loanee')}
required/>
@ -248,31 +267,31 @@ let LoanForm = React.createClass({
<Property
name='gallery'
label={getLangText('Gallery/exhibition (optional)')}
editable={!this.props.gallery}
overrideForm={!!this.props.gallery}>
editable={!gallery}
overrideForm={!!gallery}>
<input
value={this.props.gallery}
value={gallery}
type="text"
placeholder={getLangText('Gallery/exhibition (optional)')}/>
</Property>
<Property
name='startdate'
label={getLangText('Start date')}
editable={!this.props.startdate}
overrideForm={!!this.props.startdate}
hidden={!this.props.showStartDate}>
editable={!startDate}
overrideForm={!!startDate}
hidden={!showStartDate}>
<InputDate
defaultValue={this.props.startdate}
defaultValue={startDate}
placeholderText={getLangText('Loan start date')} />
</Property>
<Property
name='enddate'
editable={!this.props.enddate}
overrideForm={!!this.props.enddate}
editable={!endDate}
overrideForm={!!endDate}
label={getLangText('End date')}
hidden={!this.props.showEndDate}>
hidden={!showEndDate}>
<InputDate
defaultValue={this.props.enddate}
defaultValue={endDate}
placeholderText={getLangText('Loan end date')} />
</Property>
<Property
@ -280,25 +299,25 @@ let LoanForm = React.createClass({
label={getLangText('Personal Message')}
editable={true}
overrideForm={true}
hidden={!this.props.showPersonalMessage}>
hidden={!showPersonalMessage}>
<InputTextAreaToggable
rows={1}
defaultValue={this.props.message}
defaultValue={message}
placeholder={getLangText('Enter a message...')}
required={this.props.showPersonalMessage}/>
required={showPersonalMessage}/>
</Property>
{this.getContractCheckbox()}
{this.getAppendix()}
<Property
name='password'
label={getLangText('Password')}
hidden={!this.props.showPassword}>
hidden={!showPassword}>
<input
type="password"
placeholder={getLangText('Enter your password')}
required={this.props.showPassword ? 'required' : ''}/>
required={showPassword ? 'required' : ''}/>
</Property>
{this.props.children}
{children}
</Form>
);
}

View File

@ -65,8 +65,8 @@ let LoanRequestAnswerForm = React.createClass({
url={this.props.url}
email={this.state.loanRequest ? this.state.loanRequest.new_owner : null}
gallery={this.state.loanRequest ? this.state.loanRequest.gallery : null}
startdate={startDate}
enddate={endDate}
startDate={startDate}
endDate={endDate}
showPassword={true}
showPersonalMessage={false}
handleSuccess={this.props.handleSuccess}/>
@ -76,4 +76,4 @@ let LoanRequestAnswerForm = React.createClass({
}
});
export default LoanRequestAnswerForm;
export default LoanRequestAnswerForm;

View File

@ -292,8 +292,8 @@ let PrizePieceRatings = React.createClass({
url={ApiUrls.ownership_loans_pieces_request}
email={this.props.currentUser.email}
gallery={this.props.piece.prize.name}
startdate={today}
enddate={endDate}
startDate={today}
endDate={endDate}
showPersonalMessage={true}
showPassword={false}
handleSuccess={this.handleLoanSuccess} />

View File

@ -214,8 +214,8 @@ let CylandRegisterPiece = React.createClass({
url={ApiUrls.ownership_loans_pieces}
email={this.state.whitelabel.user}
gallery="Cyland Archive"
startdate={today}
enddate={datetimeWhenWeAllWillBeFlyingCoolHoverboardsAndDinosaursWillLiveAgain}
startDate={today}
endDate={datetimeWhenWeAllWillBeFlyingCoolHoverboardsAndDinosaursWillLiveAgain}
showStartDate={false}
showEndDate={false}
showPersonalMessage={false}

View File

@ -192,8 +192,8 @@ let IkonotvRegisterPiece = React.createClass({
getSlideLoan() {
if (this.canSubmit()) {
let today = new Moment();
let enddate = new Moment();
enddate.add(2, 'years');
let endDate = new Moment();
endDate.add(2, 'years');
return (
<div data-slide-title={getLangText('Loan')}>
<Row className="no-margin">
@ -203,8 +203,8 @@ let IkonotvRegisterPiece = React.createClass({
id={{piece_id: this.state.piece.id}}
url={ApiUrls.ownership_loans_pieces}
email="submissions@ikono.org"
startdate={today}
enddate={enddate}
startDate={today}
endDate={endDate}
showStartDate={false}
showEndDate={false}
gallery="IkonoTV archive"