feat: text editor for description
This commit is contained in:
@@ -53,7 +53,7 @@ class CourseLesson(Document):
|
||||
ex.course = None
|
||||
ex.index_ = 0
|
||||
ex.index_label = ""
|
||||
ex.save()
|
||||
ex.save(ignore_permissions=True)
|
||||
|
||||
def check_and_create_folder(self):
|
||||
args = {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Markdown Editor",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Description",
|
||||
"reqd": 1
|
||||
},
|
||||
@@ -260,7 +260,7 @@
|
||||
}
|
||||
],
|
||||
"make_attachments_public": 1,
|
||||
"modified": "2023-02-23 09:45:54.826327",
|
||||
"modified": "2023-02-23 09:45:54.826328",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
{% if course.edit_mode and course.name %}
|
||||
<button class="btn btn-md btn-secondary btn-chapter pull-right"> {{ _("New Chapter") }} </button>
|
||||
<button class="btn btn-sm btn-secondary btn-chapter pull-right"> {{ _("New Chapter") }} </button>
|
||||
{% endif %}
|
||||
|
||||
{% if course.name and (course.edit_mode or chapters | length) %}
|
||||
|
||||
@@ -50,4 +50,5 @@ lms.patches.v0_0.video_embed_link
|
||||
lms.patches.v0_0.rename_exercise_doctype
|
||||
lms.patches.v0_0.add_question_type
|
||||
lms.patches.v0_0.add_evaluator_to_assignment
|
||||
lms.patches.v0_0.convert_lesson_markdown_to_html #05-04-2023
|
||||
lms.patches.v0_0.convert_lesson_markdown_to_html #05-04-2023
|
||||
lms.patches.v0_0.convert_course_description_to_html
|
||||
12
lms/patches/v0_0/convert_course_description_to_html.py
Normal file
12
lms/patches/v0_0/convert_course_description_to_html.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import frappe
|
||||
from lms.lms.md import markdown_to_html
|
||||
|
||||
|
||||
def execute():
|
||||
courses = frappe.get_all("LMS Course", fields=["name", "description"])
|
||||
|
||||
for course in courses:
|
||||
html = markdown_to_html(course.description)
|
||||
frappe.db.set_value("LMS Course", course.name, "description", html)
|
||||
|
||||
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||
@@ -1561,7 +1561,7 @@ li {
|
||||
outline: none;
|
||||
background-color: var(--bg-light-gray);
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px dashed var(--gray-600);
|
||||
border: 1px solid var(--gray-300);
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: var(--gray-900);
|
||||
}
|
||||
@@ -1575,7 +1575,7 @@ li {
|
||||
margin-top: 0.25rem;
|
||||
background-color: var(--bg-light-gray);
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px dashed var(--gray-600);
|
||||
border: 1px solid var(--gray-300);
|
||||
padding: 0.5rem 0.75rem;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,10 @@
|
||||
id="quiz-id">{% if lesson.quiz_id %}{{ lesson.quiz_id }}{% endif %}</div>
|
||||
</div>
|
||||
|
||||
<div id="body" {% if lesson.body %} data-body="{{ lesson.body }}" {% endif %}></div>
|
||||
{% if lesson.body %}
|
||||
<div class="body-data hide"> {{ lesson.body }} </div>
|
||||
{% endif %}
|
||||
<div id="body"></div>
|
||||
|
||||
<div class="d-flex medium mx-0 mb-4">
|
||||
<div class="flex-grow-1" contenteditable="true" data-placeholder="{{ _('Assignment Question') }}"
|
||||
|
||||
@@ -597,13 +597,8 @@ const make_editor = () => {
|
||||
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"',
|
||||
fieldtype: "Text Editor",
|
||||
default: $(".body-data").html(),
|
||||
},
|
||||
],
|
||||
body: $("#body").get(0),
|
||||
|
||||
@@ -201,7 +201,10 @@
|
||||
<!-- Description -->
|
||||
{% macro Description(course) %}
|
||||
{% if course.edit_mode %}
|
||||
<div id="description" {% if course.description %} data-description="{{ course.description }}" {% endif %}></div>
|
||||
{% if course.description %}
|
||||
<div class="description-data hide">{{ course.description }}</div>
|
||||
{% endif %}
|
||||
<div id="description"></div>
|
||||
{% else %}
|
||||
<div class="course-description-section">
|
||||
{{ frappe.utils.md_to_html(course.description) }}
|
||||
@@ -232,12 +235,12 @@
|
||||
<!-- Save -->
|
||||
{% macro Save(course) %}
|
||||
{% if course.edit_mode %}
|
||||
<div class="mt-4 mb-16">
|
||||
<button class="btn btn-primary btn-md btn-save-course">
|
||||
<div class="mb-16">
|
||||
<button class="btn btn-primary btn-sm btn-save-course">
|
||||
{{ _("Save Course Details") }}
|
||||
</button>
|
||||
{% if course.name %}
|
||||
<a class="btn btn-secondary btn-md btn-exit-edit ml-2" href="/courses/{{ course.name }}">
|
||||
<a class="btn btn-secondary btn-sm btn-exit-edit ml-2" href="/courses/{{ course.name }}">
|
||||
{{ _("Back to Course") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -396,13 +396,8 @@ const make_editor = () => {
|
||||
fields: [
|
||||
{
|
||||
fieldname: "code_md",
|
||||
fieldtype: "Code",
|
||||
options: "Markdown",
|
||||
wrap: true,
|
||||
max_lines: Infinity,
|
||||
min_lines: 20,
|
||||
default: $("#description").data("description"),
|
||||
depends_on: 'eval:doc.type=="Markdown"',
|
||||
fieldtype: "Text Editor",
|
||||
default: $(".description-data").html(),
|
||||
},
|
||||
],
|
||||
body: $("#description").get(0),
|
||||
|
||||
Reference in New Issue
Block a user