fix: course page
This commit is contained in:
@@ -8,7 +8,9 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"course",
|
"course",
|
||||||
"title",
|
"title",
|
||||||
|
"column_break_3",
|
||||||
"description",
|
"description",
|
||||||
|
"section_break_5",
|
||||||
"lessons"
|
"lessons"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@@ -20,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Markdown Editor",
|
"fieldtype": "Small Text",
|
||||||
"label": "Description"
|
"label": "Description"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -35,6 +37,14 @@
|
|||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Lessons",
|
"label": "Lessons",
|
||||||
"options": "Lessons"
|
"options": "Lessons"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_3",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_5",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
@@ -45,7 +55,7 @@
|
|||||||
"link_fieldname": "chapter"
|
"link_fieldname": "chapter"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-07-27 16:28:08.667964",
|
"modified": "2021-08-19 13:43:51.025072",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Chapter",
|
"name": "Chapter",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
frappe.ui.form.on('LMS Course', {
|
frappe.ui.form.on('LMS Course', {
|
||||||
|
|
||||||
onload: function (frm) {
|
onload: function (frm) {
|
||||||
|
|
||||||
frm.set_query("chapter", "chapters", function () {
|
frm.set_query("chapter", "chapters", function () {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -11,6 +12,14 @@ frappe.ui.form.on('LMS Course', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("instructor", function (doc) {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"ignore_user_type": 1,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,17 +18,18 @@
|
|||||||
"video_link",
|
"video_link",
|
||||||
"image",
|
"image",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
|
"instructor",
|
||||||
"tags",
|
"tags",
|
||||||
|
"section_break_7",
|
||||||
"is_published",
|
"is_published",
|
||||||
|
"column_break_9",
|
||||||
"upcoming",
|
"upcoming",
|
||||||
|
"column_break_11",
|
||||||
"disable_self_learning",
|
"disable_self_learning",
|
||||||
"section_break_5",
|
"section_break_5",
|
||||||
"short_introduction",
|
"short_introduction",
|
||||||
"description",
|
"description",
|
||||||
"chapters",
|
"chapters"
|
||||||
"certification_section",
|
|
||||||
"enable_certification",
|
|
||||||
"expiry"
|
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -99,23 +100,25 @@
|
|||||||
"options": "Chapters"
|
"options": "Chapters"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "certification_section",
|
"fieldname": "instructor",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"in_standard_filter": 1,
|
||||||
|
"label": "Instructor",
|
||||||
|
"options": "User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_7",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Certification"
|
"label": "Course Settings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"fieldname": "column_break_9",
|
||||||
"fieldname": "enable_certification",
|
"fieldtype": "Column Break"
|
||||||
"fieldtype": "Check",
|
|
||||||
"label": "Enable Certification"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"fieldname": "column_break_11",
|
||||||
"depends_on": "enable_certification",
|
"fieldtype": "Column Break"
|
||||||
"fieldname": "expiry",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"label": "Certification Expires After Years",
|
|
||||||
"options": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
@@ -137,7 +140,7 @@
|
|||||||
"link_fieldname": "course"
|
"link_fieldname": "course"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-08-18 18:02:12.623807",
|
"modified": "2021-08-20 11:01:15.795219",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Course",
|
"name": "LMS Course",
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ class LMSCourse(Document):
|
|||||||
return batch_name and frappe.get_doc("LMS Batch", batch_name)
|
return batch_name and frappe.get_doc("LMS Batch", batch_name)
|
||||||
|
|
||||||
def get_instructor(self):
|
def get_instructor(self):
|
||||||
|
if self.instructor:
|
||||||
|
return frappe.get_doc("User", self.instructor)
|
||||||
return frappe.get_doc("User", self.owner)
|
return frappe.get_doc("User", self.owner)
|
||||||
|
|
||||||
def get_chapters(self):
|
def get_chapters(self):
|
||||||
|
|||||||
@@ -8,3 +8,4 @@ community.patches.replace_member_with_user_in_lms_message
|
|||||||
community.patches.replace_member_with_user_in_mentor_request
|
community.patches.replace_member_with_user_in_mentor_request
|
||||||
community.patches.v0_0.chapter_lesson_index_table
|
community.patches.v0_0.chapter_lesson_index_table
|
||||||
execute:frappe.delete_doc("DocType", "LMS Message")
|
execute:frappe.delete_doc("DocType", "LMS Message")
|
||||||
|
community.patches.v0_0.course_instructor_update
|
||||||
|
|||||||
7
community/patches/v0_0/course_instructor_update.py
Normal file
7
community/patches/v0_0/course_instructor_update.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||||
|
courses = frappe.get_all("LMS Course", fields=["name", "owner"])
|
||||||
|
for course in courses:
|
||||||
|
frappe.db.set_value("LMS Course", course.name, "instructor", course.owner)
|
||||||
@@ -16,9 +16,9 @@ def get_context(context):
|
|||||||
redirect_to_course_list()
|
redirect_to_course_list()
|
||||||
|
|
||||||
context.course = frappe.db.get_value("LMS Course", course_name,
|
context.course = frappe.db.get_value("LMS Course", course_name,
|
||||||
["owner", "title", "name"], as_dict=True)
|
["instructor", "title", "name"], as_dict=True)
|
||||||
|
|
||||||
context.instructor = frappe.db.get_value("User", context.course.owner,
|
context.instructor = frappe.db.get_value("User", context.course.instructor,
|
||||||
["full_name", "username"], as_dict=True)
|
["full_name", "username"], as_dict=True)
|
||||||
|
|
||||||
context.student = frappe.db.get_value("User", context.certificate.student,
|
context.student = frappe.db.get_value("User", context.certificate.student,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="course-buttons">
|
<div class="course-buttons">
|
||||||
{% if not course.disable_self_learning and not membership %}
|
{% if not course.disable_self_learning and not membership and not course.upcoming %}
|
||||||
<div class="button wide-button start-learning is-primary join-batch" data-course="{{ course.name | urlencode }}">
|
<div class="button wide-button start-learning is-primary join-batch" data-course="{{ course.name | urlencode }}">
|
||||||
Start Learning
|
Start Learning
|
||||||
<img class="ml-2" src="/assets/community/icons/white-arrow.svg" />
|
<img class="ml-2" src="/assets/community/icons/white-arrow.svg" />
|
||||||
|
|||||||
0
community/www/discussions/__init__.py
Normal file
0
community/www/discussions/__init__.py
Normal file
Reference in New Issue
Block a user