PluginProbe
WP Ultimate Post Grid / 4.1.1
WP Ultimate Post Grid v4.1.1
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / assets / js / admin-modal / menu / index.js

index.js in WP Ultimate Post Grid 4.1.1, at assets/js/admin-modal/menu/index.js

86 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 }