Templates: modified routing logic, added data attributes in template
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
9335593b56
commit
38c1baf719
@ -8,11 +8,12 @@
|
||||
<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 %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% with current_content = current_content %}
|
||||
<div id="content-holder" data-type="{{current_content.content_type}}" data-content="{{ current_content.name }}" data-course="{{ current_course.name }}" data-program="{{ current_program }}">
|
||||
{% with current_content = current_content, next_content = next_content, course_name = current_course.name, program=current_program%}
|
||||
{% include "www/lms/templates/includes/" + current_content.content_type.lower() + ".html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<style>
|
||||
.footer-message {
|
||||
display: none;
|
||||
@ -35,6 +36,10 @@
|
||||
.article-content-section {
|
||||
padding-top: 0em !important;
|
||||
}
|
||||
|
||||
.quiz-section {
|
||||
padding-top: 0rem !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
@ -3,6 +3,17 @@ 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()
|
||||
if frappe.form_dict['course']:
|
||||
context.current_course = frappe.get_doc("Course", frappe.form_dict["course"])
|
||||
context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
|
||||
context.current_program = frappe.form_dict["program"]
|
||||
context.next_content = get_next_content(context)
|
||||
|
||||
|
||||
def get_next_content(context):
|
||||
if context.current_course:
|
||||
course_data = [content_item.content for content_item in context.current_course.course_content]
|
||||
try:
|
||||
return course_data[course_data.index(context.current_content.name) + 1]
|
||||
except IndexError:
|
||||
return None
|
@ -13,7 +13,7 @@
|
||||
<div class="card">
|
||||
<img src="{{ hero_image }}" style='height: 150px'>
|
||||
<div class='card-body'>
|
||||
<a href="/lms/program?code={{ code }}">
|
||||
<a href="/lms/program?program={{ code }}">
|
||||
<h5 class='card-title'>{{ program_name }}</h5>
|
||||
</a>
|
||||
<div>{{ description }}</div>
|
||||
|
@ -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="/lms/course?course={{ name }}&content=ERPNext Introduction">Start Course</a>
|
||||
<a class='btn btn-primary btn-sm btn-block' href="/lms/course?program={{ program.program_code }}&course={{ name }}&content={{ course_data[name][0] }}">Start Course</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,9 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
from erpnext.education.utils import get_student_name
|
||||
import frappe
|
||||
|
||||
|
||||
def get_context(context):
|
||||
context.program = frappe.get_doc("Program", frappe.form_dict["code"])
|
||||
print(get_student_name(frappe.session.user))
|
||||
context.program = frappe.get_doc("Program", frappe.form_dict["program"])
|
||||
context.course_list, context.course_data = get_courses(context)
|
||||
|
||||
def get_courses(context):
|
||||
|
@ -10,7 +10,11 @@
|
||||
</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>
|
||||
{% if next_content != None %}
|
||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
||||
{% else %}
|
||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/program?program={{ program }}">Finish Course</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
@ -23,7 +27,7 @@
|
||||
</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>
|
||||
<a class='btn btn-primary' href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">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
|
||||
|
@ -1,56 +1,62 @@
|
||||
{% 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>
|
||||
{% macro quiz(loop_index, question_id, question, options) %}
|
||||
<div class="question mt-4" id="question" data-question="{{ question_id }}">
|
||||
<h5>{{ loop_index }}{{ question }}</h5>
|
||||
<div class="options ml-2">
|
||||
<div class="form-check pb-1 hidden">
|
||||
<input class="form-check-input" type="radio" name="{{ question_id }}" value="0" checked>
|
||||
</div>
|
||||
{% for option in options %}
|
||||
<div class="form-check pb-1">
|
||||
<input class="form-check-input" type="radio" name="{{ question_id }}" id="{{loop_index}}-{{ option }}" value="{{ loop.index|str }}">
|
||||
<label class="form-check-label" for="{{loop_index}}-{{ option }}">
|
||||
{{ option }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
<section class="article-section">
|
||||
<div class='container'>
|
||||
<div class="mt-3 row">
|
||||
<div class="col-md-8">
|
||||
<h2>Quiz — 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>
|
||||
<section class="quiz-section">
|
||||
<div class='container'>
|
||||
<div class="mt-3 row">
|
||||
<div class="col-md-8">
|
||||
<h2>Quiz: {{ current_content.name }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="content">
|
||||
<hr>
|
||||
<form id="quiz" name="{{ current_content.name }}">
|
||||
<div id="quiz-body">
|
||||
{% for quiz_item in current_content.quiz %}
|
||||
{{ quiz(loop.index|str +". ", quiz_item.name, quiz_item.question, [ quiz_item.option_1, quiz_item.option_2,
|
||||
quiz_item.option_3, quiz_item.option_4]) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<div id="quiz-actions" class="text-right">
|
||||
<button class='btn btn-outline-secondary' type="reset">Reset</button>
|
||||
<button class='btn btn-primary' type="button" onclick="submitQuiz()">Submit</button>
|
||||
</div>
|
||||
<div id="post-quiz-actions" class="row" hidden="hidden">
|
||||
<div class="col-md-8 text-left">
|
||||
<h3>Your Score: <span id="result"></span></h3>
|
||||
</div>
|
||||
<div class="col-md-4 text-right">
|
||||
<a class='btn btn-outline-secondary' href="#">Previous</a>
|
||||
{% if next_content != None %}
|
||||
<a class='btn btn-primary' href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
||||
{% else %}
|
||||
<a class='btn btn-primary' href="/lms/program?program={{ program }}">Finish Course</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
@ -13,7 +13,11 @@
|
||||
</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>
|
||||
{% if next_content != None %}
|
||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
||||
{% else %}
|
||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/program?program={{ program }}">Finish Course</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user