1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 21:52:08 +02:00
onion/js/components/ascribe_buttons/unconsign_request_button.js
Brett Sun 7014514654 Use UrlResolver to resolve api urls based on white labelling rather than updating ApiUrl's export
Keeping an export constant is more predictable and less surprising for
most people.
2016-06-14 17:58:00 +02:00

54 lines
1.7 KiB
JavaScript

'use strict';
import React from 'react';
import Button from 'react-bootstrap/lib/Button';
import ModalWrapper from '../ascribe_modal/modal_wrapper';
import UnConsignRequestForm from '../ascribe_forms/form_unconsign_request';
import withContext from '../context/with_context';
import { currentUserShape } from '../prop_types';
import { getLangText } from '../../utils/lang';
import { resolveUrl } from '../../utils/url_resolver';
const UnConsignRequestButton = React.createClass({
propTypes: {
edition: React.PropTypes.object.isRequired,
handleSuccess: React.PropTypes.func,
// Injected through HOCs
currentUser: currentUserShape.isRequired // eslint-disable-line react/sort-prop-types
},
render() {
const { currentUser, edition, handleSuccess } = this.props;
return (
<ModalWrapper
trigger={
<Button bsStyle="danger" className="btn-delete pull-center" bsSize="small" type="submit">
{getLangText('REQUEST UNCONSIGN')}
</Button>
}
handleSuccess={handleSuccess}
title={getLangText('Request to Un-Consign')}>
<UnConsignRequestForm
url={resolveUrl('ownership_unconsigns_request')}
id={{'bitcoin_id': edition.bitcoin_id}}
message={`${getLangText('Hi')},
${getLangText('I request you to un-consign')} \" ${edition.title} \".
${getLangText('Truly yours')},
${currentUser.username}`
} />
</ModalWrapper>
);
}
});
export default withContext(UnConsignRequestButton, 'currentUser');