1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

restructure cyland submit button

This commit is contained in:
Tim Daubenschütz 2015-08-19 13:56:43 +02:00
parent e88612704f
commit 6dab66ec61

View File

@ -3,18 +3,12 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Moment from 'moment'; import ButtonLink from 'react-router-bootstrap/lib/ButtonLink';
import WhitelabelActions from '../../../../../../actions/whitelabel_actions'; import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../../stores/whitelabel_store'; import WhitelabelStore from '../../../../../../stores/whitelabel_store';
import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
import LoanForm from '../../../../../ascribe_forms/form_loan';
import ApiUrls from '../../../../../../constants/api_urls';
import { getLangText } from '../../../../../../utils/lang_utils'; import { getLangText } from '../../../../../../utils/lang_utils';
import { getAclFormMessage } from '../../../../../../utils/form_utils';
let CylandSubmitButton = React.createClass({ let CylandSubmitButton = React.createClass({
propTypes: { propTypes: {
@ -41,36 +35,14 @@ let CylandSubmitButton = React.createClass({
this.setState(state); this.setState(state);
}, },
getSubmitButton() { render() {
return ( return (
<button <ButtonLink
to="register_piece"
query={{'slide_num': 1}}
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}> className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
{getLangText('Submit to Cyland')} {getLangText('Submit to Cyland')}
</button> </ButtonLink>
);
},
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')}>
<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>
); );
} }
}); });