1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 16:48:04 +02:00
onion/js/components/ascribe_forms/form_share_email.js

82 lines
2.5 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';
2015-10-15 11:17:16 +02:00
import AclInformation from '../ascribe_buttons/acl_information';
import AscribeSpinner from '../ascribe_spinner';
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">
<p className="pull-right">
<AscribeSpinner color='dark-blue' size='md'/>
</p>
2015-07-13 14:10:46 +02:00
</div>}>
2015-10-15 11:17:16 +02:00
<AclInformation aim={'form'} verbs={['acl_share']}/>
<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 />
</Property>
</Form>
2015-05-28 18:18:13 +02:00
);
}
});
export default ShareForm;