fix: misc fixes
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<div class="text-base">
|
<div class="text-base">
|
||||||
<div
|
<div
|
||||||
v-if="title && (outline.data?.length || allowEdit)"
|
v-if="title && (outline.data?.length || allowEdit)"
|
||||||
class="flex items-center justify-between mb-4 pl-2"
|
class="grid grid-cols-[70%,30%] mb-4 px-3"
|
||||||
>
|
>
|
||||||
<div class="font-semibold text-lg">
|
<div class="font-semibold text-lg">
|
||||||
{{ __(title) }}
|
{{ __(title) }}
|
||||||
|
|||||||
@@ -149,6 +149,12 @@ updateDocumentTitle(pageMeta)
|
|||||||
padding: revert;
|
padding: revert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.course-description ul {
|
||||||
|
list-style: disc;
|
||||||
|
margin: revert;
|
||||||
|
padding: revert;
|
||||||
|
}
|
||||||
|
|
||||||
.avatar-group {
|
.avatar-group {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
<div class="text-lg font-semibold mt-5 mb-4">
|
<div class="text-lg font-semibold mt-5 mb-4">
|
||||||
{{ __('Settings') }}
|
{{ __('Settings') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between mb-5">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<FormControl
|
<FormControl
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
v-model="course.published"
|
v-model="course.published"
|
||||||
@@ -139,6 +139,12 @@
|
|||||||
:label="__('Disable Self Enrollment')"
|
:label="__('Disable Self Enrollment')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<FormControl
|
||||||
|
v-model="course.published_on"
|
||||||
|
:label="__('Published On')"
|
||||||
|
type="date"
|
||||||
|
class="mb-5"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="container border-t">
|
<div class="container border-t">
|
||||||
<div class="text-lg font-semibold mt-5 mb-4">
|
<div class="text-lg font-semibold mt-5 mb-4">
|
||||||
@@ -212,6 +218,7 @@ const course = reactive({
|
|||||||
course_image: null,
|
course_image: null,
|
||||||
tags: '',
|
tags: '',
|
||||||
published: false,
|
published: false,
|
||||||
|
published_on: '',
|
||||||
upcoming: false,
|
upcoming: false,
|
||||||
disable_self_learning: false,
|
disable_self_learning: false,
|
||||||
paid_course: false,
|
paid_course: false,
|
||||||
@@ -358,7 +365,7 @@ watch(
|
|||||||
|
|
||||||
const validateFile = (file) => {
|
const validateFile = (file) => {
|
||||||
let extension = file.name.split('.').pop().toLowerCase()
|
let extension = file.name.split('.').pop().toLowerCase()
|
||||||
if (!['jpg', 'jpeg', 'png'].includes(extension)) {
|
if (!['jpg', 'jpeg', 'png', 'webp'].includes(extension)) {
|
||||||
return 'Only image file is allowed.'
|
return 'Only image file is allowed.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,13 @@ def create_certificate(course):
|
|||||||
},
|
},
|
||||||
"value",
|
"value",
|
||||||
)
|
)
|
||||||
|
if not default_certificate_template:
|
||||||
|
default_certificate_template = frappe.db.get_value(
|
||||||
|
"Print Format",
|
||||||
|
{
|
||||||
|
"doc_type": "LMS Certificate",
|
||||||
|
},
|
||||||
|
)
|
||||||
certificate = frappe.get_doc(
|
certificate = frappe.get_doc(
|
||||||
{
|
{
|
||||||
"doctype": "LMS Certificate",
|
"doctype": "LMS Certificate",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import random
|
import random
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint, today
|
||||||
from frappe.utils.telemetry import capture
|
from frappe.utils.telemetry import capture
|
||||||
from lms.lms.utils import get_chapters, can_create_courses
|
from lms.lms.utils import get_chapters, can_create_courses
|
||||||
from ...utils import generate_slug, validate_image
|
from ...utils import generate_slug, validate_image
|
||||||
@@ -14,11 +14,16 @@ from frappe import _
|
|||||||
|
|
||||||
class LMSCourse(Document):
|
class LMSCourse(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.validate_published()
|
||||||
self.validate_instructors()
|
self.validate_instructors()
|
||||||
self.validate_video_link()
|
self.validate_video_link()
|
||||||
self.validate_status()
|
self.validate_status()
|
||||||
self.image = validate_image(self.image)
|
self.image = validate_image(self.image)
|
||||||
|
|
||||||
|
def validate_published(self):
|
||||||
|
if self.published and not self.published_on:
|
||||||
|
self.published_on = today()
|
||||||
|
|
||||||
def validate_instructors(self):
|
def validate_instructors(self):
|
||||||
if self.is_new() and not self.instructors:
|
if self.is_new() and not self.instructors:
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ def new_course(title, additional_filters=None):
|
|||||||
"title": title,
|
"title": title,
|
||||||
"short_introduction": title,
|
"short_introduction": title,
|
||||||
"description": title,
|
"description": title,
|
||||||
|
"video_link": "https://youtu.be/pEbIhUySqbk",
|
||||||
|
"image": "/assets/lms/images/course-home.png",
|
||||||
}
|
}
|
||||||
|
|
||||||
if additional_filters:
|
if additional_filters:
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ def get_meta(app_path):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if re.match(r"^courses/.*$", app_path):
|
if re.match(r"^courses/.*$", app_path):
|
||||||
|
if "new/edit" in app_path:
|
||||||
|
return {
|
||||||
|
"title": _("New Course"),
|
||||||
|
"image": frappe.db.get_single_value("Website Settings", "banner_image"),
|
||||||
|
"description": "Create a new course",
|
||||||
|
"keywords": "New Course, Create Course",
|
||||||
|
"link": "/lms/courses/new/edit",
|
||||||
|
}
|
||||||
course_name = app_path.split("/")[1]
|
course_name = app_path.split("/")[1]
|
||||||
course = frappe.db.get_value(
|
course = frappe.db.get_value(
|
||||||
"LMS Course",
|
"LMS Course",
|
||||||
@@ -56,7 +64,6 @@ def get_meta(app_path):
|
|||||||
"link": "/batches",
|
"link": "/batches",
|
||||||
}
|
}
|
||||||
if re.match(r"^batches/details/.*$", app_path):
|
if re.match(r"^batches/details/.*$", app_path):
|
||||||
print(app_path, "app_path")
|
|
||||||
batch_name = app_path.split("/")[2]
|
batch_name = app_path.split("/")[2]
|
||||||
batch = frappe.db.get_value(
|
batch = frappe.db.get_value(
|
||||||
"LMS Batch",
|
"LMS Batch",
|
||||||
|
|||||||
Reference in New Issue
Block a user