Merge pull request #761 from pateljannat/rewrite-fixes

fix: mobile layout and certification link
This commit is contained in:
Jannat Patel
2024-04-05 08:59:38 +05:30
committed by GitHub
9 changed files with 37 additions and 15 deletions

View File

@@ -3,7 +3,7 @@
<iframe <iframe
v-if="course.data.video_link" v-if="course.data.video_link"
:src="video_link" :src="video_link"
class="rounded-t-md min-h-56 min-w-80" class="rounded-t-md min-h-56 w-full"
/> />
<div class="p-5"> <div class="p-5">
<div v-if="course.data.price" class="text-2xl font-semibold mb-3"> <div v-if="course.data.price" class="text-2xl font-semibold mb-3">

View File

@@ -11,7 +11,7 @@
<div v-if="showTopics" v-for="(topic, index) in topics.data"> <div v-if="showTopics" v-for="(topic, index) in topics.data">
<div <div
@click="showReplies(topic)" @click="showReplies(topic)"
class="flex items-center cursor-pointer py-5" class="flex items-center cursor-pointer py-5 w-full"
:class="{ 'border-b': index + 1 != topics.data.length }" :class="{ 'border-b': index + 1 != topics.data.length }"
> >
<UserAvatar :user="topic.user" size="2xl" class="mr-4" /> <UserAvatar :user="topic.user" size="2xl" class="mr-4" />
@@ -23,7 +23,7 @@
<span> <span>
{{ topic.user.full_name }} {{ topic.user.full_name }}
</span> </span>
<span class="text-sm ml-2"> <span class="text-sm ml-3">
{{ timeAgo(topic.creation) }} {{ timeAgo(topic.creation) }}
</span> </span>
</div> </div>

View File

@@ -1,13 +1,13 @@
<template> <template>
<div class="flex h-full flex-col"> <div class="flex h-full flex-col">
<div class="h-full" id="scrollContainer"> <div class="h-full pb-10" id="scrollContainer">
<slot /> <slot />
</div> </div>
<div <div
v-if="tabs" v-if="tabs"
class="grid grid-cols-5 border-t border-gray-300 sticky bottom-0 z-10 bg-white standalone:pb-4" class="fixed flex justify-around border-t border-gray-300 bottom-0 z-10 w-full bg-white standalone:pb-4"
:style="{ :style="{
gridTemplateColumns: `repeat(${tabs.length - 1}, minmax(0, 1fr))`, gridTemplateColumns: `repeat(${tabs.length}, minmax(0, 1fr))`,
}" }"
> >
<button <button
@@ -19,7 +19,7 @@
> >
<component <component
:is="tab.icon" :is="tab.icon"
class="h-7 w-7 stroke-1.5" class="h-6 w-6 stroke-1.5"
:class="[isActive(tab) ? 'text-gray-900' : 'text-gray-600']" :class="[isActive(tab) ? 'text-gray-900' : 'text-gray-600']"
/> />
</button> </button>

View File

@@ -31,7 +31,11 @@
> >
{{ __('Loading Batches...') }} {{ __('Loading Batches...') }}
</div> </div>
<Tabs v-model="tabIndex" :tabs="tabs" tablistClass="overflow-x-visible"> <Tabs
v-model="tabIndex"
:tabs="tabs"
tablistClass="overflow-x-visible flex-wrap !gap-3 md:flex-nowrap"
>
<template #tab="{ tab, selected }"> <template #tab="{ tab, selected }">
<div> <div>
<button <button

View File

@@ -3,10 +3,10 @@
<div class="grid md:grid-cols-[70%,30%] h-full"> <div class="grid md:grid-cols-[70%,30%] h-full">
<div> <div>
<header <header
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5" class="sticky top-0 z-10 flex flex-col md:flex-row md:items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
> >
<Breadcrumbs class="h-7" :items="breadcrumbs" /> <Breadcrumbs class="h-7" :items="breadcrumbs" />
<div class="flex items-center"> <div class="flex items-center mt-3 md:mt-0">
<router-link <router-link
v-if="courseResource.data" v-if="courseResource.data"
:to="{ :to="{

View File

@@ -1,12 +1,12 @@
<template> <template>
<div class=""> <div class="">
<div class="grid grid-cols-[75%,25%] h-full"> <div class="grid md:grid-cols-[75%,25%] h-full">
<div class="border-r"> <div class="border-r">
<header <header
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5" class="sticky top-0 z-10 flex flex-col md:flex-row md:items-center justify-between border-b overflow-hidden bg-white px-3 py-2.5 sm:px-5"
> >
<Breadcrumbs :items="breadcrumbs" /> <Breadcrumbs class="text-ellipsis" :items="breadcrumbs" />
<Button variant="solid" @click="saveLesson()"> <Button variant="solid" @click="saveLesson()" class="mt-3 md:mt-0">
{{ __('Save') }} {{ __('Save') }}
</Button> </Button>
</header> </header>

View File

@@ -136,13 +136,17 @@ override_whitelisted_methods = {
# Add all simple route rules here # Add all simple route rules here
website_route_rules = [ website_route_rules = [
{"from_route": "/lms/<path:app_path>", "to_route": "lms"}, {"from_route": "/lms/<path:app_path>", "to_route": "lms"},
{
"from_route": "/courses/<course_name>/<certificate_id>",
"to_route": "certificate",
},
] ]
website_redirects = [ website_redirects = [
{"source": "/update-profile", "target": "/edit-profile"}, {"source": "/update-profile", "target": "/edit-profile"},
{"source": "/courses", "target": "/lms/courses"}, {"source": "/courses", "target": "/lms/courses"},
{ {
"source": r"/courses/(.*)", "source": r"/courses/([^/]*)",
"target": "/lms/courses", "target": "/lms/courses",
"match_with_query_string": True, "match_with_query_string": True,
}, },

0
lms/www/certificate.html Normal file
View File

14
lms/www/certificate.py Normal file
View File

@@ -0,0 +1,14 @@
import frappe
from urllib.parse import quote
def get_context(context):
context.no_cache = 1
template = frappe.db.get_value(
"LMS Certificate", frappe.form_dict.certificate_id, "template"
)
certificate_id = frappe.form_dict.certificate_id
template = quote(template)
frappe.local.flags.redirect_location = f"/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name={certificate_id}&format={template}"
raise frappe.Redirect