| 1 |
import React, { Component, Fragment } from 'react'; |
| 2 |
|
| 3 |
import '../../../css/admin/modal/menu.scss'; |
| 4 |
|
| 5 |
import { __wpupg } from 'Shared/Translations'; |
| 6 |
import Header from '../general/Header'; |
| 7 |
import Button from 'Shared/Button'; |
| 8 |
|
| 9 |
export default class Menu extends Component { |
| 10 |
render() { |
| 11 |
return ( |
| 12 |
<Fragment> |
| 13 |
<Header |
| 14 |
onCloseModal={ this.props.maybeCloseModal } |
| 15 |
> |
| 16 |
WP Ultimate Post Grid |
| 17 |
</Header> |
| 18 |
<div className="wpupg-admin-modal-menu-container"> |
| 19 |
<h2>{ __wpupg( 'Insert existing Grid' ) }</h2> |
| 20 |
<div className="wpupg-admin-modal-menu-buttons"> |
| 21 |
<Button |
| 22 |
isPrimary |
| 23 |
onClick={ () => { |
| 24 |
WPUPG_Modal.open( 'select', { |
| 25 |
title: __wpupg( 'Insert Grid with Filters' ), |
| 26 |
button: __wpupg( 'Insert' ), |
| 27 |
fields: { |
| 28 |
grid: true, |
| 29 |
filter: false, |
| 30 |
}, |
| 31 |
insertCallback: ( fields ) => { |
| 32 |
if ( 'function' === typeof this.props.args.insertCallback ) { |
| 33 |
this.props.args.insertCallback( `[wpupg-grid-with-filters id="${ fields.grid }"]` ); |
| 34 |
} |
| 35 |
}, |
| 36 |
}, true ); |
| 37 |
} } |
| 38 |
>{ __wpupg( 'Insert Grid with Filters' ) }</Button> |
| 39 |
<Button |
| 40 |
onClick={ () => { |
| 41 |
WPUPG_Modal.open( 'select', { |
| 42 |
title: __wpupg( 'Insert Grid only' ), |
| 43 |
button: __wpupg( 'Insert' ), |
| 44 |
fields: { |
| 45 |
grid: true, |
| 46 |
filter: false, |
| 47 |
}, |
| 48 |
insertCallback: ( fields ) => { |
| 49 |
if ( 'function' === typeof this.props.args.insertCallback ) { |
| 50 |
this.props.args.insertCallback( `[wpupg-grid id="${ fields.grid }"]` ); |
| 51 |
} |
| 52 |
}, |
| 53 |
}, true ); |
| 54 |
} } |
| 55 |
>{ __wpupg( 'Insert Grid only' ) }</Button> |
| 56 |
<Button |
| 57 |
onClick={ () => { |
| 58 |
WPUPG_Modal.open( 'select', { |
| 59 |
title: __wpupg( 'Insert Filter only' ), |
| 60 |
button: __wpupg( 'Insert' ), |
| 61 |
fields: { |
| 62 |
grid: true, |
| 63 |
filter: true, |
| 64 |
}, |
| 65 |
insertCallback: ( fields ) => { |
| 66 |
if ( 'function' === typeof this.props.args.insertCallback ) { |
| 67 |
let shortcode = `[wpupg-filter id="${ fields.grid }"`; |
| 68 |
|
| 69 |
if ( true === fields.filter ) { |
| 70 |
shortcode += ']'; |
| 71 |
} else { |
| 72 |
shortcode += ` filter="${ fields.filter }"]`; |
| 73 |
} |
| 74 |
|
| 75 |
this.props.args.insertCallback( shortcode ); |
| 76 |
} |
| 77 |
}, |
| 78 |
}, true ); |
| 79 |
} } |
| 80 |
>{ __wpupg( 'Insert Filter only' ) }</Button> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
</Fragment> |
| 84 |
); |
| 85 |
} |
| 86 |
} |