2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
2015-05-28 18:18:13 +02:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
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-05-28 18:18:13 +02:00
|
|
|
|
|
|
|
let ShareForm = React.createClass({
|
|
|
|
mixins: [FormMixin],
|
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
url() {
|
2015-06-23 17:01:15 +02:00
|
|
|
return ApiUrls.ownership_shares;
|
2015-05-28 18:18:13 +02:00
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-28 18:18:13 +02:00
|
|
|
getFormData() {
|
|
|
|
return {
|
2015-06-02 14:00:05 +02:00
|
|
|
bitcoin_id: this.getBitcoinIds().join(),
|
2015-05-29 01:54:56 +02:00
|
|
|
share_emails: this.refs.share_emails.state.value,
|
|
|
|
share_message: this.refs.share_message.state.value
|
2015-06-05 11:06:36 +02:00
|
|
|
};
|
2015-05-28 18:18:13 +02:00
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
renderForm() {
|
2015-06-05 11:06:36 +02:00
|
|
|
let title = this.getTitlesString().join('');
|
2015-05-29 10:58:07 +02:00
|
|
|
let username = this.props.currentUser.username;
|
|
|
|
let message =
|
|
|
|
`Hi,
|
|
|
|
|
2015-06-02 14:00:05 +02:00
|
|
|
I am sharing :
|
|
|
|
${title}with you.
|
2015-05-29 10:58:07 +02:00
|
|
|
|
|
|
|
Truly yours,
|
|
|
|
${username}`;
|
|
|
|
|
2015-05-28 18:18:13 +02:00
|
|
|
return (
|
2015-05-29 01:54:56 +02:00
|
|
|
<form id="share_modal_content" role="form" key="share_modal_content" onSubmit={this.submit}>
|
|
|
|
<InputText
|
|
|
|
ref="share_emails"
|
|
|
|
placeHolder="Comma separated emails"
|
|
|
|
required="required"
|
|
|
|
type="text"
|
|
|
|
submitted={this.state.submitted}/>
|
|
|
|
<InputTextArea
|
|
|
|
ref="share_message"
|
|
|
|
defaultValue={message}
|
|
|
|
required=""
|
|
|
|
/>
|
|
|
|
<ButtonSubmitOrClose
|
|
|
|
text="SHARE"
|
|
|
|
onClose={this.props.onRequestHide}
|
|
|
|
submitted={this.state.submitted} />
|
2015-05-28 18:18:13 +02:00
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default ShareForm;
|