1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 17:45:10 +01:00
onion/js/components/ascribe_forms/form_delete_piece.js

66 lines
1.9 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
2015-08-06 10:15:02 +02:00
import Form from '../ascribe_forms/form';
import AclInformation from '../ascribe_buttons/acl_information';
import ApiUrls from '../../constants/api_urls';
import AscribeSpinner from '../ascribe_spinner';
2015-08-06 10:15:02 +02:00
import { getLangText } from '../../utils/lang_utils';
2015-08-06 10:23:01 +02:00
let PieceDeleteForm = React.createClass({
propTypes: {
2015-08-06 10:15:02 +02:00
pieceId: React.PropTypes.number,
2015-08-06 10:15:02 +02:00
// Propagated by ModalWrapper in most cases
handleSuccess: React.PropTypes.func
},
2015-08-06 10:15:02 +02:00
getFormData() {
return {
piece_id: this.props.pieceId
};
},
2015-08-06 10:15:02 +02:00
render() {
return (
2015-08-06 10:15:02 +02:00
<Form
ref='form'
url={ApiUrls.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>
2015-08-06 10:15:02 +02:00
</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>
2015-08-06 10:15:02 +02:00
</Form>
);
}
});
export default PieceDeleteForm;