← All changes
|
assets/js/admin-modal/grid/section/SectionDataSource.js
+14
-117
4.1.1
→
3.0.0
View file →
| @@ -3,15 +3,8 @@ | ||
| 3 | 3 | import Field from 'Modal/field'; |
| 4 | 4 | import { __wpupg } from 'Shared/Translations'; |
| 5 | 5 | |
| 6 | 6 | const SectionDataSource = (props) => { |
| 7 | - let languageOptions = [ | |
| 8 | - { value: false, label: __wpupg( 'Ignore post language' ) }, | |
| 9 | - ]; | |
| 10 | - if ( wpupg_admin_manage_modal.hasOwnProperty( 'multilingual' ) && 'wpml' === wpupg_admin_manage_modal.multilingual.plugin ) { | |
| 11 | - languageOptions = languageOptions.concat( Object.values( wpupg_admin_manage_modal.multilingual.languages ) ); | |
| 12 | - } | |
| 13 | - | |
| 14 | 7 | return ( |
| 15 | 8 | <Fragment> |
| 16 | 9 | <Field |
| 17 | 10 | value={ props.grid.type } |
| @@ -51,97 +44,8 @@ | ||
| 51 | 44 | label={ __wpupg( 'Post Types' ) } |
| 52 | 45 | help={ wpupg_admin.addons.premium ? null : __wpupg( 'Multiple post types are available in WP Ultimate Post Grid Premium' ) } |
| 53 | 46 | /> |
| 54 | 47 | <Field |
| 55 | - value={ props.grid.password_protected } | |
| 56 | - onChange={ ( value ) => { | |
| 57 | - props.onGridChange({ | |
| 58 | - password_protected: value, | |
| 59 | - }); | |
| 60 | - }} | |
| 61 | - type="dropdown" | |
| 62 | - label={ __wpupg( 'Password Protected' ) } | |
| 63 | - options={[ | |
| 64 | - { | |
| 65 | - value: 'all', | |
| 66 | - label: __wpupg( 'Include all posts' ), | |
| 67 | - }, | |
| 68 | - { | |
| 69 | - value: 'exclude', | |
| 70 | - label: __wpupg( 'Exclude password protected posts' ), | |
| 71 | - }, | |
| 72 | - { | |
| 73 | - value: 'only', | |
| 74 | - label: __wpupg( 'Only show password protected posts' ), | |
| 75 | - }, | |
| 76 | - ]} | |
| 77 | - /> | |
| 78 | - <Field | |
| 79 | - value={ props.grid.post_status } | |
| 80 | - onChange={ ( value ) => { | |
| 81 | - props.onGridChange({ | |
| 82 | - post_status: value, | |
| 83 | - }); | |
| 84 | - }} | |
| 85 | - type="dropdown" | |
| 86 | - label={ __wpupg( 'Post Status' ) } | |
| 87 | - options={[ | |
| 88 | - { | |
| 89 | - value: 'publish', | |
| 90 | - label: __wpupg( 'Published Posts' ), | |
| 91 | - }, | |
| 92 | - { | |
| 93 | - value: 'private', | |
| 94 | - label: __wpupg( 'Private Posts' ), | |
| 95 | - }, | |
| 96 | - { | |
| 97 | - value: 'future', | |
| 98 | - label: __wpupg( 'Scheduled Posts' ), | |
| 99 | - }, | |
| 100 | - { | |
| 101 | - value: 'pending', | |
| 102 | - label: __wpupg( 'Pending Posts' ), | |
| 103 | - }, | |
| 104 | - { | |
| 105 | - value: 'draft', | |
| 106 | - label: __wpupg( 'Draft Posts' ), | |
| 107 | - }, | |
| 108 | - ]} | |
| 109 | - isMulti | |
| 110 | - help={ __wpupg( 'Select the post statusses you want to display in the grid.' ) } | |
| 111 | - /> | |
| 112 | - { | |
| 113 | - props.grid.post_status.includes( 'private' ) | |
| 114 | - && | |
| 115 | - <Field | |
| 116 | - value={ props.grid.post_status_require_permission } | |
| 117 | - onChange={ ( value ) => { | |
| 118 | - props.onGridChange({ | |
| 119 | - post_status_require_permission: value, | |
| 120 | - }); | |
| 121 | - }} | |
| 122 | - type="checkbox" | |
| 123 | - label={ __wpupg( 'Only if readable' ) } | |
| 124 | - help={ __wpupg( 'Only show private posts when a visitor has read permission for them.' ) } | |
| 125 | - /> | |
| 126 | - } | |
| 127 | - { | |
| 128 | - | |
| 129 | - 1 < languageOptions.length | |
| 130 | - && | |
| 131 | - <Field | |
| 132 | - value={ props.grid.language } | |
| 133 | - onChange={ ( value ) => { | |
| 134 | - props.onGridChange({ | |
| 135 | - language: value, | |
| 136 | - }); | |
| 137 | - }} | |
| 138 | - type="dropdown" | |
| 139 | - label={ __wpupg( 'Language' ) } | |
| 140 | - options={ languageOptions } | |
| 141 | - /> | |
| 142 | - } | |
| 143 | - <Field | |
| 144 | 48 | value={ props.grid.order_by } |
| 145 | 49 | onChange={ ( value ) => { |
| 146 | 50 | props.onGridChange({ |
| 147 | 51 | order_by: value, |
| @@ -150,11 +54,8 @@ | ||
| 150 | 54 | type="dropdown" |
| 151 | 55 | options={[ |
| 152 | 56 | { value: 'title', label: __wpupg( 'Title' ) }, |
| 153 | 57 | { value: 'date', label: __wpupg( 'Date' ) }, |
| 154 | - { value: 'modified', label: __wpupg( 'Date Modified' ) }, | |
| 155 | - { value: 'author', label: __wpupg( 'Author' ) }, | |
| 156 | - { value: 'comment_count', label: __wpupg( 'Comment Count' ) }, | |
| 157 | 58 | { value: 'rand', label: __wpupg( 'Random' ) }, |
| 158 | 59 | { value: 'menu_order', label: __wpupg( 'Menu Order (pages)' ) }, |
| 159 | 60 | { value: 'custom', label: `${ __wpupg( 'Custom Field' ) }${ wpupg_admin.addons.premium ? '' : ` (${__wpupg( 'Premium Only' ) })` }`, }, |
| 160 | 61 | ]} |
| @@ -187,26 +88,22 @@ | ||
| 187 | 88 | help={ __wpupg( 'Enable if the custom field contains numbers.' ) } |
| 188 | 89 | /> |
| 189 | 90 | </Fragment> |
| 190 | 91 | } |
| 191 | - { | |
| 192 | - 'rand' !== props.grid.order_by | |
| 193 | - && | |
| 194 | - <Field | |
| 195 | - value={ props.grid.order } | |
| 196 | - onChange={ ( value ) => { | |
| 197 | - props.onGridChange({ | |
| 198 | - order: value, | |
| 199 | - }); | |
| 200 | - }} | |
| 201 | - type="dropdown" | |
| 202 | - options={[ | |
| 203 | - { value: 'asc', label: __wpupg( 'Ascending' ) }, | |
| 204 | - { value: 'desc', label: __wpupg( 'Descending' ) }, | |
| 205 | - ]} | |
| 206 | - label={ __wpupg( 'Order' ) } | |
| 207 | - /> | |
| 208 | - } | |
| 92 | + <Field | |
| 93 | + value={ props.grid.order } | |
| 94 | + onChange={ ( value ) => { | |
| 95 | + props.onGridChange({ | |
| 96 | + order: value, | |
| 97 | + }); | |
| 98 | + }} | |
| 99 | + type="dropdown" | |
| 100 | + options={[ | |
| 101 | + { value: 'asc', label: __wpupg( 'Ascending' ) }, | |
| 102 | + { value: 'desc', label: __wpupg( 'Descending' ) }, | |
| 103 | + ]} | |
| 104 | + label={ __wpupg( 'Order' ) } | |
| 105 | + /> | |
| 209 | 106 | </Fragment> |
| 210 | 107 | } |
| 211 | 108 | { |
| 212 | 109 | 'terms' === props.grid.type |