fix: removed switch to desk
This commit is contained in:
@@ -1,67 +1,67 @@
|
|||||||
<template>
|
<template>
|
||||||
<Popover placement="right-start" class="flex w-full">
|
<Popover placement="right-start" class="flex w-full">
|
||||||
<template #target="{ togglePopover }">
|
<template #target="{ togglePopover }">
|
||||||
<button
|
<button
|
||||||
:class="[
|
:class="[
|
||||||
'group w-full flex h-7 items-center justify-between rounded px-2 text-base text-gray-800 hover:bg-gray-100',
|
'group w-full flex h-7 items-center justify-between rounded px-2 text-base text-gray-800 hover:bg-gray-100',
|
||||||
]"
|
]"
|
||||||
@click.prevent="togglePopover()"
|
@click.prevent="togglePopover()"
|
||||||
>
|
>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<LayoutGrid class="size-4 stroke-1.5" />
|
<LayoutGrid class="size-4 stroke-1.5" />
|
||||||
<span class="whitespace-nowrap">
|
<span class="whitespace-nowrap">
|
||||||
{{ __('Apps') }}
|
{{ __('Apps') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronRight class="h-4 w-4 stroke-1.5" />
|
<ChevronRight class="h-4 w-4 stroke-1.5" />
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<div
|
<div
|
||||||
class="grid grid-cols-3 justify-between mx-3 p-2 rounded-lg border border-gray-100 bg-white shadow-xl"
|
class="grid grid-cols-3 justify-between mx-3 p-2 rounded-lg border border-gray-100 bg-white shadow-xl"
|
||||||
>
|
>
|
||||||
<div v-for="app in apps.data" key="name">
|
<div v-for="app in apps.data" key="name">
|
||||||
<a
|
<a
|
||||||
:href="app.route"
|
:href="app.route"
|
||||||
class="flex flex-col gap-1.5 rounded justify-center items-center py-2 px-3 hover:bg-gray-100"
|
class="flex flex-col gap-1.5 rounded justify-center items-center py-2 px-3 hover:bg-gray-100"
|
||||||
>
|
>
|
||||||
<img class="size-8" :src="app.logo" />
|
<img class="size-8" :src="app.logo" />
|
||||||
<div class="text-sm" @click="app.onClick">
|
<div class="text-sm" @click="app.onClick">
|
||||||
{{ app.title }}
|
{{ app.title }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Popover>
|
</Popover>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Popover, createResource } from 'frappe-ui'
|
import { Popover, createResource } from 'frappe-ui'
|
||||||
import { LayoutGrid, ChevronRight } from 'lucide-vue-next';
|
import { LayoutGrid, ChevronRight } from 'lucide-vue-next'
|
||||||
|
|
||||||
const apps = createResource({
|
const apps = createResource({
|
||||||
url: 'frappe.apps.get_apps',
|
url: 'frappe.apps.get_apps',
|
||||||
cache: 'apps',
|
cache: 'apps',
|
||||||
auto: true,
|
auto: true,
|
||||||
transform: (data) => {
|
transform: (data) => {
|
||||||
let _apps = [
|
let _apps = [
|
||||||
{
|
{
|
||||||
name: 'frappe',
|
name: 'frappe',
|
||||||
logo: '/assets/lms/images/desk.png',
|
logo: '/assets/lms/images/desk.png',
|
||||||
title: __('Desk'),
|
title: __('Desk'),
|
||||||
route: '/app',
|
route: '/app',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
data.map((app) => {
|
data.map((app) => {
|
||||||
if (app.name === 'lms') return
|
if (app.name === 'lms') return
|
||||||
_apps.push({
|
_apps.push({
|
||||||
name: app.name,
|
name: app.name,
|
||||||
logo: app.logo,
|
logo: app.logo,
|
||||||
title: __(app.title),
|
title: __(app.title),
|
||||||
route: app.route,
|
route: app.route,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return _apps
|
return _apps
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
16
lms/hooks.py
16
lms/hooks.py
@@ -232,10 +232,12 @@ signup_form_template = "lms.plugins.show_custom_signup"
|
|||||||
|
|
||||||
on_session_creation = "lms.overrides.user.on_session_creation"
|
on_session_creation = "lms.overrides.user.on_session_creation"
|
||||||
|
|
||||||
add_to_apps_screen = [{
|
add_to_apps_screen = [
|
||||||
"name": "lms",
|
{
|
||||||
"logo": "/assets/lms/images/lms-logo.png",
|
"name": "lms",
|
||||||
"title": "Learning",
|
"logo": "/assets/lms/images/lms-logo.png",
|
||||||
"route": "/lms",
|
"title": "Learning",
|
||||||
"has_permission": "lms.lms.api.check_app_permission"
|
"route": "/lms",
|
||||||
}]
|
"has_permission": "lms.lms.api.check_app_permission",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ def get_members(start=0, search=""):
|
|||||||
|
|
||||||
return members
|
return members
|
||||||
|
|
||||||
|
|
||||||
def check_app_permission():
|
def check_app_permission():
|
||||||
"""Check if the user has permission to access the app."""
|
"""Check if the user has permission to access the app."""
|
||||||
if frappe.session.user == "Administrator":
|
if frappe.session.user == "Administrator":
|
||||||
|
|||||||
Reference in New Issue
Block a user