Merge branch 'develop' of https://github.com/frappe/lms into read-only

This commit is contained in:
Jannat Patel
2025-04-29 18:40:42 +05:30
2 changed files with 20 additions and 2 deletions

View File

@@ -31,9 +31,21 @@
)
}}
</div>
<Button v-if="user.data" @click="enrollStudent()" variant="solid">
<Button
v-if="user.data && !lesson.data.disable_self_learning"
@click="enrollStudent()"
variant="solid"
>
{{ __('Start Learning') }}
</Button>
<Badge
theme="blue"
size="lg"
v-else-if="lesson.data.disable_self_learning"
class="mt-2"
>
{{ __('Contact the Administrator to enroll for this course.') }}
</Badge>
<Button v-else @click="redirectToLogin()">
<template #prefix>
<LogIn class="w-4 h-4 stroke-1" />
@@ -254,6 +266,7 @@
<script setup>
import {
createResource,
Badge,
Breadcrumbs,
Button,
Tooltip,

View File

@@ -1271,7 +1271,10 @@ def get_lesson(course, chapter, lesson):
membership = get_membership(course)
course_info = frappe.db.get_value(
"LMS Course", course, ["title", "paid_certificate"], as_dict=1
"LMS Course",
course,
["title", "paid_certificate", "disable_self_learning"],
as_dict=1,
)
if (
@@ -1284,6 +1287,7 @@ def get_lesson(course, chapter, lesson):
"no_preview": 1,
"title": lesson_details.title,
"course_title": course_info.title,
"disable_self_learning": course_info.disable_self_learning,
}
lesson_details = frappe.db.get_value(
@@ -1324,6 +1328,7 @@ def get_lesson(course, chapter, lesson):
lesson_details.instructors = get_instructors("LMS Course", course)
lesson_details.course_title = course_info.title
lesson_details.paid_certificate = course_info.paid_certificate
lesson_details.disable_self_learning = course_info.disable_self_learning
return lesson_details