LMS: Fixed views for article and video
This commit is contained in:
parent
18baff5fec
commit
590227b107
@ -54,7 +54,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Text Editor",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
@ -185,7 +185,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-10-17 06:57:00.219252",
|
"modified": "2018-10-18 12:26:47.709081",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Video",
|
"name": "Video",
|
||||||
|
@ -1,45 +1,41 @@
|
|||||||
{% extends "frappe_theme/templates/base.html" %}
|
{% extends "frappe_theme/templates/base.html" %}
|
||||||
{% block title %}ERPNext Academy{% endblock %}
|
{% block title %}ERPNext Academy{% endblock %}
|
||||||
|
|
||||||
{% from "templates/includes/media.html" import media %}
|
{% from "templates/includes/media.html" import media %}
|
||||||
|
|
||||||
{% block head_include %}
|
{% block head_include %}
|
||||||
<meta name="description" content="ERPNext Academy is a learnig platform to gain expertise in the world's top 100% open source ERP software." />
|
<meta name="description" content="ERPNext Academy is a learnig platform to gain expertise in the world's top 100% open source ERP software." />
|
||||||
<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" />
|
<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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block 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 }}">
|
<div id="content-holder" data-type="{{ content_type }}" data-content="{{ current_content.name }}" data-course="{{ course_name }}" data-program="{{ program_name }}">
|
||||||
{% with quiz = quiz, current_content = current_content, next_content = next_content, course_name = course_name, program=current_program%}
|
{% with content = current_content, next_content = next_content, course_name = course_name, program_name = program_name %}
|
||||||
{% include "www/lms/templates/includes/" + current_content.content_type.lower() + ".html" %}
|
{% include "www/lms/templates/includes/" + content_type.lower() + ".html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
.footer-message {
|
.footer-message {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-top-section {
|
.video-top-section {
|
||||||
padding-top: 3rem !important;
|
padding-top: 3rem !important;
|
||||||
padding-bottom: 1rem !important;
|
padding-bottom: 1rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-description-section {
|
.video-description-section {
|
||||||
padding-top: 0em !important;
|
padding-top: 0em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-top-section {
|
.article-top-section {
|
||||||
padding-top: 3rem !important;
|
padding-top: 3rem !important;
|
||||||
padding-bottom: 0rem !important;
|
padding-bottom: 0rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-content-section {
|
.article-content-section {
|
||||||
padding-top: 0em !important;
|
padding-top: 0em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quiz-section {
|
.quiz-section {
|
||||||
padding-top: 0rem !important;
|
padding-top: 0rem !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,23 +1,31 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import erpnext.education.utils as utils
|
import erpnext.education.utils as utils
|
||||||
|
from urlparse import urlparse, parse_qs
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
if frappe.form_dict['course']:
|
if frappe.form_dict['course']:
|
||||||
context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
|
# Save form_dict variables
|
||||||
context.course_name = frappe.form_dict["course"]
|
program_name = frappe.form_dict["program"]
|
||||||
context.current_course = utils.get_contents_in_course(context.course_name)
|
course_name = frappe.form_dict["course"]
|
||||||
context.current_program = frappe.form_dict["program"]
|
content_name = frappe.form_dict["content"]
|
||||||
context.next_content = get_next_content(context)
|
content_type = frappe.form_dict["type"]
|
||||||
if context.current_content.content_type == "Quiz":
|
|
||||||
context.questions = utils.get_quiz_as_dict(context.current_content.name)
|
|
||||||
|
|
||||||
|
# Get the required doctypes
|
||||||
|
current_course = frappe.get_doc("Course", course_name)
|
||||||
|
current_content = frappe.get_doc(content_type, content_name)
|
||||||
|
|
||||||
def get_next_content(context):
|
# Saving context variables for Jinja
|
||||||
if context.current_course:
|
context.current_content = current_content
|
||||||
course_data = [content.name for content in context.current_course]
|
context.course_name = course_name
|
||||||
|
context.program_name = program_name
|
||||||
|
context.content_type = content_type
|
||||||
|
context.next_content_type, context.next_content = get_next_content(content_name, content_type, current_course.get_content_info())
|
||||||
|
|
||||||
|
def get_next_content(c_name, c_type, content_list):
|
||||||
try:
|
try:
|
||||||
return course_data[course_data.index(context.current_content.name) + 1]
|
next = content_list[content_list.index([c_type, c_name]) + 1]
|
||||||
|
return next[0], next[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return None
|
return None, None
|
@ -11,7 +11,7 @@
|
|||||||
<div class='card-body'>
|
<div class='card-body'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="course-details col-xs-8 col-sm-9 col-md-10">
|
<div class="course-details col-xs-8 col-sm-9 col-md-10">
|
||||||
<h5>{{ course.name }}</h5>
|
<h5>{{ course.course_name }}</h5>
|
||||||
<span class="course-list text-muted" id="getting-started">
|
<span class="course-list text-muted" id="getting-started">
|
||||||
Course Content
|
Course Content
|
||||||
<ul class="mb-0 mt-1">
|
<ul class="mb-0 mt-1">
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='text-center col-xs-4 col-sm-3 col-md-2'>
|
<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?program={{ program.program_code }}&course={{ course.name }}&content={{ course.course_content[0].content }}">Start Course</a>
|
<a class='btn btn-primary btn-sm btn-block' href="/lms/course?program={{ program.program_code }}&course={{ course.name }}&type={{course.course_content[0].content_type}}&content={{ course.course_content[0].content }}">Start Course</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,5 +4,8 @@ import frappe
|
|||||||
|
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.program = frappe.get_doc("Program", frappe.form_dict["program"])
|
program = frappe.get_doc("Program", frappe.form_dict["program"])
|
||||||
context.course_list = utils.get_courses_in_program(frappe.form_dict["program"])
|
course_list = program.get_course_list()
|
||||||
|
|
||||||
|
context.program = program
|
||||||
|
context.course_list = course_list
|
@ -2,19 +2,15 @@
|
|||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<h2>{{ current_content.name }}</h2>
|
<h2>{{ content.title }}</h2>
|
||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
<i class="octicon octicon-clock" title="Duration"></i> 49 Mins
|
Published on {{ content.publish_date }}, by {{ content.author }}
|
||||||
— Published on 28th October 2018.
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-right">
|
<div class="col-md-4 text-right">
|
||||||
<a class='btn btn-outline-secondary' href="#">Previous</a>
|
{% with next_content = next_content, course_name = course_name, program_name = program_name %}
|
||||||
{% if next_content != None %}
|
{% include "www/lms/templates/includes/lms-nav.html" %}
|
||||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
{% endwith %}
|
||||||
{% else %}
|
|
||||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/program?program={{ program }}">Finish Course</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@ -23,11 +19,12 @@
|
|||||||
<section class="article-content-section">
|
<section class="article-content-section">
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ current_content.article_content }}
|
{{ content.content }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right hidden">
|
<div class="text-right">
|
||||||
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
|
{% with next_content = next_content, course_name = course_name, program_name = program_name %}
|
||||||
<a class='btn btn-primary' href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
{% include "www/lms/templates/includes/lms-nav.html" %}
|
||||||
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 text-right">
|
<div class="mt-3 text-right">
|
||||||
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
|
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
|
||||||
|
6
erpnext/www/lms/templates/includes/lms-nav.html
Normal file
6
erpnext/www/lms/templates/includes/lms-nav.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<a class='btn btn-outline-secondary' href="#">Previous</a>
|
||||||
|
{% if next_content != None %}
|
||||||
|
<a class='btn btn-primary' onclick="addActivity()" href="/lms/course?program={{ program_name }}&course={{ course_name }}&type={{ next_content_type }}&content={{ next_content }}">Next</a>
|
||||||
|
{% else %}
|
||||||
|
<a class='btn btn-primary' onclick="addActivity()" href="/lms/program?program={{ program_name }}">Finish Course</a>
|
||||||
|
{% endif %}
|
@ -1,23 +1,20 @@
|
|||||||
<section class='video-top-section video-section-bg'>
|
<section class='video-top-section video-section-bg'>
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="embed-responsive embed-responsive-16by9">
|
<div class="embed-responsive embed-responsive-16by9">
|
||||||
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/{{ current_content.video_url }}" allowfullscreen></iframe>
|
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/{{ content.url.split('v=')[1].split('&')[0] }}" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 row">
|
<div class="mt-3 row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<h2>{{ current_content.name }}</h2>
|
<h2>{{ content.name }}</h2>
|
||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
<i class="octicon octicon-clock" title="Duration"></i> 49 Mins
|
<i class="octicon octicon-clock" title="Duration"></i> {{ content.duration }} Mins
|
||||||
— Published on 28th October 2018.
|
— Published on {{ content.publish_date }}.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-right">
|
<div class="col-md-4 text-right">
|
||||||
<a class='btn btn-outline-secondary' href="#">Previous</a>
|
{% with next_content = next_content, course_name = course_name, program_name = program_name %}
|
||||||
{% if next_content != None %}
|
{% include "www/lms/templates/includes/lms-nav.html" %}
|
||||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/course?program={{ program }}&course={{ course_name }}&content={{ next_content }}">Next</a>
|
{% endwith %}
|
||||||
{% else %}
|
|
||||||
<a class='btn btn-primary' onclick="addActivity()" href="/lms/program?program={{ program }}">Finish Course</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@ -26,7 +23,7 @@
|
|||||||
<section class="video-description-section">
|
<section class="video-description-section">
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ current_content.video_description }}
|
{{ content.description }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right hidden">
|
<div class="text-right hidden">
|
||||||
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
|
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user