2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
2015-05-28 18:18:13 +02:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2015-07-10 20:00:35 +02:00
|
|
|
import Form from './form';
|
|
|
|
import Property from './property';
|
|
|
|
import InputTextAreaToggable from './input_textarea_toggable';
|
2015-08-06 10:58:09 +02:00
|
|
|
|
2015-07-10 20:00:35 +02:00
|
|
|
import Button from 'react-bootstrap/lib/Button';
|
|
|
|
|
2015-10-15 11:17:16 +02:00
|
|
|
import AclInformation from '../ascribe_buttons/acl_information';
|
2015-10-22 13:38:49 +02:00
|
|
|
|
2015-10-12 15:25:21 +02:00
|
|
|
import AscribeSpinner from '../ascribe_spinner';
|
2015-08-06 10:58:09 +02:00
|
|
|
|
2015-07-10 20:00:35 +02:00
|
|
|
import { getLangText } from '../../utils/lang_utils.js';
|
2015-05-28 18:18:13 +02:00
|
|
|
|
|
|
|
|
2015-07-10 20:00:35 +02:00
|
|
|
let ShareForm = React.createClass({
|
|
|
|
propTypes: {
|
2015-07-13 14:10:46 +02:00
|
|
|
url: React.PropTypes.string,
|
2015-07-13 21:19:45 +02:00
|
|
|
id: React.PropTypes.object,
|
2015-07-13 14:10:46 +02:00
|
|
|
message: React.PropTypes.string,
|
2015-07-10 20:00:35 +02:00
|
|
|
editions: React.PropTypes.array,
|
2015-07-13 14:10:46 +02:00
|
|
|
currentUser: React.PropTypes.object,
|
|
|
|
handleSuccess: React.PropTypes.func
|
2015-07-10 20:00:35 +02:00
|
|
|
},
|
|
|
|
|
2015-07-13 14:10:46 +02:00
|
|
|
getFormData(){
|
|
|
|
return this.props.id;
|
2015-07-10 20:00:35 +02:00
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-07-10 20:00:35 +02:00
|
|
|
render() {
|
2015-05-29 10:58:07 +02:00
|
|
|
|
2015-05-28 18:18:13 +02:00
|
|
|
return (
|
2015-07-10 20:00:35 +02:00
|
|
|
<Form
|
|
|
|
ref='form'
|
2015-07-13 14:10:46 +02:00
|
|
|
url={this.props.url}
|
2015-07-10 20:00:35 +02:00
|
|
|
getFormData={this.getFormData}
|
2015-07-13 14:10:46 +02:00
|
|
|
handleSuccess={this.props.handleSuccess}
|
2015-07-10 20:00:35 +02:00
|
|
|
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">
|
2016-02-08 14:50:24 +01:00
|
|
|
{getLangText('SHARE')}
|
2015-08-05 18:00:44 +02:00
|
|
|
</Button>
|
2015-07-10 20:00:35 +02:00
|
|
|
</p>
|
|
|
|
</div>}
|
|
|
|
spinner={
|
|
|
|
<div className="modal-footer">
|
2015-10-12 15:25:21 +02:00
|
|
|
<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']}/>
|
2015-07-10 20:00:35 +02:00
|
|
|
<Property
|
|
|
|
name='share_emails'
|
|
|
|
label={getLangText('Emails')}>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
placeholder={getLangText('Comma separated emails')}
|
|
|
|
required/>
|
|
|
|
</Property>
|
|
|
|
<Property
|
|
|
|
name='share_message'
|
|
|
|
label='Personal Message'
|
2015-09-21 12:05:42 +02:00
|
|
|
editable={true}
|
|
|
|
overrideForm={true}>
|
2015-07-10 20:00:35 +02:00
|
|
|
<InputTextAreaToggable
|
|
|
|
rows={1}
|
2015-07-13 14:10:46 +02:00
|
|
|
defaultValue={this.props.message}
|
2015-07-10 20:00:35 +02:00
|
|
|
placeholder={getLangText('Enter a message...')}
|
2015-10-28 19:19:14 +01:00
|
|
|
required />
|
2015-07-10 20:00:35 +02:00
|
|
|
</Property>
|
|
|
|
</Form>
|
2015-05-28 18:18:13 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-10-28 19:19:14 +01:00
|
|
|
export default ShareForm;
|