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

cyland loan form for accordion list

This commit is contained in:
Tim Daubenschütz 2015-08-18 13:39:06 +02:00
parent ad8be7e34a
commit e88612704f
2 changed files with 41 additions and 94 deletions

View File

@ -3,16 +3,42 @@
import React from 'react';
import classNames from 'classnames';
import Moment from 'moment';
import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../../stores/whitelabel_store';
import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
import CylandPieceSubmitForm from '../ascribe_forms/cyland_form_submit';
import LoanForm from '../../../../../ascribe_forms/form_loan';
import ApiUrls from '../../../../../../constants/api_urls';
import { getLangText } from '../../../../../../utils/lang_utils';
import { getAclFormMessage } from '../../../../../../utils/form_utils';
let CylandSubmitButton = React.createClass({
propTypes: {
className: React.PropTypes.string,
handleSuccess: React.PropTypes.func,
piece: React.PropTypes.object.isRequired
piece: React.PropTypes.object.isRequired,
username: React.PropTypes.string
},
getInitialState() {
return WhitelabelStore.getState();
},
componentDidMount() {
WhitelabelStore.listen(this.onChange);
WhitelabelActions.fetchWhitelabel();
},
componentWillUnmount() {
WhitelabelStore.unlisten(this.onChange);
},
onChange(state) {
this.setState(state);
},
getSubmitButton() {
@ -25,16 +51,26 @@ let CylandSubmitButton = React.createClass({
},
render() {
let today = new Moment();
let loanEndDate = new Moment();
loanEndDate.add(1000, 'years');
return (
<ModalWrapper
trigger={this.getSubmitButton()}
handleSuccess={this.props.handleSuccess}
title={getLangText('Submit to Cyland')}>
<CylandPieceSubmitForm
piece={this.props.piece}
<LoanForm
message={getAclFormMessage('acl_loan', '\"' + this.props.piece.title + '\"', this.props.username)}
id={{piece_id: this.props.piece.id}}
url={ApiUrls.ownership_loans_pieces}
email={this.state.whitelabel.user}
gallery="Cyland Archive"
startdate={today}
enddate={loanEndDate}
showPersonalMessage={false}
handleSuccess={this.props.handleSuccess}/>
</ModalWrapper>
);
}
});

View File

@ -1,89 +0,0 @@
'use strict';
import React from 'react';
import Form from '../../../../../ascribe_forms/form';
import Property from '../../../../../ascribe_forms/property';
import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable';
import InputCheckbox from '../../../../../ascribe_forms/input_checkbox';
import Alert from 'react-bootstrap/lib/Alert';
import AppConstants from '../../../../../../constants/application_constants';
import ApiUrls from '../../../../../../constants/api_urls';
import { getLangText } from '../../../../../../utils/lang_utils.js';
import requests from '../../../../../../utils/requests';
let CylandPieceSubmitForm = React.createClass({
propTypes: {
piece: React.PropTypes.object,
handleSuccess: React.PropTypes.func
},
render() {
//return (
// <Form
// ref='form'
// url={requests.prepareUrl(ApiUrls.piece_submit_to_prize, {piece_id: this.props.piece.id})}
// handleSuccess={this.props.handleSuccess}
// buttons={
// <div className="modal-footer">
// <p className="pull-right">
// <button
// className="btn btn-default btn-sm ascribe-margin-1px"
// type="submit">
// {getLangText('SUBMIT TO PRIZE')}
// </button>
// </p>
// </div>}
// spinner={
// <div className="modal-footer">
// <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
// </div>}>
// <Property
// name='artist_statement'
// label={getLangText('Artist statement')}
// editable={true}>
// <InputTextAreaToggable
// rows={1}
// editable={true}
// placeholder={getLangText('Enter your statement')}
// required="required"/>
// </Property>
// <Property
// name='work_description'
// label={getLangText('Work description')}
// editable={true}>
// <InputTextAreaToggable
// rows={1}
// editable={true}
// placeholder={getLangText('Enter the description for your work')}
// required="required"/>
// </Property>
// <Property
// name="terms"
// className="ascribe-settings-property-collapsible-toggle"
// style={{paddingBottom: 0}}>
// <InputCheckbox>
// <span>
// {' ' + getLangText('I agree to the Terms of Service the art price') + ' '}
// (<a href="https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/sluice/terms.pdf" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
// {getLangText('read')}
// </a>)
// </span>
// </InputCheckbox>
// </Property>
// <Alert bsStyle='warning'>
// <p>{getLangText('Are you sure you want to submit to the prize?')}</p>
// <p>{getLangText('This is an irrevocable action%s', '.')}</p>
// </Alert>
// </Form>
//);
return null;
}
});
export default CylandPieceSubmitForm;