1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 09:50:31 +01:00
onion/js/components/ascribe_forms/form_share_email.js

76 lines
2.4 KiB
JavaScript
Raw Normal View History

'use strict';
2015-05-28 18:18:13 +02:00
import React from 'react';
import Form from './form';
import Property from './property';
import InputTextAreaToggable from './input_textarea_toggable';
2015-08-06 10:58:09 +02:00
import Button from 'react-bootstrap/lib/Button';
import AppConstants from '../../constants/application_constants';
2015-08-06 10:58:09 +02:00
import { getLangText } from '../../utils/lang_utils.js';
2015-05-28 18:18:13 +02:00
let ShareForm = React.createClass({
propTypes: {
2015-07-13 14:10:46 +02:00
url: React.PropTypes.string,
id: React.PropTypes.object,
2015-07-13 14:10:46 +02:00
message: React.PropTypes.string,
editions: React.PropTypes.array,
2015-07-13 14:10:46 +02:00
currentUser: React.PropTypes.object,
handleSuccess: React.PropTypes.func
},
2015-07-13 14:10:46 +02:00
getFormData(){
return this.props.id;
},
render() {
2015-05-29 10:58:07 +02:00
2015-05-28 18:18:13 +02:00
return (
<Form
ref='form'
2015-07-13 14:10:46 +02:00
url={this.props.url}
getFormData={this.getFormData}
2015-07-13 14:10:46 +02:00
handleSuccess={this.props.handleSuccess}
buttons={
<div className="modal-footer">
<p className="pull-right">
<Button
className="btn btn-default btn-sm ascribe-margin-1px"
2015-08-05 18:00:44 +02:00
type="submit">
SHARE
</Button>
</p>
</div>}
spinner={
<div className="modal-footer">
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
2015-07-13 14:10:46 +02:00
</div>}>
<Property
name='share_emails'
label={getLangText('Emails')}>
<input
type="text"
placeholder={getLangText('Comma separated emails')}
required/>
</Property>
<Property
name='share_message'
label='Personal Message'
editable={true}
overrideForm={true}>
<InputTextAreaToggable
rows={1}
2015-07-13 14:10:46 +02:00
defaultValue={this.props.message}
placeholder={getLangText('Enter a message...')}
required="required"/>
</Property>
</Form>
2015-05-28 18:18:13 +02:00
);
}
});
export default ShareForm;