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_delete_piece.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

66 lines
2.0 KiB
JavaScript

'use strict';
import React from 'react';
import Form from '../ascribe_forms/form';
import AclInformation from '../ascribe_buttons/acl_information';
import AscribeSpinner from '../ascribe_spinner';
import { getLangText } from '../../utils/lang';
import { resolveUrl } from '../../utils/url_resolver';
let PieceDeleteForm = React.createClass({
propTypes: {
pieceId: React.PropTypes.number,
// Propagated by ModalWrapper in most cases
handleSuccess: React.PropTypes.func
},
getFormData() {
return {
piece_id: this.props.pieceId
};
},
render() {
return (
<Form
ref='form'
url={resolveUrl('piece')}
getFormData={this.getFormData}
method="delete"
handleSuccess={this.props.handleSuccess}
buttons={
<div className="modal-footer">
<p className="pull-right">
<button
type="submit"
className="btn btn-danger btn-delete btn-sm ascribe-margin-1px"
onClick={this.submit}>
{getLangText('YES, DELETE')}
</button>
</p>
</div>
}
spinner={
<div className="modal-footer">
<p className="pull-right">
<AscribeSpinner color='dark-blue' size='md'/>
</p>
</div>
}>
<AclInformation aim={'form'} verbs={['acl_delete']}/>
<p>{getLangText('Are you sure you would like to permanently delete this piece')}&#63;</p>
<p>{getLangText('This is an irrevocable action%s', '.')}</p>
</Form>
);
}
});
export default PieceDeleteForm;