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

View File

@ -65,8 +65,8 @@ let LoanRequestAnswerForm = React.createClass({
url={this.props.url} url={this.props.url}
email={this.state.loanRequest ? this.state.loanRequest.new_owner : null} email={this.state.loanRequest ? this.state.loanRequest.new_owner : null}
gallery={this.state.loanRequest ? this.state.loanRequest.gallery : null} gallery={this.state.loanRequest ? this.state.loanRequest.gallery : null}
startdate={startDate} startDate={startDate}
enddate={endDate} endDate={endDate}
showPassword={true} showPassword={true}
showPersonalMessage={false} showPersonalMessage={false}
handleSuccess={this.props.handleSuccess}/> 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} url={ApiUrls.ownership_loans_pieces_request}
email={this.props.currentUser.email} email={this.props.currentUser.email}
gallery={this.props.piece.prize.name} gallery={this.props.piece.prize.name}
startdate={today} startDate={today}
enddate={endDate} endDate={endDate}
showPersonalMessage={true} showPersonalMessage={true}
showPassword={false} showPassword={false}
handleSuccess={this.handleLoanSuccess} /> handleSuccess={this.handleLoanSuccess} />

View File

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

View File

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