LearnPress – WordPress LMS Plugin - Version 3.2.6.5

Version Description

(20.11.2019) = ~ Fixed email doesn't send. ~ Fixed some js errors. ~ Fixed js call twice times. ~ Fixed question doesn't show after added to quiz. ~ Fixed ignore some metadata when copying course. ~ Fixed search orders in backend.

Download this release

Release Info

Developer tunnhn
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 3.2.6.5
Comparing to
See all releases

Code changes from version 3.2.6.4 to 3.2.6.5

Files changed (66) hide show
  1. assets/css/admin/admin.css +10 -5
  2. assets/js/admin/admin.js +293 -285
  3. assets/js/admin/admin.min.js +1 -1
  4. assets/js/admin/conditional-logic.js +290 -231
  5. assets/js/admin/conditional-logic.min.js +1 -1
  6. assets/js/admin/editor/course.js +756 -902
  7. assets/js/admin/editor/course.min.js +1 -1
  8. assets/js/admin/editor/question.js +296 -341
  9. assets/js/admin/editor/question.min.js +1 -1
  10. assets/js/admin/editor/quiz.js +876 -999
  11. assets/js/admin/editor/quiz.min.js +1 -1
  12. assets/js/admin/learnpress.js +912 -883
  13. assets/js/admin/learnpress.min.js +1 -1
  14. assets/js/admin/pages/setup.js +174 -169
  15. assets/js/admin/pages/setup.min.js +1 -1
  16. assets/js/admin/pages/statistic.js +329 -296
  17. assets/js/admin/pages/statistic.min.js +1 -1
  18. assets/js/admin/partial/meta-box-order.js +161 -151
  19. assets/js/admin/partial/meta-box-order.min.js +1 -1
  20. assets/js/admin/question-editor.asset.php +1 -0
  21. assets/js/admin/question-editor.deps.json +1 -0
  22. assets/js/admin/utils.js +2395 -2282
  23. assets/js/admin/utils.min.js +1 -1
  24. assets/js/frontend/learnpress.js +26 -12
  25. assets/js/frontend/learnpress.min.js +1 -1
  26. assets/js/frontend/utils.js +24 -13
  27. assets/js/frontend/utils.min.js +1 -1
  28. assets/js/global.js +22 -1492
  29. assets/js/global.min.js +1 -1
  30. assets/js/utils.js +1320 -1243
  31. assets/js/utils.min.js +1 -1
  32. assets/js/vendor/admin.plugins.all.min.js +1 -1
  33. assets/js/vendor/chart.js +10 -0
  34. assets/js/vendor/chart.min.js +1 -10
  35. assets/js/vendor/jquery/jquery-appear.min.js +1 -1
  36. assets/js/vendor/jquery/jquery.scrollbar.min.js +1 -1
  37. assets/js/vendor/jquery/jquery.tipsy.min.js +1 -1
  38. assets/js/vendor/plugins.all.min.js +1 -1
  39. assets/js/vendor/vue/vue-draggable.min.js +1 -1
  40. assets/js/vendor/vue/vue-resource.min.js +1 -1
  41. assets/js/vendor/vue/vue.min.js +1 -1
  42. assets/js/vendor/vue/vuex.min.js +1 -1
  43. inc/admin/class-lp-admin-ajax.php +20 -9
  44. inc/admin/editor/class-lp-admin-editor-quiz.php +11 -6
  45. inc/admin/lp-admin-functions.php +15 -3
  46. inc/admin/views/course/section-item.php +3 -1
  47. inc/admin/views/meta-boxes/order/details.php +1 -1
  48. inc/background-process/class-lp-background-emailer.php +3 -1
  49. inc/class-lp-emails.php +5 -1
  50. inc/class-lp-request-handler.php +1 -1
  51. inc/course/class-lp-course-item.php +2 -2
  52. inc/curds/class-lp-quiz-curd.php +24 -9
  53. inc/curds/class-lp-section-curd.php +1 -1
  54. inc/custom-post-types/order.php +5 -3
  55. inc/emails/class-lp-email-finished-course-user.php +5 -0
  56. inc/emails/class-lp-email-new-order-guest.php +2 -1
  57. inc/emails/class-lp-email.php +13 -13
  58. inc/interfaces/interface-curd.php +31 -0
  59. inc/order/class-lp-order.php +4 -3
  60. inc/quiz/class-lp-quiz.php +18 -12
  61. inc/user-item/class-lp-user-item-course.php +2 -1
  62. inc/user/abstract-lp-user.php +3 -2
  63. languages/learnpress-vi.mo +0 -0
  64. languages/learnpress-vi.po +10236 -0
  65. learnpress.php +2 -14
  66. readme.txt +11 -2
