| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "./assets/src/apps/js/blocks/courses/course-order-by/edit.js" |
| 6 |
/*!*******************************************************************!*\ |
| 7 |
!*** ./assets/src/apps/js/blocks/courses/course-order-by/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 */ edit: () => (/* binding */ edit) |
| 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_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); |
| 20 |
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
const edit = props => { |
| 25 |
var _orderByData$find$lab; |
| 26 |
const { |
| 27 |
attributes, |
| 28 |
setAttributes, |
| 29 |
context |
| 30 |
} = props; |
| 31 |
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)(); |
| 32 |
const orderByValue = context.lpCourseQuery?.order_by || 'post_date'; |
| 33 |
const orderByData = [{ |
| 34 |
label: 'Newly published', |
| 35 |
value: 'post_date' |
| 36 |
}, { |
| 37 |
label: 'Title a-z', |
| 38 |
value: 'post_title' |
| 39 |
}, { |
| 40 |
label: 'Title z-a', |
| 41 |
value: 'post_title_desc' |
| 42 |
}, { |
| 43 |
label: 'Price high to low', |
| 44 |
value: 'price' |
| 45 |
}, { |
| 46 |
label: 'Price low to high', |
| 47 |
value: 'price_low' |
| 48 |
}, { |
| 49 |
label: 'Popular', |
| 50 |
value: 'popular' |
| 51 |
}, { |
| 52 |
label: 'Average Ratings', |
| 53 |
value: 'rating' |
| 54 |
}]; |
| 55 |
const orderByLabel = (_orderByData$find$lab = orderByData.find(item => item.value === orderByValue)?.label) !== null && _orderByData$find$lab !== void 0 ? _orderByData$find$lab : 'Newly published'; |
| 56 |
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 57 |
...blockProps |
| 58 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { |
| 59 |
className: "courses-order-by-wrapper" |
| 60 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("select", { |
| 61 |
name: "order_by", |
| 62 |
className: "block-courses-order-by" |
| 63 |
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { |
| 64 |
selected: "selected" |
| 65 |
}, orderByLabel))))); |
| 66 |
}; |
| 67 |
|
| 68 |
/***/ }, |
| 69 |
|
| 70 |
/***/ "./assets/src/apps/js/blocks/courses/course-order-by/save.js" |
| 71 |
/*!*******************************************************************!*\ |
| 72 |
!*** ./assets/src/apps/js/blocks/courses/course-order-by/save.js ***! |
| 73 |
\*******************************************************************/ |
| 74 |
(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 75 |
|
| 76 |
__webpack_require__.r(__webpack_exports__); |
| 77 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 78 |
/* harmony export */ save: () => (/* binding */ save) |
| 79 |
/* harmony export */ }); |
| 80 |
const save = props => null; |
| 81 |
|
| 82 |
/***/ }, |
| 83 |
|
| 84 |
/***/ "react" |
| 85 |
/*!************************!*\ |
| 86 |
!*** external "React" ***! |
| 87 |
\************************/ |
| 88 |
(module) { |
| 89 |
|
| 90 |
module.exports = window["React"]; |
| 91 |
|
| 92 |
/***/ }, |
| 93 |
|
| 94 |
/***/ "@wordpress/block-editor" |
| 95 |
/*!*************************************!*\ |
| 96 |
!*** external ["wp","blockEditor"] ***! |
| 97 |
\*************************************/ |
| 98 |
(module) { |
| 99 |
|
| 100 |
module.exports = window["wp"]["blockEditor"]; |
| 101 |
|
| 102 |
/***/ }, |
| 103 |
|
| 104 |
/***/ "@wordpress/blocks" |
| 105 |
/*!********************************!*\ |
| 106 |
!*** external ["wp","blocks"] ***! |
| 107 |
\********************************/ |
| 108 |
(module) { |
| 109 |
|
| 110 |
module.exports = window["wp"]["blocks"]; |
| 111 |
|
| 112 |
/***/ }, |
| 113 |
|
| 114 |
/***/ "@wordpress/i18n" |
| 115 |
/*!******************************!*\ |
| 116 |
!*** external ["wp","i18n"] ***! |
| 117 |
\******************************/ |
| 118 |
(module) { |
| 119 |
|
| 120 |
module.exports = window["wp"]["i18n"]; |
| 121 |
|
| 122 |
/***/ }, |
| 123 |
|
| 124 |
/***/ "./assets/src/apps/js/blocks/courses/course-order-by/block.json" |
| 125 |
/*!**********************************************************************!*\ |
| 126 |
!*** ./assets/src/apps/js/blocks/courses/course-order-by/block.json ***! |
| 127 |
\**********************************************************************/ |
| 128 |
(module) { |
| 129 |
|
| 130 |
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"learnpress/course-order-by","title":"Course Sorting","category":"learnpress-course-elements","icon":"editor-alignleft","description":"Show sorting select box for courses.","textdomain":"learnpress","keywords":["sort","learnpress"],"usesContext":["lpCourseQuery"],"ancestor":["learnpress/list-courses"],"supports":{"inserter":true,"reusable":true,"reorder":true,"html":false,"multiple":true}}'); |
| 131 |
|
| 132 |
/***/ } |
| 133 |
|
| 134 |
/******/ }); |
| 135 |
/************************************************************************/ |
| 136 |
/******/ // The module cache |
| 137 |
/******/ var __webpack_module_cache__ = {}; |
| 138 |
/******/ |
| 139 |
/******/ // The require function |
| 140 |
/******/ function __webpack_require__(moduleId) { |
| 141 |
/******/ // Check if module is in cache |
| 142 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 143 |
/******/ if (cachedModule !== undefined) { |
| 144 |
/******/ return cachedModule.exports; |
| 145 |
/******/ } |
| 146 |
/******/ // Create a new module (and put it into the cache) |
| 147 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 148 |
/******/ // no module.id needed |
| 149 |
/******/ // no module.loaded needed |
| 150 |
/******/ exports: {} |
| 151 |
/******/ }; |
| 152 |
/******/ |
| 153 |
/******/ // Execute the module function |
| 154 |
/******/ if (!(moduleId in __webpack_modules__)) { |
| 155 |
/******/ delete __webpack_module_cache__[moduleId]; |
| 156 |
/******/ var e = new Error("Cannot find module '" + moduleId + "'"); |
| 157 |
/******/ e.code = 'MODULE_NOT_FOUND'; |
| 158 |
/******/ throw e; |
| 159 |
/******/ } |
| 160 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 161 |
/******/ |
| 162 |
/******/ // Return the exports of the module |
| 163 |
/******/ return module.exports; |
| 164 |
/******/ } |
| 165 |
/******/ |
| 166 |
/************************************************************************/ |
| 167 |
/******/ /* webpack/runtime/compat get default export */ |
| 168 |
/******/ (() => { |
| 169 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 170 |
/******/ __webpack_require__.n = (module) => { |
| 171 |
/******/ var getter = module && module.__esModule ? |
| 172 |
/******/ () => (module['default']) : |
| 173 |
/******/ () => (module); |
| 174 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 175 |
/******/ return getter; |
| 176 |
/******/ }; |
| 177 |
/******/ })(); |
| 178 |
/******/ |
| 179 |
/******/ /* webpack/runtime/define property getters */ |
| 180 |
/******/ (() => { |
| 181 |
/******/ // define getter functions for harmony exports |
| 182 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 183 |
/******/ for(var key in definition) { |
| 184 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 185 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 186 |
/******/ } |
| 187 |
/******/ } |
| 188 |
/******/ }; |
| 189 |
/******/ })(); |
| 190 |
/******/ |
| 191 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 192 |
/******/ (() => { |
| 193 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 194 |
/******/ })(); |
| 195 |
/******/ |
| 196 |
/******/ /* webpack/runtime/make namespace object */ |
| 197 |
/******/ (() => { |
| 198 |
/******/ // define __esModule on exports |
| 199 |
/******/ __webpack_require__.r = (exports) => { |
| 200 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 201 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 202 |
/******/ } |
| 203 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 204 |
/******/ }; |
| 205 |
/******/ })(); |
| 206 |
/******/ |
| 207 |
/************************************************************************/ |
| 208 |
var __webpack_exports__ = {}; |
| 209 |
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. |
| 210 |
(() => { |
| 211 |
/*!********************************************************************!*\ |
| 212 |
!*** ./assets/src/apps/js/blocks/courses/course-order-by/index.js ***! |
| 213 |
\********************************************************************/ |
| 214 |
__webpack_require__.r(__webpack_exports__); |
| 215 |
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./edit */ "./assets/src/apps/js/blocks/courses/course-order-by/edit.js"); |
| 216 |
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./save */ "./assets/src/apps/js/blocks/courses/course-order-by/save.js"); |
| 217 |
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./assets/src/apps/js/blocks/courses/course-order-by/block.json"); |
| 218 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 219 |
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__); |
| 220 |
/** |
| 221 |
* Register block course order by property. |
| 222 |
*/ |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, { |
| 229 |
..._block_json__WEBPACK_IMPORTED_MODULE_2__, |
| 230 |
edit: _edit__WEBPACK_IMPORTED_MODULE_0__.edit, |
| 231 |
save: _save__WEBPACK_IMPORTED_MODULE_1__.save |
| 232 |
}); |
| 233 |
})(); |
| 234 |
|
| 235 |
/******/ })() |
| 236 |
; |
| 237 |
//# sourceMappingURL=course-order-by.js.map |