1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 21:52:08 +02:00
onion/js/components/ascribe_forms/form_transfer.js

74 lines
2.4 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
import ApiUrls from '../../constants/api_urls';
import FormMixin from '../../mixins/form_mixin';
import InputText from './input_text';
import InputTextArea from './input_textarea';
2015-06-03 10:27:11 +02:00
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
2015-07-03 19:08:56 +02:00
import { getLangText } from '../../utils/lang_utils.js'
let TransferForm = React.createClass({
mixins: [FormMixin],
url() {
return ApiUrls.ownership_transfers;
},
getFormData() {
return {
2015-06-02 11:38:18 +02:00
bitcoin_id: this.getBitcoinIds().join(),
transferee: this.refs.transferee.state.value,
transfer_message: this.refs.transfer_message.state.value,
password: this.refs.password.state.value
};
},
renderForm() {
let title = this.getTitlesString().join('');
2015-06-02 11:38:18 +02:00
let username = this.props.currentUser.username;
let message =
2015-07-03 19:08:56 +02:00
`${getLangText('Hi')},
2015-06-02 11:38:18 +02:00
2015-07-03 19:08:56 +02:00
${getLangText('I transfer ownership of')} :
${title}${getLangText('to you')}.
2015-06-02 11:38:18 +02:00
2015-07-03 19:08:56 +02:00
${getLangText('Truly yours')},
2015-06-02 11:38:18 +02:00
${username}`;
return (
<form id="transfer_modal_content" role="form" onSubmit={this.submit}>
<input className="invisible" type="email" name="fake_transferee"/>
<input className="invisible" type="password" name="fake_password"/>
<InputText
ref="transferee"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Transferee email')}
required="required"
type="email"
submitted={this.state.submitted}/>
<InputTextArea
ref="transfer_message"
defaultValue={message}
required=""
/>
<InputText
ref="password"
2015-07-03 19:08:56 +02:00
placeHolder={getLangText('Password')}
required="required"
type="password"
submitted={this.state.submitted}/>
<div>
Make sure that display instructions and technology details are correct.
They cannot be edited after the transfer.
</div>
<ButtonSubmitOrClose
2015-07-03 19:08:56 +02:00
text={getLangText('TRANSFER')}
onClose={this.props.onRequestHide}
submitted={this.state.submitted} />
</form>
);
}
});
export default TransferForm;