diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 57a1f906..93e811c8 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -387,3 +387,7 @@ def first_lesson_exists(course): return False return True + +def redirect_to_courses_list(): + frappe.local.flags.redirect_location = "/courses" + raise frappe.Redirect diff --git a/lms/lms/widgets/CourseOutline.html b/lms/lms/widgets/CourseOutline.html index c231ffea..f15622b4 100644 --- a/lms/lms/widgets/CourseOutline.html +++ b/lms/lms/widgets/CourseOutline.html @@ -13,7 +13,7 @@ {% if get_chapters(course.name) | length %} {% for chapter in get_chapters(course.name) %} -
+
{% endmacro %} +{% macro EditLesson(lesson) %} +
{% if lesson.body %} {{ lesson.body }} {% endif %}
+ +
+ + + +
+ + +
+
+ +
+ + + + + {{ _("Upload Attachments") }} + +
+
+
+
+
+{% endmacro %} + {% macro Discussions() %} {% set topics_count = frappe.db.count("Discussion Topic", {"reference_doctype": "Course Lesson", "reference_docname": lesson.name}) %} diff --git a/lms/www/batch/learn.js b/lms/www/batch/learn.js index 621bccc7..1921adfa 100644 --- a/lms/www/batch/learn.js +++ b/lms/www/batch/learn.js @@ -1,6 +1,7 @@ frappe.ready(() => { localStorage.removeItem($("#quiz-title").text()); + fetch_assignments(); save_current_lesson(); @@ -478,7 +479,7 @@ const save_lesson = (e) => { method: "lms.lms.doctype.lms_course.lms_course.save_lesson", args: { "title": $("#title").text(), - "body": $("#body").text(), + "body": $("#body").find("br").replaceWith("\n\n").end().text(), "chapter": $("#title").data("chapter"), "preview": $("#preview").prop("checked") ? 1 : 0, "idx": $("#title").data("index"), diff --git a/lms/www/batch/learn.py b/lms/www/batch/learn.py index 43d73aee..8eb84ea7 100644 --- a/lms/www/batch/learn.py +++ b/lms/www/batch/learn.py @@ -1,7 +1,6 @@ -from re import I import frappe from lms.www.utils import get_common_context, redirect_to_lesson -from lms.lms.utils import get_lesson_url +from lms.lms.utils import get_lesson_url, is_instructor, redirect_to_courses_list from frappe.utils import cstr, flt def get_context(context): @@ -28,6 +27,8 @@ def get_context(context): context.lessom = frappe._dict() if frappe.form_dict.get("edit"): + if not is_instructor(context.course.name): + redirect_to_courses_list() context.lesson.edit_mode = True neighbours = get_neighbours(lesson_number, context.lessons) diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html index c3975797..d77941c6 100644 --- a/lms/www/courses/course.html +++ b/lms/www/courses/course.html @@ -307,7 +307,8 @@ data-placeholder="Description">{% if course.description %}{{ frappe.utils.md_to_ {% macro Save(course) %} {% if course.edit_mode %}
- +
{% endif %} {% endmacro %} diff --git a/lms/www/courses/course.js b/lms/www/courses/course.js index 1874142e..a0537241 100644 --- a/lms/www/courses/course.js +++ b/lms/www/courses/course.js @@ -322,7 +322,7 @@ const clear_image = () => { const add_tag = (e) => { $(`
`).insertBefore(`.btn-tag`); + data-placeholder="${__('Tag')}">
`).insertBefore(`.btn-tag`); }; diff --git a/lms/www/courses/course.py b/lms/www/courses/course.py index 94eed8f3..8cfc2feb 100644 --- a/lms/www/courses/course.py +++ b/lms/www/courses/course.py @@ -1,6 +1,6 @@ import frappe from lms.lms.doctype.lms_settings.lms_settings import check_profile_restriction -from lms.lms.utils import get_membership, is_instructor, is_certified, get_evaluation_details +from lms.lms.utils import get_membership, is_instructor, is_certified, get_evaluation_details, redirect_to_courses_list def get_context(context): context.no_cache = 1 @@ -72,8 +72,3 @@ def get_user_interest(course): def show_start_learing_cta(course, membership, restriction): return not course.disable_self_learning and not membership and not course.upcoming and not restriction.get("restrict") and not is_instructor(course.name) - - -def redirect_to_courses_list(): - frappe.local.flags.redirect_location = "/courses" - raise frappe.Redirect