templates: add templates for LMS content

Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
scmmishra 2018-10-08 17:18:11 +05:30 committed by Aditya Hase
parent de36e13db7
commit 6660a675f1
7 changed files with 159 additions and 56 deletions

View File

@ -8,56 +8,33 @@
<meta name="keywords" content="ERP Software, Cloud ERP, Open Source ERP, Accounting Software, Online ERP, Online Accounting, ERP for small business, Learn ERP, ERPNext Academy, Learn ERPNext, Learn Accounting" />
{% endblock %}
{% macro video(id) %}
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/{{ lesson.video_url }}" allowfullscreen></iframe>
</div>
{% endmacro %}
{% block content %}
<section class='video-top-section video-section-bg'>
<div class='container'>
{% if lesson.video_url is defined %}
{{ video("lesson,video") }}
{% endif %}
<div class="mt-3 row">
<div class="col-md-8">
<h2>{{ lesson.name }}</h2>
<span class="text-muted">
<i class="octicon octicon-clock" title="Duration"></i> 49 Mins
&mdash; Published on 28th October 2018.
</span>
</div>
<div class="col-md-4 text-right">
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
<a class='btn btn-primary' href="/learn?module={{ module }}&lesson={{ next_lesson }}">Next</a>
</div>
</div>
<hr>
</div>
</section>
{% for lesson in lesson_list %}
{{ lesson }}
{% endfor %}
<section class="video-description-section">
<div class='container'>
<div class="content">
{{ lesson.content }}
</div>
<div class="text-right hidden">
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
<a class='btn btn-primary' href="/classrooms/module">Next</a>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a Mistake</a>
</div>
</div>
</section>
{% with current_content = current_content %}
{% include "www/lms/templates/includes/" + current_content.content_type.lower() + ".html" %}
{% endwith %}
<style>
.footer-message {
display: none;
}
.video-top-section {
padding-top: 3rem !important;
padding-bottom: 1rem !important;
}
.video-description-section {
padding-top: 0em !important;
}
.article-top-section {
padding-top: 3rem !important;
padding-bottom: 0rem !important;
}
.article-content-section {
padding-top: 0em !important;
}
</style>
{% endblock %}

View File

@ -1,2 +1,8 @@
# current_module = frappe.get_doc("Course", frappe.form_dict["lesson"])
# current_lesson = frappe.get_doc("Lesson", frappe.form_dict["lesson"])
from __future__ import unicode_literals
import frappe
def get_context(context):
context.current_course = frappe.get_doc("Course", frappe.form_dict["course"])
context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
next_content = get_next_content()

View File

@ -22,7 +22,7 @@
</span>
</div>
<div class='text-center col-xs-4 col-sm-3 col-md-2'>
<a class='btn btn-primary btn-sm btn-block' href="/course?course={{ name }}&content=Getting Started">Start Course</a>
<a class='btn btn-primary btn-sm btn-block' href="/lms/course?course={{ name }}&content=ERPNext Introduction">Start Course</a>
</div>
</div>
</div>

View File

@ -2,18 +2,13 @@ from __future__ import unicode_literals
import frappe
# Get the classroom's route parameter from the url
url_param = frappe.form_dict["code"]
# Get classroom from classroom_name
current_program = frappe.get_doc("Program", url_param)
def get_context(context):
context.program = current_program
context.course_list, context.course_data = get_courses()
context.program = frappe.get_doc("Program", frappe.form_dict["code"])
context.course_list, context.course_data = get_courses(context)
def get_courses():
def get_courses(context):
course_data = {}
course_names = [program.course_name for program in current_program.courses]
course_names = [program.course_name for program in context.program.courses]
program_courses = [frappe.get_doc('Course', name) for name in course_names]
for course_item in program_courses:
course_data[course_item.name] = [content_item.content for content_item in course_item.course_content if content_item.content_type in ('Video', 'Article')]

View File

