PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.1
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 4.2.1 All 138 releases
learnpress / inc / admin / views / question / actions.php

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

77 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin question editor: question actions template.
4 *
5 * @author ThimPress <nhamdv>
6 * @since 4.0.0
7 */
8 ?>
9
10 <script type="text/x-template" id="tmpl-lp-question-actions">
11 <div class="lp-box-data-head lp-row">
12 <h3 class="heading"><?php esc_html_e( 'Details', 'learnpress' ); ?></h3>
13 <div class="lp-question-editor lp-question-editor--right">
14 <div class="lp-question-editor__inner">
15 <div class="question-types">
16 <a>{{typeLabel()}}</a>
17 <ul>
18 <li v-for="(type, key) in types" :data-type="key" :class="active(key)">
19 <a href="" @click.prevent="changeType(key)">{{type}}</a>
20 </li>
21 </ul>
22 </div>
23 </div>
24 </div>
25 </div>
26 </script>
27
28 <script type="text/javascript">
29 jQuery( function( $ ) {
30 var $store = window.LP_Question_Store;
31 var pick = lodash.pick;
32
33 window.$Vue = window.$Vue || Vue;
34
35 $Vue.component( 'lp-question-actions', {
36 template: '#tmpl-lp-question-actions',
37 props: ['type'],
38 computed: {
39 types: function() {
40 return $store.getters['types']
41 }
42 },
43 methods: {
44 typeLabel: function() {
45 var types = this.types;
46 return types[this.type];
47 },
48 active: function( type ) {
49 var classes = [''];
50
51 if ( this.type === type ) {
52 classes.push('active');
53 }
54
55 var supportTypes = $store.getters['supportAnswerOptions'];
56
57 if ( supportTypes.indexOf( type ) === -1 || supportTypes.indexOf( this.type ) === -1 ) {
58 classes.push( 'disabled' )
59 }
60
61 return classes;
62 },
63 changeType: function( type ) {
64 if ( this.type !== type ) {
65 this.$emit( 'changeType', type );
66 }
67 },
68 getQuestionsSupportAnswerOptions: function() {
69 var supportTypes = $store.getters['supportAnswerOptions'];
70
71 return supportTypes.indexOf( this.type ) !== -1 ? pick( this.types, supportTypes ) : false;
72 }
73 }
74 });
75 });
76 </script>
77