PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.6.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.6.9
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / quiz / questions.php

questions.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.6.9, at inc/admin/views/quiz/questions.php

59 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Quiz Editor: List questions.
4 *
5 * @since 3.0.0
6 */
7
8 learn_press_admin_view( 'quiz/question' );
9 ?>
10
11 <script type="text/x-template" id="tmpl-lp-quiz-questions">
12 <div class="main">
13 <lp-quiz-question-item v-for="(question, index) in questions" :question="question" :index="index" :key="index"></lp-quiz-question-item>
14 </div>
15 </script>
16
17 <script type="text/javascript">
18 jQuery( function($) {
19 var $Vue = window.$Vue || Vue;
20 var $store = window.LP_Quiz_Store;
21
22 $Vue.component('lp-quiz-questions', {
23 template: '#tmpl-lp-quiz-questions',
24 computed: {
25 questions: function() {
26 return $store.getters['lqs/listQuestions'];
27 }
28 },
29 mounted: function() {
30 var _self = this;
31 setTimeout(function() {
32 var $el = $('.lp-list-questions .main');
33
34 $el.sortable({
35 handle: '.question-actions .sort',
36 axis: 'y',
37 update: function () {
38 _self.sort();
39 }
40 });
41 }, 1000)
42 },
43 methods: {
44 sort: function() {
45 var _items = $('.lp-list-questions .main>div.question-item');
46 var _order = [];
47
48 _items.each(function (index, item) {
49 $(item).find('.question-actions .order').text(index + 1);
50 _order.push($(item).data('item-id'));
51 });
52
53 $store.dispatch('lqs/updateQuestionsOrder', _order);
54 }
55 }
56 });
57 });
58 </script>
59