diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index a420dec3..0019f743 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -167,7 +167,6 @@ def reindex_exercises(doc): @frappe.whitelist(allow_guest=True) def search_course(text): - search_courses = [] courses = frappe.get_all( "LMS Course", filters={"published": True}, @@ -177,17 +176,8 @@ def search_course(text): "short_introduction": ["like", f"%{text}%"], "description": ["like", f"%{text}%"], }, + fields=["name", "title"], ) - - """ for course in courses: - search_courses.append(frappe.get_doc("LMS Course", course)) """ - - """ template = frappe.render_template("lms/templates/course_list.html", { - "title": _("Search Results"), - "courses": search_courses, - "widgets": Widgets() - }) """ - return courses diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 1f9ea4ac..1697920b 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -929,17 +929,29 @@ pre { } .search { - background-image: url(/assets/frappe/icons/timeless/search.svg); - border: none; - border-radius: var(--border-radius-md); - font-size: var(--text-sm); - padding: 0.625rem 0.75rem; - height: 36px; - background-repeat: no-repeat; - text-indent: 1.5rem; - background-position: 1rem 0.7rem; - width: 30%; - box-shadow: var(--shadow-sm); + background-image: url(/assets/frappe/icons/timeless/search.svg); + border: none; + border-radius: var(--border-radius-md); + font-size: var(--text-sm); + padding: 0.625rem 0.75rem; + height: 36px; + background-repeat: no-repeat; + text-indent: 1.5rem; + background-position: 1rem 0.7rem; + width: 30%; + box-shadow: var(--shadow-sm); +} + +.search-course { + background-position: 1rem; + text-indent: 1rem; + font-size: var(--text-base); + padding: 1.5rem; + width: 100%; +} + +.search:focus { + outline: none; } .course-search-header { @@ -1918,3 +1930,28 @@ select { cursor: pointer; margin-right: 1rem; } + +.result-row { + display: block; + padding: 1rem; + border-top: 1px solid var(--gray-300); + font-weight: 500; + color: var(--gray-900); + font-size: var(--text-base); + cursor: pointer; +} + +.result-row:hover { + color: inherit; + text-decoration: none; +} + +.search-modal .modal-dialog { + max-width: 70%; + margin: 15% auto !important; +} + +.search-modal .modal-body { + padding: 0 !important; + margin: 0 !important; +} diff --git a/lms/templates/search_course/search_course.html b/lms/templates/search_course/search_course.html index 3de74cb2..22bcd2a2 100644 --- a/lms/templates/search_course/search_course.html +++ b/lms/templates/search_course/search_course.html @@ -1,16 +1,14 @@ {% set search_placeholder = frappe.db.get_single_value("LMS Settings", "search_placeholder") %} {% set portal_course_creation = frappe.db.get_single_value("LMS Settings", "portal_course_creation") %} - -