| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "./assets/src/apps/js/blocks/courses/list-courses/edit.js" |
| 6 |
/*!****************************************************************!*\ |
| 7 |
!*** ./assets/src/apps/js/blocks/courses/list-courses/edit.js ***! |
| 8 |
\****************************************************************/ |
| 9 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 10 |
|
| 11 |
__webpack_require__.r(__webpack_exports__); |
| 12 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 14 |
/* harmony export */ }); |
| 15 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 16 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 17 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 18 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 19 |
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); |
| 20 |
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); |
| 21 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 22 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
const Edit = props => { |
| 28 |
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); |
| 29 |
const { |
| 30 |
attributes, |
| 31 |
setAttributes, |
| 32 |
clientId |
| 33 |
} = props; |
| 34 |
const { |
| 35 |
courseQuery |
| 36 |
} = attributes; |
| 37 |
const QUERY_LOOP_TEMPLATE = [['learnpress/course-item-template']]; |
| 38 |
const resetAllTaxonomy = () => { |
| 39 |
setAttributes({ |
| 40 |
courseQuery: { |
| 41 |
...courseQuery, |
| 42 |
term_id: '', |
| 43 |
tag_id: '' |
| 44 |
} |
| 45 |
}); |
| 46 |
}; |
| 47 |
const orderByData = [{ |
| 48 |
label: 'Newly published', |
| 49 |
value: 'post_date' |
| 50 |
}, { |
| 51 |
label: 'Title a-z', |
| 52 |
value: 'post_title' |
| 53 |
}, { |
| 54 |
label: 'Title z-a', |
| 55 |
value: 'post_title_desc' |
| 56 |
}, { |
| 57 |
label: 'Price high to low', |
| 58 |
value: 'price' |
| 59 |
}, { |
| 60 |
label: 'Price low to high', |
| 61 |
value: 'price_low' |
| 62 |
}, { |
| 63 |
label: 'Popular', |
| 64 |
value: 'popular' |
| 65 |
}, { |
| 66 |
label: 'Average Ratings', |
| 67 |
value: 'rating' |
| 68 |
}]; |
| 69 |
const paginationTypes = [{ |
| 70 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Number', 'learnpress'), |
| 71 |
value: 'number' |
| 72 |
}, { |
| 73 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Load more', 'learnpress'), |
| 74 |
value: 'load-more' |
| 75 |
}, { |
| 76 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Infinite Scroll', 'learnpress'), |
| 77 |
value: 'infinite' |
| 78 |
}]; |
| 79 |
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, { |
| 80 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Query Settings', 'learnpress') |
| 81 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RangeControl, { |
| 82 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Posts per page'), |
| 83 |
value: courseQuery.limit, |
| 84 |
onChange: limit => setAttributes({ |
| 85 |
courseQuery: { |
| 86 |
...courseQuery, |
| 87 |
limit |
| 88 |
} |
| 89 |
}), |
| 90 |
min: 1, |
| 91 |
max: 20 |
| 92 |
}), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 93 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Related Course', 'learnpress'), |
| 94 |
checked: courseQuery.related, |
| 95 |
onChange: related => { |
| 96 |
if (related) { |
| 97 |
setAttributes({ |
| 98 |
courseQuery: { |
| 99 |
...courseQuery, |
| 100 |
term_id: '', |
| 101 |
tag_id: '', |
| 102 |
pagination: false, |
| 103 |
order_by: 'post_date', |
| 104 |
related |
| 105 |
} |
| 106 |
}); |
| 107 |
} else { |
| 108 |
setAttributes({ |
| 109 |
courseQuery: { |
| 110 |
...courseQuery, |
| 111 |
related |
| 112 |
} |
| 113 |
}); |
| 114 |
} |
| 115 |
} |
| 116 |
}), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 117 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enable AJAX', 'learnpress'), |
| 118 |
checked: courseQuery.load_ajax, |
| 119 |
onChange: load_ajax => { |
| 120 |
setAttributes({ |
| 121 |
courseQuery: { |
| 122 |
...courseQuery, |
| 123 |
load_ajax, |
| 124 |
load_ajax_after: !load_ajax ? false : courseQuery.load_ajax_after |
| 125 |
} |
| 126 |
}); |
| 127 |
} |
| 128 |
}), !courseQuery.related && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { |
| 129 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Order by', 'learnpress'), |
| 130 |
value: courseQuery.order_by, |
| 131 |
options: orderByData, |
| 132 |
onChange: order_by => { |
| 133 |
setAttributes({ |
| 134 |
courseQuery: { |
| 135 |
...courseQuery, |
| 136 |
order_by |
| 137 |
} |
| 138 |
}); |
| 139 |
} |
| 140 |
}), !courseQuery.related && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { |
| 141 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Pagination', 'learnpress'), |
| 142 |
checked: courseQuery.pagination, |
| 143 |
onChange: pagination => { |
| 144 |
setAttributes({ |
| 145 |
courseQuery: { |
| 146 |
...courseQuery, |
| 147 |
pagination, |
| 148 |
pagination_type: !pagination ? 'number' : courseQuery.pagination_type |
| 149 |
} |
| 150 |
}); |
| 151 |
} |
| 152 |
}), courseQuery.pagination && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { |
| 153 |
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Pagination Type', 'learnpress'), |
| 154 |
value: courseQuery.pagination_type, |
| 155 |
options: paginationTypes, |
| 156 |
onChange: pagination_type => { |
| 157 |
setAttributes({ |
| 158 |
courseQuery: { |
| 159 |
...courseQuery, |
| 160 |
pagination_type |
| 161 |
} |
| 162 |
}); |
| 163 |
} |
| 164 |
}))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 165 |
...blockProps |
| 166 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, { |
| 167 |
template: QUERY_LOOP_TEMPLATE |
| 168 |
}))); |
| 169 |
}; |
| 170 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit); |
| 171 |
|
| 172 |
/***/ }, |
| 173 |
|
| 174 |
/***/ "./assets/src/apps/js/blocks/courses/list-courses/save.js" |
| 175 |
/*!****************************************************************!*\ |
| 176 |
!*** ./assets/src/apps/js/blocks/courses/list-courses/save.js ***! |
| 177 |
\****************************************************************/ |
| 178 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 179 |
|
| 180 |
__webpack_require__.r(__webpack_exports__); |
| 181 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 182 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 183 |
/* harmony export */ }); |
| 184 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 185 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 186 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 187 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); |
| 188 |
|
| 189 |
|
| 190 |
const Save = props => { |
| 191 |
const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save(); |
| 192 |
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 193 |
...blockProps |
| 194 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null)); |
| 195 |
}; |
| 196 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Save); |
| 197 |
|
| 198 |
/***/ }, |
| 199 |
|
| 200 |
/***/ "react" |
| 201 |
/*!************************!*\ |
| 202 |
!*** external "React" ***! |
| 203 |
\************************/ |
| 204 |
(module) { |
| 205 |
|
| 206 |
module.exports = window["React"]; |
| 207 |
|
| 208 |
/***/ }, |
| 209 |
|
| 210 |
/***/ "@wordpress/block-editor" |
| 211 |
/*!*************************************!*\ |
| 212 |
!*** external ["wp","blockEditor"] ***! |
| 213 |
\*************************************/ |
| 214 |
(module) { |
| 215 |
|
| 216 |
module.exports = window["wp"]["blockEditor"]; |
| 217 |
|
| 218 |
/***/ }, |
| 219 |
|
| 220 |
/***/ "@wordpress/blocks" |
| 221 |
/*!********************************!*\ |
| 222 |
!*** external ["wp","blocks"] ***! |
| 223 |
\********************************/ |
| 224 |
(module) { |
| 225 |
|
| 226 |
module.exports = window["wp"]["blocks"]; |
| 227 |
|
| 228 |
/***/ }, |
| 229 |
|
| 230 |
/***/ "@wordpress/components" |
| 231 |
/*!************************************!*\ |
| 232 |
!*** external ["wp","components"] ***! |
| 233 |
\************************************/ |
| 234 |
(module) { |
| 235 |
|
| 236 |
module.exports = window["wp"]["components"]; |
| 237 |
|
| 238 |
/***/ }, |
| 239 |
|
| 240 |
/***/ "@wordpress/i18n" |
| 241 |
/*!******************************!*\ |
| 242 |
!*** external ["wp","i18n"] ***! |
| 243 |
\******************************/ |
| 244 |
(module) { |
| 245 |
|
| 246 |
module.exports = window["wp"]["i18n"]; |
| 247 |
|
| 248 |
/***/ }, |
| 249 |
|
| 250 |
/***/ "./assets/src/apps/js/blocks/courses/list-courses/block.json" |
| 251 |
/*!*******************************************************************!*\ |
| 252 |
!*** ./assets/src/apps/js/blocks/courses/list-courses/block.json ***! |
| 253 |
\*******************************************************************/ |
| 254 |
(module) { |
| 255 |
|
| 256 |
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"learnpress/list-courses","title":"Course Listing","category":"learnpress-category","description":"Course Listing block","textdomain":"learnpress","keywords":["listing course","learnpress","query loop"],"usesContext":[],"attributes":{"courseQuery":{"type":"object","default":{"limit":10,"order_by":"post_date","related":false,"pagination":false,"pagination_type":"number","tag_id":"","term_id":"","load_ajax":false}}},"providesContext":{"lpCourseQuery":"courseQuery"},"supports":{"html":false,"align":["wide","full"]}}'); |
| 257 |
|
| 258 |
/***/ } |
| 259 |
|
| 260 |
/******/ }); |
| 261 |
/************************************************************************/ |
| 262 |
/******/ // The module cache |
| 263 |
/******/ const __webpack_module_cache__ = {}; |
| 264 |
/******/ |
| 265 |
/******/ // The require function |
| 266 |
/******/ function __webpack_require__(moduleId) { |
| 267 |
/******/ // Check if module is in cache |
| 268 |
/******/ const cachedModule = __webpack_module_cache__[moduleId]; |
| 269 |
/******/ if (cachedModule !== undefined) { |
| 270 |
/******/ return cachedModule.exports; |
| 271 |
/******/ } |
| 272 |
/******/ // Create a new module (and put it into the cache) |
| 273 |
/******/ const module = __webpack_module_cache__[moduleId] = { |
| 274 |
/******/ // no module.id needed |
| 275 |
/******/ // no module.loaded needed |
| 276 |
/******/ exports: {} |
| 277 |
/******/ }; |
| 278 |
/******/ |
| 279 |
/******/ // Execute the module function |
| 280 |
/******/ if (!(moduleId in __webpack_modules__)) { |
| 281 |
/******/ delete __webpack_module_cache__[moduleId]; |
| 282 |
/******/ const e = new Error("Cannot find module '" + moduleId + "'"); |
| 283 |
/******/ e.code = 'MODULE_NOT_FOUND'; |
| 284 |
/******/ throw e; |
| 285 |
/******/ } |
| 286 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 287 |
/******/ |
| 288 |
/******/ // Return the exports of the module |
| 289 |
/******/ return module.exports; |
| 290 |
/******/ } |
| 291 |
/******/ |
| 292 |
/************************************************************************/ |
| 293 |
/******/ /* webpack/runtime/compat get default export */ |
| 294 |
/******/ (() => { |
| 295 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 296 |
/******/ __webpack_require__.n = (module) => { |
| 297 |
/******/ const getter = module && module.__esModule ? |
| 298 |
/******/ () => (module['default']) : |
| 299 |
/******/ () => (module); |
| 300 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 301 |
/******/ return getter; |
| 302 |
/******/ }; |
| 303 |
/******/ })(); |
| 304 |
/******/ |
| 305 |
/******/ /* webpack/runtime/define property getters */ |
| 306 |
/******/ (() => { |
| 307 |
/******/ // define getter/value functions for harmony exports |
| 308 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 309 |
/******/ if(Array.isArray(definition)) { |
| 310 |
/******/ var i = 0; |
| 311 |
/******/ while(i < definition.length) { |
| 312 |
/******/ var key = definition[i++]; |
| 313 |
/******/ var binding = definition[i++]; |
| 314 |
/******/ if(!__webpack_require__.o(exports, key)) { |
| 315 |
/******/ if(binding === 0) { |
| 316 |
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); |
| 317 |
/******/ } else { |
| 318 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); |
| 319 |
/******/ } |
| 320 |
/******/ } else if(binding === 0) { i++; } |
| 321 |
/******/ } |
| 322 |
/******/ } else { |
| 323 |
/******/ for(var key in definition) { |
| 324 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 325 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 326 |
/******/ } |
| 327 |
/******/ } |
| 328 |
/******/ } |
| 329 |
/******/ }; |
| 330 |
/******/ })(); |
| 331 |
/******/ |
| 332 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 333 |
/******/ (() => { |
| 334 |
/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) |
| 335 |
/******/ })(); |
| 336 |
/******/ |
| 337 |
/******/ /* webpack/runtime/make namespace object */ |
| 338 |
/******/ (() => { |
| 339 |
/******/ // define __esModule on exports |
| 340 |
/******/ __webpack_require__.r = (exports) => { |
| 341 |
/******/ if(Symbol.toStringTag) { |
| 342 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 343 |
/******/ } |
| 344 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 345 |
/******/ }; |
| 346 |
/******/ })(); |
| 347 |
/******/ |
| 348 |
/************************************************************************/ |
| 349 |
let __webpack_exports__ = {}; |
| 350 |
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. |
| 351 |
(() => { |
| 352 |
/*!*****************************************************************!*\ |
| 353 |
!*** ./assets/src/apps/js/blocks/courses/list-courses/index.js ***! |
| 354 |
\*****************************************************************/ |
| 355 |
__webpack_require__.r(__webpack_exports__); |
| 356 |
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./edit */ "./assets/src/apps/js/blocks/courses/list-courses/edit.js"); |
| 357 |
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./save */ "./assets/src/apps/js/blocks/courses/list-courses/save.js"); |
| 358 |
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./assets/src/apps/js/blocks/courses/list-courses/block.json"); |
| 359 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 360 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__); |
| 361 |
/** |
| 362 |
* Register block course title. |
| 363 |
*/ |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)('learnpress/list-courses', { |
| 369 |
..._block_json__WEBPACK_IMPORTED_MODULE_2__, |
| 370 |
edit: _edit__WEBPACK_IMPORTED_MODULE_0__["default"], |
| 371 |
save: _save__WEBPACK_IMPORTED_MODULE_1__["default"] |
| 372 |
}); |
| 373 |
})(); |
| 374 |
|
| 375 |
/******/ })() |
| 376 |
; |
| 377 |
//# sourceMappingURL=list-courses.js.map |