fix: dashboard links, web form redirects and patch for status

This commit is contained in:
Jannat Patel
2022-03-15 16:51:39 +05:30
parent aa9ef65375
commit 27e1aec001
18 changed files with 99 additions and 46 deletions

View File

@@ -1,5 +1,6 @@
{
"actions": [],
"autoname": "hash",
"creation": "2021-07-27 16:25:02.903245",
"doctype": "DocType",
"editable_grid": 1,
@@ -20,13 +21,15 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-09-30 10:35:30.014950",
"modified": "2022-03-15 09:39:41.937565",
"modified_by": "Administrator",
"module": "LMS",
"name": "Chapter Reference",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}

View File

@@ -110,11 +110,5 @@ def save_progress(lesson, course, status):
return progress
@frappe.whitelist()
def get_lesson_info(lesson_name):
chapter = frappe.db.get_value("Course Lesson", lesson_name, "chapter")
course = frappe.db.get_value("Course Chapter", chapter, "course")
lesson_idx = frappe.db.get_value("Lesson Reference", {"lesson": lesson_name}, ["idx"])
chapter_idx = frappe.db.get_value("Chapter Reference", {"chapter": chapter}, ["idx"])
return get_lesson_url(course, f"{chapter_idx}.{lesson_idx}")
def get_lesson_info(chapter):
return frappe.db.get_value("Course Chapter", chapter, "course")

View File

@@ -1,5 +1,6 @@
{
"actions": [],
"autoname": "hash",
"creation": "2021-07-27 16:25:48.269536",
"doctype": "DocType",
"editable_grid": 1,
@@ -20,13 +21,15 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-09-30 10:35:47.832547",
"modified": "2022-03-15 09:39:29.495991",
"modified_by": "Administrator",
"module": "LMS",
"name": "Lesson Reference",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}

View File

@@ -144,8 +144,10 @@
"fieldname": "status",
"fieldtype": "Select",
"hidden": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"options": "In Progress\nReady for Review\nApproved",
"options": "In Progress\nUnder Review\nApproved",
"read_only": 1
},
{
@@ -184,7 +186,7 @@
"link_fieldname": "course"
}
],
"modified": "2022-03-14 17:56:46.514391",
"modified": "2022-03-15 10:16:53.796878",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",

View File

@@ -208,5 +208,5 @@ def submit_for_review(course):
chapters = frappe.get_all("Chapter Reference", {"parent": course})
if not len(chapters):
return "No Chp"
frappe.db.set_value("LMS Course", course, "status", "Ready for Review")
frappe.db.set_value("LMS Course", course, "status", "Under Review")
return "OK"

View File

@@ -1,5 +1,6 @@
frappe.ready(function() {
frappe.web_form.after_save = () => {
window.location.href = `/dashboard#courses-created`;
let route = frappe.web_form.doc.name ? `/courses/${frappe.web_form.doc.name}` : `/course`;
window.location.href = route;
}
});

View File

@@ -1,5 +1,15 @@
frappe.ready(function() {
frappe.web_form.after_save = () => {
window.location.href = `/courses/`
frappe.web_form.after_save = () => {
setTimeout(() => {
frappe.call({
method: "school.lms.doctype.course_lesson.course_lesson.get_lesson_info",
args: {
"chapter": frappe.web_form.doc.chapter
},
callback: (data) => {
window.location.href = `/courses/${data.message}`;
}
});
});
};
});

View File

@@ -17,9 +17,11 @@
<div class="course-card-content">
<div class="course-card-meta">
{% if get_lessons(course.name) | length %}
<span>
{{ get_lessons(course.name) | length }} {{ _("Lessons") }}
</span>
<span> {{ get_lessons(course.name) | length }} {{ _("Lessons") }} </span>
{% endif %}
{% if course.status and course.status != "Approved"%}
{% set pill_color = "gray" if course.status == "In Progress" else "orange" %}
<span class="pull-right indicator-pill {{ pill_color }} "> {{ course.status }} </span>
{% endif %}
</div>
<div class="course-card-title">{{ course.title }}</div>