@ -0,0 +1,33 @@
<section class='article-top-section video-section-bg'>
<div class='container'>
<div class="row">
<div class="col-md-8">
<h2>{{ current_content.name }}</h2>
<span class="text-muted">
<i class="octicon octicon-clock" title="Duration"></i> 49 Mins
&mdash; Published on 28th October 2018.
</span>
</div>
<div class="col-md-4 text-right">
<a class='btn btn-outline-secondary' href="#">Previous</a>
<a class='btn btn-primary' href="#s">Next</a>
</div>
</div>
<hr>
</div>
</section>
<section class="article-content-section">
<div class='container'>
<div class="content">
{{ current_content.article_content }}
</div>
<div class="text-right hidden">
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
<a class='btn btn-primary' href="/classrooms/module">Next</a>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
Mistake</a>
</div>
</div>
</section>

View File

@ -0,0 +1,56 @@
{% macro quiz(question, opt1, opt2, opt3, opt4) %}
<div class="question mt-4">
<h5>{{ question }}</h5>
<div class="options ml-2">
<div class="form-check pb-1">
<input class="form-check-input" type="radio" name="{{ question }}" id="{{ opt1 }}" value="{{ opt1 }}">
<label class="form-check-label" for="{{ opt1 }}">
{{ opt1 }}
</label>
</div>
<div class="form-check pb-1">
<input class="form-check-input" type="radio" name="{{ question }}" id="{{ opt2 }}" value="{{ opt2 }}">
<label class="form-check-label" for="{{ opt2 }}">
{{ opt2 }}
</label>
</div>
<div class="form-check pb-1">
<input class="form-check-input" type="radio" name="{{ question }}" id="{{ opt3 }}" value="{{ opt3 }}">
<label class="form-check-label" for="{{ opt3 }}">
{{ opt3 }}
</label>
</div>
<div class="form-check pb-1">
<input class="form-check-input" type="radio" name="{{ question }}" id="{{ opt3 }}" value="{{ opt4 }}">
<label class="form-check-label" for="{{ opt3 }}">
{{ opt4 }}
</label>
</div>
</div>
</div>
{% endmacro %}
<section class="article-section">
<div class='container'>
<div class="mt-3 row">
<div class="col-md-8">
<h2>Quiz &mdash; Accounting with ERPNext</h2>
</div>
</div>
<div class="content">
<hr>
<form>
{{ quiz('1. What is a Sales Invoice?','The bills that you raise to your Customers for the products or services you provide.','Bills that your Suppliers give you for their products or services.','The bills for accounting entries, like payments, credit and other types.','The bills that were recovered from an oblivion of files and folders stacked in a old and rusty closet.') }}
{{ quiz('2. How to create a Sales Invoice?','Accounts > Billing > Sales Invoice > New Sales Invoice','Accounts > Buying > New Sales Invoice','Accounts > CRM > New Sales Invoice','Accounts > Purchases > New Sales Invoice') }}
{{ quiz('3. The long term assets that have no physical existence but are rights that have value is known as','Current Assets','Fixed Assets','Intangible Assets','Investments') }}
<div class="text-right">
<button class='btn btn-outline-secondary' type="reset">Reset</button>
<button class='btn btn-primary' type="submit">Submit</button>
</div>
</form>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a Mistake</a>
</div>
</div>
</section>

View File

@ -0,0 +1,36 @@
<section class='video-top-section video-section-bg'>
<div class='container'>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/{{ current_content.video_url }}" allowfullscreen></iframe>
</div>
<div class="mt-3 row">
<div class="col-md-8">
<h2>{{ current_content.name }}</h2>
<span class="text-muted">
<i class="octicon octicon-clock" title="Duration"></i> 49 Mins
&mdash; Published on 28th October 2018.
</span>
</div>
<div class="col-md-4 text-right">
<a class='btn btn-outline-secondary' href="#">Previous</a>
<a class='btn btn-primary' href="#s">Next</a>
</div>
</div>
<hr>
</div>
</section>
<section class="video-description-section">
<div class='container'>
<div class="content">
{{ current_content.video_description }}
</div>
<div class="text-right hidden">
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
<a class='btn btn-primary' href="/classrooms/module">Next</a>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
Mistake</a>
</div>
</div>
</section>