feat: added program and course pages
This commit is contained in:
parent
823c79588b
commit
d7e8298a5f
77
erpnext/www/lms/course.html
Normal file
77
erpnext/www/lms/course.html
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{% extends "templates/base.html" %}
|
||||||
|
{% block title %}{{ course.course_name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block head_include %}
|
||||||
|
<style>
|
||||||
|
div.card-hero-img {
|
||||||
|
height: 220px;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-color: rgb(250, 251, 252);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-image-wrapper {
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 220px;
|
||||||
|
background-color: rgb(250, 251, 252);
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-body {
|
||||||
|
align-self: center;
|
||||||
|
color: #d1d8dd;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro card(topic, index, length) %}
|
||||||
|
<div class="col-sm-{{ 12 if length%3 == 1 and index == 1 else 6 if length%3 == 2 and index in [1,2] else 4}} mb-4 text-left">
|
||||||
|
<div class="card h-100">
|
||||||
|
<a href="/lms/content?topic={{ topic.name }}&type=Content" class="no-decoration no-underline">
|
||||||
|
{% if topic.hero_image %}
|
||||||
|
<div class="card-hero-img" style="background-image: url({{ topic.hero_image }})"></div>
|
||||||
|
{% else %}
|
||||||
|
<div class="card-image-wrapper text-center">
|
||||||
|
<div class="image-body">{{ topic.topic_name }}</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class='card-body'>
|
||||||
|
<h5 class='card-title'>{{ topic.topic_name }}</h5>
|
||||||
|
<div>
|
||||||
|
<ol class="list-unstyled">
|
||||||
|
{% for content in topic.topic_content %}
|
||||||
|
<li><a class="text-muted" href="/lms/content?topic={{ topic.name }}&type={{ content.content_type }}&content={{ content.content }}">{{ content.content }}</li></a>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<section class="top-section ">
|
||||||
|
<div class='container pb-5'>
|
||||||
|
<h1>{{ course.course_name }}</h1>
|
||||||
|
<p class='lead'>{{ course.course_intro }}</p>
|
||||||
|
<p class="mt-4">
|
||||||
|
<a class="btn btn-primary btn-lg" style="width: 170px;" href="/login#signup">Sign Up</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class='container'>
|
||||||
|
<div class="row mt-5">
|
||||||
|
{% for topic in topics %}
|
||||||
|
{{ card(topic.as_dict(), loop.index, topics|length) }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
11
erpnext/www/lms/course.py
Normal file
11
erpnext/www/lms/course.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import erpnext.education.utils as utils
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
no_cache = 1
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
context.education_settings = frappe.get_single("Education Settings")
|
||||||
|
course = frappe.get_doc('Course', frappe.form_dict['name'])
|
||||||
|
context.course = course
|
||||||
|
context.topics = course.get_topics()
|
@ -31,23 +31,20 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% macro card(program, is_enrolled) %}
|
{% macro card(course, index, length) %}
|
||||||
<div class="col-sm mb-4 text-left">
|
<div class="col-sm-{{ 12 if length%3 == 1 and index == 1 else 6 if length%3 == 2 and index in [1,2] else 4}} mb-4 text-left">
|
||||||
<div class="card">
|
<div class="card h-100">
|
||||||
<a href="/lms/program?name={{ program.name }}" class="no-decoration no-underline">
|
<a href="/lms/course?name={{ course.name }}" class="no-decoration no-underline">
|
||||||
{% if program.hero_image %}
|
{% if course.hero_image %}
|
||||||
<div class="card-hero-img" style="background-image: url({{ program.hero_image }})"></div>
|
<div class="card-hero-img" style="background-image: url({{ course.hero_image }})"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="card-image-wrapper text-center">
|
<div class="card-image-wrapper text-center">
|
||||||
<div class="image-body">{{ program.program_name }}</div>
|
<div class="image-body">{{ course.course_name }}</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class='card-body'>
|
<div class='card-body'>
|
||||||
<h5 class='card-title'>{{ program.program_name }}</h5>
|
<h5 class='card-title'>{{ course.course_name }}</h5>
|
||||||
<div>{{ program.description }}</div>
|
<div>{{ course.course_intro }}</div>
|
||||||
</div>
|
|
||||||
<div class='card-footer'>
|
|
||||||
<a href='#' class='small'>Watch Intro</a>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -65,8 +62,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
{% for program in all_programs %}
|
{% for course in program.courses %}
|
||||||
{{ card(program.program, program.is_enrolled) }}
|
{{ card(frappe.get_doc("Course", course.course), loop.index, program.courses|length) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user