2019-05-21 06:34:50 +00:00
|
|
|
{% extends "templates/base.html" %}
|
2019-05-29 07:41:34 +00:00
|
|
|
{% block title %}{{ content.name or 'Content Page' }}{% endblock %}
|
2019-05-21 06:34:50 +00:00
|
|
|
|
|
|
|
{% block head_include %}
|
|
|
|
<style>
|
2019-06-06 10:32:38 +00:00
|
|
|
.lms-content {
|
|
|
|
line-height: 1.8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.lms-content h1 {
|
|
|
|
margin-top: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.lms-content h2 {
|
|
|
|
margin-top: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.lms-content h3 {
|
|
|
|
margin-top: 0.8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.lms-content h4 {
|
|
|
|
margin-top: 0.6em;
|
|
|
|
}
|
|
|
|
|
2019-06-06 08:33:01 +00:00
|
|
|
section {
|
|
|
|
padding: 5rem 0 5rem 0;
|
|
|
|
}
|
|
|
|
.plyr--video .plyr__control.plyr__tab-focus,
|
|
|
|
.plyr--video .plyr__control:hover,
|
|
|
|
.plyr--video .plyr__control[aria-expanded='true'] {
|
|
|
|
background: #5e64ff !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.plyr__control--overlaid:focus,
|
|
|
|
.plyr__control--overlaid:hover {
|
|
|
|
background: #5e64ff !important;
|
2019-05-21 06:34:50 +00:00
|
|
|
}
|
|
|
|
|
2019-06-06 08:33:01 +00:00
|
|
|
.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::before {
|
|
|
|
background: #5e64ff !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.plyr__menu__container
|
|
|
|
.plyr__control[role='menuitemradio'][aria-checked='true']::before {
|
|
|
|
background: #5e64ff;
|
|
|
|
}
|
|
|
|
.plyr--full-ui input[type='range'] {
|
|
|
|
color: #5e64ff !important;
|
2019-05-21 06:34:50 +00:00
|
|
|
}
|
|
|
|
|
2019-06-06 08:33:01 +00:00
|
|
|
.plyr__control--overlaid {
|
|
|
|
background: rgba(94, 100, 255, 0.8) !important;
|
2019-05-21 06:34:50 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<link rel="stylesheet" href="https://cdn.plyr.io/3.5.3/plyr.css" />
|
|
|
|
{% endblock %}
|
|
|
|
|
2019-06-06 08:33:01 +00:00
|
|
|
{% macro title() %}
|
|
|
|
<div class="mb-3">
|
2019-06-12 09:52:42 +00:00
|
|
|
<a href="/lms/course?name={{ course }}&program={{ program }}" class="text-muted">
|
2020-06-22 05:36:12 +00:00
|
|
|
{{_('Back to Course')}}
|
2019-06-06 08:33:01 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2020-04-03 04:38:19 +00:00
|
|
|
<h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{length}})</span></h2>
|
2019-06-06 08:33:01 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2019-05-21 06:34:50 +00:00
|
|
|
{% macro navigation() %}
|
2019-06-06 08:33:01 +00:00
|
|
|
{% if previous %}
|
2020-06-22 05:36:12 +00:00
|
|
|
<a href="/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ previous.content_type }}&content={{ previous.content }}" class='btn text-muted' style="box-shadow: none;">{{_('Previous')}}</a>
|
2019-06-06 08:33:01 +00:00
|
|
|
{% else %}
|
2020-06-22 05:36:12 +00:00
|
|
|
<a href="/lms/course?name={{ course }}&program={{ program }}" class='btn text-muted' style="box-shadow: none;">{{ _('Back to Course') }}</a>
|
2019-06-06 08:33:01 +00:00
|
|
|
{% endif %}
|
2019-05-21 06:34:50 +00:00
|
|
|
|
2019-06-06 08:33:01 +00:00
|
|
|
{% if next %}
|
2020-06-22 05:36:12 +00:00
|
|
|
<button id="nextButton" onclick="handle('/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ next.content_type }}&content={{ next.content }}')" class='btn btn-primary' disabled="true">{{_('Next')}}</button>
|
2019-06-06 08:33:01 +00:00
|
|
|
{% else %}
|
2020-06-22 05:36:12 +00:00
|
|
|
<button id="nextButton" onclick="handle('/lms/course?name={{ course }}&program={{ program }}')" class='btn btn-primary' disabled="true">{{_('Finish Topic')}}</button>
|
2019-06-06 08:33:01 +00:00
|
|
|
{% endif %}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro video() %}
|
|
|
|
<div class="mb-5">
|
2019-06-06 08:33:01 +00:00
|
|
|
{{ title() }}
|
2019-05-21 06:34:50 +00:00
|
|
|
<div class="text-muted">
|
|
|
|
{% if content.duration %}
|
2020-06-22 05:36:12 +00:00
|
|
|
{{ content.duration }} {{_('Mins')}}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if content.publish_date and content.duration%}
|
|
|
|
-
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if content.publish_date %}
|
2020-06-22 05:36:12 +00:00
|
|
|
{{_('Published on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="player" data-plyr-provider="{{ content.provider|lower }}" data-plyr-embed-id="{{ content.url }}"></div>
|
2019-06-06 10:32:38 +00:00
|
|
|
<div class="my-5 lms-content">
|
2019-05-21 06:34:50 +00:00
|
|
|
{{ content.description }}
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro article() %}
|
|
|
|
<div class="mb-5">
|
2019-06-06 08:33:01 +00:00
|
|
|
{{ title() }}
|
2019-05-21 06:34:50 +00:00
|
|
|
<div class="text-muted">
|
|
|
|
{% if content.author or content.publish_date %}
|
2020-06-22 05:36:12 +00:00
|
|
|
{{_('Published')}}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if content.author %}
|
2020-06-22 05:36:12 +00:00
|
|
|
{{_('by')}} {{ content.author }}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if content.publish_date %}
|
2020-06-22 05:36:12 +00:00
|
|
|
{{_('on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-06 10:32:38 +00:00
|
|
|
<div class="lms-content">
|
2019-05-21 06:34:50 +00:00
|
|
|
{{ content.content }}
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2019-06-03 07:27:38 +00:00
|
|
|
{% macro quiz() %}
|
|
|
|
<div class="mb-5">
|
2019-06-06 08:33:01 +00:00
|
|
|
{{ title() }}
|
2019-06-03 07:27:38 +00:00
|
|
|
</div>
|
|
|
|
<div id="quiz-wrapper">
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2019-05-21 06:34:50 +00:00
|
|
|
{% block content %}
|
|
|
|
<section class="section">
|
|
|
|
<div>
|
|
|
|
<div class='container pb-5'>
|
|
|
|
{% if content_type=='Video' %}
|
|
|
|
{{ video() }}
|
|
|
|
{% elif content_type=='Article'%}
|
|
|
|
{{ article() }}
|
|
|
|
{% elif content_type=='Quiz' %}
|
2019-06-03 07:27:38 +00:00
|
|
|
{{ quiz() }}
|
2019-05-21 06:34:50 +00:00
|
|
|
{% endif %}
|
2019-06-06 08:33:01 +00:00
|
|
|
<div class="pull-right" {{ 'hidden' if content_type=='Quiz'}}>
|
|
|
|
{{ navigation() }}
|
|
|
|
</div>
|
2019-05-21 06:34:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
2019-05-29 07:41:34 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block script %}
|
|
|
|
{% if content_type=='Video' %}
|
2019-06-03 07:27:38 +00:00
|
|
|
<script src="https://cdn.plyr.io/3.5.3/plyr.js"></script>
|
|
|
|
{% elif content_type == 'Quiz' %}
|
|
|
|
<script src='/assets/erpnext/js/education/lms/quiz.js'></script>
|
2019-05-29 07:41:34 +00:00
|
|
|
{% endif %}
|
|
|
|
<script>
|
2019-06-03 07:27:38 +00:00
|
|
|
{% if content_type == 'Video' %}
|
2019-05-29 07:41:34 +00:00
|
|
|
const player = new Plyr('#player');
|
2019-06-03 07:27:38 +00:00
|
|
|
{% elif content_type == 'Quiz' %}
|
|
|
|
{% if next %}
|
|
|
|
const quiz_exit_button = 'Next'
|
|
|
|
const next_url = '/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ next.content_type }}&content={{ next.content }}'
|
|
|
|
{% else %}
|
|
|
|
const quiz_exit_button = 'Finish Course'
|
|
|
|
const next_url = '/lms/course?name={{ course }}&program={{ program }}'
|
|
|
|
{% endif %}
|
|
|
|
frappe.ready(() => {
|
|
|
|
const quiz = new Quiz(document.getElementById('quiz-wrapper'), {
|
|
|
|
name: '{{ content.name }}',
|
|
|
|
course: '{{ course }}',
|
2019-06-03 09:10:52 +00:00
|
|
|
program: '{{ program }}',
|
2019-06-03 07:27:38 +00:00
|
|
|
quiz_exit_button: quiz_exit_button,
|
|
|
|
next_url: next_url
|
|
|
|
})
|
|
|
|
window.quiz = quiz;
|
|
|
|
})
|
2019-05-29 07:41:34 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2019-06-03 07:27:38 +00:00
|
|
|
{% if content_type != 'Quiz' %}
|
|
|
|
|
2019-05-29 07:41:34 +00:00
|
|
|
frappe.ready(() => {
|
|
|
|
next = document.getElementById('nextButton')
|
|
|
|
next.disabled = false;
|
|
|
|
})
|
|
|
|
|
2019-05-30 12:35:00 +00:00
|
|
|
|
2019-06-03 07:27:38 +00:00
|
|
|
function handle(url) {
|
2019-05-30 12:35:00 +00:00
|
|
|
opts = {
|
|
|
|
method: "erpnext.education.utils.add_activity",
|
|
|
|
args: {
|
2019-05-29 07:41:34 +00:00
|
|
|
course: "{{ course }}",
|
|
|
|
content_type: "{{ content_type }}",
|
2019-06-03 09:10:52 +00:00
|
|
|
content: "{{ content.name }}",
|
|
|
|
program: "{{ program }}"
|
2019-05-29 07:41:34 +00:00
|
|
|
}
|
2019-05-30 12:35:00 +00:00
|
|
|
}
|
|
|
|
frappe.call(opts).then(res => {
|
|
|
|
window.location.href = url;
|
|
|
|
})
|
2019-05-29 07:41:34 +00:00
|
|
|
}
|
2019-06-03 07:27:38 +00:00
|
|
|
|
|
|
|
{% endif %}
|
2019-05-29 07:41:34 +00:00
|
|
|
</script>
|
2020-06-22 05:36:12 +00:00
|
|
|
{% endblock %}
|