assets/css/admin/admin.css CHANGED
@@ -2389,7 +2389,9 @@ ul .clearfix {
2389
box-shadow: none;
2390
font-weight: normal;
2391
color: #777;
2392
- padding: 0; }
2393
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings {
2394
border: 1px solid #ddd;
2395
border-left: none;
@@ -2635,7 +2637,9 @@ ul .clearfix {
2635
border: 0;
2636
width: 100%;
2637
margin: 0;
2638
- padding: 6px 0px;
2639
-webkit-box-shadow: none;
2640
-moz-box-shadow: none;
2641
box-shadow: none;
@@ -2654,11 +2658,12 @@ ul .clearfix {
2654
border-bottom: 1px solid #DDD;
2655
display: inline-block; }
2656
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .footer .table-row .add-new-question .add-new {
2657
- display: inline;
2658
- position: relative; }
2659
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .footer .table-row .add-new-question .add-new ul.question-types {
2660
position: absolute;
2661
- margin: 6px;
2662
background-color: #FFF;
2663
top: 100%;
2664
border: 1px solid #DDD;
2389
box-shadow: none;
2390
font-weight: normal;
2391
color: #777;
2392
+ padding: 0;
2393
+ min-height: auto;
2394
+ line-height: 1; }
2395
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings {
2396
border: 1px solid #ddd;
2397
border-left: none;
2637
border: 0;
2638
width: 100%;
2639
margin: 0;
2640
+ padding: 6px 0;
2641
+ line-height: 1;
2642
+ min-height: auto;
2643
-webkit-box-shadow: none;
2644
-moz-box-shadow: none;
2645
box-shadow: none;
2658
border-bottom: 1px solid #DDD;
2659
display: inline-block; }
2660
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .footer .table-row .add-new-question .add-new {
2661
+ display: inline-block;
2662
+ position: relative;
2663
+ vertical-align: top; }
2664
#admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .footer .table-row .add-new-question .add-new ul.question-types {
2665
position: absolute;
2666
+ margin: 0;
2667
background-color: #FFF;
2668
top: 100%;
2669
border: 1px solid #DDD;
assets/js/admin/admin.js CHANGED
@@ -36,19 +36,34 @@
36
/******/ // define getter function for harmony exports
37
/******/ __webpack_require__.d = function(exports, name, getter) {
38
/******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, {
40
- /******/ configurable: false,
41
- /******/ enumerable: true,
42
- /******/ get: getter
43
- /******/ });
44
/******/ }
45
/******/ };
46
/******/
47
/******/ // define __esModule on exports
48
/******/ __webpack_require__.r = function(exports) {
49
/******/ Object.defineProperty(exports, '__esModule', { value: true });
50
/******/ };
51
/******/
52
/******/ // getDefaultExport function for compatibility with non-harmony modules
53
/******/ __webpack_require__.n = function(module) {
54
/******/ var getter = module && module.__esModule ?
@@ -75,137 +90,134 @@
75
/*!**************************************!*\
76
!*** ./assets/src/js/admin/admin.js ***!
77
\**************************************/
78
- /*! no static exports found */
79
- /***/ (function(module, exports, __webpack_require__) {
80
81
"use strict";
82
-
83
-
84
- var _update = __webpack_require__(/*! ./pages/update */ "./assets/src/js/admin/pages/update.js");
85
-
86
- var _update2 = _interopRequireDefault(_update);
87
-
88
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
89
-
90
- ; /**
91
- * JS code may run in all pages in admin.
92
- *
93
- * @version 3.2.6
94
- */
95
//import Utils from './utils';
96
//import Test from './test';
97
98
- (function () {
99
- var $ = jQuery;
100
101
- var updateItemPreview = function updateItemPreview() {
102
- $.ajax({
103
- url: '',
104
- data: {
105
- 'lp-ajax': 'toggle_item_preview',
106
- item_id: this.value,
107
- previewable: this.checked ? 'yes' : 'no',
108
- nonce: $(this).attr('data-nonce')
109
- },
110
- dataType: 'text',
111
- success: function success(response) {
112
- response = LP.parseJSON(response);
113
- }
114
- });
115
- };
116
-
117
- /**
118
- * Callback event for button to creating pages inside error message.
119
- *
120
- * @param {Event} e
121
- */
122
- var createPages = function createPages(e) {
123
- var $button = $(this).addClass('disabled');
124
- e.preventDefault();
125
- $.post({
126
- url: $button.attr('href'),
127
- data: {
128
- 'lp-ajax': 'create-pages'
129
- },
130
- dataType: 'text',
131
- success: function success(res) {
132
- var $message = $button.closest('.lp-notice').html('<p>' + res + '</p>');
133
- setTimeout(function () {
134
- $message.fadeOut();
135
- }, 2000);
136
- }
137
- });
138
- };
139
140
- var hideUpgradeMessage = function hideUpgradeMessage(e) {
141
- e.preventDefault();
142
- var $btn = $(this);
143
- $btn.closest('.lp-upgrade-notice').fadeOut();
144
- $.post({
145
- url: '',
146
- data: {
147
- 'lp-hide-upgrade-message': 'yes'
148
- },
149
- success: function success(res) {}
150
- });
151
- };
152
153
- var pluginActions = function pluginActions(e) {
154
155
- // Premium addon
156
- if ($(e.target).hasClass('buy-now')) {
157
- return;
158
- }
159
160
- e.preventDefault();
161
162
- var $plugin = $(this).closest('.plugin-card');
163
- if ($(this).hasClass('updating-message')) {
164
- return;
165
- }
166
- $(this).addClass('updating-message button-working disabled');
167
$.ajax({
168
- url: $(this).attr('href'),
169
- data: {},
170
- success: function success(r) {
171
- $.ajax({
172
- url: window.location.href,
173
- success: function success(r) {
174
- var $p = $(r).find('#' + $plugin.attr('id'));
175
- if ($p.length) {
176
- $plugin.replaceWith($p);
177
- } else {
178
- $plugin.find('.plugin-action-buttons a').removeClass('updating-message button-working').html(learn_press_admin_localize.plugin_installed);
179
- }
180
- }
181
- });
182
}
183
});
184
- };
185
-
186
- var preventDefault = function preventDefault(e) {
187
- e.preventDefault();
188
- return false;
189
- };
190
-
191
- var onReady = function onReady() {
192
-
193
- $('.learn-press-dropdown-pages').LP('DropdownPages');
194
- $('.learn-press-advertisement-slider').LP('Advertisement', 'a', 's').appendTo($('#wpbody-content'));
195
- $('.learn-press-toggle-item-preview').on('change', updateItemPreview);
196
- $('.learn-press-tip').LP('QuickTip');
197
- //$('.learn-press-tabs').LP('AdminTab');
198
-
199
- $(document).on('click', '#learn-press-create-pages', createPages).on('click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage).on('click', '.plugin-action-buttons a', pluginActions).on('click', '[data-remove-confirm]', preventDefault).on('mousedown', '.lp-sortable-handle', function (e) {
200
- $('html, body').addClass('lp-item-moving');
201
- $(e.target).closest('.lp-sortable-handle').css('cursor', 'inherit');
202
- }).on('mouseup', function (e) {
203
- $('html, body').removeClass('lp-item-moving');
204
- $('.lp-sortable-handle').css('cursor', '');
205
- });
206
- };
207
-
208
- $(document).ready(onReady);
209
})();
210
211
/***/ }),
@@ -215,188 +227,184 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
215
!*** ./assets/src/js/admin/pages/update.js ***!
216
\*********************************************/
217
/*! no static exports found */
218
- /***/ (function(module, exports, __webpack_require__) {
219
-
220
- "use strict";
221
-
222
-
223
- ;(function ($) {
224
- 'use strict';
225
-
226
- var Package = function Package(data) {
227
- this.data = data;
228
-
229
- var currentIndex = -1,
230
- currentVersion = null,
231
- currentPackage = null,
232
- versions = Object.keys(this.data);
233
-
234
- this.reset = function (current) {
235
- current = current === undefined || current > versions.length - 1 || current < 0 ? 0 : current;
236
- currentIndex = current;
237
- currentVersion = versions[current];
238
- currentPackage = this.data[currentVersion];
239
-
240
- return currentPackage;
241
- };
242
-
243
- this.next = function () {
244
- if (currentIndex >= versions.length - 1) {
245
- return false;
246
- }
247
248
- currentIndex++;
249
- this.reset(currentIndex);
250
251
- return currentPackage;
252
- };
253
254
- this.prev = function () {
255
- if (currentIndex <= 0) {
256
- return false;
257
- }
258
259
- currentIndex--;
260
- this.reset(currentIndex);
261
262
- return currentPackage;
263
- };
264
265
- this.currentVersion = function () {
266
- return currentVersion;
267
- };
268
269
- this.hasPackage = function () {
270
- return versions.length;
271
- };
272
273
- this.getPercentCompleted = function () {
274
- return currentIndex / versions.length;
275
- };
276
277
- this.getTotal = function () {
278
- return versions.length;
279
};
280
-
281
- if (!this.data) {
282
- return;
283
- }
284
- };
285
- var UpdaterSettings = {
286
- el: '#learn-press-updater',
287
- data: {
288
- packages: null,
289
- status: '',
290
- force: false
291
- },
292
- watch: {
293
- packages: function packages(newPackages, oldPackages) {
294
- if (newPackages) {}
295
- }
296
- },
297
- mounted: function mounted() {
298
- $(this.$el).show();
299
- },
300
- methods: {
301
- getUpdatePackages: function getUpdatePackages(callback) {
302
- var that = this;
303
- $.ajax({
304
- url: lpGlobalSettings.admin_url,
305
- data: {
306
- 'lp-ajax': 'get-update-packages',
307
- force: this.force,
308
- _wpnonce: lpGlobalSettings._wpnonce
309
- },
310
- success: function success(res) {
311
- var packages = LP.parseJSON(res);
312
- that.packages = new Package(packages);
313
- callback && callback.call(that);
314
- }
315
- });
316
- },
317
- start: function start(e, force) {
318
- this.packages = null;
319
- this.force = force;
320
- this.getUpdatePackages(function () {
321
- if (this.packages.hasPackage()) {
322
- var p = this.packages.next();
323
- this.status = 'updating';
324
- this.doUpdate(p);
325
- }
326
- });
327
- },
328
- getPackages: function getPackages() {
329
- return this.packages ? this.packages.data : {};
330
- },
331
- hasPackage: function hasPackage() {
332
- return !$.isEmptyObject(this.getPackages());
333
- },
334
- updateButtonClass: function updateButtonClass() {
335
- return {
336
- 'disabled': this.status === 'updating'
337
- };
338
},
339
- doUpdate: function doUpdate(p, i) {
340
- var that = this;
341
-
342
- p = p ? p : this.packages.next();
343
- i = i ? i : 1;
344
-
345
- if (p) {
346
- $.ajax({
347
- url: lpGlobalSettings.admin_url,
348
- data: {
349
- 'lp-ajax': 'do-update-package',
350
- package: p,
351
- version: this.packages.currentVersion(),
352
- _wpnonce: lpGlobalSettings._wpnonce,
353
- force: this.force,
354
- i: i
355
- },
356
- success: function success(res) {
357
- var response = LP.parseJSON(res),
358
- $status = $(that.$el).find('.updater-progress-status');
359
- if (response.done === 'yes') {
360
- that.update(that.packages.getPercentCompleted() * 100);
361
- that.doUpdate();
362
- } else {
363
- var newWidth = that.packages.getPercentCompleted() * 100;
364
- if (response.percent) {
365
- var stepWidth = 1 / that.packages.getTotal();
366
- newWidth += stepWidth * response.percent;
367
- }
368
-
369
- that.update(newWidth);
370
- that.doUpdate(p, ++i);
371
- }
372
- },
373
- error: function error() {
374
- that.doUpdate(p, i);
375
- }
376
- });
377
- } else {
378
- that.update(100).addClass('completed');
379
- setTimeout(function (x) {
380
- x.status = 'completed';
381
- }, 2000, this);
382
}
383
},
384
- update: function update(value) {
385
- return $(this.$el).find('.updater-progress-status').css('width', value + '%').attr('data-value', parseInt(value));
386
}
387
}
388
- };
389
-
390
- function init() {
391
392
- window.lpGlobalSettings = window.lpGlobalSettings || {};
393
394
- if ($('#learn-press-updater').length) {
395
- var Updater = new Vue(UpdaterSettings);
396
- }
397
}
398
399
- $(document).ready(init);
400
})(jQuery);
401
402
/***/ })
36
/******/ // define getter function for harmony exports
37
/******/ __webpack_require__.d = function(exports, name, getter) {
38
/******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
/******/ }
41
/******/ };
42
/******/
43
/******/ // define __esModule on exports
44
/******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
/******/ Object.defineProperty(exports, '__esModule', { value: true });
49
/******/ };
50
/******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
/******/ // getDefaultExport function for compatibility with non-harmony modules
68
/******/ __webpack_require__.n = function(module) {
69
/******/ var getter = module && module.__esModule ?
90
/*!**************************************!*\
91
!*** ./assets/src/js/admin/admin.js ***!
92
\**************************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
96
"use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var _pages_update__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pages/update */ "./assets/src/js/admin/pages/update.js");
99
+ /* harmony import */ var _pages_update__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_pages_update__WEBPACK_IMPORTED_MODULE_0__);
100
+ /**
101
+ * JS code may run in all pages in admin.
102
+ *
103
+ * @version 3.2.6
104
+ */
105
//import Utils from './utils';
106
//import Test from './test';
107
108
+ ;
109
110
+ (function () {
111
+ var $ = jQuery;
112
+
113
+ var updateItemPreview = function updateItemPreview() {
114
+ $.ajax({
115
+ url: '',
116
+ data: {
117
+ 'lp-ajax': 'toggle_item_preview',
118
+ item_id: this.value,
119
+ previewable: this.checked ? 'yes' : 'no',
120
+ nonce: $(this).attr('data-nonce')
121
+ },
122
+ dataType: 'text',
123
+ success: function success(response) {
124
+ response = LP.parseJSON(response);
125
+ }
126
+ });
127
+ };
128
+ /**
129
+ * Callback event for button to creating pages inside error message.
130
+ *
131
+ * @param {Event} e
132
+ */
133
134
135
+ var createPages = function createPages(e) {
136
+ var $button = $(this).addClass('disabled');
137
+ e.preventDefault();
138
+ $.post({
139
+ url: $button.attr('href'),
140
+ data: {
141
+ 'lp-ajax': 'create-pages'
142
+ },
143
+ dataType: 'text',
144
+ success: function success(res) {
145
+ var $message = $button.closest('.lp-notice').html('<p>' + res + '</p>');
146
+ setTimeout(function () {
147
+ $message.fadeOut();
148
+ }, 2000);
149
+ }
150
+ });
151
+ };
152
+
153
+ var hideUpgradeMessage = function hideUpgradeMessage(e) {
154
+ e.preventDefault();
155
+ var $btn = $(this);
156
+ $btn.closest('.lp-upgrade-notice').fadeOut();
157
+ $.post({
158
+ url: '',
159
+ data: {
160
+ 'lp-hide-upgrade-message': 'yes'
161
+ },
162
+ success: function success(res) {}
163
+ });
164
+ };
165
+
166
+ var pluginActions = function pluginActions(e) {
167
+ // Premium addon
168
+ if ($(e.target).hasClass('buy-now')) {
169
+ return;
170
+ }
171
172
+ e.preventDefault();
173
+ var $plugin = $(this).closest('.plugin-card');
174
175
+ if ($(this).hasClass('updating-message')) {
176
+ return;
177
+ }
178
179
+ $(this).addClass('updating-message button-working disabled');
180
+ $.ajax({
181
+ url: $(this).attr('href'),
182
+ data: {},
183
+ success: function success(r) {
184
$.ajax({
185
+ url: window.location.href,
186
+ success: function success(r) {
187
+ var $p = $(r).find('#' + $plugin.attr('id'));
188
+
189
+ if ($p.length) {
190
+ $plugin.replaceWith($p);
191
+ } else {
192
+ $plugin.find('.plugin-action-buttons a').removeClass('updating-message button-working').html(learn_press_admin_localize.plugin_installed);
193
}
194
+ }
195
});
196
+ }
197
+ });
198
+ };
199
+
200
+ var preventDefault = function preventDefault(e) {
201
+ e.preventDefault();
202
+ return false;
203
+ };
204
+
205
+ var onReady = function onReady() {
206
+ $('.learn-press-dropdown-pages').LP('DropdownPages');
207
+ $('.learn-press-advertisement-slider').LP('Advertisement', 'a', 's').appendTo($('#wpbody-content'));
208
+ $('.learn-press-toggle-item-preview').on('change', updateItemPreview);
209
+ $('.learn-press-tip').LP('QuickTip'); //$('.learn-press-tabs').LP('AdminTab');
210
+
211
+ $(document).on('click', '#learn-press-create-pages', createPages).on('click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage).on('click', '.plugin-action-buttons a', pluginActions).on('click', '[data-remove-confirm]', preventDefault).on('mousedown', '.lp-sortable-handle', function (e) {
212
+ $('html, body').addClass('lp-item-moving');
213
+ $(e.target).closest('.lp-sortable-handle').css('cursor', 'inherit');
214
+ }).on('mouseup', function (e) {
215
+ $('html, body').removeClass('lp-item-moving');
216
+ $('.lp-sortable-handle').css('cursor', '');
217
+ });
218
+ };
219
+
220
+ $(document).ready(onReady);
221
})();
222
223
/***/ }),
227
!*** ./assets/src/js/admin/pages/update.js ***!
228
\*********************************************/
229
/*! no static exports found */
230
+ /***/ (function(module, exports) {
231
+
232
+ ;
233
+
234
+ (function ($) {
235
+ 'use strict';
236
+
237
+ var Package = function Package(data) {
238
+ this.data = data;
239
+ var currentIndex = -1,
240
+ currentVersion = null,
241
+ currentPackage = null,
242
+ versions = Object.keys(this.data);
243
+
244
+ this.reset = function (current) {
245
+ current = current === undefined || current > versions.length - 1 || current < 0 ? 0 : current;
246
+ currentIndex = current;
247
+ currentVersion = versions[current];
248
+ currentPackage = this.data[currentVersion];
249
+ return currentPackage;
250
+ };
251
252
+ this.next = function () {
253
+ if (currentIndex >= versions.length - 1) {
254
+ return false;
255
+ }
256
257
+ currentIndex++;
258
+ this.reset(currentIndex);
259
+ return currentPackage;
260
+ };
261
262
+ this.prev = function () {
263
+ if (currentIndex <= 0) {
264
+ return false;
265
+ }
266
267
+ currentIndex--;
268
+ this.reset(currentIndex);
269
+ return currentPackage;
270
+ };
271
272
+ this.currentVersion = function () {
273
+ return currentVersion;
274
+ };
275
276
+ this.hasPackage = function () {
277
+ return versions.length;
278
+ };
279
280
+ this.getPercentCompleted = function () {
281
+ return currentIndex / versions.length;
282
+ };
283
284
+ this.getTotal = function () {
285
+ return versions.length;
286
+ };
287
288
+ if (!this.data) {
289
+ return;
290
+ }
291
+ };
292
+
293
+ var UpdaterSettings = {
294
+ el: '#learn-press-updater',
295
+ data: {
296
+ packages: null,
297
+ status: '',
298
+ force: false
299
+ },
300
+ watch: {
301
+ packages: function packages(newPackages, oldPackages) {
302
+ if (newPackages) {}
303
+ }
304
+ },
305
+ mounted: function mounted() {
306
+ $(this.$el).show();
307
+ },
308
+ methods: {
309
+ getUpdatePackages: function getUpdatePackages(callback) {
310
+ var that = this;
311
+ $.ajax({
312
+ url: lpGlobalSettings.admin_url,
313
+ data: {
314
+ 'lp-ajax': 'get-update-packages',
315
+ force: this.force,
316
+ _wpnonce: lpGlobalSettings._wpnonce
317
+ },
318
+ success: function success(res) {
319
+ var packages = LP.parseJSON(res);
320
+ that.packages = new Package(packages);
321
+ callback && callback.call(that);
322
+ }
323
+ });
324
+ },
325
+ start: function start(e, force) {
326
+ this.packages = null;
327
+ this.force = force;
328
+ this.getUpdatePackages(function () {
329
+ if (this.packages.hasPackage()) {
330
+ var p = this.packages.next();
331
+ this.status = 'updating';
332
+ this.doUpdate(p);
333
+ }
334
+ });
335
+ },
336
+ getPackages: function getPackages() {
337
+ return this.packages ? this.packages.data : {};
338
+ },
339
+ hasPackage: function hasPackage() {
340
+ return !$.isEmptyObject(this.getPackages());
341
+ },
342
+ updateButtonClass: function updateButtonClass() {
343
+ return {
344
+ 'disabled': this.status === 'updating'
345
};
346
+ },
347
+ doUpdate: function doUpdate(p, i) {
348
+ var that = this;
349
+ p = p ? p : this.packages.next();
350
+ i = i ? i : 1;
351
+
352
+ if (p) {
353
+ $.ajax({
354
+ url: lpGlobalSettings.admin_url,
355
+ data: {
356
+ 'lp-ajax': 'do-update-package',
357
+ "package": p,
358
+ version: this.packages.currentVersion(),
359
+ _wpnonce: lpGlobalSettings._wpnonce,
360
+ force: this.force,
361
+ i: i
362
},
363
+ success: function success(res) {
364
+ var response = LP.parseJSON(res),
365
+ $status = $(that.$el).find('.updater-progress-status');
366
+
367
+ if (response.done === 'yes') {
368
+ that.update(that.packages.getPercentCompleted() * 100);
369
+ that.doUpdate();
370
+ } else {
371
+ var newWidth = that.packages.getPercentCompleted() * 100;
372
+
373
+ if (response.percent) {
374
+ var stepWidth = 1 / that.packages.getTotal();
375
+ newWidth += stepWidth * response.percent;
376
}
377
+
378
+ that.update(newWidth);
379
+ that.doUpdate(p, ++i);
380
+ }
381
},
382
+ error: function error() {
383
+ that.doUpdate(p, i);
384
}
385
+ });
386
+ } else {
387
+ that.update(100).addClass('completed');
388
+ setTimeout(function (x) {
389
+ x.status = 'completed';
390
+ }, 2000, this);
391
}
392
+ },
393
+ update: function update(value) {
394
+ return $(this.$el).find('.updater-progress-status').css('width', value + '%').attr('data-value', parseInt(value));
395
+ }
396
+ }
397
+ };
398
399
+ function init() {
400
+ window.lpGlobalSettings = window.lpGlobalSettings || {};
401
402
+ if ($('#learn-press-updater').length) {
403
+ var Updater = new Vue(UpdaterSettings);
404
}
405
+ }
406
407
+ $(document).ready(init);
408
})(jQuery);
409
410
/***/ })
assets/js/admin/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function a(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,a),s.l=!0,s.exports}a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},a.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=62)}({61:function(t,e,a){"use strict";!function(t){var e={el:"#learn-press-updater",data:{packages:null,status:"",force:!1},watch:{packages:function(t,e){}},mounted:function(){t(this.$el).show()},methods:{getUpdatePackages:function(e){var a=this;t.ajax({url:lpGlobalSettings.admin_url,data:{"lp-ajax":"get-update-packages",force:this.force,_wpnonce:lpGlobalSettings._wpnonce},success:function(t){var n=LP.parseJSON(t);a.packages=new function(t){this.data=t;var e=-1,a=null,n=null,s=Object.keys(this.data);this.reset=function(t){return t=void 0===t||t>s.length-1||t<0?0:t,e=t,a=s[t],n=this.data[a]},this.next=function(){return!(e>=s.length-1)&&(e++,this.reset(e),n)},this.prev=function(){return!(e<=0)&&(e--,this.reset(e),n)},this.currentVersion=function(){return a},this.hasPackage=function(){return s.length},this.getPercentCompleted=function(){return e/s.length},this.getTotal=function(){return s.length},this.data}(n),e&&e.call(a)}})},start:function(t,e){this.packages=null,this.force=e,this.getUpdatePackages(function(){if(this.packages.hasPackage()){var t=this.packages.next();this.status="updating",this.doUpdate(t)}})},getPackages:function(){return this.packages?this.packages.data:{}},hasPackage:function(){return!t.isEmptyObject(this.getPackages())},updateButtonClass:function(){return{disabled:"updating"===this.status}},doUpdate:function(e,a){var n=this;e=e||this.packages.next(),a=a||1,e?t.ajax({url:lpGlobalSettings.admin_url,data:{"lp-ajax":"do-update-package",package:e,version:this.packages.currentVersion(),_wpnonce:lpGlobalSettings._wpnonce,force:this.force,i:a},success:function(s){var r=LP.parseJSON(s);t(n.$el).find(".updater-progress-status");if("yes"===r.done)n.update(100*n.packages.getPercentCompleted()),n.doUpdate();else{var i=100*n.packages.getPercentCompleted();if(r.percent)i+=1/n.packages.getTotal()*r.percent;n.update(i),n.doUpdate(e,++a)}},error:function(){n.doUpdate(e,a)}}):(n.update(100).addClass("completed"),setTimeout(function(t){t.status="completed"},2e3,this))},update:function(e){return t(this.$el).find(".updater-progress-status").css("width",e+"%").attr("data-value",parseInt(e))}}};t(document).ready(function(){window.lpGlobalSettings=window.lpGlobalSettings||{},t("#learn-press-updater").length&&new Vue(e)})}(jQuery)},62:function(t,e,a){"use strict";!function(t){t&&t.__esModule}(a(61));!function(){var t=jQuery,e=function(){t.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:t(this).attr("data-nonce")},dataType:"text",success:function(t){t=LP.parseJSON(t)}})},a=function(e){var a=t(this).addClass("disabled");e.preventDefault(),t.post({url:a.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(t){var e=a.closest(".lp-notice").html("<p>"+t+"</p>");setTimeout(function(){e.fadeOut()},2e3)}})},n=function(e){e.preventDefault(),t(this).closest(".lp-upgrade-notice").fadeOut(),t.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(t){}})},s=function(e){if(!t(e.target).hasClass("buy-now")){e.preventDefault();var a=t(this).closest(".plugin-card");t(this).hasClass("updating-message")||(t(this).addClass("updating-message button-working disabled"),t.ajax({url:t(this).attr("href"),data:{},success:function(e){t.ajax({url:window.location.href,success:function(e){var n=t(e).find("#"+a.attr("id"));n.length?a.replaceWith(n):a.find(".plugin-action-buttons a").removeClass("updating-message button-working").html(learn_press_admin_localize.plugin_installed)}})}}))}},r=function(t){return t.preventDefault(),!1};t(document).ready(function(){t(".learn-press-dropdown-pages").LP("DropdownPages"),t(".learn-press-advertisement-slider").LP("Advertisement","a","s").appendTo(t("#wpbody-content")),t(".learn-press-toggle-item-preview").on("change",e),t(".learn-press-tip").LP("QuickTip"),t(document).on("click","#learn-press-create-pages",a).on("click",".lp-upgrade-notice .close-notice",n).on("click",".plugin-action-buttons a",s).on("click","[data-remove-confirm]",r).on("mousedown",".lp-sortable-handle",function(e){t("html, body").addClass("lp-item-moving"),t(e.target).closest(".lp-sortable-handle").css("cursor","inherit")}).on("mouseup",function(e){t("html, body").removeClass("lp-item-moving"),t(".lp-sortable-handle").css("cursor","")})})}()}});
1
+ !function(e){var t={};function n(a){if(t[a])return t[a].exports;var s=t[a]={i:a,l:!1,exports:{}};return e[a].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(a,s,function(t){return e[t]}.bind(null,s));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}({16:function(e,t,n){"use strict";n.r(t);var a,s,r,i,o,u;n(17);a=jQuery,s=function(){a.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:a(this).attr("data-nonce")},dataType:"text",success:function(e){e=LP.parseJSON(e)}})},r=function(e){var t=a(this).addClass("disabled");e.preventDefault(),a.post({url:t.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(e){var n=t.closest(".lp-notice").html("<p>"+e+"</p>");setTimeout((function(){n.fadeOut()}),2e3)}})},i=function(e){e.preventDefault(),a(this).closest(".lp-upgrade-notice").fadeOut(),a.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(e){}})},o=function(e){if(!a(e.target).hasClass("buy-now")){e.preventDefault();var t=a(this).closest(".plugin-card");a(this).hasClass("updating-message")||(a(this).addClass("updating-message button-working disabled"),a.ajax({url:a(this).attr("href"),data:{},success:function(e){a.ajax({url:window.location.href,success:function(e){var n=a(e).find("#"+t.attr("id"));n.length?t.replaceWith(n):t.find(".plugin-action-buttons a").removeClass("updating-message button-working").html(learn_press_admin_localize.plugin_installed)}})}}))}},u=function(e){return e.preventDefault(),!1},a(document).ready((function(){a(".learn-press-dropdown-pages").LP("DropdownPages"),a(".learn-press-advertisement-slider").LP("Advertisement","a","s").appendTo(a("#wpbody-content")),a(".learn-press-toggle-item-preview").on("change",s),a(".learn-press-tip").LP("QuickTip"),a(document).on("click","#learn-press-create-pages",r).on("click",".lp-upgrade-notice .close-notice",i).on("click",".plugin-action-buttons a",o).on("click","[data-remove-confirm]",u).on("mousedown",".lp-sortable-handle",(function(e){a("html, body").addClass("lp-item-moving"),a(e.target).closest(".lp-sortable-handle").css("cursor","inherit")})).on("mouseup",(function(e){a("html, body").removeClass("lp-item-moving"),a(".lp-sortable-handle").css("cursor","")}))}))},17:function(e,t){!function(e){"use strict";var t=function(e){this.data=e;var t=-1,n=null,a=null,s=Object.keys(this.data);this.reset=function(e){return e=void 0===e||e>s.length-1||e<0?0:e,t=e,n=s[e],a=this.data[n]},this.next=function(){return!(t>=s.length-1)&&(t++,this.reset(t),a)},this.prev=function(){return!(t<=0)&&(t--,this.reset(t),a)},this.currentVersion=function(){return n},this.hasPackage=function(){return s.length},this.getPercentCompleted=function(){return t/s.length},this.getTotal=function(){return s.length},this.data},n={el:"#learn-press-updater",data:{packages:null,status:"",force:!1},watch:{packages:function(e,t){}},mounted:function(){e(this.$el).show()},methods:{getUpdatePackages:function(n){var a=this;e.ajax({url:lpGlobalSettings.admin_url,data:{"lp-ajax":"get-update-packages",force:this.force,_wpnonce:lpGlobalSettings._wpnonce},success:function(e){var s=LP.parseJSON(e);a.packages=new t(s),n&&n.call(a)}})},start:function(e,t){this.packages=null,this.force=t,this.getUpdatePackages((function(){if(this.packages.hasPackage()){var e=this.packages.next();this.status="updating",this.doUpdate(e)}}))},getPackages:function(){return this.packages?this.packages.data:{}},hasPackage:function(){return!e.isEmptyObject(this.getPackages())},updateButtonClass:function(){return{disabled:"updating"===this.status}},doUpdate:function(t,n){var a=this;t=t||this.packages.next(),n=n||1,t?e.ajax({url:lpGlobalSettings.admin_url,data:{"lp-ajax":"do-update-package",package:t,version:this.packages.currentVersion(),_wpnonce:lpGlobalSettings._wpnonce,force:this.force,i:n},success:function(s){var r=LP.parseJSON(s);e(a.$el).find(".updater-progress-status");if("yes"===r.done)a.update(100*a.packages.getPercentCompleted()),a.doUpdate();else{var i=100*a.packages.getPercentCompleted();if(r.percent)i+=1/a.packages.getTotal()*r.percent;a.update(i),a.doUpdate(t,++n)}},error:function(){a.doUpdate(t,n)}}):(a.update(100).addClass("completed"),setTimeout((function(e){e.status="completed"}),2e3,this))},update:function(t){return e(this.$el).find(".updater-progress-status").css("width",t+"%").attr("data-value",parseInt(t))}}};e(document).ready((function(){if(window.lpGlobalSettings=window.lpGlobalSettings||{},e("#learn-press-updater").length)new Vue(n)}))}(jQuery)}});
assets/js/admin/conditional-logic.js CHANGED
@@ -36,19 +36,34 @@
36
/******/ // define getter function for harmony exports
37
/******/ __webpack_require__.d = function(exports, name, getter) {
38
/******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, {
40
- /******/ configurable: false,
41
- /******/ enumerable: true,
42
- /******/ get: getter
43
- /******/ });
44
/******/ }
45
/******/ };
46
/******/
47
/******/ // define __esModule on exports
48
/******/ __webpack_require__.r = function(exports) {
49
/******/ Object.defineProperty(exports, '__esModule', { value: true });
50
/******/ };
51
/******/
52
/******/ // getDefaultExport function for compatibility with non-harmony modules
53
/******/ __webpack_require__.n = function(module) {
54
/******/ var getter = module && module.__esModule ?
@@ -76,10 +91,7 @@
76
!*** ./assets/src/js/admin/utils/conditional-logic.js ***!
77
\********************************************************/
78
/*! no static exports found */
79
- /***/ (function(module, exports, __webpack_require__) {
80
-
81
- "use strict";
82
-
83
84
/**
85
* Conditional Logic for metabox fields
@@ -88,232 +100,279 @@
88
* @package LearnPress/JS
89
* @version 3.0.0
90
*/
91
- ;(function ($) {
92
- window.conditional_logic_gray_state = function (state, field) {
93
- if (state) {
94
- $(this).removeClass('disabled');
95
- } else {
96
- $(this).addClass('disabled');
97
}
98
- };
99
- var Conditional_Logic = window.Conditional_Logic = function (options) {
100
- this.options = $.extend({}, options || {});
101
- this.updateAll();
102
- };
103
-
104
- Conditional_Logic.prototype = $.extend(Conditional_Logic.prototype, {
105
- evaluate: function evaluate(changedId, conditionals) {
106
- if (!conditionals) {
107
- return undefined;
108
- }
109
- if (!conditionals || !$.isArray(conditionals.conditional)) {
110
- return undefined;
111
- }
112
- var show = undefined,
113
- controls = conditionals.conditional;
114
- for (var i in controls) {
115
- var _show = this.evaluateRequirement(controls[i]),
116
- operator = (controls[i].combine || 'and').toLowerCase();
117
- if (_show !== undefined && show !== undefined) {
118
- if (operator === 'and') {
119
- show = show && _show;
120
- } else {
121
- show = show || _show;
122
- }
123
- } else if (show === undefined) {
124
- show = _show;
125
- }
126
- }
127
- return show;
128
- },
129
- evaluateRequirement: function evaluateRequirement(requirement) {
130
- if (!requirement) {
131
- return undefined;
132
- }
133
- if (!requirement['field']) {
134
- return undefined;
135
- }
136
- if (requirement['compare'] === undefined) {
137
- requirement['compare'] = '=';
138
- }
139
- var control = $('#field-' + requirement.field);
140
- switch (requirement['state']) {
141
- case 'show':
142
- return control.is(':visible');
143
- break;
144
- case 'hide':
145
- return !control.is(':visible');
146
- break;
147
- default:
148
- var value = '';
149
- switch (this.getFieldType(control)) {
150
- case 'yes-no':
151
- var $chk = control.find('input[type="checkbox"]');
152
- value = $chk.is(':checked') ? $chk.val() : '';
153
- break;
154
- case 'radio':
155
- value = control.find('input:checked').val();
156
- break;
157
- default:
158
- value = control.find('input, select').val();
159
-
160
- }
161
-
162
- return this.compare(requirement['value'], value, requirement['compare']);
163
- }
164
- },
165
-
166
- compare: function compare(value2, value1, operator) {
167
- var show = undefined;
168
- switch (operator) {
169
- case '===':
170
- show = value1 === value2;
171
- break;
172
- case '==':
173
- case '=':
174
- case 'equals':
175
- case 'equal':
176
- show = value1 === value2;
177
- break;
178
- case '!==':
179
- show = value1 !== value2;
180
- break;
181
- case '!=':
182
- case 'not equal':
183
- show = value1 !== value2;
184
- break;
185
- case '>=':
186
- case 'greater or equal':
187
- case 'equal or greater':
188
- show = value1 >= value2;
189
- break;
190
- case '<=':
191
- case 'smaller or equal':
192
- case 'equal or smaller':
193
- show = value1 <= value2;
194
- break;
195
- case '>':
196
- case 'greater':
197
- show = value1 > value2;
198
- break;
199
- case '<':
200
- case 'smaller':
201
- show = value1 < value2;
202
- break;
203
- case 'contains':
204
- case 'in':
205
- var _array, _string;
206
- if ($.isArray(value1) && !$.isArray(value2)) {
207
- _array = value1;
208
- _string = value2;
209
- } else if ($.isArray(value2) && !$.isArray(value1)) {
210
- _array = value2;
211
- _string = value1;
212
- }
213
- if (_array && _string) {
214
- if (-1 === $.inArray(_string, _array)) {
215
- show = false;
216
- }
217
- } else {
218
- if (-1 === value1.indexOf(value2) && -1 === value2.indexOf(value1)) {
219
- show = false;
220
- }
221
- }
222
- break;
223
- default:
224
- show = value1 === value2;
225
- }
226
- if (show !== undefined) {
227
- return show;
228
- }
229
- return true;
230
- },
231
- hasConditional: function hasConditional(source, target) {
232
- if (!this.options.conditionals) {
233
- return;
234
- }
235
- if (!this.options.conditionals[target]) {
236
- return false;
237
- }
238
- for (var i in this.options.conditionals[target]['conditional']) {
239
- if (this.options.conditionals[target]['conditional'][i].field === source) {
240
- return this.options.conditionals[target];
241
- }
242
- }
243
- return false;
244
- },
245
- update: function update(changedField, $fields) {
246
- var $changedField = $(changedField),
247
- id = this.getFieldName($changedField);
248
- $fields = $fields || $('.rwmb-field');
249
- _.forEach($fields, function (field) {
250
- var thisField = $(field),
251
- thisId = this.getFieldName(thisField);
252
-
253
- if (thisId === id) {
254
- return;
255
- }
256
- var conditional = this.hasConditional(id, thisId);
257
-
258
- if (!conditional) {
259
- return;
260
- }
261
- var show = this.evaluate($changedField, conditional);
262
-
263
- if (show !== undefined) {
264
- if (conditional.state === 'hide') {
265
- show = !show;
266
- }
267
- if ($.isFunction(window[conditional.state_callback])) {
268
- window[conditional.state_callback].call(thisField, show, thisField);
269
- } else {
270
- thisField.toggle(show);
271
- }
272
- }
273
- }, this);
274
- },
275
- updateAll: function updateAll() {
276
- var $fields = $('.rwmb-field'),
277
- that = this;
278
- _.forEach($fields, function (field) {
279
- var $field = $(field),
280
- type = this.getFieldType($field),
281
- id = $field.find('.rwmb-field-name').val();
282
- if (!id) {
283
- return;
284
- }
285
- $field.attr('id', 'field-' + id);
286
-
287
- if (-1 === _.indexOf(this.supportFields, type)) {
288
- return;
289
- }
290
- $field.find('input, select, textarea').on('change', function () {
291
- that.update($(this).closest('.rwmb-field'), $fields);
292
- }).trigger('change');
293
- }, this);
294
- },
295
- getFieldType: function getFieldType(field) {
296
- var $field = $(field);
297
- if ($field.length === 0) {
298
- return false;
299
}
300
- var className = $field.get(0).className,
301
- m = className.match(/rwmb-([^\s]*)-wrapper/);
302
- if (m) {
303
- return m[1];
304
}
305
- return false;
306
- },
307
- getFieldName: function getFieldName(field) {
308
- return $(field).find('.rwmb-field-name').val();
309
- },
310
- supportFields: ['yes-no', 'text', 'number', 'radio']
311
- });
312
- $(document).ready(function () {
313
- if (window.lp_conditional_logic !== undefined) {
314
- new Conditional_Logic({ conditionals: lp_conditional_logic });
315
}
316
- });
317
})(jQuery);
318
319
/***/ })
36
/******/ // define getter function for harmony exports
37
/******/ __webpack_require__.d = function(exports, name, getter) {
38
/******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
/******/ }
41
/******/ };
42
/******/
43
/******/ // define __esModule on exports
44
/******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
/******/ Object.defineProperty(exports, '__esModule', { value: true });
49
/******/ };
50
/******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
/******/ // getDefaultExport function for compatibility with non-harmony modules
68
/******/ __webpack_require__.n = function(module) {
69
/******/ var getter = module && module.__esModule ?
91
!*** ./assets/src/js/admin/utils/conditional-logic.js ***!
92
\********************************************************/
93
/*! no static exports found */
94
+ /***/ (function(module, exports) {
95
96
/**
97
* Conditional Logic for metabox fields
100
* @package LearnPress/JS
101
* @version 3.0.0
102
*/
103
+ ;
104
+
105
+ (function ($) {
106
+ window.conditional_logic_gray_state = function (state, field) {
107
+ if (state) {
108
+ $(this).removeClass('disabled');
109
+ } else {
110
+ $(this).addClass('disabled');
111
+ }
112
+ };
113
+
114
+ var Conditional_Logic = window.Conditional_Logic = function (options) {
115
+ this.options = $.extend({}, options || {});
116
+ this.updateAll();
117
+ };
118
+
119
+ Conditional_Logic.prototype = $.extend(Conditional_Logic.prototype, {
120
+ evaluate: function evaluate(changedId, conditionals) {
121
+ if (!conditionals) {
122
+ return undefined;
123
+ }
124
+
125
+ if (!conditionals || !$.isArray(conditionals.conditional)) {
126
+ return undefined;
127
+ }
128
+
129
+ var show = undefined,
130
+ controls = conditionals.conditional;
131
+
132
+ for (var i in controls) {
133
+ var _show = this.evaluateRequirement(controls[i]),
134
+ operator = (controls[i].combine || 'and').toLowerCase();
135
+
136
+ if (_show !== undefined && show !== undefined) {
137
+ if (operator === 'and') {
138
+ show = show && _show;
139
+ } else {
140
+ show = show || _show;
141
+ }
142
+ } else if (show === undefined) {
143
+ show = _show;
144
}
145
+ }
146
+
147
+ return show;
148
+ },
149
+ evaluateRequirement: function evaluateRequirement(requirement) {
150
+ if (!requirement) {
151
+ return undefined;
152
+ }
153
+
154
+ if (!requirement['field']) {
155
+ return undefined;
156
+ }
157
+
158
+ if (requirement['compare'] === undefined) {
159
+ requirement['compare'] = '=';
160
+ }
161
+
162
+ var control = $('#field-' + requirement.field);
163
+
164
+ switch (requirement['state']) {
165
+ case 'show':
166
+ return control.is(':visible');
167
+ break;
168
+
169
+ case 'hide':
170
+ return !control.is(':visible');
171
+ break;
172
+
173
+ default:
174
+ var value = '';
175
+
176
+ switch (this.getFieldType(control)) {
177
+ case 'yes-no':
178
+ var $chk = control.find('input[type="checkbox"]');
179
+ value = $chk.is(':checked') ? $chk.val() : '';
180
+ break;
181
+
182
+ case 'radio':
183
+ value = control.find('input:checked').val();
184
+ break;
185
+
186
+ default:
187
+ value = control.find('input, select').val();
188
+ }
189
+
190
+ return this.compare(requirement['value'], value, requirement['compare']);
191
+ }
192
+ },
193
+ compare: function compare(value2, value1, operator) {
194
+ var show = undefined;
195
+
196
+ switch (operator) {
197
+ case '===':
198
+ show = value1 === value2;
199
+ break;
200
+
201
+ case '==':
202
+ case '=':
203
+ case 'equals':
204
+ case 'equal':
205
+ show = value1 === value2;
206
+ break;
207
+
208
+ case '!==':
209
+ show = value1 !== value2;
210
+ break;
211
+
212
+ case '!=':
213
+ case 'not equal':
214
+ show = value1 !== value2;
215
+ break;
216
+
217
+ case '>=':
218
+ case 'greater or equal':
219
+ case 'equal or greater':
220
+ show = value1 >= value2;
221
+ break;
222
+
223
+ case '<=':
224
+ case 'smaller or equal':
225
+ case 'equal or smaller':
226
+ show = value1 <= value2;
227
+ break;
228
+
229
+ case '>':
230
+ case 'greater':
231
+ show = value1 > value2;
232
+ break;
233
+
234
+ case '<':
235
+ case 'smaller':
236
+ show = value1 < value2;
237
+ break;
238
+
239
+ case 'contains':
240
+ case 'in':
241
+ var _array, _string;
242
+
243
+ if ($.isArray(value1) && !$.isArray(value2)) {
244
+ _array = value1;
245
+ _string = value2;
246
+ } else if ($.isArray(value2) && !$.isArray(value1)) {
247
+ _array = value2;
248
+ _string = value1;
249
+ }
250
+
251
+ if (_array && _string) {
252
+ if (-1 === $.inArray(_string, _array)) {
253
+ show = false;
254
}
255
+ } else {
256
+ if (-1 === value1.indexOf(value2) && -1 === value2.indexOf(value1)) {
257
+ show = false;
258
}
259
+ }
260
+
261
+ break;
262
+
263
+ default:
264
+ show = value1 === value2;
265
+ }
266
+
267
+ if (show !== undefined) {
268
+ return show;
269
+ }
270
+
271
+ return true;
272
+ },
273
+ hasConditional: function hasConditional(source, target) {
274
+ if (!this.options.conditionals) {
275
+ return;
276
+ }
277
+
278
+ if (!this.options.conditionals[target]) {
279
+ return false;
280
+ }
281
+
282
+ for (var i in this.options.conditionals[target]['conditional']) {
283
+ if (this.options.conditionals[target]['conditional'][i].field === source) {
284
+ return this.options.conditionals[target];
285
+ }
286
+ }
287
+
288
+ return false;
289
+ },
290
+ update: function update(changedField, $fields) {
291
+ var $changedField = $(changedField),
292
+ id = this.getFieldName($changedField);
293
+ $fields = $fields || $('.rwmb-field');
294
+
295
+ _.forEach($fields, function (field) {
296
+ var thisField = $(field),
297
+ thisId = this.getFieldName(thisField);
298
+
299
+ if (thisId === id) {
300
+ return;
301
}
302
+
303
+ var conditional = this.hasConditional(id, thisId);
304
+
305
+ if (!conditional) {
306
+ return;
307
+ }
308
+
309
+ var show = this.evaluate($changedField, conditional);
310
+
311
+ if (show !== undefined) {
312
+ if (conditional.state === 'hide') {
313
+ show = !show;
314
+ }
315
+
316
+ if ($.isFunction(window[conditional.state_callback])) {
317
+ window[conditional.state_callback].call(thisField, show, thisField);
318
+ } else {
319
+ thisField.toggle(show);
320
+ }
321
+ }
322
+ }, this);
323
+ },
324
+ updateAll: function updateAll() {
325
+ var $fields = $('.rwmb-field'),
326
+ that = this;
327
+
328
+ _.forEach($fields, function (field) {
329
+ var $field = $(field),
330
+ type = this.getFieldType($field),
331
+ id = $field.find('.rwmb-field-name').val();
332
+
333
+ if (!id) {
334
+ return;
335
+ }
336
+
337
+ $field.attr('id', 'field-' + id);
338
+
339
+ if (-1 === _.indexOf(this.supportFields, type)) {
340
+ return;
341
+ }
342
+
343
+ $field.find('input, select, textarea').on('change', function () {
344
+ that.update($(this).closest('.rwmb-field'), $fields);
345
+ }).trigger('change');
346
+ }, this);
347
+ },
348
+ getFieldType: function getFieldType(field) {
349
+ var $field = $(field);
350
+
351
+ if ($field.length === 0) {
352
+ return false;
353
+ }
354
+
355
+ var className = $field.get(0).className,
356
+ m = className.match(/rwmb-([^\s]*)-wrapper/);
357
+
358
+ if (m) {
359
+ return m[1];
360
+ }
361
+
362
+ return false;
363
+ },
364
+ getFieldName: function getFieldName(field) {
365
+ return $(field).find('.rwmb-field-name').val();
366
+ },
367
+ supportFields: ['yes-no', 'text', 'number', 'radio']
368
+ });
369
+ $(document).ready(function () {
370
+ if (window.lp_conditional_logic !== undefined) {
371
+ new Conditional_Logic({
372
+ conditionals: lp_conditional_logic
373
+ });
374
+ }
375
+ });
376
})(jQuery);
377
378
/***/ })
assets/js/admin/conditional-logic.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var i={};function t(a){if(i[a])return i[a].exports;var n=i[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=i,t.d=function(e,i,a){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:a})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},t.p="",t(t.s=10)}({10:function(e,i,t){"use strict";!function(e){window.conditional_logic_gray_state=function(i,t){i?e(this).removeClass("disabled"):e(this).addClass("disabled")};var i=window.Conditional_Logic=function(i){this.options=e.extend({},i||{}),this.updateAll()};i.prototype=e.extend(i.prototype,{evaluate:function(i,t){if(t&&t&&e.isArray(t.conditional)){var a=void 0,n=t.conditional;for(var r in n){var o=this.evaluateRequirement(n[r]),s=(n[r].combine||"and").toLowerCase();void 0!==o&&void 0!==a?a="and"===s?a&&o:a||o:void 0===a&&(a=o)}return a}},evaluateRequirement:function(i){if(i&&i.field){void 0===i.compare&&(i.compare="=");var t=e("#field-"+i.field);switch(i.state){case"show":return t.is(":visible");case"hide":return!t.is(":visible");default:var a="";switch(this.getFieldType(t)){case"yes-no":var n=t.find('input[type="checkbox"]');a=n.is(":checked")?n.val():"";break;case"radio":a=t.find("input:checked").val();break;default:a=t.find("input, select").val()}return this.compare(i.value,a,i.compare)}}},compare:function(i,t,a){var n=void 0;switch(a){case"===":n=t===i;break;case"==":case"=":case"equals":case"equal":n=t===i;break;case"!==":n=t!==i;break;case"!=":case"not equal":n=t!==i;break;case">=":case"greater or equal":case"equal or greater":n=t>=i;break;case"<=":case"smaller or equal":case"equal or smaller":n=t<=i;break;case">":case"greater":n=t>i;break;case"<":case"smaller":n=t<i;break;case"contains":case"in":var r,o;e.isArray(t)&&!e.isArray(i)?(r=t,o=i):e.isArray(i)&&!e.isArray(t)&&(r=i,o=t),r&&o?-1===e.inArray(o,r)&&(n=!1):-1===t.indexOf(i)&&-1===i.indexOf(t)&&(n=!1);break;default:n=t===i}return void 0===n||n},hasConditional:function(e,i){if(this.options.conditionals){if(!this.options.conditionals[i])return!1;for(var t in this.options.conditionals[i].conditional)if(this.options.conditionals[i].conditional[t].field===e)return this.options.conditionals[i];return!1}},update:function(i,t){var a=e(i),n=this.getFieldName(a);t=t||e(".rwmb-field"),_.forEach(t,function(i){var t=e(i),r=this.getFieldName(t);if(r!==n){var o=this.hasConditional(n,r);if(o){var s=this.evaluate(a,o);void 0!==s&&("hide"===o.state&&(s=!s),e.isFunction(window[o.state_callback])?window[o.state_callback].call(t,s,t):t.toggle(s))}}},this)},updateAll:function(){var i=e(".rwmb-field"),t=this;_.forEach(i,function(a){var n=e(a),r=this.getFieldType(n),o=n.find(".rwmb-field-name").val();o&&(n.attr("id","field-"+o),-1!==_.indexOf(this.supportFields,r)&&n.find("input, select, textarea").on("change",function(){t.update(e(this).closest(".rwmb-field"),i)}).trigger("change"))},this)},getFieldType:function(i){var t=e(i);if(0===t.length)return!1;var a=t.get(0).className.match(/rwmb-([^\s]*)-wrapper/);return!!a&&a[1]},getFieldName:function(i){return e(i).find(".rwmb-field-name").val()},supportFields:["yes-no","text","number","radio"]}),e(document).ready(function(){void 0!==window.lp_conditional_logic&&new i({conditionals:lp_conditional_logic})})}(jQuery)}});
1
+ !function(e){var i={};function t(a){if(i[a])return i[a].exports;var n=i[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=i,t.d=function(e,i,a){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:a})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var n in e)t.d(a,n,function(i){return e[i]}.bind(null,n));return a},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},t.p="",t(t.s=8)}({8:function(e,i){!function(e){window.conditional_logic_gray_state=function(i,t){i?e(this).removeClass("disabled"):e(this).addClass("disabled")};var i=window.Conditional_Logic=function(i){this.options=e.extend({},i||{}),this.updateAll()};i.prototype=e.extend(i.prototype,{evaluate:function(i,t){if(t&&t&&e.isArray(t.conditional)){var a=void 0,n=t.conditional;for(var r in n){var o=this.evaluateRequirement(n[r]),s=(n[r].combine||"and").toLowerCase();void 0!==o&&void 0!==a?a="and"===s?a&&o:a||o:void 0===a&&(a=o)}return a}},evaluateRequirement:function(i){if(i&&i.field){void 0===i.compare&&(i.compare="=");var t=e("#field-"+i.field);switch(i.state){case"show":return t.is(":visible");case"hide":return!t.is(":visible");default:var a="";switch(this.getFieldType(t)){case"yes-no":var n=t.find('input[type="checkbox"]');a=n.is(":checked")?n.val():"";break;case"radio":a=t.find("input:checked").val();break;default:a=t.find("input, select").val()}return this.compare(i.value,a,i.compare)}}},compare:function(i,t,a){var n=void 0;switch(a){case"===":n=t===i;break;case"==":case"=":case"equals":case"equal":n=t===i;break;case"!==":n=t!==i;break;case"!=":case"not equal":n=t!==i;break;case">=":case"greater or equal":case"equal or greater":n=t>=i;break;case"<=":case"smaller or equal":case"equal or smaller":n=t<=i;break;case">":case"greater":n=t>i;break;case"<":case"smaller":n=t<i;break;case"contains":case"in":var r,o;e.isArray(t)&&!e.isArray(i)?(r=t,o=i):e.isArray(i)&&!e.isArray(t)&&(r=i,o=t),r&&o?-1===e.inArray(o,r)&&(n=!1):-1===t.indexOf(i)&&-1===i.indexOf(t)&&(n=!1);break;default:n=t===i}return void 0===n||n},hasConditional:function(e,i){if(this.options.conditionals){if(!this.options.conditionals[i])return!1;for(var t in this.options.conditionals[i].conditional)if(this.options.conditionals[i].conditional[t].field===e)return this.options.conditionals[i];return!1}},update:function(i,t){var a=e(i),n=this.getFieldName(a);t=t||e(".rwmb-field"),_.forEach(t,(function(i){var t=e(i),r=this.getFieldName(t);if(r!==n){var o=this.hasConditional(n,r);if(o){var s=this.evaluate(a,o);void 0!==s&&("hide"===o.state&&(s=!s),e.isFunction(window[o.state_callback])?window[o.state_callback].call(t,s,t):t.toggle(s))}}}),this)},updateAll:function(){var i=e(".rwmb-field"),t=this;_.forEach(i,(function(a){var n=e(a),r=this.getFieldType(n),o=n.find(".rwmb-field-name").val();o&&(n.attr("id","field-"+o),-1!==_.indexOf(this.supportFields,r)&&n.find("input, select, textarea").on("change",(function(){t.update(e(this).closest(".rwmb-field"),i)})).trigger("change"))}),this)},getFieldType:function(i){var t=e(i);if(0===t.length)return!1;var a=t.get(0).className.match(/rwmb-([^\s]*)-wrapper/);return!!a&&a[1]},getFieldName:function(i){return e(i).find(".rwmb-field-name").val()},supportFields:["yes-no","text","number","radio"]}),e(document).ready((function(){void 0!==window.lp_conditional_logic&&new i({conditionals:lp_conditional_logic})}))}(jQuery)}});
assets/js/admin/editor/course.js CHANGED
@@ -36,19 +36,34 @@
36
/******/ // define getter function for harmony exports
37
/******/ __webpack_require__.d = function(exports, name, getter) {
38
/******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, {
40
- /******/ configurable: false,
41
- /******/ enumerable: true,
42
- /******/ get: getter
43
- /******/ });
44
/******/ }
45
/******/ };
46
/******/
47
/******/ // define __esModule on exports
48
/******/ __webpack_require__.r = function(exports) {
49
/******/ Object.defineProperty(exports, '__esModule', { value: true });
50
/******/ };
51
/******/
52
/******/ // getDefaultExport function for compatibility with non-harmony modules
53
/******/ __webpack_require__.n = function(module) {
54
/******/ var getter = module && module.__esModule ?
@@ -75,207 +90,188 @@
75
/*!**************************************************************!*\
76
!*** ./assets/src/js/admin/editor/actions/course-section.js ***!
77
\**************************************************************/
78
- /*! no static exports found */
79
- /***/ (function(module, exports, __webpack_require__) {
80
81
"use strict";
82
-
83
-
84
- Object.defineProperty(exports, "__esModule", {
85
- value: true
86
- });
87
var CourseCurriculum = {
88
- toggleAllSections: function toggleAllSections(context) {
89
- var hidden = context.getters['isHiddenAllSections'];
90
91
- if (hidden) {
92
- context.commit('OPEN_ALL_SECTIONS');
93
- } else {
94
- context.commit('CLOSE_ALL_SECTIONS');
95
- }
96
-
97
- LP.Request({
98
- type: 'hidden-sections',
99
- hidden: context.getters['hiddenSections']
100
- });
101
- },
102
-
103
- updateSectionsOrder: function updateSectionsOrder(context, order) {
104
- LP.Request({
105
- type: 'sort-sections',
106
- order: JSON.stringify(order)
107
- }).then(function (response) {
108
- var result = response.body;
109
- var order_sections = result.data;
110
- context.commit('SORT_SECTION', order_sections);
111
- }, function (error) {
112
- console.error(error);
113
- });
114
- },
115
-
116
- toggleSection: function toggleSection(context, section) {
117
- if (section.open) {
118
- context.commit('CLOSE_SECTION', section);
119
- } else {
120
- context.commit('OPEN_SECTION', section);
121
- }
122
-
123
- LP.Request({
124
- type: 'hidden-sections',
125
- hidden: context.getters['hiddenSections']
126
- });
127
- },
128
-
129
- updateSection: function updateSection(context, section) {
130
- context.commit('UPDATE_SECTION_REQUEST', section.id);
131
-
132
- LP.Request({
133
- type: 'update-section',
134
- section: JSON.stringify(section)
135
- }).then(function () {
136
- context.commit('UPDATE_SECTION_SUCCESS', section.id);
137
- }).catch(function () {
138
- context.commit('UPDATE_SECTION_FAILURE', section.id);
139
- });
140
- },
141
-
142
- removeSection: function removeSection(context, payload) {
143
- context.commit('REMOVE_SECTION', payload.index);
144
-
145
- LP.Request({
146
- type: 'remove-section',
147
- section_id: payload.section.id
148
- }).then(function (response) {
149
- var result = response.body;
150
- }, function (error) {
151
- console.error(error);
152
- });
153
- },
154
-
155
- newSection: function newSection(context, name) {
156
- var newSection = {
157
- type: 'new-section',
158
- section_name: name,
159
- temp_id: LP.uniqueId()
160
- };
161
- context.commit('ADD_NEW_SECTION', {
162
- id: newSection.temp_id,
163
- items: [],
164
- open: false,
165
- title: newSection.section_name
166
- });
167
-
168
- LP.Request(newSection).then(function (response) {
169
- var result = response.body;
170
-
171
- if (result.success) {
172
- var section = $.extend({}, result.data, { open: true });
173
-
174
- // update course section
175
- context.commit('ADD_NEW_SECTION', section);
176
- }
177
- }, function (error) {
178
- console.error(error);
179
- });
180
- },
181
-
182
- updateSectionItem: function updateSectionItem(context, payload) {
183
- context.commit('UPDATE_SECTION_ITEM_REQUEST', payload.item.id);
184
-
185
- LP.Request({
186
- type: 'update-section-item',
187
- section_id: payload.section_id,
188
- item: JSON.stringify(payload.item)
189
-
190
- }).then(function (response) {
191
- context.commit('UPDATE_SECTION_ITEM_SUCCESS', payload.item.id);
192
193
- var result = response.body;
194
- if (result.success) {
195
- var item = result.data;
196
197
- context.commit('UPDATE_SECTION_ITEM', { section_id: payload.section_id, item: item });
198
- }
199
- }, function (error) {
200
- context.commit('UPDATE_SECTION_ITEM_FAILURE', payload.item.id);
201
- console.error(error);
202
- });
203
- },
204
-
205
- removeSectionItem: function removeSectionItem(context, payload) {
206
- var id = payload.item.id;
207
- context.commit('REMOVE_SECTION_ITEM', payload);
208
- payload.item.temp_id = 0;
209
- LP.Request({
210
- type: 'remove-section-item',
211
- section_id: payload.section_id,
212
- item_id: id
213
- }).then(function () {
214
- context.commit('REMOVE_SECTION_ITEM', payload);
215
- });
216
- },
217
-
218
- deleteSectionItem: function deleteSectionItem(context, payload) {
219
- var id = payload.item.id;
220
- context.commit('REMOVE_SECTION_ITEM', payload);
221
- payload.item.temp_id = 0;
222
- LP.Request({
223
- type: 'delete-section-item',
224
- section_id: payload.section_id,
225
- item_id: id
226
- }).then(function () {
227
- context.commit('REMOVE_SECTION_ITEM', payload);
228
});
229
- },
230
-
231
- newSectionItem: function newSectionItem(context, payload) {
232
-
233
- context.commit('APPEND_EMPTY_ITEM_TO_SECTION', payload);
234
- //context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
235
- LP.Request({
236
- type: 'new-section-item',
237
- section_id: payload.section_id,
238
- item: JSON.stringify(payload.item)
239
- }).then(function (response) {
240
- var result = response.body;
241
-
242
- if (result.success) {
243
- // context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
244
- var items = {};
245
- $.each(result.data, function (i, a) {
246
- items[a.old_id ? a.old_id : a.id] = a;
247
- });
248
- context.commit('UPDATE_ITEM_SECTION_BY_ID', {
249
- section_id: payload.section_id,
250
- items: items
251
- });
252
- }
253
- }, function (error) {
254
- console.error(error);
255
});
256
- },
257
-
258
- updateSectionItems: function updateSectionItems(_ref, payload) {
259
- var state = _ref.state;
260
-
261
- LP.Request({
262
- type: 'update-section-items',
263
- section_id: payload.section_id,
264
- items: JSON.stringify(payload.items),
265
- last_section: state.sections[state.sections.length - 1] === payload.section_id
266
- }).then(function (response) {
267
- var result = response.body;
268
-
269
- if (result.success) {
270
- // console.log(result);
271
- }
272
- }, function (error) {
273
- console.error(error);
274
});
275
- }
276
};
277
-
278
- exports.default = CourseCurriculum;
279
280
/***/ }),
281
@@ -283,66 +279,58 @@ exports.default = CourseCurriculum;
283
/*!******************************************************!*\
284
!*** ./assets/src/js/admin/editor/actions/course.js ***!
285
\******************************************************/
286
- /*! no static exports found */
287
- /***/ (function(module, exports, __webpack_require__) {
288
289
"use strict";
290
-
291
-
292
- Object.defineProperty(exports, "__esModule", {
293
- value: true
294
- });
295
var Course = {
296
- heartbeat: function heartbeat(context) {
297
- LP.Request({
298
- type: 'heartbeat'
299
- }).then(function (response) {
300
- var result = response.body;
301
- context.commit('UPDATE_HEART_BEAT', !!result.success);
302
- }, function (error) {
303
- context.commit('UPDATE_HEART_BEAT', false);
304
- });
305
- },
306
-
307
- draftCourse: function draftCourse(context, payload) {
308
- var auto_draft = context.getters['autoDraft'];
309
-
310
- if (auto_draft) {
311
- LP.Request({
312
- type: 'draft-course',
313
- course: JSON.stringify(payload)
314
- }).then(function (response) {
315
- var result = response.body;
316
-
317
- if (!result.success) {
318
- return;
319
- }
320
-
321
- context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
322
- });
323
}
324
- },
325
326
- newRequest: function newRequest(context) {
327
- context.commit('INCREASE_NUMBER_REQUEST');
328
- context.commit('UPDATE_STATUS', 'loading');
329
-
330
- window.onbeforeunload = function () {
331
- return '';
332
- };
333
- },
334
335
- requestCompleted: function requestCompleted(context, status) {
336
- context.commit('DECREASE_NUMBER_REQUEST');
337
338
- if (context.getters.currentRequest === 0) {
339
- context.commit('UPDATE_STATUS', status);
340
- window.onbeforeunload = null;
341
- }
342
}
343
};
344
-
345
- exports.default = Course;
346
347
/***/ }),
348
@@ -350,91 +338,78 @@ exports.default = Course;
350
/*!******************************************************************!*\
351
!*** ./assets/src/js/admin/editor/actions/modal-course-items.js ***!
352
\******************************************************************/
353
- /*! no static exports found */
354
- /***/ (function(module, exports, __webpack_require__) {
355
356
"use strict";
357
-
358
-
359
- Object.defineProperty(exports, "__esModule", {
360
- value: true
361
- });
362
var ModalCourseItems = {
363
-
364
- toggle: function toggle(context) {
365
- context.commit('TOGGLE');
366
- },
367
-
368
- open: function open(context, sectionId) {
369
- context.commit('SET_SECTION', sectionId);
370
- context.commit('RESET');
371
- context.commit('TOGGLE');
372
- },
373
-
374
- searchItems: function searchItems(context, payload) {
375
- context.commit('SEARCH_ITEMS_REQUEST');
376
-
377
- LP.Request({
378
- type: 'search-items',
379
- query: payload.query,
380
- item_type: payload.type,
381
- page: payload.page,
382
- exclude: JSON.stringify([])
383
- }).then(function (response) {
384
- var result = response.body;
385
-
386
- if (!result.success) {
387
- return;
388
- }
389
-
390
- var data = result.data;
391
-
392
- context.commit('SET_LIST_ITEMS', data.items);
393
- context.commit('UPDATE_PAGINATION', data.pagination);
394
- context.commit('SEARCH_ITEMS_SUCCESS');
395
- }, function (error) {
396
- context.commit('SEARCH_ITEMS_FAILURE');
397
-
398
- console.error(error);
399
- });
400
- },
401
-
402
- addItem: function addItem(context, item) {
403
- context.commit('ADD_ITEM', item);
404
- },
405
-
406
- removeItem: function removeItem(context, index) {
407
- context.commit('REMOVE_ADDED_ITEM', index);
408
- },
409
-
410
- addItemsToSection: function addItemsToSection(context) {
411
- var items = context.getters.addedItems;
412
-
413
- if (items.length > 0) {
414
- LP.Request({
415
- type: 'add-items-to-section',
416
- section_id: context.getters.section,
417
- items: JSON.stringify(items)
418
- }).then(function (response) {
419
- var result = response.body;
420
-
421
- if (result.success) {
422
- context.commit('TOGGLE');
423
-
424
- var items = result.data;
425
- context.commit('ss/UPDATE_SECTION_ITEMS', {
426
- section_id: context.getters.section,
427
- items: items
428
- }, { root: true });
429
- }
430
- }, function (error) {
431
- console.error(error);
432
- });
433
}
434
}
435
};
436
-
437
- exports.default = ModalCourseItems;
438
439
/***/ }),
440
@@ -442,43 +417,36 @@ exports.default = ModalCourseItems;
442
/*!**********************************************!*\
443
!*** ./assets/src/js/admin/editor/course.js ***!
444
\**********************************************/
445
- /*! no static exports found */
446
- /***/ (function(module, exports, __webpack_require__) {
447
448
"use strict";
449
450
451
- var _http = __webpack_require__(/*! ./http */ "./assets/src/js/admin/editor/http.js");
452
-
453
- var _http2 = _interopRequireDefault(_http);
454
-
455
- var _course = __webpack_require__(/*! ./store/course */ "./assets/src/js/admin/editor/store/course.js");
456
-
457
- var _course2 = _interopRequireDefault(_course);
458
-
459
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
460
-
461
window.$Vue = window.$Vue || Vue;
462
window.$Vuex = window.$Vuex || Vuex;
463
-
464
var $ = window.jQuery;
465
-
466
/**
467
* Init app.
468
*
469
* @since 3.0.0
470
*/
471
- $(document).ready(function () {
472
473
- window.LP_Curriculum_Store = new $Vuex.Store((0, _course2.default)(lpAdminCourseEditorSettings));
474
- (0, _http2.default)({ ns: 'LPCurriculumRequest', store: LP_Curriculum_Store });
475
-
476
- setTimeout(function () {
477
- window.LP_Course_Editor = new $Vue({
478
- el: '#admin-editor-lp_course',
479
- template: '<lp-course-editor></lp-course-editor>'
480
- });
481
- }, 100);
482
});
483
484
/***/ }),
@@ -487,44 +455,38 @@ $(document).ready(function () {
487
/*!**************************************************************!*\
488
!*** ./assets/src/js/admin/editor/getters/course-section.js ***!
489
\**************************************************************/
490
- /*! no static exports found */
491
- /***/ (function(module, exports, __webpack_require__) {
492
493
"use strict";
494
-
495
-
496
- Object.defineProperty(exports, "__esModule", {
497
- value: true
498
- });
499
var CourseCurriculum = {
500
- sections: function sections(state) {
501
- return state.sections || [];
502
- },
503
- urlEdit: function urlEdit(state) {
504
- return state.urlEdit;
505
- },
506
- hiddenSections: function hiddenSections(state) {
507
- return state.sections.filter(function (section) {
508
- return !section.open;
509
- }).map(function (section) {
510
- return parseInt(section.id);
511
- });
512
- },
513
- isHiddenAllSections: function isHiddenAllSections(state, getters) {
514
- var sections = getters['sections'];
515
- var hiddenSections = getters['hiddenSections'];
516
-
517
- return hiddenSections.length === sections.length;
518
- },
519
- statusUpdateSection: function statusUpdateSection(state) {
520
- return state.statusUpdateSection;
521
- },
522
- statusUpdateSectionItem: function statusUpdateSectionItem(state) {
523
- return state.statusUpdateSectionItem;
524
- }
525
};
526
-
527
- exports.default = CourseCurriculum;
528
529
/***/ }),
530
@@ -532,46 +494,41 @@ exports.default = CourseCurriculum;
532
/*!******************************************************!*\
533
!*** ./assets/src/js/admin/editor/getters/course.js ***!
534
\******************************************************/
535
- /*! no static exports found */
536
- /***/ (function(module, exports, __webpack_require__) {
537
538
"use strict";
539
-
540
-
541
- Object.defineProperty(exports, "__esModule", {
542
- value: true
543
- });
544
var Course = {
545
- heartbeat: function heartbeat(state) {
546
- return state.heartbeat;
547
- },
548
- action: function action(state) {
549
- return state.action;
550
- },
551
- id: function id(state) {
552
- return state.course_id;
553
- },
554
- autoDraft: function autoDraft(state) {
555
- return state.auto_draft;
556
- },
557
- disable_curriculum: function disable_curriculum(state) {
558
- return state.disable_curriculum;
559
- },
560
- status: function status(state) {
561
- return state.status || 'error';
562
- },
563
- currentRequest: function currentRequest(state) {
564
- return state.countCurrentRequest || 0;
565
- },
566
- urlAjax: function urlAjax(state) {
567
- return state.ajax;
568
- },
569
- nonce: function nonce(state) {
570
- return state.nonce;
571
- }
572
};
573
-
574
- exports.default = Course;
575
576
/***/ }),
577
@@ -579,49 +536,42 @@ exports.default = Course;
579
/*!******************************************************************!*\
580
!*** ./assets/src/js/admin/editor/getters/modal-course-items.js ***!
581
\******************************************************************/
582
- /*! no static exports found */
583
- /***/ (function(module, exports, __webpack_require__) {
584
585
"use strict";
586
-
587
-
588
- Object.defineProperty(exports, "__esModule", {
589
- value: true
590
- });
591
-
592
var Getters = {
593
- status: function status(state) {
594
- return state.status;
595
- },
596
- pagination: function pagination(state) {
597
- return state.pagination;
598
- },
599
- items: function items(state, _getters) {
600
- return state.items.map(function (item) {
601
- var find = _getters.addedItems.find(function (_item) {
602
- return item.id === _item.id;
603
- });
604
-
605
- item.added = !!find;
606
-
607
- return item;
608
- });
609
- },
610
- addedItems: function addedItems(state) {
611
- return state.addedItems;
612
- },
613
- isOpen: function isOpen(state) {
614
- return state.open;
615
- },
616
- types: function types(state) {
617
- return state.types;
618
- },
619
- section: function section(state) {
620
- return state.sectionId;
621
- }
622
};
623
-
624
- exports.default = Getters;
625
626
/***/ }),
627
@@ -629,76 +579,68 @@ exports.default = Getters;
629
/*!********************************************!*\
630
!*** ./assets/src/js/admin/editor/http.js ***!
631
\********************************************/
632
- /*! no static exports found */
633
- /***/ (function(module, exports, __webpack_require__) {
634
635
"use strict";
636
637
638
- Object.defineProperty(exports, "__esModule", {
639
- value: true
640
- });
641
- exports.default = HTTP;
642
- function HTTP(options) {
643
- var $ = window.jQuery;
644
- var $VueHTTP = Vue.http;
645
-
646
- options = $.extend({
647
- ns: 'LPRequest',
648
- store: false
649
- }, options || {});
650
-
651
- var $publishingAction = null;
652
-
653
- LP.Request = function (payload) {
654
- $publishingAction = $('#publishing-action');
655
-
656
- payload['id'] = options.store.getters.id;
657
- payload['nonce'] = options.store.getters.nonce;
658
- payload['lp-ajax'] = options.store.getters.action;
659
- payload['code'] = options.store.getters.code;
660
-
661
- $publishingAction.find('#publish').addClass('disabled');
662
- $publishingAction.find('.spinner').addClass('is-active');
663
- $publishingAction.addClass('code-' + payload['code']);
664
-
665
- return $VueHTTP.post(options.store.getters.urlAjax, payload, {
666
- emulateJSON: true,
667
- params: {
668
- namespace: options.ns,
669
- code: payload['code']
670
- }
671
- });
672
- };
673
674
- $VueHTTP.interceptors.push(function (request, next) {
675
- if (request.params['namespace'] !== options.ns) {
676
- next();
677
- return;
678
- }
679
680
- options.store.dispatch('newRequest');
681
-
682
- next(function (response) {
683
- if (!jQuery.isPlainObject(response.body)) {
684
- response.body = LP.parseJSON(response.body);
685
- }
686
-
687
- var body = response.body;
688
- var result = body.success || false;
689
-
690
- if (result) {
691
- options.store.dispatch('requestCompleted', 'successful');
692
- } else {
693
- options.store.dispatch('requestCompleted', 'failed');
694
- }
695
- $publishingAction.removeClass('code-' + request.params.code);
696
- if (!$publishingAction.attr('class')) {
697
- $publishingAction.find('#publish').removeClass('disabled');
698
- $publishingAction.find('.spinner').removeClass('is-active');
699
- }
700
- });
701
});
702
}
703
704
/***/ }),
@@ -707,187 +649,172 @@ function HTTP(options) {
707
/*!****************************************************************!*\
708
!*** ./assets/src/js/admin/editor/mutations/course-section.js ***!
709
\****************************************************************/
710
- /*! no static exports found */
711
- /***/ (function(module, exports, __webpack_require__) {
712
713
"use strict";
714
-
715
-
716
- Object.defineProperty(exports, "__esModule", {
717
- value: true
718
- });
719
var CourseCurriculum = {
720
- 'SORT_SECTION': function SORT_SECTION(state, orders) {
721
- state.sections = state.sections.map(function (section) {
722
- section.order = orders[section.id];
723
-
724
- return section;
725
- });
726
- },
727
- 'SET_SECTIONS': function SET_SECTIONS(state, sections) {
728
- state.sections = sections;
729
- },
730
- 'ADD_NEW_SECTION': function ADD_NEW_SECTION(state, newSection) {
731
- if (newSection.open === undefined) {
732
- newSection.open = true;
733
- }
734
- var pos;
735
-
736
- if (newSection.temp_id) {
737
- state.sections.map(function (section, i) {
738
- if (newSection.temp_id == section.id) {
739
- pos = i;
740
- return false;
741
- }
742
- });
743
- }
744
-
745
- if (pos !== undefined) {
746
- $Vue.set(state.sections, pos, newSection);
747
- } else {
748
- state.sections.push(newSection);
749
- }
750
- },
751
- 'ADD_EMPTY_SECTION': function ADD_EMPTY_SECTION(state, section) {
752
- section.open = true;
753
- state.sections.push(section);
754
- },
755
- 'REMOVE_SECTION': function REMOVE_SECTION(state, index) {
756
- state.sections.splice(index, 1);
757
- },
758
- 'REMOVE_SECTION_ITEM': function REMOVE_SECTION_ITEM(state, payload) {
759
-
760
- var section = state.sections.find(function (section) {
761
- return section.id === payload.section_id;
762
- });
763
764
- var items = section.items || [],
765
- item = payload.item,
766
- index = -1;
767
- items.forEach(function (it, i) {
768
- if (it.id === item.id) {
769
- index = i;
770
- }
771
- });
772
773
- if (index !== -1) {
774
- if (item.temp_id) {
775
- items[index].id = item.temp_id;
776
- } else {
777
- items.splice(index, 1);
778
- }
779
}
780
- },
781
- 'UPDATE_SECTION_ITEMS': function UPDATE_SECTION_ITEMS(state, payload) {
782
- var section = state.sections.find(function (section) {
783
- return parseInt(section.id) === parseInt(payload.section_id);
784
- });
785
-
786
- if (!section) {
787
- return;
788
- }
789
- section.items = payload.items;
790
- },
791
- 'UPDATE_SECTION_ITEM': function UPDATE_SECTION_ITEM(state, payload) {},
792
-
793
- 'CLOSE_SECTION': function CLOSE_SECTION(state, section) {
794
- state.sections.forEach(function (_section, index) {
795
- if (section.id === _section.id) {
796
- state.sections[index].open = false;
797
- }
798
- });
799
- },
800
-
801
- 'OPEN_SECTION': function OPEN_SECTION(state, section) {
802
- state.sections.forEach(function (_section, index) {
803
- if (section.id === _section.id) {
804
- state.sections[index].open = true;
805
- }
806
- });
807
- },
808
-
809
- 'OPEN_ALL_SECTIONS': function OPEN_ALL_SECTIONS(state) {
810
- state.sections = state.sections.map(function (_section) {
811
- _section.open = true;
812
-
813
- return _section;
814
- });
815
- },
816
-
817
- 'CLOSE_ALL_SECTIONS': function CLOSE_ALL_SECTIONS(state) {
818
- state.sections = state.sections.map(function (_section) {
819
- _section.open = false;
820
-
821
- return _section;
822
- });
823
- },
824
825
- 'UPDATE_SECTION_REQUEST': function UPDATE_SECTION_REQUEST(state, sectionId) {
826
- $Vue.set(state.statusUpdateSection, sectionId, 'updating');
827
- },
828
829
- 'UPDATE_SECTION_SUCCESS': function UPDATE_SECTION_SUCCESS(state, sectionId) {
830
- $Vue.set(state.statusUpdateSection, sectionId, 'successful');
831
- },
832
833
- 'UPDATE_SECTION_FAILURE': function UPDATE_SECTION_FAILURE(state, sectionId) {
834
- $Vue.set(state.statusUpdateSection, sectionId, 'failed');
835
- },
836
837
- 'UPDATE_SECTION_ITEM_REQUEST': function UPDATE_SECTION_ITEM_REQUEST(state, itemId) {
838
- $Vue.set(state.statusUpdateSectionItem, itemId, 'updating');
839
- },
840
841
- 'UPDATE_SECTION_ITEM_SUCCESS': function UPDATE_SECTION_ITEM_SUCCESS(state, itemId) {
842
- $Vue.set(state.statusUpdateSectionItem, itemId, 'successful');
843
- },
844
845
- 'UPDATE_SECTION_ITEM_FAILURE': function UPDATE_SECTION_ITEM_FAILURE(state, itemId) {
846
- $Vue.set(state.statusUpdateSectionItem, itemId, 'failed');
847
- },
848
- 'APPEND_EMPTY_ITEM_TO_SECTION': function APPEND_EMPTY_ITEM_TO_SECTION(state, data) {
849
850
- var section = state.sections.find(function (section) {
851
- return parseInt(section.id) === parseInt(data.section_id);
852
- });
853
854
- if (!section) {
855
- return;
856
}
857
858
- section.items.push({ id: data.item.id, title: data.item.title, type: 'empty-item' });
859
- },
860
- 'UPDATE_ITEM_SECTION_BY_ID': function UPDATE_ITEM_SECTION_BY_ID(state, data) {
861
- var section = state.sections.find(function (section) {
862
- return parseInt(section.id) === parseInt(data.section_id);
863
- });
864
865
- if (!section) {
866
- return;
867
}
868
869
- for (var i = 0; i < section.items.length; i++) {
870
- try {
871
- if (!section.items[i]) {
872
- continue;
873
- }
874
-
875
- var item_id = section.items[i].id;
876
- if (item_id) {
877
- if (data.items[item_id]) {
878
- $Vue.set(section.items, i, data.items[item_id]);
879
- }
880
- }
881
- } catch (ex) {
882
- console.log(ex);
883
- }
884
- }
885
-
886
- //section.items.push({id: data.item.id, title: data.item.title, type: 'empty-item'});
887
- }
888
};
889
-
890
- exports.default = CourseCurriculum;
891
892
/***/ }),
893
@@ -895,40 +822,30 @@ exports.default = CourseCurriculum;
895
/*!********************************************************!*\
896
!*** ./assets/src/js/admin/editor/mutations/course.js ***!
897
\********************************************************/
898
- /*! no static exports found */
899
- /***/ (function(module, exports, __webpack_require__) {
900
901
"use strict";
902
-
903
-
904
- Object.defineProperty(exports, "__esModule", {
905
- value: true
906
- });
907
var Course = {
908
-
909
- 'UPDATE_HEART_BEAT': function UPDATE_HEART_BEAT(state, status) {
910
- state.heartbeat = !!status;
911
- },
912
-
913
- 'UPDATE_AUTO_DRAFT_STATUS': function UPDATE_AUTO_DRAFT_STATUS(state, status) {
914
- // check auto draft status
915
- state.auto_draft = status;
916
- },
917
-
918
- 'UPDATE_STATUS': function UPDATE_STATUS(state, status) {
919
- state.status = status;
920
- },
921
-
922
- 'INCREASE_NUMBER_REQUEST': function INCREASE_NUMBER_REQUEST(state) {
923
- state.countCurrentRequest++;
924
- },
925
-
926
- 'DECREASE_NUMBER_REQUEST': function DECREASE_NUMBER_REQUEST(state) {
927
- state.countCurrentRequest--;
928
- }
929
};
930
-
931
- exports.default = Course;
932
933
/***/ }),
934
@@ -936,54 +853,49 @@ exports.default = Course;
936
/*!********************************************************************!*\
937
!*** ./assets/src/js/admin/editor/mutations/modal-course-items.js ***!
938
\********************************************************************/
939
- /*! no static exports found */
940
- /***/ (function(module, exports, __webpack_require__) {
941
942
"use strict";
943
-
944
-
945
- Object.defineProperty(exports, "__esModule", {
946
- value: true
947
- });
948
var Mutations = {
949
- 'TOGGLE': function TOGGLE(state) {
950
- state.open = !state.open;
951
- },
952
- 'SET_SECTION': function SET_SECTION(state, sectionId) {
953
- state.sectionId = sectionId;
954
- },
955
- 'SET_LIST_ITEMS': function SET_LIST_ITEMS(state, items) {
956
- state.items = items;
957
- },
958
- 'ADD_ITEM': function ADD_ITEM(state, item) {
959
- state.addedItems.push(item);
960
- },
961
- 'REMOVE_ADDED_ITEM': function REMOVE_ADDED_ITEM(state, item) {
962
- state.addedItems.forEach(function (_item, index) {
963
- if (_item.id === item.id) {
964
- state.addedItems.splice(index, 1);
965
- }
966
- });
967
- },
968
- 'RESET': function RESET(state) {
969
- state.addedItems = [];
970
- state.items = [];
971
- },
972
- 'UPDATE_PAGINATION': function UPDATE_PAGINATION(state, pagination) {
973
- state.pagination = pagination;
974
- },
975
- 'SEARCH_ITEMS_REQUEST': function SEARCH_ITEMS_REQUEST(state) {
976
- state.status = 'loading';
977
- },
978
- 'SEARCH_ITEMS_SUCCESS': function SEARCH_ITEMS_SUCCESS(state) {
979
- state.status = 'successful';
980
- },
981
- 'SEARCH_ITEMS_FAILURE': function SEARCH_ITEMS_FAILURE(state) {
982
- state.status = 'failed';
983
- }
984
};
985
-
986
- exports.default = Mutations;
987
988
/***/ }),
989
@@ -991,57 +903,38 @@ exports.default = Mutations;
991
/*!************************************************************!*\
992
!*** ./assets/src/js/admin/editor/store/course-section.js ***!
993
\************************************************************/
994
- /*! no static exports found */
995
- /***/ (function(module, exports, __webpack_require__) {
996
997
"use strict";
998
999
1000
- Object.defineProperty(exports, "__esModule", {
1001
- value: true
1002
- });
1003
-
1004
- exports.default = function (data) {
1005
- var state = $.extend({}, data.sections);
1006
-
1007
- state.statusUpdateSection = {};
1008
- state.statusUpdateSectionItem = {};
1009
-
1010
- state.sections = state.sections.map(function (section) {
1011
- var hiddenSections = state.hidden_sections;
1012
- var find = hiddenSections.find(function (sectionId) {
1013
- return parseInt(section.id) === parseInt(sectionId);
1014
- });
1015
-
1016
- section.open = !find;
1017
-
1018
- return section;
1019
- });
1020
-
1021
- return {
1022
- namespaced: true,
1023
- state: state,
1024
- getters: _courseSection6.default,
1025
- mutations: _courseSection4.default,
1026
- actions: _courseSection2.default
1027
- };
1028
- };
1029
-
1030
- var _courseSection = __webpack_require__(/*! ../actions/course-section */ "./assets/src/js/admin/editor/actions/course-section.js");
1031
-
1032
- var _courseSection2 = _interopRequireDefault(_courseSection);
1033
-
1034
- var _courseSection3 = __webpack_require__(/*! ../mutations/course-section */ "./assets/src/js/admin/editor/mutations/course-section.js");
1035
-
1036
- var _courseSection4 = _interopRequireDefault(_courseSection3);
1037
-
1038
- var _courseSection5 = __webpack_require__(/*! ../getters/course-section */ "./assets/src/js/admin/editor/getters/course-section.js");
1039
-
1040
- var _courseSection6 = _interopRequireDefault(_courseSection5);
1041
-
1042
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1043
1044
var $ = jQuery;
1045
1046
/***/ }),
1047
@@ -1049,64 +942,44 @@ var $ = jQuery;
1049
/*!****************************************************!*\
1050
!*** ./assets/src/js/admin/editor/store/course.js ***!
1051
\****************************************************/
1052
- /*! no static exports found */
1053
- /***/ (function(module, exports, __webpack_require__) {
1054
1055
"use strict";
1056
1057
1058
- Object.defineProperty(exports, "__esModule", {
1059
- value: true
1060
- });
1061
-
1062
- var _modalCourseItems = __webpack_require__(/*! ../store/modal-course-items */ "./assets/src/js/admin/editor/store/modal-course-items.js");
1063
-
1064
- var _modalCourseItems2 = _interopRequireDefault(_modalCourseItems);
1065
-
1066
- var _courseSection = __webpack_require__(/*! ../store/course-section */ "./assets/src/js/admin/editor/store/course-section.js");
1067
-
1068
- var _courseSection2 = _interopRequireDefault(_courseSection);
1069
-
1070
- var _i18n = __webpack_require__(/*! ../store/i18n */ "./assets/src/js/admin/editor/store/i18n.js");
1071
-
1072
- var _i18n2 = _interopRequireDefault(_i18n);
1073
-
1074
- var _course = __webpack_require__(/*! ../getters/course */ "./assets/src/js/admin/editor/getters/course.js");
1075
1076
- var _course2 = _interopRequireDefault(_course);
1077
1078
- var _course3 = __webpack_require__(/*! ../mutations/course */ "./assets/src/js/admin/editor/mutations/course.js");
1079
1080
- var _course4 = _interopRequireDefault(_course3);
1081
-
1082
- var _course5 = __webpack_require__(/*! ../actions/course */ "./assets/src/js/admin/editor/actions/course.js");
1083
-
1084
- var _course6 = _interopRequireDefault(_course5);
1085
-
1086
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1087
1088
var $ = window.jQuery;
1089
var Course = function Course(data) {
1090
- var state = $.extend({}, data.root);
1091
-
1092
- state.status = 'success';
1093
- state.heartbeat = true;
1094
- state.countCurrentRequest = 0;
1095
-
1096
- return {
1097
- state: state,
1098
- getters: _course2.default,
1099
- mutations: _course4.default,
1100
- actions: _course6.default,
1101
- modules: {
1102
- ci: (0, _modalCourseItems2.default)(data),
1103
- i18n: (0, _i18n2.default)(data.i18n),
1104
- ss: (0, _courseSection2.default)(data)
1105
- }
1106
- };
1107
};
1108
1109
- exports.default = Course;
1110
1111
/***/ }),
1112
@@ -1114,32 +987,28 @@ exports.default = Course;
1114
/*!**************************************************!*\
1115
!*** ./assets/src/js/admin/editor/store/i18n.js ***!
1116
\**************************************************/
1117
- /*! no static exports found */
1118
- /***/ (function(module, exports, __webpack_require__) {
1119
1120
"use strict";
1121
-
1122
-
1123
- Object.defineProperty(exports, "__esModule", {
1124
- value: true
1125
- });
1126
var $ = window.jQuery;
1127
- var i18n = function i18n(i18n) {
1128
- var state = $.extend({}, i18n);
1129
- var getters = {
1130
- all: function all(state) {
1131
- return state;
1132
- }
1133
- };
1134
1135
- return {
1136
- namespaced: true,
1137
- state: state,
1138
- getters: getters
1139
- };
1140
};
1141
1142
- exports.default = i18n;
1143
1144
/***/ }),
1145
@@ -1147,46 +1016,31 @@ exports.default = i18n;
1147
/*!****************************************************************!*\
1148
!*** ./assets/src/js/admin/editor/store/modal-course-items.js ***!
1149
\****************************************************************/
1150
- /*! no static exports found */
1151
- /***/ (function(module, exports, __webpack_require__) {
1152
1153
"use strict";
1154
1155
1156
- Object.defineProperty(exports, "__esModule", {
1157
- value: true
1158
- });
1159
-
1160
- exports.default = function (data) {
1161
- var state = $.extend({}, data.chooseItems);
1162
- state.sectionId = false;
1163
- state.pagination = '';
1164
- state.status = '';
1165
-
1166
- return {
1167
- namespaced: true,
1168
- state: state,
1169
- getters: _modalCourseItems2.default,
1170
- mutations: _modalCourseItems4.default,
1171
- actions: _modalCourseItems6.default
1172
- };
1173
- };
1174
-
1175
- var _modalCourseItems = __webpack_require__(/*! ../getters/modal-course-items */ "./assets/src/js/admin/editor/getters/modal-course-items.js");
1176
-
1177
- var _modalCourseItems2 = _interopRequireDefault(_modalCourseItems);
1178