feat: editor js import

This commit is contained in:
Jannat Patel
2023-04-18 11:51:57 +05:30
parent 4c220a67f2
commit a0782c7bf7
11 changed files with 70 additions and 17 deletions
+25
View File
@@ -0,0 +1,25 @@
{% extends "lms/templates/lms_base.html" %}
{% block title %}
{% if lesson.title %}
{{ lesson.title }} - {{ course.title }}
{% else %}
{{ _("New Lesson") }}
{% endif %}
{% endblock %}
{% block content %}
<div class="container">
<div>
<div class="">
<div>
{{ _("Title") }}
</div>
<div>
{{ _("Something short and concise.") }}
</div>
<input class="form-control">
</div>
</div>
</div>
{% endblock %}
+10
View File
@@ -0,0 +1,10 @@
import frappe
from lms.www.utils import get_current_lesson_details, get_common_context
def get_context(context):
get_common_context(context)
chapter_index = frappe.form_dict.get("chapter")
lesson_index = frappe.form_dict.get("lesson")
lesson_number = f"{chapter_index}.{lesson_index}"
context.lesson = get_current_lesson_details(lesson_number, context)
+2 -2
View File
@@ -593,7 +593,7 @@ const build_attachment_table = (file_doc) => {
};
const make_editor = () => {
this.code_field_group = new frappe.ui.FieldGroup({
/* this.code_field_group = new frappe.ui.FieldGroup({
fields: [
{
fieldname: "code_md",
@@ -606,7 +606,7 @@ const make_editor = () => {
this.code_field_group.make();
$("#body .form-section:last").removeClass("empty-section");
$("#body .frappe-control").removeClass("hide-control");
$("#body .form-column").addClass("p-0");
$("#body .form-column").addClass("p-0"); */
};
const set_file_type = () => {
+5 -15
View File
@@ -3,7 +3,11 @@ from frappe import _
from frappe.utils import cstr, flt
from lms.lms.utils import get_lesson_url, has_course_moderator_role, is_instructor
from lms.www.utils import get_common_context, redirect_to_lesson
from lms.www.utils import (
get_common_context,
redirect_to_lesson,
get_current_lesson_details,
)
def get_context(context):
@@ -62,20 +66,6 @@ def get_context(context):
}
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):
if frappe.form_dict.get("edit"):
return None
else:
redirect_to_lesson(context.course)
lesson_info = details_list[0]
lesson_info.body = lesson_info.body.replace('"', "'")
return lesson_info
def get_url(lesson_number, course):
return (
get_lesson_url(course.name, lesson_number)