diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py
index fccfd39b..001c440a 100644
--- a/lms/lms/doctype/lms_course/lms_course.py
+++ b/lms/lms/doctype/lms_course/lms_course.py
@@ -2,7 +2,6 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from codecs import ignore_errors
import frappe
from frappe.model.document import Document
import json
diff --git a/lms/lms/widgets/CourseOutline.html b/lms/lms/widgets/CourseOutline.html
index f15622b4..72e76130 100644
--- a/lms/lms/widgets/CourseOutline.html
+++ b/lms/lms/widgets/CourseOutline.html
@@ -37,7 +37,7 @@
- {% if membership or lesson.include_in_preview %}
-
+ {% if membership or lesson.include_in_preview or is_instructor %}
+
- {% elif is_instructor and not lesson.include_in_preview %}
-
-
-
- {{ lesson.title }}
-
-
{% else %}
@@ -108,20 +100,8 @@
{% endif %}
-{{ widgets.NoPreviewModal(course=course) }}
-
-
-
-
-
-
-
-
-
-
-
-
+{{ widgets.NoPreviewModal(course=course) }}
-
+{{ include_script('controls.bundle.js') }}
{% for ext in page_extensions %}
{{ ext.render_footer() }}
{% endfor %}
diff --git a/lms/www/batch/learn.js b/lms/www/batch/learn.js
index 1921adfa..cb97a2ee 100644
--- a/lms/www/batch/learn.js
+++ b/lms/www/batch/learn.js
@@ -75,6 +75,10 @@ frappe.ready(() => {
$(".active-question").length && quiz_summary();
});
}
+
+ if ($("#body").length) {
+ make_editor();
+ }
});
@@ -479,14 +483,14 @@ const save_lesson = (e) => {
method: "lms.lms.doctype.lms_course.lms_course.save_lesson",
args: {
"title": $("#title").text(),
- "body": $("#body").find("br").replaceWith("\n\n").end().text(),
+ "body": this.code_field_group.fields_dict["code_md"].last_value,
"chapter": $("#title").data("chapter"),
"preview": $("#preview").prop("checked") ? 1 : 0,
"idx": $("#title").data("index"),
"lesson": lesson ? lesson : ""
},
callback: (data) => {
- window.location.reload();
+ window.location.href = window.location.href.split("?")[0];
}
});
};
@@ -518,3 +522,26 @@ const build_attachment_table = (file_doc) => {
`);
};
+
+
+const make_editor = () => {
+ this.code_field_group = new frappe.ui.FieldGroup({
+ fields: [
+ {
+ fieldname: "code_md",
+ fieldtype: "Code",
+ options: "Markdown",
+ wrap: true,
+ max_lines: Infinity,
+ min_lines: 20,
+ default: $("#body").data("body"),
+ depends_on: 'eval:doc.type=="Markdown"',
+ }
+ ],
+ body: $("#body").get(0),
+ });
+ this.code_field_group.make();
+ $("#body .form-section:last").removeClass("empty-section");
+ $("#body .frappe-control").removeClass("hide-control");
+ $("#body .form-column").addClass("p-0");
+};
diff --git a/lms/www/batch/learn.py b/lms/www/batch/learn.py
index 8eb84ea7..f1711869 100644
--- a/lms/www/batch/learn.py
+++ b/lms/www/batch/learn.py
@@ -54,7 +54,10 @@ def get_current_lesson_details(lesson_number, context):
details_list = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))
if not len(details_list):
redirect_to_lesson(context.course)
- return details_list[0]
+ lesson_info = details_list[0]
+ lesson_info.body = lesson_info.body.replace("\"", "'")
+ print(lesson_info)
+ return lesson_info
def get_url(lesson_number, course):
diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html
index d77941c6..4380f12a 100644
--- a/lms/www/courses/course.html
+++ b/lms/www/courses/course.html
@@ -3,11 +3,13 @@
{{ course.title if course.title else _("New Course") }}
{% endblock %}
+
{% block head_include %}
{% include "public/icons/symbol-defs.svg" %}
{% endblock %}
+
{% block content %}
{% endif %}
-{% endmacro%}
+{% endmacro %}
@@ -133,25 +135,7 @@
{{ course.title }}
-
- {{ _("You have opted to be notified for this course. You will receive an email when the course becomes available.") }}
-
-
- {% if certificate_request and not certificate %}
-
{{ _("Evaluation On: ") }}
- {{ _("{0} at {1}").format(frappe.utils.format_date(certificate_request.date, "medium"),
- frappe.utils.format_time(certificate_request.start_time, "short")) }}
- {% endif %}
-
- {% if course.status == "Under Review" %}
-
- {{ _("Your course is currently under review. Once the review is complete, the System Admins will publish it on the website.") }}
-
- {% endif %}
-
- {% if no_of_attempts and no_of_attempts >= course.max_attempts %}
-
{{ _("You have exceeded the maximum number of attempts allowed to appear for evaluations of this course.") }}
- {% endif %}
+ {{ Notes(course) }}
{% endif %}
- {% set lesson_index = get_lesson_index(membership.current_lesson) if membership and
- membership.current_lesson else "1.1" if first_lesson_exists(course.name) else None %}
-
- {% if show_start_learing_cta %}
-
-
- {% elif is_instructor(course.name) and not course.published and course.status == "Under Review" %}
-
-
- {% elif is_instructor(course.name) and lesson_index %}
-
- {{ _("Checkout Course") }}
-
-
- {% elif course.upcoming and not is_user_interested %}
-
- {{ _("Notify me when available") }}
-
-
- {% elif is_cohort_staff(course.name, frappe.session.user) %}
-
- {{ _("Manage the course") }}
-
-
- {% elif membership %}
-
- {{ _("Continue Learning") }}
-
- {% endif %}
-
- {% set progress = frappe.utils.cint(membership.progress) %}
-
- {% if membership and course.enable_certification %}
- {% if certificate %}
-
- {{ _("Get Certificate") }}
-
-
- {% elif eligible_for_evaluation %}
-
- {{ _("Apply for Certificate") }}
-
-
- {% elif course.grant_certificate_after == "Completion" and progress == 100 %}
-
- {{ _("Get Certificate") }}
-
- {% endif %}
- {% endif %}
-
- {% if is_instructor(course.name) %}
-
{{ _("Edit Course") }}
- {% endif %}
+ {{ CTASection(course, membership) }}
+{{ SlotModal(course) }}
+{% endif %}
+{% endmacro %}
+
+
+
+{% macro Description(course) %}
+
{% if course.description %}{{ frappe.utils.md_to_html(course.description) }}{% endif %}
+{% endmacro %}
+
+
+
+{% macro Save(course) %}
+{% if course.edit_mode %}
+
+{% endif %}
+{% endmacro %}
+
+
+{% macro CourseCreator(course) %}
+
{{ _("Course Creators") }}
+
+
+ {% set instructors = get_instructors(course.name) %}
+ {% for instructor in instructors %}
+
+ {{ widgets.Avatar(member=instructor, avatar_class="avatar-medium") }}
+
+
{{ instructor.full_name }}
+
{{ get_authored_courses(instructor.name) | length }} {{ _("Courses Created") }}
+
+
+ {% endfor %}
+
+{% endmacro %}
+
+
+
+{% macro RelatedCourses(course) %}
+{% if course.related_courses | length %}
+
+{% endif%}
+{% endmacro %}
+
+
+
+{% macro CTASection(course, membership) %}
+ {% set lesson_index = get_lesson_index(membership.current_lesson) if membership and
+ membership.current_lesson else "1.1" if first_lesson_exists(course.name) else None %}
+
+ {% if show_start_learing_cta %}
+
+
+ {% elif is_instructor(course.name) and not course.published and course.status != "Under Review" %}
+
+ {{ _("Submit for Review") }}
+
+
+ {% elif is_instructor(course.name) and lesson_index %}
+
+ {{ _("Checkout Course") }}
+
+
+ {% elif course.upcoming and not is_user_interested %}
+
+ {{ _("Notify me when available") }}
+
+
+ {% elif is_cohort_staff(course.name, frappe.session.user) %}
+
+ {{ _("Manage the course") }}
+
+
+ {% elif membership %}
+
+ {{ _("Continue Learning") }}
+
+ {% endif %}
+
+ {% set progress = frappe.utils.cint(membership.progress) %}
+
+ {% if membership and course.enable_certification %}
+ {% if certificate %}
+
+ {{ _("Get Certificate") }}
+
+
+ {% elif eligible_for_evaluation %}
+
+ {{ _("Apply for Certificate") }}
+
+
+ {% elif course.grant_certificate_after == "Completion" and progress == 100 %}
+
+ {{ _("Get Certificate") }}
+
+ {% endif %}
+ {% endif %}
+
+ {% if is_instructor(course.name) %}
+
{{ _("Edit Course") }}
+ {% endif %}
+{% endmacro %}
+
+
+
+{% macro Notes(course) %}
+
+ {{ _("You have opted to be notified for this course. You will receive an email when the course becomes available.") }}
+
+
+ {% if certificate_request and not certificate %}
+
{{ _("Evaluation On: ") }}
+ {{ _("{0} at {1}").format(frappe.utils.format_date(certificate_request.date, "medium"),
+ frappe.utils.format_time(certificate_request.start_time, "short")) }}
+ {% endif %}
+
+ {% if course.status == "Under Review" %}
+
+ {{ _("Your course is currently under review. Once the review is complete, the System Admins will publish it on the website.") }}
+
+ {% endif %}
+
+ {% if no_of_attempts and no_of_attempts >= course.max_attempts %}
+
{{ _("You have exceeded the maximum number of attempts allowed to appear for evaluations of this course.") }}
+ {% endif %}
+{% endmacro %}
+
+
+
+{% macro SlotModal(course) %}
-{% endif %}
-{% endmacro %}
-
-
-
-{% macro Description(course) %}
-
{% if course.description %}{{ frappe.utils.md_to_html(course.description) }}{% endif %}
-{% endmacro %}
-
-
-
-{% macro Save(course) %}
-{% if course.edit_mode %}
-
-
-
-{% endif %}
-{% endmacro %}
-
-{% macro CourseCreator(course) %}
-
{{ _("Course Creators") }}
-
-
- {% set instructors = get_instructors(course.name) %}
- {% for instructor in instructors %}
-
- {{ widgets.Avatar(member=instructor, avatar_class="avatar-medium") }}
-
-
{{ instructor.full_name }}
-
{{ get_authored_courses(instructor.name) | length }} {{ _("Courses Created") }}
-
-
- {% endfor %}
-
-{% endmacro %}
-
-{% macro RelatedCourses(course) %}
-{% if course.related_courses | length %}
-
-{% endif%}
{% endmacro %}