PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.3
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.3
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 / course / sections.php

sections.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.3, at inc/admin/views/course/sections.php

67 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 * Template list sections.
4 *
5 * @since 3.0.0
6 */
7
8 learn_press_admin_view( 'course/section' );
9 learn_press_admin_view( 'course/new-section' );
10 ?>
11
12 <script type="text/x-template" id="tmpl-lp-list-sections">
13 <div class="curriculum-sections">
14 <lp-section v-for="(section, index) in sections" :section="section" :index="index" :disableCurriculum="disableCurriculum" :key="index"></lp-section>
15
16 <div class="add-new-section" v-if="!disableCurriculum">
17 <lp-new-section></lp-new-section>
18 </div>
19 </div>
20 </script>
21
22 <script type="text/javascript">
23 window.$Vue = window.$Vue || Vue;
24
25 jQuery( function( $ ) {
26 ( function( $store ) {
27 $Vue.component( 'lp-list-sections', {
28 template: '#tmpl-lp-list-sections',
29 computed: {
30 sections: function() {
31 return $store.getters['ss/sections'];
32 },
33 disableCurriculum: function() {
34 return $store.getters['disable_curriculum'];
35 }
36 },
37 created: function() {
38 var _self = this;
39
40 setTimeout( function() {
41 var $el = $( '.curriculum-sections' );
42
43 $el.sortable({
44 handle: '.section-head .movable',
45 axis: 'y',
46 items: "> .section",
47 update: function () {
48 _self.sort();
49 }
50 });
51 }, 1000 );
52 },
53 methods: {
54 sort: function() {
55 var _items = $( '.curriculum-sections>div.section' ),
56 order = _items.map( function() {
57 return $( this ).data( 'section-id' );
58 }).get();
59
60 $store.dispatch( 'ss/updateSectionsOrder', order );
61 }
62 }
63 });
64 })( LP_Curriculum_Store );
65 });
66 </script>
67