2015-07-14 17:42:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import Button from 'react-bootstrap/lib/Button';
|
|
|
|
|
|
|
|
import ModalWrapper from '../ascribe_modal/modal_wrapper';
|
2016-06-06 18:52:05 +02:00
|
|
|
import UnConsignRequestForm from '../ascribe_forms/form_unconsign_request';
|
2015-07-14 17:42:15 +02:00
|
|
|
|
2016-06-08 13:11:16 +02:00
|
|
|
import withContext from '../context/with_context';
|
2016-06-06 18:52:05 +02:00
|
|
|
import { currentUserShape } from '../prop_types';
|
|
|
|
|
2016-06-13 14:35:02 +02:00
|
|
|
import { getLangText } from '../../utils/lang';
|
2016-06-14 13:05:57 +02:00
|
|
|
import { resolveUrl } from '../../utils/url_resolver';
|
2015-07-14 17:42:15 +02:00
|
|
|
|
|
|
|
|
2016-06-06 18:52:05 +02:00
|
|
|
const UnConsignRequestButton = React.createClass({
|
2015-07-14 17:42:15 +02:00
|
|
|
propTypes: {
|
|
|
|
edition: React.PropTypes.object.isRequired,
|
2016-02-05 11:53:33 +01:00
|
|
|
|
2016-06-06 18:52:05 +02:00
|
|
|
handleSuccess: React.PropTypes.func,
|
|
|
|
|
|
|
|
// Injected through HOCs
|
|
|
|
currentUser: currentUserShape.isRequired // eslint-disable-line react/sort-prop-types
|
2015-07-14 17:42:15 +02:00
|
|
|
},
|
|
|
|
|
2016-06-06 18:52:05 +02:00
|
|
|
render() {
|
2016-02-05 11:53:33 +01:00
|
|
|
const { currentUser, edition, handleSuccess } = this.props;
|
2015-07-14 17:42:15 +02:00
|
|
|
return (
|
|
|
|
<ModalWrapper
|
2015-08-05 17:32:35 +02:00
|
|
|
trigger={
|
2015-07-14 17:42:15 +02:00
|
|
|
<Button bsStyle="danger" className="btn-delete pull-center" bsSize="small" type="submit">
|
2016-02-08 14:50:24 +01:00
|
|
|
{getLangText('REQUEST UNCONSIGN')}
|
2015-07-14 17:42:15 +02:00
|
|
|
</Button>
|
|
|
|
}
|
2016-02-05 11:53:33 +01:00
|
|
|
handleSuccess={handleSuccess}
|
2016-02-08 14:50:24 +01:00
|
|
|
title={getLangText('Request to Un-Consign')}>
|
2015-07-14 17:42:15 +02:00
|
|
|
<UnConsignRequestForm
|
2016-06-14 13:05:57 +02:00
|
|
|
url={resolveUrl('ownership_unconsigns_request')}
|
2016-02-05 11:53:33 +01:00
|
|
|
id={{'bitcoin_id': edition.bitcoin_id}}
|
2015-07-14 17:42:15 +02:00
|
|
|
message={`${getLangText('Hi')},
|
|
|
|
|
2016-02-05 11:53:33 +01:00
|
|
|
${getLangText('I request you to un-consign')} \" ${edition.title} \".
|
2015-07-14 17:42:15 +02:00
|
|
|
|
|
|
|
${getLangText('Truly yours')},
|
2016-02-05 11:53:33 +01:00
|
|
|
${currentUser.username}`
|
|
|
|
} />
|
2015-07-14 17:42:15 +02:00
|
|
|
</ModalWrapper>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-08 13:11:16 +02:00
|
|
|
export default withContext(UnConsignRequestButton, 'currentUser');
|