PluginProbe
WP Ultimate Post Grid / 4.0.1
WP Ultimate Post Grid v4.0.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 / grid / section / SectionLimit.js

SectionLimit.js in WP Ultimate Post Grid 4.0.1, at assets/js/admin-modal/grid/section/SectionLimit.js

112 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { Fragment } from 'react';
2 const { hooks } = WPUltimatePostGrid['wp-ultimate-post-grid/dist/shared'];
3
4 import Field from 'Modal/field';
5 import EditMode from 'Modal/general/EditMode';
6 import { __wpupg } from 'Shared/Translations';
7
8 const SectionLimit = (props) => {
9 const specificRules = hooks.applyFilters( 'limitItemsRules', {});
10
11 const modes = hooks.applyFilters( 'limitItems', {
12 general: {
13 label: __wpupg( 'General' ),
14 block: (
15 <Fragment>
16 {
17 'posts' === props.grid.type
18 &&
19 <Fragment>
20 <Field
21 value={ props.grid.limit_posts_offset }
22 onChange={ ( value ) => {
23 props.onGridChange({
24 limit_posts_offset: value,
25 });
26 }}
27 type="number"
28 label={ __wpupg( 'Offset First # Items' ) }
29 help={ __wpupg( 'Exclude the first x items from getting displayed the grid.' ) }
30 />
31 <Field
32 value={ props.grid.limit_posts_number }
33 onChange={ ( value ) => {
34 props.onGridChange({
35 limit_posts_number: value,
36 });
37 }}
38 type="number"
39 min="1"
40 label={ __wpupg( 'Limit Total # Items' ) }
41 help={ __wpupg( 'Limit the total number of items in the grid.' ) }
42 />
43 <Field
44 value={ props.grid.images_only }
45 onChange={ ( value ) => {
46 props.onGridChange({
47 images_only: value,
48 });
49 }}
50 type="checkbox"
51 label={ __wpupg( 'Images Only' ) }
52 help={ __wpupg( 'Only display items that have a featured or custom image set.' ) }
53 />
54 </Fragment>
55 }
56 {
57 'terms' === props.grid.type
58 &&
59 <Fragment>
60 <Field
61 value={ props.grid.terms_images_only }
62 onChange={ ( value ) => {
63 props.onGridChange({
64 terms_images_only: value,
65 });
66 }}
67 type="checkbox"
68 label={ __wpupg( 'Images Only' ) }
69 help={ __wpupg( 'Only display terms that have a grod image set.' ) }
70 />
71 <Field
72 value={ props.grid.terms_hide_empty }
73 onChange={ ( value ) => {
74 props.onGridChange({
75 terms_hide_empty: value,
76 });
77 }}
78 type="checkbox"
79 label={ __wpupg( 'Hide Empty' ) }
80 help={ __wpupg( 'Hide terms without associated posts.' ) }
81 />
82 </Fragment>
83 }
84 </Fragment>
85 ),
86 },
87 specific: {
88 label: __wpupg( 'Specific Rules' ),
89 block: (
90 <Fragment>
91 {
92 specificRules.hasOwnProperty( props.grid.type )
93 ?
94 specificRules[ props.grid.type ](props)
95 :
96 <p style={ { color: 'darkred' } }>
97 { __wpupg( 'This feature is only available in' ) } <a href="https://bootstrapped.ventures/wp-ultimate-post-grid/get-the-plugin/">WP Ultimate Post Grid Premium</a>.
98 </p>
99 }
100 </Fragment>
101 ),
102 },
103 } );
104
105 return (
106 <EditMode
107 modes={ modes }
108 />
109 );
110 }
111 export default SectionLimit;
112