form
8 years ago
scss
8 years ago
block.js
8 years ago
controls.js
8 years ago
inspector.js
7 years ago
controls.js
49 lines
| 1 | /** |
| 2 | * Internal dependencies |
| 3 | */ |
| 4 | const { __ } = wp.i18n; |
| 5 | const { BlockControls } = wp.blocks; |
| 6 | import './scss/controls.scss'; |
| 7 | |
| 8 | |
| 9 | /** |
| 10 | * Render Block Controls |
| 11 | */ |
| 12 | const Controls = ( props ) => { |
| 13 | // Event(s) |
| 14 | const onChangeForm = () => { |
| 15 | props.setAttributes( { prevId: props.attributes.id } ); |
| 16 | props.setAttributes( { id: 0 } ); |
| 17 | }; |
| 18 | |
| 19 | return ( |
| 20 | <div className="give-block-controls"> |
| 21 | |
| 22 | <div className="control-popup"> |
| 23 | |
| 24 | { /* Change Form */ } |
| 25 | <div className="control-button change-form" onClick={ onChangeForm } > |
| 26 | <div> |
| 27 | <span className="dashicons dashicons-image-rotate"></span><span>{ __( 'Change Form' ) }</span> |
| 28 | </div> |
| 29 | </div> |
| 30 | |
| 31 | { /* Edit Form */ } |
| 32 | <a |
| 33 | className="control-button edit-form" |
| 34 | href={ `${ wpApiSettings.schema.url }/wp-admin/post.php?post=${ props.attributes.id }&action=edit` } |
| 35 | target="_blank" |
| 36 | tooltip={ __( 'Edit donation form' ) } |
| 37 | > |
| 38 | <div> |
| 39 | <span className="dashicons dashicons-edit"></span><span>{ __( 'Edit Form' ) }</span> |
| 40 | </div> |
| 41 | </a> |
| 42 | |
| 43 | </div> |
| 44 | </div> |
| 45 | ); |
| 46 | }; |
| 47 | |
| 48 | export default Controls; |
| 49 |