| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template curriculum course. |
| 4 |
* |
| 5 |
* @since 3.0.0 |
| 6 |
*/ |
| 7 |
|
| 8 |
learn_press_admin_view( 'course/sections' ); |
| 9 |
?> |
| 10 |
|
| 11 |
<script type="text/x-template" id="tmpl-lp-course-curriculum"> |
| 12 |
<div class="lp-course-curriculum"> |
| 13 |
<div class="heading"> |
| 14 |
<h4><?php esc_html_e( 'Details', 'learnpress' ); ?> <span :class="['status', status]"></span></h4> |
| 15 |
<div class="section-item-counts"><span>{{countAllItems()}}</span></div> |
| 16 |
<span class="collapse-sections" @click="toggle" :class="isOpen ? 'open' : 'close'"></span> |
| 17 |
</div> |
| 18 |
<lp-list-sections></lp-list-sections> |
| 19 |
</div> |
| 20 |
</script> |
| 21 |
|
| 22 |
<script type="text/javascript"> |
| 23 |
|
| 24 |
window.$Vue = window.$Vue = Vue; |
| 25 |
|
| 26 |
jQuery( function( $ ) { |
| 27 |
( function( $store ) { |
| 28 |
$Vue.component( 'lp-curriculum', { |
| 29 |
template: '#tmpl-lp-course-curriculum', |
| 30 |
computed: { |
| 31 |
status: function() { |
| 32 |
return $store.getters.status; |
| 33 |
}, |
| 34 |
isOpen: function() { |
| 35 |
return ! $store.getters['ss/isHiddenAllSections']; |
| 36 |
} |
| 37 |
}, |
| 38 |
methods: { |
| 39 |
toggle: function() { |
| 40 |
$store.dispatch( 'ss/toggleAllSections' ); |
| 41 |
}, |
| 42 |
countAllItems: function() { |
| 43 |
var count = 0, |
| 44 |
labels = $store.getters['i18n/all'].item_labels; |
| 45 |
|
| 46 |
$.each( $store.getters['ss/sections'], function ( i, section ) { |
| 47 |
count += section.items.length; |
| 48 |
}); |
| 49 |
|
| 50 |
return count + ' ' + (count <= 1 ? labels.singular : labels.plural); |
| 51 |
} |
| 52 |
} |
| 53 |
}); |
| 54 |
|
| 55 |
})( LP_Curriculum_Store ); |
| 56 |
}); |
| 57 |
</script> |
| 58 |
|