PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.6.9.3
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.6.9.3
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 / question.php

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

60 lines 1.5 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: Question item.
4 *
5 * @since 3.0.0
6 */
7
8 learn_press_admin_view( 'quiz/question-actions' );
9 learn_press_admin_view( 'quiz/question-settings' );
10 ?>
11
12 <script type="text/x-template" id="tmpl-lp-quiz-question-item">
13 <div :class="['question-item',question.type.key, isNew() ? 'empty-question' : '']" :data-item-id="question.id" :data-question-order="index">
14 <lp-quiz-question-actions :question="question" :index="index" @nav="navItem"></lp-quiz-question-actions>
15 <lp-quiz-question-settings :question="question" :index="index"></lp-quiz-question-settings>
16 </div>
17 </script>
18
19 <script type="text/javascript">
20 jQuery(function ($) {
21 var $Vue = window.$Vue || Vue;
22 var $store = window.LP_Quiz_Store;
23
24 $Vue.component('lp-quiz-question-item', {
25 template: '#tmpl-lp-quiz-question-item',
26 props: ['question', 'index'],
27 computed: {
28 numberQuestions: function () {
29 return ($store.getters['lqs/listQuestions']).length;
30 }
31 },
32 methods: {
33 // navigation questions in quiz
34 navItem: function (payload) {
35
36 var keyCode = payload.key,
37 order = payload.order;
38
39 if (keyCode === 38 && order !== 0) {
40 this.nav(order - 1);
41 }
42 if ((keyCode === 40 || keyCode === 13) && this.numberQuestions !== order) {
43 this.nav(order + 1);
44 }
45
46 },
47 // focus item
48 nav: function (position) {
49 var element = 'div[data-question-order=' + position + ']';
50 ($(element).find('.name input')).focus();
51 },
52 isNew: function () {
53 return isNaN(this.question.id);
54 }
55 }
56 });
57
58 })
59 </script>
60