blob: c86ac9c11f9fbfa55cef4a14dec90f34453e2292 [file] [log] [blame]
Shivam Mishrad7e82982019-05-20 11:55:17 +05301{% extends "templates/base.html" %}
2{% block title %}{{ course.course_name }}{% endblock %}
Shivam Mishra87a74382019-05-21 12:05:19 +05303{% from "www/lms/macros/hero.html" import hero %}
Shivam Mishra2a0483d2019-06-06 16:02:38 +05304{% from "www/lms/macros/card.html" import null_card %}
Shivam Mishrad7e82982019-05-20 11:55:17 +05305
6{% block head_include %}
7 <style>
8 div.card-hero-img {
9 height: 220px;
10 background-size: cover;
11 background-repeat: no-repeat;
12 background-position: center;
13 background-color: rgb(250, 251, 252);
14 }
15
16 .card-image-wrapper {
17 display: flex;
18 overflow: hidden;
19 height: 220px;
20 background-color: rgb(250, 251, 252);
21 justify-content: center;
22 }
23
24 .image-body {
25 align-self: center;
26 color: #d1d8dd;
27 font-size: 24px;
28 font-weight: 600;
29 line-height: 1;
30 padding: 20px;
31 }
Shivam Mishrab3127652019-06-06 14:03:01 +053032 section {
33 padding: 5rem 0 5rem 0;
34 }
Shivam Mishrad7e82982019-05-20 11:55:17 +053035 </style>
36{% endblock %}
37
38
Shivam Mishra2a0483d2019-06-06 16:02:38 +053039{% macro card(topic) %}
40<div class="col-sm-4 mb-4 text-left">
Shivam Mishrad7e82982019-05-20 11:55:17 +053041 <div class="card h-100">
Shivam Mishra24bd07d2019-05-30 16:36:58 +053042 {% if has_access %}
Shivam Mishrad69892a2019-06-05 19:42:30 +053043 <a href="/lms/topic?program={{ program }}&course={{ course.name }}&topic={{ topic.name }}" class="no-decoration no-underline">
Shivam Mishraae2871f2019-05-29 13:11:34 +053044 {% else %}
Shivam Mishra449f2612019-06-06 18:33:58 +053045 <div onclick="show_singup()">
Shivam Mishraae2871f2019-05-29 13:11:34 +053046 {% endif %}
Shivam Mishrad7e82982019-05-20 11:55:17 +053047 {% if topic.hero_image %}
Shivam Mishra04d61712019-06-07 13:03:46 +053048 <div class="card-hero-img" style="background-image: url('{{ topic.hero_image }})'"></div>
Shivam Mishrad7e82982019-05-20 11:55:17 +053049 {% else %}
50 <div class="card-image-wrapper text-center">
Shivam Mishra24bd07d2019-05-30 16:36:58 +053051 <div class="image-body"><i class="fa fa-picture-o" aria-hidden="true"></i></div>
Shivam Mishrad7e82982019-05-20 11:55:17 +053052 </div>
53 {% endif %}
54 <div class='card-body'>
55 <h5 class='card-title'>{{ topic.topic_name }}</h5>
56 <div>
57 <ol class="list-unstyled">
58 {% for content in topic.topic_content %}
Shivam Mishraae2871f2019-05-29 13:11:34 +053059 <li>
Shivam Mishra24bd07d2019-05-30 16:36:58 +053060 {% if has_access %}
61 <a class="text-muted" href="/lms/content?program={{ program }}&course={{ course.name }}&topic={{ topic.name }}&type={{ content.content_type }}&content={{ content.content }}">
Shivam Mishraae2871f2019-05-29 13:11:34 +053062 {{ content.content }}
63 </a>
Shivam Mishra24bd07d2019-05-30 16:36:58 +053064 {% else %}
65 <span class="text-muted">{{ content.content }}</span>
Shivam Mishraae2871f2019-05-29 13:11:34 +053066 {% endif %}
67 </li>
Shivam Mishrad7e82982019-05-20 11:55:17 +053068 {% endfor %}
69 </ol>
70 </div>
71 </div>
Shivam Mishra24bd07d2019-05-30 16:36:58 +053072 {% if has_access %}
Shivam Mishra87a74382019-05-21 12:05:19 +053073 <div class='card-footer'>
Shivam Mishra570161b2019-06-05 13:08:53 +053074 {% if progress[topic.name].completed %}
75 <span class="indicator green">Completed</span>
76 {% elif progress[topic.name].started %}
77 <span class="indicator orange">In Progress</span>
78 {% else %}
Shivam Mishrad69892a2019-06-05 19:42:30 +053079 <span class="indicator blue">Start</span>
Shivam Mishra570161b2019-06-05 13:08:53 +053080 {% endif %}
Shivam Mishra87a74382019-05-21 12:05:19 +053081 </div>
Shivam Mishraae2871f2019-05-29 13:11:34 +053082 </a>
Shivam Mishra24bd07d2019-05-30 16:36:58 +053083 {% else %}
84 </div>
Shivam Mishraae2871f2019-05-29 13:11:34 +053085 {% endif %}
Shivam Mishrad7e82982019-05-20 11:55:17 +053086 </div>
87</div>
88{% endmacro %}
89
90{% block content %}
Shivam Mishrab3127652019-06-06 14:03:01 +053091<section class="section">
Shivam Mishrad69892a2019-06-05 19:42:30 +053092 {{ hero(course.course_name, course.description, has_access, {'name': 'Program', 'url': '/lms/program?program=' + program }) }}
Shivam Mishrad7e82982019-05-20 11:55:17 +053093 <div class='container'>
94 <div class="row mt-5">
95 {% for topic in topics %}
Shivam Mishra2a0483d2019-06-06 16:02:38 +053096 {{ card(topic) }}
Shivam Mishrad7e82982019-05-20 11:55:17 +053097 {% endfor %}
Shivam Mishra2a0483d2019-06-06 16:02:38 +053098 {% if topics %}
Shivam Mishra278ef4b2019-06-12 14:53:00 +053099 {% for n in range( (3 - (topics|length)) %3) %}
Shivam Mishra2a0483d2019-06-06 16:02:38 +0530100 {{ null_card() }}
101 {% endfor %}
102 {% endif %}
Shivam Mishrad7e82982019-05-20 11:55:17 +0530103 </div>
104 </div>
105</section>
Shivam Mishra449f2612019-06-06 18:33:58 +0530106{% endblock %}
107
108{% block script %}
109<script>
110 function show_singup() {
111 if (frappe.session.user == "Guest") {
112 let signup_dialog = new frappe.ui.Dialog({
113 title: __('Sign Up'),
114 primary_action: function() {
115 window.location.href = '/login#signup'
116 },
117 primary_action_label: 'Sign Up'
118 })
119 signup_dialog.set_message('You have to sign up to access the course');
120 signup_dialog.$message.show()
121 signup_dialog.show();
122 }
123 }
124</script>
Shivam Mishrad7e82982019-05-20 11:55:17 +0530125{% endblock %}