blob: 3e00c79f9c36179f53846a62b080686e78c6fd39 [file] [log] [blame]
Shivam Mishrac8c790a2019-05-21 12:04:50 +05301{% extends "templates/base.html" %}
2{% block title %}{% endblock %}
3
4{% block head_include %}
5 <style>
6 div.card-hero-img {
7 height: 220px;
8 background-size: cover;
9 background-repeat: no-repeat;
10 background-position: center;
11 background-color: rgb(250, 251, 252);
12 }
13
14 .card-image-wrapper {
15 display: flex;
16 overflow: hidden;
17 height: 220px;
18 background-color: rgb(250, 251, 252);
19 justify-content: center;
20 }
21
22 .image-body {
23 align-self: center;
24 color: #d1d8dd;
25 font-size: 24px;
26 font-weight: 600;
27 line-height: 1;
28 padding: 20px;
29 }
30 </style>
31 <link rel="stylesheet" href="https://cdn.plyr.io/3.5.3/plyr.css" />
32{% endblock %}
33
34{% macro navigation() %}
35<div class="row">
36 <div class="col-md-7">
37 <h1>{{ content.name }}</h1>
38 </div>
39 <div class="col-md-5 text-right">
40 {% if previous %}
41 <a href="/lms/content?course={{ course }}&topic={{ topic }}&type={{ previous.content_type }}&content={{ previous.content }}" class='btn btn-outline-secondary'>Previous</a>
42 {% else %}
43 <a href="/lms/course?name={{ course }}" class='btn btn-outline-secondary'>Back to Course</a>
44 {% endif %}
45
46 {% if next %}
47 <button id="nextButton" onclick="handle('/lms/content?course={{ course }}&topic={{ topic }}&type={{ next.content_type }}&content={{ next.content }}')" class='btn btn-primary' disabled="true">Next</button>
48 {% else %}
49 <button id="nextButton" onclick="handle('/lms/course?name={{ course }}')" class='btn btn-primary' disabled="true">Finish Topic</button>
50 {% endif %}
51 </div>
52 </div>
53{% endmacro %}
54
55{% macro video() %}
56<div class="mb-5">
57 {{ navigation() }}
58 <div class="text-muted">
59 {% if content.duration %}
60 {{ content.duration }} Mins
61 {% endif %}
62
63 {% if content.publish_date and content.duration%}
64 -
65 {% endif %}
66
67 {% if content.publish_date %}
68 Published on {{ content.publish_date.strftime('%d, %b %Y') }}
69 {% endif %}
70 </div>
71</div>
72<div id="player" data-plyr-provider="{{ content.provider|lower }}" data-plyr-embed-id="{{ content.url }}"></div>
73<div class="my-5">
74 {{ content.description }}
75</div>
76
77{% block script %}
78 <script src="https://cdn.plyr.io/3.5.3/plyr.js"></script>
79 <script>
80 const player = new Plyr('#player');
81
82 frappe.ready(() => {
83 next = document.getElementById('nextButton')
84 next.disabled = false;
85 })
86
87 function handle(url) {
88 frappe.call('ping').then((r) => {
89 frappe.call("add_activity",
90 {
91 course: {{ course }},
92 content_type: {{ content_type }},
93 content: {{ content.name }},
94 }
95 )
96 })
97 }
98 </script>
99{% endblock %}
100{% endmacro %}
101
102{% macro article() %}
103<div class="mb-5">
104 {{ navigation() }}
105 <div class="text-muted">
106 {% if content.author or content.publish_date %}
107 Published
108 {% endif %}
109 {% if content.author %}
110 by {{ content.author }}
111 {% endif %}
112 {% if content.publish_date %}
113 on {{ content.publish_date.strftime('%d, %b %Y') }}
114 {% endif %}
115 </div>
116</div>
117<div>
118 {{ content.content }}
119</div>
120{% endmacro %}
121
122{% block content %}
123<section class="section">
124 <div>
125 <div class='container pb-5'>
126 {% if content_type=='Video' %}
127 {{ video() }}
128 {% elif content_type=='Article'%}
129 {{ article() }}
130 {% elif content_type=='Quiz' %}
131 <h2>Quiz: {{ content.name }}</h2>
132 {% endif %}
133 </div>
134 </div>
135</section>
136{% endblock %}