Compare commits
73 Commits
v2.0.3
...
pot_develo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f41372c1 | ||
|
|
e07aae3fb0 | ||
|
|
65d628ffc0 | ||
|
|
bf290bbf0a | ||
|
|
3c9059025b | ||
|
|
4b0413720b | ||
|
|
f8b4ff4bd3 | ||
|
|
3b8ff171f4 | ||
|
|
dec270a10b | ||
|
|
152a339c4e | ||
|
|
395fe700e0 | ||
|
|
ec25e895dc | ||
|
|
e02e4c7ab4 | ||
|
|
e69cc9af1a | ||
|
|
98b8464e1a | ||
|
|
0170fcc111 | ||
|
|
0be5439e81 | ||
|
|
63f857b8fc | ||
|
|
a3b8ed8f91 | ||
|
|
cdd46667f3 | ||
|
|
2f8acea988 | ||
|
|
75f0e5b9f1 | ||
|
|
ce51129e84 | ||
|
|
86aa8b0a2a | ||
|
|
aeae62a45c | ||
|
|
6b12df44a0 | ||
|
|
a710183bc7 | ||
|
|
669316ba14 | ||
|
|
6c18f9a02f | ||
|
|
363edb9a50 | ||
|
|
afbf64170a | ||
|
|
14f36d0c64 | ||
|
|
ceecab395b | ||
|
|
b8eb9fd717 | ||
|
|
230a52f06b | ||
|
|
3e82608d5f | ||
|
|
cf2c2345c3 | ||
|
|
05ebe4b787 | ||
|
|
a744a43d14 | ||
|
|
5abdbfec1f | ||
|
|
0335b3b4d0 | ||
|
|
703fafd6c3 | ||
|
|
b956c4e383 | ||
|
|
d0d1fb2c8c | ||
|
|
d18a6f6e73 | ||
|
|
2994144718 | ||
|
|
62ab853605 | ||
|
|
7f7986d77a | ||
|
|
61f01cc51b | ||
|
|
86af8c6301 | ||
|
|
f1b0fcfbfc | ||
|
|
ab5ce39645 | ||
|
|
685e09ce4b | ||
|
|
8ed4f775e5 | ||
|
|
a3a3085b1f | ||
|
|
ed97640107 | ||
|
|
a9e93a679b | ||
|
|
418c36c09f | ||
|
|
935f7f1f7b | ||
|
|
9a0056b6ca | ||
|
|
cd56da5d85 | ||
|
|
97d5d853fc | ||
|
|
8adfe247b2 | ||
|
|
afe7df2989 | ||
|
|
cdb028c69c | ||
|
|
eed330662b | ||
|
|
26db10bbe0 | ||
|
|
14230bd588 | ||
|
|
27ca13ece6 | ||
|
|
471e7d9229 | ||
|
|
b8c3bdc0b4 | ||
|
|
a450c846a6 | ||
|
|
fa774b0db2 |
2
.github/helper/update_pot_file.sh
vendored
2
.github/helper/update_pot_file.sh
vendored
@@ -22,7 +22,7 @@ git config user.name "frappe-pr-bot"
|
|||||||
|
|
||||||
echo "Setting the correct git remote..."
|
echo "Setting the correct git remote..."
|
||||||
# Here, the git remote is a local file path by default. Let's change it to the upstream repo.
|
# Here, the git remote is a local file path by default. Let's change it to the upstream repo.
|
||||||
git remote add upstream https://github.com/frappe/lms.git
|
git remote set-url upstream https://github.com/frappe/lms.git
|
||||||
|
|
||||||
echo "Creating a new branch..."
|
echo "Creating a new branch..."
|
||||||
isodate=$(date -u +"%Y-%m-%d")
|
isodate=$(date -u +"%Y-%m-%d")
|
||||||
|
|||||||
2
.github/workflows/generate-pot-file.yml
vendored
2
.github/workflows/generate-pot-file.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
regeneratee-pot-file:
|
regenerate-pot-file:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
27
.github/workflows/make_release_pr.yml
vendored
Normal file
27
.github/workflows/make_release_pr.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Create weekly release
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# 13:00 UTC -> 7pm IST on every Wednesday
|
||||||
|
- cron: '30 4 * * 3'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: octokit/request-action@v2.x
|
||||||
|
with:
|
||||||
|
route: POST /repos/{owner}/{repo}/pulls
|
||||||
|
owner: frappe
|
||||||
|
repo: lms
|
||||||
|
title: |-
|
||||||
|
"chore: merge 'develop' into 'main'"
|
||||||
|
body: "Automated weekly release"
|
||||||
|
base: main
|
||||||
|
head: develop
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
1
.github/workflows/ui-tests.yml
vendored
1
.github/workflows/ui-tests.yml
vendored
@@ -99,6 +99,7 @@ jobs:
|
|||||||
cd ~/frappe-bench/
|
cd ~/frappe-bench/
|
||||||
bench --site lms.test execute frappe.utils.install.complete_setup_wizard
|
bench --site lms.test execute frappe.utils.install.complete_setup_wizard
|
||||||
bench --site lms.test execute frappe.tests.ui_test_helpers.create_test_user
|
bench --site lms.test execute frappe.tests.ui_test_helpers.create_test_user
|
||||||
|
bench --site lms.test set-password frappe@example.com admin
|
||||||
|
|
||||||
- name: cypress pre-requisites
|
- name: cypress pre-requisites
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
lms/public/frontend
|
lms/public/frontend
|
||||||
lms/www/lms.html
|
lms/www/lms.html
|
||||||
|
frappe-ui
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "frappe-ui"]
|
||||||
|
path = frappe-ui
|
||||||
|
url = https://github.com/pateljannat/frappe-ui
|
||||||
@@ -35,7 +35,6 @@ bench new-site lms.localhost \
|
|||||||
bench --site lms.localhost install-app lms
|
bench --site lms.localhost install-app lms
|
||||||
bench --site lms.localhost set-config developer_mode 1
|
bench --site lms.localhost set-config developer_mode 1
|
||||||
bench --site lms.localhost clear-cache
|
bench --site lms.localhost clear-cache
|
||||||
bench --site lms.localhost set-config mute_emails 1
|
|
||||||
bench use lms.localhost
|
bench use lms.localhost
|
||||||
|
|
||||||
bench start
|
bench start
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { Toasts } from 'frappe-ui'
|
import { Toasts } from 'frappe-ui'
|
||||||
import { Dialogs } from '@/utils/dialogs'
|
import { Dialogs } from '@/utils/dialogs'
|
||||||
import { computed, defineAsyncComponent } from 'vue'
|
import { computed, onMounted, onUnmounted } from 'vue'
|
||||||
import { useScreenSize } from './utils/composables'
|
import { useScreenSize } from './utils/composables'
|
||||||
import DesktopLayout from './components/DesktopLayout.vue'
|
import DesktopLayout from './components/DesktopLayout.vue'
|
||||||
import MobileLayout from './components/MobileLayout.vue'
|
import MobileLayout from './components/MobileLayout.vue'
|
||||||
|
import { stopSession } from '@/telemetry'
|
||||||
|
import { init as initTelemetry } from '@/telemetry'
|
||||||
|
|
||||||
const screenSize = useScreenSize()
|
const screenSize = useScreenSize()
|
||||||
|
|
||||||
@@ -22,4 +24,12 @@ const Layout = computed(() => {
|
|||||||
return DesktopLayout
|
return DesktopLayout
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await initTelemetry()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
stopSession()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
class="flex flex-col overflow-hidden"
|
class="flex flex-col overflow-hidden"
|
||||||
:class="isSidebarCollapsed ? 'items-center' : ''"
|
:class="isSidebarCollapsed ? 'items-center' : ''"
|
||||||
>
|
>
|
||||||
<UserDropdown class="p-2" :isCollapsed="isSidebarCollapsed" />
|
<UserDropdown :isCollapsed="isSidebarCollapsed" />
|
||||||
<div class="flex flex-col" v-if="sidebarSettings.data">
|
<div class="flex flex-col" v-if="sidebarSettings.data">
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
v-for="link in sidebarLinks"
|
v-for="link in sidebarLinks"
|
||||||
@@ -100,7 +100,7 @@ import { ChevronRight, Plus } from 'lucide-vue-next'
|
|||||||
import { createResource, Button } from 'frappe-ui'
|
import { createResource, Button } from 'frappe-ui'
|
||||||
import PageModal from '@/components/Modals/PageModal.vue'
|
import PageModal from '@/components/Modals/PageModal.vue'
|
||||||
|
|
||||||
const { user } = sessionStore()
|
const { user, sidebarSettings } = sessionStore()
|
||||||
const { userResource } = usersStore()
|
const { userResource } = usersStore()
|
||||||
const socket = inject('$socket')
|
const socket = inject('$socket')
|
||||||
const unreadCount = ref(0)
|
const unreadCount = ref(0)
|
||||||
@@ -115,6 +115,20 @@ onMounted(() => {
|
|||||||
unreadNotifications.reload()
|
unreadNotifications.reload()
|
||||||
})
|
})
|
||||||
addNotifications()
|
addNotifications()
|
||||||
|
sidebarSettings.reload(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess(data) {
|
||||||
|
Object.keys(data).forEach((key) => {
|
||||||
|
if (!parseInt(data[key])) {
|
||||||
|
sidebarLinks.value = sidebarLinks.value.filter(
|
||||||
|
(link) => link.label.toLowerCase().split(' ').join('_') !== key
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const unreadNotifications = createResource({
|
const unreadNotifications = createResource({
|
||||||
@@ -153,21 +167,6 @@ const addNotifications = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sidebarSettings = createResource({
|
|
||||||
url: 'lms.lms.api.get_sidebar_settings',
|
|
||||||
cache: 'Sidebar Settings',
|
|
||||||
auto: true,
|
|
||||||
onSuccess(data) {
|
|
||||||
Object.keys(data).forEach((key) => {
|
|
||||||
if (!parseInt(data[key])) {
|
|
||||||
sidebarLinks.value = sidebarLinks.value.filter(
|
|
||||||
(link) => link.label.toLowerCase().split(' ').join('_') !== key
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const openPageModal = (link) => {
|
const openPageModal = (link) => {
|
||||||
showPageModal.value = true
|
showPageModal.value = true
|
||||||
pageToEdit.value = link
|
pageToEdit.value = link
|
||||||
|
|||||||
67
frontend/src/components/Apps.vue
Normal file
67
frontend/src/components/Apps.vue
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
<Popover placement="right-start" class="flex w-full">
|
||||||
|
<template #target="{ togglePopover }">
|
||||||
|
<button
|
||||||
|
:class="[
|
||||||
|
'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()"
|
||||||
|
>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<LayoutGrid class="size-4 stroke-1.5" />
|
||||||
|
<span class="whitespace-nowrap">
|
||||||
|
{{ __('Apps') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<ChevronRight class="h-4 w-4 stroke-1.5" />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<template #body>
|
||||||
|
<div
|
||||||
|
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">
|
||||||
|
<a
|
||||||
|
:href="app.route"
|
||||||
|
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" />
|
||||||
|
<div class="text-sm" @click="app.onClick">
|
||||||
|
{{ app.title }}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Popover>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { Popover, createResource } from 'frappe-ui'
|
||||||
|
import { LayoutGrid, ChevronRight } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const apps = createResource({
|
||||||
|
url: 'frappe.apps.get_apps',
|
||||||
|
cache: 'apps',
|
||||||
|
auto: true,
|
||||||
|
transform: (data) => {
|
||||||
|
let _apps = [
|
||||||
|
{
|
||||||
|
name: 'frappe',
|
||||||
|
logo: '/assets/lms/images/desk.png',
|
||||||
|
title: __('Desk'),
|
||||||
|
route: '/app',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
data.map((app) => {
|
||||||
|
if (app.name === 'lms') return
|
||||||
|
_apps.push({
|
||||||
|
name: app.name,
|
||||||
|
logo: app.logo,
|
||||||
|
title: __(app.title),
|
||||||
|
route: app.route,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return _apps
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
<router-link
|
<router-link
|
||||||
v-if="isModerator"
|
v-if="isModerator"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'BatchCreation',
|
name: 'BatchForm',
|
||||||
params: {
|
params: {
|
||||||
batchName: batch.data.name,
|
batchName: batch.data.name,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
:class="[
|
:class="[
|
||||||
'flex items-center rounded px-2.5 py-1.5 text-base',
|
'flex items-center rounded px-2.5 py-2 text-base',
|
||||||
{ 'bg-gray-100': active },
|
{ 'bg-gray-100': active },
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
@@ -87,7 +87,16 @@
|
|||||||
name="item-label"
|
name="item-label"
|
||||||
v-bind="{ active, selected, option }"
|
v-bind="{ active, selected, option }"
|
||||||
>
|
>
|
||||||
|
<div class="flex flex-col space-y-1">
|
||||||
|
<div>
|
||||||
{{ option.label }}
|
{{ option.label }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="option.label != option.description"
|
||||||
|
class="text-xs text-gray-700"
|
||||||
|
v-html="option.description"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
</li>
|
</li>
|
||||||
</ComboboxOption>
|
</ComboboxOption>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ const options = createResource({
|
|||||||
return {
|
return {
|
||||||
label: option.value,
|
label: option.value,
|
||||||
value: option.value,
|
value: option.value,
|
||||||
|
description: option.description,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { Star } from 'lucide-vue-next'
|
import { Star } from 'lucide-vue-next'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
<router-link
|
<router-link
|
||||||
v-if="user?.data?.is_moderator || is_instructor()"
|
v-if="user?.data?.is_moderator || is_instructor()"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'CreateCourse',
|
name: 'CourseForm',
|
||||||
params: {
|
params: {
|
||||||
courseName: course.data.name,
|
courseName: course.data.name,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
<DisclosurePanel>
|
<DisclosurePanel>
|
||||||
<Draggable
|
<Draggable
|
||||||
:list="chapter.lessons"
|
:list="chapter.lessons"
|
||||||
|
:disabled="!allowEdit"
|
||||||
item-key="name"
|
item-key="name"
|
||||||
group="items"
|
group="items"
|
||||||
@end="updateOutline"
|
@end="updateOutline"
|
||||||
@@ -50,7 +51,7 @@
|
|||||||
<div class="outline-lesson pl-8 py-2 pr-4">
|
<div class="outline-lesson pl-8 py-2 pr-4">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: allowEdit ? 'CreateLesson' : 'Lesson',
|
name: allowEdit ? 'LessonForm' : 'Lesson',
|
||||||
params: {
|
params: {
|
||||||
courseName: courseName,
|
courseName: courseName,
|
||||||
chapterNumber: lesson.number.split('.')[0],
|
chapterNumber: lesson.number.split('.')[0],
|
||||||
@@ -89,7 +90,7 @@
|
|||||||
<div v-if="allowEdit" class="flex mt-2 mb-4 pl-8">
|
<div v-if="allowEdit" class="flex mt-2 mb-4 pl-8">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'CreateLesson',
|
name: 'LessonForm',
|
||||||
params: {
|
params: {
|
||||||
courseName: courseName,
|
courseName: courseName,
|
||||||
chapterNumber: chapter.idx,
|
chapterNumber: chapter.idx,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Button v-if="!singleThread" class="float-right" @click="openTopicModal()">
|
<Button v-if="!singleThread" class="float-right" @click="openTopicModal()">
|
||||||
{{ __('New {0}').format(title) }}
|
{{ __('New {0}').format(singularize(title)) }}
|
||||||
</Button>
|
</Button>
|
||||||
<div class="text-xl font-semibold">
|
<div class="text-xl font-semibold">
|
||||||
{{ __(title) }}
|
{{ __(title) }}
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { createResource, Button } from 'frappe-ui'
|
import { createResource, Button } from 'frappe-ui'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
import { timeAgo } from '../utils'
|
import { singularize, timeAgo } from '../utils'
|
||||||
import { ref, onMounted, inject } from 'vue'
|
import { ref, onMounted, inject } from 'vue'
|
||||||
import DiscussionReplies from '@/components/DiscussionReplies.vue'
|
import DiscussionReplies from '@/components/DiscussionReplies.vue'
|
||||||
import DiscussionModal from '@/components/Modals/DiscussionModal.vue'
|
import DiscussionModal from '@/components/Modals/DiscussionModal.vue'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="text-lg font-semibold">
|
<div class="text-lg font-semibold">
|
||||||
{{ __('Components') }}
|
{{ __('Components') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5 space-y-4">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
:text="
|
:text="
|
||||||
__(
|
__(
|
||||||
@@ -18,20 +18,31 @@
|
|||||||
<Select v-model="currentEditor" :options="getEditorOptions()" />
|
<Select v-model="currentEditor" :options="getEditorOptions()" />
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div class="flex mt-4">
|
<div class="flex">
|
||||||
<Link
|
<Link
|
||||||
v-model="quiz"
|
:value="quiz"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
doctype="LMS Quiz"
|
doctype="LMS Quiz"
|
||||||
:label="__('Select a Quiz')"
|
:label="__('Add an existing quiz')"
|
||||||
|
@change="(option) => addQuiz(option)"
|
||||||
/>
|
/>
|
||||||
<Button @click="addQuiz()" class="self-end ml-2">
|
<router-link
|
||||||
|
:to="{
|
||||||
|
name: 'QuizCreation',
|
||||||
|
params: {
|
||||||
|
quizID: 'new',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
class="self-end ml-2"
|
||||||
|
>
|
||||||
|
<Button>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Plus class="h-4 w-4 stroke-1.5" />
|
<Plus class="h-4 w-4 stroke-1.5" />
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="">
|
||||||
<div class="text-xs text-gray-600 mb-1">
|
<div class="text-xs text-gray-600 mb-1">
|
||||||
{{ __('Add an image, video, pdf or audio.') }}
|
{{ __('Add an image, video, pdf or audio.') }}
|
||||||
</div>
|
</div>
|
||||||
@@ -68,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="">
|
||||||
<div class="text-xs text-gray-600 mb-1">
|
<div class="text-xs text-gray-600 mb-1">
|
||||||
{{
|
{{
|
||||||
__(
|
__(
|
||||||
@@ -112,11 +123,11 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const addQuiz = () => {
|
const addQuiz = (value) => {
|
||||||
getCurrentEditor().caret.setToLastBlock('end', 0)
|
getCurrentEditor().caret.setToLastBlock('end', 0)
|
||||||
if (quiz.value) {
|
if (value) {
|
||||||
getCurrentEditor().blocks.insert('quiz', {
|
getCurrentEditor().blocks.insert('quiz', {
|
||||||
quiz: quiz.value,
|
quiz: value,
|
||||||
})
|
})
|
||||||
quiz.value = null
|
quiz.value = null
|
||||||
}
|
}
|
||||||
|
|||||||
183
frontend/src/components/Members.vue
Normal file
183
frontend/src/components/Members.vue
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<template>
|
||||||
|
<div class="text-base p-4">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<div class="font-semibold mb-1">
|
||||||
|
{{ __(label) }}
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-600">
|
||||||
|
{{ __(description) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex item-center space-x-2">
|
||||||
|
<FormControl
|
||||||
|
v-model="search"
|
||||||
|
:placeholder="__('Search')"
|
||||||
|
type="text"
|
||||||
|
:debounce="300"
|
||||||
|
/>
|
||||||
|
<Button @click="() => (showForm = true)">
|
||||||
|
<template #icon>
|
||||||
|
<Plus class="h-3 w-3 stroke-1.5" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="my-4">
|
||||||
|
<!-- Form to add new member -->
|
||||||
|
<div v-if="showForm" class="flex items-center space-x-2 mb-4">
|
||||||
|
<FormControl
|
||||||
|
v-model="member.email"
|
||||||
|
:placeholder="__('Email')"
|
||||||
|
type="email"
|
||||||
|
class="w-full"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="member.first_name"
|
||||||
|
:placeholder="__('First Name')"
|
||||||
|
type="test"
|
||||||
|
class="w-full"
|
||||||
|
/>
|
||||||
|
<Button @click="addMember()" variant="subtle">
|
||||||
|
{{ __('Add') }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Member list -->
|
||||||
|
<div
|
||||||
|
v-for="member in memberList"
|
||||||
|
class="grid grid-cols-5 grid-flow-row py-2 cursor-pointer"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
@click="openProfile(member.username)"
|
||||||
|
class="flex items-center space-x-2 col-span-2"
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
:image="member.user_image"
|
||||||
|
:label="member.full_name"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
{{ member.full_name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-700 col-span-2">
|
||||||
|
{{ member.name }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-700 justify-self-end">
|
||||||
|
{{ getRole(member.role) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="hasNextPage" class="flex justify-center">
|
||||||
|
<Button variant="solid" @click="members.reload()">
|
||||||
|
<template #prefix>
|
||||||
|
<RefreshCw class="h-3 w-3 stroke-1.5" />
|
||||||
|
</template>
|
||||||
|
{{ __('Load More') }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { createResource, Avatar, Button, FormControl } from 'frappe-ui'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { ref, watch, reactive } from 'vue'
|
||||||
|
import { RefreshCw, Plus } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const show = defineModel('show')
|
||||||
|
const search = ref('')
|
||||||
|
const start = ref(0)
|
||||||
|
const memberList = ref([])
|
||||||
|
const hasNextPage = ref(false)
|
||||||
|
const showForm = ref(false)
|
||||||
|
|
||||||
|
const member = reactive({
|
||||||
|
email: '',
|
||||||
|
first_name: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const members = createResource({
|
||||||
|
url: 'lms.lms.api.get_members',
|
||||||
|
makeParams: () => {
|
||||||
|
return {
|
||||||
|
search: search.value,
|
||||||
|
start: start.value,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess(data) {
|
||||||
|
memberList.value = memberList.value.concat(data)
|
||||||
|
start.value = start.value + 20
|
||||||
|
hasNextPage.value = data.length === 20
|
||||||
|
},
|
||||||
|
auto: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
const openProfile = (username) => {
|
||||||
|
show.value = false
|
||||||
|
router.push({
|
||||||
|
name: 'Profile',
|
||||||
|
params: {
|
||||||
|
username: username,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const newMember = createResource({
|
||||||
|
url: 'frappe.client.insert',
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doc: {
|
||||||
|
doctype: 'User',
|
||||||
|
first_name: member.first_name,
|
||||||
|
email: member.email,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
auto: false,
|
||||||
|
onSuccess(data) {
|
||||||
|
show.value = false
|
||||||
|
router.push({
|
||||||
|
name: 'Profile',
|
||||||
|
params: {
|
||||||
|
username: data.username,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const addMember = () => {
|
||||||
|
newMember.reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(search, () => {
|
||||||
|
memberList.value = []
|
||||||
|
start.value = 0
|
||||||
|
members.reload()
|
||||||
|
})
|
||||||
|
|
||||||
|
const getRole = (role) => {
|
||||||
|
const map = {
|
||||||
|
'LMS Student': 'Student',
|
||||||
|
'Course Creator': 'Instructor',
|
||||||
|
Moderator: 'Moderator',
|
||||||
|
'Batch Evaluator': 'Evaluator',
|
||||||
|
}
|
||||||
|
return map[role]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -4,14 +4,14 @@
|
|||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="tabs"
|
v-if="sidebarSettings.data"
|
||||||
class="fixed flex justify-around border-t border-gray-300 bottom-0 z-10 w-full 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}, minmax(0, 1fr))`,
|
gridTemplateColumns: `repeat(${sidebarLinks.length}, minmax(0, 1fr))`,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
v-for="tab in tabs"
|
v-for="tab in sidebarLinks"
|
||||||
:key="tab.label"
|
:key="tab.label"
|
||||||
:class="isVisible(tab) ? 'block' : 'hidden'"
|
:class="isVisible(tab) ? 'block' : 'hidden'"
|
||||||
class="flex flex-col items-center justify-center py-3 transition active:scale-95"
|
class="flex flex-col items-center justify-center py-3 transition active:scale-95"
|
||||||
@@ -29,21 +29,38 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { getSidebarLinks } from '../utils'
|
import { getSidebarLinks } from '../utils'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { computed } from 'vue'
|
import { computed, ref, onMounted } from 'vue'
|
||||||
import { sessionStore } from '@/stores/session'
|
import { sessionStore } from '@/stores/session'
|
||||||
import { usersStore } from '@/stores/user'
|
import { usersStore } from '@/stores/user'
|
||||||
import * as icons from 'lucide-vue-next'
|
import * as icons from 'lucide-vue-next'
|
||||||
|
|
||||||
const { logout, user } = sessionStore()
|
const { logout, user, sidebarSettings } = sessionStore()
|
||||||
let { isLoggedIn } = sessionStore()
|
let { isLoggedIn } = sessionStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
let { userResource } = usersStore()
|
let { userResource } = usersStore()
|
||||||
|
const sidebarLinks = ref(getSidebarLinks())
|
||||||
|
|
||||||
const tabs = computed(() => {
|
onMounted(() => {
|
||||||
let links = getSidebarLinks()
|
sidebarSettings.reload(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess(data) {
|
||||||
|
Object.keys(data).forEach((key) => {
|
||||||
|
if (!parseInt(data[key])) {
|
||||||
|
sidebarLinks.value = sidebarLinks.value.filter(
|
||||||
|
(link) => link.label.toLowerCase().split(' ').join('_') !== key
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
addAccessLinks()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const addAccessLinks = () => {
|
||||||
if (user) {
|
if (user) {
|
||||||
links.push({
|
sidebarLinks.value.push({
|
||||||
label: 'Profile',
|
label: 'Profile',
|
||||||
icon: 'UserRound',
|
icon: 'UserRound',
|
||||||
activeFor: [
|
activeFor: [
|
||||||
@@ -54,18 +71,17 @@ const tabs = computed(() => {
|
|||||||
'ProfileRoles',
|
'ProfileRoles',
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
links.push({
|
sidebarLinks.value.push({
|
||||||
label: 'Log out',
|
label: 'Log out',
|
||||||
icon: 'LogOut',
|
icon: 'LogOut',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
links.push({
|
sidebarLinks.value.push({
|
||||||
label: 'Log in',
|
label: 'Log in',
|
||||||
icon: 'LogIn',
|
icon: 'LogIn',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return links
|
}
|
||||||
})
|
|
||||||
|
|
||||||
let isActive = (tab) => {
|
let isActive = (tab) => {
|
||||||
return tab.activeFor?.includes(router.currentRoute.value.name)
|
return tab.activeFor?.includes(router.currentRoute.value.name)
|
||||||
|
|||||||
@@ -21,8 +21,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Dialog, FormControl, createResource } from 'frappe-ui'
|
import { Dialog, FormControl, createResource } from 'frappe-ui'
|
||||||
import { defineModel, reactive, watch, inject } from 'vue'
|
import { defineModel, reactive, watch } from 'vue'
|
||||||
import { createToast, formatTime } from '@/utils/'
|
import { createToast } from '@/utils/'
|
||||||
|
import { capture } from '@/telemetry'
|
||||||
|
|
||||||
const show = defineModel()
|
const show = defineModel()
|
||||||
const outline = defineModel('outline')
|
const outline = defineModel('outline')
|
||||||
@@ -91,6 +92,7 @@ const addChapter = (close) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
|
capture('chapter_created')
|
||||||
chapterReference.submit(
|
chapterReference.submit(
|
||||||
{ name: data.name },
|
{ name: data.name },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
:options="{
|
:options="{
|
||||||
title: props.title,
|
title: singularize(props.title),
|
||||||
size: '2xl',
|
size: '2xl',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Dialog, FormControl, TextEditor, createResource } from 'frappe-ui'
|
import { Dialog, FormControl, TextEditor, createResource } from 'frappe-ui'
|
||||||
import { reactive, defineModel, computed } from 'vue'
|
import { reactive, defineModel } from 'vue'
|
||||||
import { showToast } from '@/utils'
|
import { showToast, singularize } from '@/utils'
|
||||||
|
|
||||||
const topics = defineModel('reloadTopics')
|
const topics = defineModel('reloadTopics')
|
||||||
|
|
||||||
|
|||||||
348
frontend/src/components/Modals/Question.vue
Normal file
348
frontend/src/components/Modals/Question.vue
Normal file
@@ -0,0 +1,348 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog v-model="show" :options="dialogOptions">
|
||||||
|
<template #body-content>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div
|
||||||
|
v-if="!editMode"
|
||||||
|
class="flex items-center text-xs text-gray-700 space-x-5"
|
||||||
|
>
|
||||||
|
<div class="flex items-center space-x-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
id="existing"
|
||||||
|
value="existing"
|
||||||
|
v-model="questionType"
|
||||||
|
class="w-3 h-3 accent-gray-900"
|
||||||
|
/>
|
||||||
|
<label for="existing">
|
||||||
|
{{ __('Add an existing question') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center space-x-2">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
id="new"
|
||||||
|
value="new"
|
||||||
|
v-model="questionType"
|
||||||
|
class="w-3 h-3"
|
||||||
|
/>
|
||||||
|
<label for="new">
|
||||||
|
{{ __('Create a new question') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="questionType == 'new' || editMode" class="space-y-2">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs text-gray-600 mb-1">
|
||||||
|
{{ __('Question') }}
|
||||||
|
</label>
|
||||||
|
<TextEditor
|
||||||
|
:content="question.question"
|
||||||
|
@change="(val) => (question.question = val)"
|
||||||
|
:editable="true"
|
||||||
|
:fixedMenu="true"
|
||||||
|
editorClass="prose-sm max-w-none border-b border-x bg-gray-100 rounded-b-md py-1 px-2 min-h-[7rem]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<FormControl
|
||||||
|
v-model="question.marks"
|
||||||
|
:label="__('Marks')"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
:label="__('Type')"
|
||||||
|
v-model="question.type"
|
||||||
|
type="select"
|
||||||
|
:options="['Choices', 'User Input']"
|
||||||
|
class="pb-2"
|
||||||
|
/>
|
||||||
|
<div v-if="question.type == 'Choices'" class="divide-y border-t">
|
||||||
|
<div v-for="n in 4" class="space-y-4 py-2">
|
||||||
|
<FormControl
|
||||||
|
:label="__('Option') + ' ' + n"
|
||||||
|
v-model="question[`option_${n}`]"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
:label="__('Explanation')"
|
||||||
|
v-model="question[`explanation_${n}`]"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
:label="__('Correct Answer')"
|
||||||
|
v-model="question[`is_correct_${n}`]"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else v-for="n in 4" class="space-y-2">
|
||||||
|
<FormControl
|
||||||
|
:label="__('Possibility') + ' ' + n"
|
||||||
|
v-model="question[`possibility_${n}`]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="questionType == 'existing'" class="space-y-2">
|
||||||
|
<Link
|
||||||
|
v-model="existingQuestion.question"
|
||||||
|
:label="__('Select a question')"
|
||||||
|
doctype="LMS Question"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="existingQuestion.marks"
|
||||||
|
:label="__('Marks')"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { Dialog, FormControl, TextEditor, createResource } from 'frappe-ui'
|
||||||
|
import { computed, watch, reactive, ref } from 'vue'
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
|
import { showToast } from '@/utils'
|
||||||
|
|
||||||
|
const show = defineModel()
|
||||||
|
const quiz = defineModel('quiz')
|
||||||
|
const questionType = ref(null)
|
||||||
|
const editMode = ref(false)
|
||||||
|
|
||||||
|
const existingQuestion = reactive({
|
||||||
|
question: '',
|
||||||
|
marks: 0,
|
||||||
|
})
|
||||||
|
const question = reactive({
|
||||||
|
question: '',
|
||||||
|
type: 'Choices',
|
||||||
|
marks: 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
const populateFields = () => {
|
||||||
|
let fields = ['option', 'is_correct', 'explanation', 'possibility']
|
||||||
|
let counter = 1
|
||||||
|
fields.forEach((field) => {
|
||||||
|
while (counter <= 4) {
|
||||||
|
question[`${field}_${counter}`] = field === 'is_correct' ? false : ''
|
||||||
|
counter++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
populateFields()
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: __('Add a new question'),
|
||||||
|
},
|
||||||
|
questionDetail: {
|
||||||
|
type: [Object, null],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const questionData = createResource({
|
||||||
|
url: 'frappe.client.get',
|
||||||
|
makeParams() {
|
||||||
|
return {
|
||||||
|
doctype: 'LMS Question',
|
||||||
|
name: props.questionDetail.question,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
auto: false,
|
||||||
|
onSuccess(data) {
|
||||||
|
let counter = 1
|
||||||
|
editMode.value = true
|
||||||
|
Object.keys(data).forEach((key) => {
|
||||||
|
if (Object.hasOwn(question, key)) question[key] = data[key]
|
||||||
|
})
|
||||||
|
while (counter <= 4) {
|
||||||
|
question[`is_correct_${counter}`] = data[`is_correct_${counter}`]
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
counter++
|
||||||
|
}
|
||||||
|
question.marks = props.questionDetail.marks
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(show, () => {
|
||||||
|
if (show.value) {
|
||||||
|
editMode.value = false
|
||||||
|
if (props.questionDetail.question) questionData.fetch()
|
||||||
|
else {
|
||||||
|
;(question.question = ''), (question.marks = 0)
|
||||||
|
question.type = 'Choices'
|
||||||
|
existingQuestion.question = ''
|
||||||
|
existingQuestion.marks = 0
|
||||||
|
questionType.value = null
|
||||||
|
populateFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.questionDetail.marks) question.marks = props.questionDetail.marks
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const questionRow = createResource({
|
||||||
|
url: 'frappe.client.insert',
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doc: {
|
||||||
|
doctype: 'LMS Quiz Question',
|
||||||
|
parent: quiz.value.data.name,
|
||||||
|
parentfield: 'questions',
|
||||||
|
parenttype: 'LMS Quiz',
|
||||||
|
...values,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const questionCreation = createResource({
|
||||||
|
url: 'frappe.client.insert',
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doc: {
|
||||||
|
doctype: 'LMS Question',
|
||||||
|
...question,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const submitQuestion = (close) => {
|
||||||
|
if (questionData.data?.name) updateQuestion(close)
|
||||||
|
else addQuestion(close)
|
||||||
|
}
|
||||||
|
|
||||||
|
const addQuestion = (close) => {
|
||||||
|
if (questionType.value == 'existing') {
|
||||||
|
addQuestionRow(
|
||||||
|
{
|
||||||
|
question: existingQuestion.question,
|
||||||
|
marks: existingQuestion.marks,
|
||||||
|
},
|
||||||
|
close
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
questionCreation.submit(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess(data) {
|
||||||
|
addQuestionRow(
|
||||||
|
{
|
||||||
|
question: data.name,
|
||||||
|
marks: question.marks,
|
||||||
|
},
|
||||||
|
close
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
showToast(__('Error'), __(err.message?.[0] || err), 'x')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const addQuestionRow = (question, close) => {
|
||||||
|
questionRow.submit(
|
||||||
|
{
|
||||||
|
...question,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onSuccess() {
|
||||||
|
show.value = false
|
||||||
|
showToast(__('Success'), __('Question added successfully'), 'check')
|
||||||
|
quiz.value.reload()
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
showToast(__('Error'), __(err.message?.[0] || err), 'x')
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const questionUpdate = createResource({
|
||||||
|
url: 'frappe.client.set_value',
|
||||||
|
auto: false,
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doctype: 'LMS Question',
|
||||||
|
name: questionData.data?.name,
|
||||||
|
fieldname: {
|
||||||
|
...question,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const marksUpdate = createResource({
|
||||||
|
url: 'frappe.client.set_value',
|
||||||
|
auto: false,
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doctype: 'LMS Quiz Question',
|
||||||
|
name: props.questionDetail.name,
|
||||||
|
fieldname: {
|
||||||
|
marks: question.marks,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateQuestion = (close) => {
|
||||||
|
questionUpdate.submit(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess() {
|
||||||
|
marksUpdate.submit(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess() {
|
||||||
|
show.value = false
|
||||||
|
showToast(
|
||||||
|
__('Success'),
|
||||||
|
__('Question updated successfully'),
|
||||||
|
'check'
|
||||||
|
)
|
||||||
|
quiz.value.reload()
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
showToast(__('Error'), __(err.message?.[0] || err), 'x')
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialogOptions = computed(() => {
|
||||||
|
return {
|
||||||
|
title: __(props.title),
|
||||||
|
size: 'xl',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: __('Submit'),
|
||||||
|
variant: 'solid',
|
||||||
|
onClick: (close) => {
|
||||||
|
submitQuestion(close)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
input[type='radio']:checked {
|
||||||
|
background-color: theme('colors.gray.900') !important;
|
||||||
|
border-color: theme('colors.gray.900') !important;
|
||||||
|
--tw-ring-color: theme('colors.gray.900') !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
279
frontend/src/components/Modals/Settings.vue
Normal file
279
frontend/src/components/Modals/Settings.vue
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog v-model="show" :options="{ size: '3xl' }">
|
||||||
|
<template #body>
|
||||||
|
<div class="flex h-[calc(100vh_-_8rem)]">
|
||||||
|
<div class="flex w-52 shrink-0 flex-col bg-gray-50 p-2">
|
||||||
|
<h1 class="mb-3 px-2 pt-2 text-lg font-semibold">
|
||||||
|
{{ __('Settings') }}
|
||||||
|
</h1>
|
||||||
|
<div v-for="tab in tabs">
|
||||||
|
<div
|
||||||
|
v-if="!tab.hideLabel"
|
||||||
|
class="mb-2 mt-3 flex cursor-pointer gap-1.5 px-1 text-base font-medium text-gray-600 transition-all duration-300 ease-in-out"
|
||||||
|
>
|
||||||
|
<span>{{ __(tab.label) }}</span>
|
||||||
|
</div>
|
||||||
|
<nav class="space-y-1">
|
||||||
|
<SidebarLink
|
||||||
|
v-for="item in tab.items"
|
||||||
|
:link="item"
|
||||||
|
class="w-full"
|
||||||
|
:class="
|
||||||
|
activeTab?.label == item.label
|
||||||
|
? 'bg-white shadow-sm'
|
||||||
|
: 'hover:bg-gray-100'
|
||||||
|
"
|
||||||
|
@click="activeTab = item"
|
||||||
|
/>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="activeTab && data.doc"
|
||||||
|
class="flex flex-1 flex-col overflow-y-auto"
|
||||||
|
>
|
||||||
|
<Members
|
||||||
|
v-if="activeTab.label === 'Members'"
|
||||||
|
:label="activeTab.label"
|
||||||
|
:description="activeTab.description"
|
||||||
|
v-model:show="show"
|
||||||
|
/>
|
||||||
|
<SettingDetails
|
||||||
|
v-else
|
||||||
|
:fields="activeTab.fields"
|
||||||
|
:label="activeTab.label"
|
||||||
|
:description="activeTab.description"
|
||||||
|
:data="data"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { Dialog, createDocumentResource } from 'frappe-ui'
|
||||||
|
import { ref, computed, watch } from 'vue'
|
||||||
|
import SettingDetails from '../SettingDetails.vue'
|
||||||
|
import SidebarLink from '@/components/SidebarLink.vue'
|
||||||
|
import Members from '@/components/Members.vue'
|
||||||
|
|
||||||
|
const show = defineModel()
|
||||||
|
const doctype = ref('LMS Settings')
|
||||||
|
const activeTab = ref(null)
|
||||||
|
|
||||||
|
const data = createDocumentResource({
|
||||||
|
doctype: doctype.value,
|
||||||
|
name: doctype.value,
|
||||||
|
fields: ['*'],
|
||||||
|
cache: doctype.value,
|
||||||
|
auto: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
const tabs = computed(() => {
|
||||||
|
let _tabs = [
|
||||||
|
{
|
||||||
|
label: 'Settings',
|
||||||
|
hideLabel: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Members',
|
||||||
|
description: 'Manage the members of your learning system',
|
||||||
|
icon: 'UserRoundPlus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Payment Gateway',
|
||||||
|
icon: 'DollarSign',
|
||||||
|
description:
|
||||||
|
'Configure the payment gateway and other payment related settings',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Razorpay Key',
|
||||||
|
name: 'razorpay_key',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Razorpay Secret',
|
||||||
|
name: 'razorpay_secret',
|
||||||
|
type: 'password',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Default Currency',
|
||||||
|
name: 'default_currency',
|
||||||
|
type: 'Link',
|
||||||
|
doctype: 'Currency',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Column Break',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Apply GST for India',
|
||||||
|
name: 'apply_gst',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Show USD equivalent amount',
|
||||||
|
name: 'show_usd_equivalent',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Apply rounding on equivalent',
|
||||||
|
name: 'apply_rounding',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Settings',
|
||||||
|
hideLabel: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Sidebar',
|
||||||
|
icon: 'PanelLeftIcon',
|
||||||
|
description: 'Customize the sidebar as per your needs',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Courses',
|
||||||
|
name: 'courses',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Batches',
|
||||||
|
name: 'batches',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Certified Participants',
|
||||||
|
name: 'certified_participants',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Column Break',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Jobs',
|
||||||
|
name: 'jobs',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Statistics',
|
||||||
|
name: 'statistics',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Notifications',
|
||||||
|
name: 'notifications',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Settings',
|
||||||
|
hideLabel: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Email Templates',
|
||||||
|
icon: 'MailPlus',
|
||||||
|
description: 'Create email templates with the content you want',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Batch Confirmation Template',
|
||||||
|
name: 'batch_confirmation_template',
|
||||||
|
doctype: 'Email Template',
|
||||||
|
type: 'Link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Certification Template',
|
||||||
|
name: 'certification_template',
|
||||||
|
doctype: 'Email Template',
|
||||||
|
type: 'Link',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Assignment Submission Template',
|
||||||
|
name: 'assignment_submission_template',
|
||||||
|
doctype: 'Email Template',
|
||||||
|
type: 'Link',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Settings',
|
||||||
|
hideLabel: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Signup',
|
||||||
|
icon: 'LogIn',
|
||||||
|
description:
|
||||||
|
'Customize the signup page to inform users about your terms and policies',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Show terms of use on signup',
|
||||||
|
name: 'terms_of_use',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Terms of Use Page',
|
||||||
|
name: 'terms_page',
|
||||||
|
type: 'Link',
|
||||||
|
doctype: 'Web Page',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Show privacy policy on signup',
|
||||||
|
name: 'privacy_policy',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Privacy Policy Page',
|
||||||
|
name: 'privacy_policy_page',
|
||||||
|
type: 'Link',
|
||||||
|
doctype: 'Web Page',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Column Break',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Show cookie policy on signup',
|
||||||
|
name: 'cookie_policy',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Cookie Policy Page',
|
||||||
|
name: 'cookie_policy_page',
|
||||||
|
type: 'Link',
|
||||||
|
doctype: 'Web Page',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Ask user category during signup',
|
||||||
|
name: 'user_category',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
return _tabs.map((tab) => {
|
||||||
|
tab.items = tab.items.filter((item) => {
|
||||||
|
if (item.condition) {
|
||||||
|
return item.condition()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
return tab
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(show, () => {
|
||||||
|
if (show.value) {
|
||||||
|
activeTab.value = tabs.value[0].items[0]
|
||||||
|
} else {
|
||||||
|
activeTab.value = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -439,7 +439,7 @@ const checkAnswer = () => {
|
|||||||
const addToLocalStorage = () => {
|
const addToLocalStorage = () => {
|
||||||
let quizData = JSON.parse(localStorage.getItem(quiz.data.title))
|
let quizData = JSON.parse(localStorage.getItem(quiz.data.title))
|
||||||
let questionData = {
|
let questionData = {
|
||||||
question_index: activeQuestion.value,
|
question_name: currentQuestion.value,
|
||||||
answer: getAnswers().join(),
|
answer: getAnswers().join(),
|
||||||
is_correct: showAnswers.filter((answer) => {
|
is_correct: showAnswers.filter((answer) => {
|
||||||
return answer != undefined
|
return answer != undefined
|
||||||
|
|||||||
96
frontend/src/components/SettingDetails.vue
Normal file
96
frontend/src/components/SettingDetails.vue
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col justify-between h-full p-4">
|
||||||
|
<div>
|
||||||
|
<div class="font-semibold mb-1">
|
||||||
|
{{ __(label) }}
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-600">
|
||||||
|
{{ __(description) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex space-x-8 my-5">
|
||||||
|
<div v-for="(column, index) in columns" :key="index">
|
||||||
|
<div class="flex flex-col space-y-4 w-60">
|
||||||
|
<div v-for="field in column">
|
||||||
|
<Link
|
||||||
|
v-if="field.type == 'Link'"
|
||||||
|
v-model="field.value"
|
||||||
|
:doctype="field.doctype"
|
||||||
|
:label="field.label"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-else
|
||||||
|
:key="field.name"
|
||||||
|
v-model="field.value"
|
||||||
|
:label="field.label"
|
||||||
|
:type="field.type"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row-reverse mt-auto">
|
||||||
|
<Button variant="solid" :loading="data.save.loading" @click="update">
|
||||||
|
{{ __('Update') }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { FormControl, Button } from 'frappe-ui'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
fields: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const columns = computed(() => {
|
||||||
|
const cols = []
|
||||||
|
let currentColumn = []
|
||||||
|
|
||||||
|
props.fields.forEach((field) => {
|
||||||
|
if (field.type === 'Column Break') {
|
||||||
|
if (currentColumn.length > 0) {
|
||||||
|
cols.push(currentColumn)
|
||||||
|
currentColumn = []
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (field.type == 'checkbox') {
|
||||||
|
field.value = props.data.doc[field.name] ? true : false
|
||||||
|
} else {
|
||||||
|
field.value = props.data.doc[field.name]
|
||||||
|
}
|
||||||
|
currentColumn.push(field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (currentColumn.length > 0) {
|
||||||
|
cols.push(currentColumn)
|
||||||
|
}
|
||||||
|
|
||||||
|
return cols
|
||||||
|
})
|
||||||
|
|
||||||
|
const update = () => {
|
||||||
|
props.fields.forEach((f) => {
|
||||||
|
props.data.doc[f.name] = f.value
|
||||||
|
})
|
||||||
|
props.data.save.submit()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dropdown :options="userDropdownOptions">
|
<Dropdown class="p-2" :options="userDropdownOptions">
|
||||||
<template v-slot="{ open }">
|
<template v-slot="{ open }">
|
||||||
<button
|
<button
|
||||||
class="flex h-12 py-2 items-center rounded-md duration-300 ease-in-out"
|
class="flex h-12 py-2 items-center rounded-md duration-300 ease-in-out"
|
||||||
@@ -56,24 +56,33 @@
|
|||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
<SettingsModal
|
||||||
|
v-if="userResource.data?.is_moderator"
|
||||||
|
v-model="showSettingsModal"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import LMSLogo from '@/components/Icons/LMSLogo.vue'
|
import LMSLogo from '@/components/Icons/LMSLogo.vue'
|
||||||
import { sessionStore } from '@/stores/session'
|
import { sessionStore } from '@/stores/session'
|
||||||
import { Dropdown } from 'frappe-ui'
|
import { Dropdown } from 'frappe-ui'
|
||||||
|
import Apps from '@/components/Apps.vue'
|
||||||
import {
|
import {
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
LogIn,
|
LogIn,
|
||||||
LogOut,
|
LogOut,
|
||||||
User,
|
User,
|
||||||
ArrowRightLeft,
|
ArrowRightLeft,
|
||||||
|
Settings,
|
||||||
} from 'lucide-vue-next'
|
} from 'lucide-vue-next'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { convertToTitleCase } from '../utils'
|
import { convertToTitleCase } from '../utils'
|
||||||
import { usersStore } from '@/stores/user'
|
import { usersStore } from '@/stores/user'
|
||||||
|
import { ref, markRaw } from 'vue'
|
||||||
|
import SettingsModal from '@/components/Modals/Settings.vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const showSettingsModal = ref(false)
|
||||||
const { logout, branding } = sessionStore()
|
const { logout, branding } = sessionStore()
|
||||||
let { userResource } = usersStore()
|
let { userResource } = usersStore()
|
||||||
let { isLoggedIn } = sessionStore()
|
let { isLoggedIn } = sessionStore()
|
||||||
@@ -97,11 +106,7 @@ const userDropdownOptions = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: ArrowRightLeft,
|
component: markRaw(Apps),
|
||||||
label: 'Switch to Desk',
|
|
||||||
onClick: () => {
|
|
||||||
window.location.href = '/app'
|
|
||||||
},
|
|
||||||
condition: () => {
|
condition: () => {
|
||||||
let cookies = new URLSearchParams(document.cookie.split('; ').join('&'))
|
let cookies = new URLSearchParams(document.cookie.split('; ').join('&'))
|
||||||
let system_user = cookies.get('system_user')
|
let system_user = cookies.get('system_user')
|
||||||
@@ -109,6 +114,16 @@ const userDropdownOptions = [
|
|||||||
else return false
|
else return false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: Settings,
|
||||||
|
label: 'Settings',
|
||||||
|
onClick: () => {
|
||||||
|
showSettingsModal.value = true
|
||||||
|
},
|
||||||
|
condition: () => {
|
||||||
|
return userResource.data?.is_moderator
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
icon: LogOut,
|
icon: LogOut,
|
||||||
label: 'Log out',
|
label: 'Log out',
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ import MultiSelect from '@/components/Controls/MultiSelect.vue'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { getFileSize, showToast } from '../utils'
|
import { getFileSize, showToast } from '../utils'
|
||||||
import { X, FileText } from 'lucide-vue-next'
|
import { X, FileText } from 'lucide-vue-next'
|
||||||
|
import { capture } from '@/telemetry'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
@@ -274,6 +275,8 @@ onMounted(() => {
|
|||||||
if (!user.data) window.location.href = '/login'
|
if (!user.data) window.location.href = '/login'
|
||||||
if (props.batchName != 'new') {
|
if (props.batchName != 'new') {
|
||||||
batchDetail.reload()
|
batchDetail.reload()
|
||||||
|
} else {
|
||||||
|
capture('batch_form_opened')
|
||||||
}
|
}
|
||||||
window.addEventListener('keydown', keyboardShortcut)
|
window.addEventListener('keydown', keyboardShortcut)
|
||||||
})
|
})
|
||||||
@@ -377,6 +380,7 @@ const createNewBatch = () => {
|
|||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
onSuccess(data) {
|
onSuccess(data) {
|
||||||
|
capture('batch_created')
|
||||||
router.push({
|
router.push({
|
||||||
name: 'BatchDetail',
|
name: 'BatchDetail',
|
||||||
params: {
|
params: {
|
||||||
@@ -447,7 +451,7 @@ const breadcrumbs = computed(() => {
|
|||||||
}
|
}
|
||||||
crumbs.push({
|
crumbs.push({
|
||||||
label: props.batchName == 'new' ? 'New Batch' : 'Edit Batch',
|
label: props.batchName == 'new' ? 'New Batch' : 'Edit Batch',
|
||||||
route: { name: 'BatchCreation', params: { batchName: props.batchName } },
|
route: { name: 'BatchForm', params: { batchName: props.batchName } },
|
||||||
})
|
})
|
||||||
return crumbs
|
return crumbs
|
||||||
})
|
})
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
>
|
>
|
||||||
<Breadcrumbs
|
<Breadcrumbs
|
||||||
class="h-7"
|
class="h-7"
|
||||||
:items="[{ label: __('All Batches'), route: { name: 'Batches' } }]"
|
:items="[{ label: __('Batches'), route: { name: 'Batches' } }]"
|
||||||
/>
|
/>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<div class="w-40">
|
<div class="w-40">
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
<router-link
|
<router-link
|
||||||
v-if="user.data?.is_moderator"
|
v-if="user.data?.is_moderator"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'BatchCreation',
|
name: 'BatchForm',
|
||||||
params: { batchName: 'new' },
|
params: { batchName: 'new' },
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Button variant="solid">
|
<Button variant="solid">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<Plus class="h-4 w-4" />
|
<Plus class="h-4 w-4 stroke-1.5" />
|
||||||
</template>
|
</template>
|
||||||
{{ __('New Batch') }}
|
{{ __('New Batch') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<FormControl
|
<FormControl
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Participants"
|
placeholder="Search"
|
||||||
v-model="searchQuery"
|
v-model="searchQuery"
|
||||||
@input="participants.reload()"
|
@input="participants.reload()"
|
||||||
|
class="w-40"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<Search class="w-4 stroke-1.5 text-gray-600" name="search" />
|
<Search class="w-4 stroke-1.5 text-gray-600" name="search" />
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ import { FileText, X } from 'lucide-vue-next'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import CourseOutline from '@/components/CourseOutline.vue'
|
import CourseOutline from '@/components/CourseOutline.vue'
|
||||||
import MultiSelect from '@/components/Controls/MultiSelect.vue'
|
import MultiSelect from '@/components/Controls/MultiSelect.vue'
|
||||||
|
import { capture } from '@/telemetry'
|
||||||
|
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
const newTag = ref('')
|
const newTag = ref('')
|
||||||
@@ -268,6 +269,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
if (props.courseName !== 'new') {
|
if (props.courseName !== 'new') {
|
||||||
courseResource.reload()
|
courseResource.reload()
|
||||||
|
} else {
|
||||||
|
capture('course_form_opened')
|
||||||
}
|
}
|
||||||
window.addEventListener('keydown', keyboardShortcut)
|
window.addEventListener('keydown', keyboardShortcut)
|
||||||
})
|
})
|
||||||
@@ -388,9 +391,10 @@ const submitCourse = () => {
|
|||||||
} else {
|
} else {
|
||||||
courseCreationResource.submit(course, {
|
courseCreationResource.submit(course, {
|
||||||
onSuccess(data) {
|
onSuccess(data) {
|
||||||
|
capture('course_created')
|
||||||
showToast('Success', 'Course created successfully', 'check')
|
showToast('Success', 'Course created successfully', 'check')
|
||||||
router.push({
|
router.push({
|
||||||
name: 'CreateCourse',
|
name: 'CourseForm',
|
||||||
params: { courseName: data.name },
|
params: { courseName: data.name },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -489,7 +493,7 @@ const breadcrumbs = computed(() => {
|
|||||||
}
|
}
|
||||||
crumbs.push({
|
crumbs.push({
|
||||||
label: props.courseName == 'new' ? 'New Course' : 'Edit Course',
|
label: props.courseName == 'new' ? 'New Course' : 'Edit Course',
|
||||||
route: { name: 'CreateCourse', params: { courseName: props.courseName } },
|
route: { name: 'CourseForm', params: { courseName: props.courseName } },
|
||||||
})
|
})
|
||||||
return crumbs
|
return crumbs
|
||||||
})
|
})
|
||||||
@@ -5,22 +5,24 @@
|
|||||||
>
|
>
|
||||||
<Breadcrumbs
|
<Breadcrumbs
|
||||||
class="h-7"
|
class="h-7"
|
||||||
:items="[{ label: __('All Courses'), route: { name: 'Courses' } }]"
|
:items="[{ label: __('Courses'), route: { name: 'Courses' } }]"
|
||||||
/>
|
/>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2 justify-end">
|
||||||
|
<div class="w-36">
|
||||||
<FormControl
|
<FormControl
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Course"
|
placeholder="Search"
|
||||||
v-model="searchQuery"
|
v-model="searchQuery"
|
||||||
@input="courses.reload()"
|
@input="courses.reload()"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<Search class="w-4 stroke-1.5 text-gray-600" name="search" />
|
<Search class="w-4 h-4 stroke-1.5 text-gray-600" name="search" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
</div>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'CreateCourse',
|
name: 'CourseForm',
|
||||||
params: {
|
params: {
|
||||||
courseName: 'new',
|
courseName: 'new',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<router-link
|
<router-link
|
||||||
v-if="allowEdit()"
|
v-if="allowEdit()"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'CreateLesson',
|
name: 'LessonForm',
|
||||||
params: {
|
params: {
|
||||||
courseName: courseName,
|
courseName: courseName,
|
||||||
chapterNumber: props.chapterNumber,
|
chapterNumber: props.chapterNumber,
|
||||||
|
|||||||
@@ -70,16 +70,25 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Breadcrumbs, FormControl, createResource, Button } from 'frappe-ui'
|
import { Breadcrumbs, FormControl, createResource, Button } from 'frappe-ui'
|
||||||
import { computed, reactive, onMounted, inject, ref, watch } from 'vue'
|
import {
|
||||||
|
computed,
|
||||||
|
reactive,
|
||||||
|
onMounted,
|
||||||
|
inject,
|
||||||
|
ref,
|
||||||
|
onBeforeUnmount,
|
||||||
|
} from 'vue'
|
||||||
import EditorJS from '@editorjs/editorjs'
|
import EditorJS from '@editorjs/editorjs'
|
||||||
import LessonPlugins from '@/components/LessonPlugins.vue'
|
import LessonPlugins from '@/components/LessonPlugins.vue'
|
||||||
import { ChevronRight } from 'lucide-vue-next'
|
import { ChevronRight } from 'lucide-vue-next'
|
||||||
import { updateDocumentTitle, createToast, getEditorTools } from '@/utils'
|
import { updateDocumentTitle, createToast, getEditorTools } from '@/utils'
|
||||||
|
import { capture } from '@/telemetry'
|
||||||
|
|
||||||
const editor = ref(null)
|
const editor = ref(null)
|
||||||
const instructorEditor = ref(null)
|
const instructorEditor = ref(null)
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
const openInstructorEditor = ref(false)
|
const openInstructorEditor = ref(false)
|
||||||
|
let autoSaveInterval
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
courseName: {
|
courseName: {
|
||||||
@@ -100,6 +109,7 @@ onMounted(() => {
|
|||||||
if (!user.data?.is_moderator && !user.data?.is_instructor) {
|
if (!user.data?.is_moderator && !user.data?.is_instructor) {
|
||||||
window.location.href = '/login'
|
window.location.href = '/login'
|
||||||
}
|
}
|
||||||
|
capture('lesson_form_opened')
|
||||||
editor.value = renderEditor('content')
|
editor.value = renderEditor('content')
|
||||||
instructorEditor.value = renderEditor('instructor-notes')
|
instructorEditor.value = renderEditor('instructor-notes')
|
||||||
})
|
})
|
||||||
@@ -134,6 +144,14 @@ const lessonDetails = createResource({
|
|||||||
lesson[key] = data.lesson[key]
|
lesson[key] = data.lesson[key]
|
||||||
})
|
})
|
||||||
lesson.include_in_preview = data.include_in_preview ? true : false
|
lesson.include_in_preview = data.include_in_preview ? true : false
|
||||||
|
addLessonContent(data)
|
||||||
|
addInstructorNotes(data)
|
||||||
|
enableAutoSave()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const addLessonContent = (data) => {
|
||||||
editor.value.isReady.then(() => {
|
editor.value.isReady.then(() => {
|
||||||
if (data.lesson.content) {
|
if (data.lesson.content) {
|
||||||
editor.value.render(JSON.parse(data.lesson.content))
|
editor.value.render(JSON.parse(data.lesson.content))
|
||||||
@@ -144,11 +162,12 @@ const lessonDetails = createResource({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const addInstructorNotes = (data) => {
|
||||||
instructorEditor.value.isReady.then(() => {
|
instructorEditor.value.isReady.then(() => {
|
||||||
if (data.lesson.instructor_content) {
|
if (data.lesson.instructor_content) {
|
||||||
instructorEditor.value.render(
|
instructorEditor.value.render(JSON.parse(data.lesson.instructor_content))
|
||||||
JSON.parse(data.lesson.instructor_content)
|
|
||||||
)
|
|
||||||
} else if (data.lesson.instructor_notes) {
|
} else if (data.lesson.instructor_notes) {
|
||||||
let blocks = convertToJSON(data.lesson)
|
let blocks = convertToJSON(data.lesson)
|
||||||
instructorEditor.value.render({
|
instructorEditor.value.render({
|
||||||
@@ -156,8 +175,16 @@ const lessonDetails = createResource({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
const enableAutoSave = () => {
|
||||||
|
autoSaveInterval = setInterval(() => {
|
||||||
|
saveLesson()
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
clearInterval(autoSaveInterval)
|
||||||
})
|
})
|
||||||
|
|
||||||
const newLessonResource = createResource({
|
const newLessonResource = createResource({
|
||||||
@@ -335,6 +362,7 @@ const createNewLesson = () => {
|
|||||||
{ lesson: data.name },
|
{ lesson: data.name },
|
||||||
{
|
{
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
|
capture('lesson_created')
|
||||||
showToast('Success', 'Lesson created successfully', 'check')
|
showToast('Success', 'Lesson created successfully', 'check')
|
||||||
lessonDetails.reload()
|
lessonDetails.reload()
|
||||||
},
|
},
|
||||||
@@ -357,9 +385,6 @@ const editCurrentLesson = () => {
|
|||||||
validate() {
|
validate() {
|
||||||
return validateLesson()
|
return validateLesson()
|
||||||
},
|
},
|
||||||
onSuccess() {
|
|
||||||
showToast('Success', 'Lesson updated successfully', 'check')
|
|
||||||
},
|
|
||||||
onError(err) {
|
onError(err) {
|
||||||
showToast('Error', err.message, 'x')
|
showToast('Error', err.message, 'x')
|
||||||
},
|
},
|
||||||
@@ -418,7 +443,7 @@ const breadcrumbs = computed(() => {
|
|||||||
crumbs.push({
|
crumbs.push({
|
||||||
label: lessonDetails?.data?.lesson ? 'Edit Lesson' : 'Create Lesson',
|
label: lessonDetails?.data?.lesson ? 'Edit Lesson' : 'Create Lesson',
|
||||||
route: {
|
route: {
|
||||||
name: 'CreateLesson',
|
name: 'LessonForm',
|
||||||
params: {
|
params: {
|
||||||
courseName: props.courseName,
|
courseName: props.courseName,
|
||||||
chapterNumber: props.chapterNumber,
|
chapterNumber: props.chapterNumber,
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<h2 class="mb-3 text-lg font-semibold text-gray-900">
|
<h2 class="mb-3 text-lg font-semibold text-gray-900">
|
||||||
{{ __('Achievements') }}
|
{{ __('Achievements') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="grid grid-cols-5 gap-4">
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4">
|
||||||
<div v-for="badge in badges.data">
|
<div v-for="badge in badges.data">
|
||||||
<Popover trigger="hover" :leaveDelay="Number(0.01)">
|
<Popover trigger="hover" :leaveDelay="Number(0.01)">
|
||||||
<template #target>
|
<template #target>
|
||||||
|
|||||||
418
frontend/src/pages/QuizCreation.vue
Normal file
418
frontend/src/pages/QuizCreation.vue
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
<template>
|
||||||
|
<header
|
||||||
|
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
|
||||||
|
>
|
||||||
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
|
<Button variant="solid" @click="submitQuiz()">
|
||||||
|
{{ __('Save') }}
|
||||||
|
</Button>
|
||||||
|
</header>
|
||||||
|
<div class="w-3/4 mx-auto py-5">
|
||||||
|
<!-- Details -->
|
||||||
|
<div class="mb-8">
|
||||||
|
<div class="text-sm font-semibold mb-4">
|
||||||
|
{{ __('Details') }}
|
||||||
|
</div>
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.title"
|
||||||
|
:label="
|
||||||
|
quizDetails.data?.name
|
||||||
|
? __('Title')
|
||||||
|
: __('Enter a title and save the quiz to proceed')
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<div v-if="quizDetails.data?.name">
|
||||||
|
<div class="grid grid-cols-3 gap-5 mt-2 mb-8">
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.max_attempts"
|
||||||
|
:label="__('Maximun Attempts')"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.total_marks"
|
||||||
|
:label="__('Total Marks')"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.passing_percentage"
|
||||||
|
:label="__('Passing Percentage')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Settings -->
|
||||||
|
<div class="mb-8">
|
||||||
|
<div class="text-sm font-semibold mb-4">
|
||||||
|
{{ __('Settings') }}
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-3 gap-5 my-4">
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.show_answers"
|
||||||
|
type="checkbox"
|
||||||
|
:label="__('Show Answers')"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.show_submission_history"
|
||||||
|
type="checkbox"
|
||||||
|
:label="__('Show Submission History')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-8">
|
||||||
|
<div class="text-sm font-semibold mb-4">
|
||||||
|
{{ __('Shuffle Settings') }}
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-3">
|
||||||
|
<FormControl
|
||||||
|
v-model="quiz.shuffle_questions"
|
||||||
|
type="checkbox"
|
||||||
|
:label="__('Shuffle Questions')"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-if="quiz.shuffle_questions"
|
||||||
|
v-model="quiz.limit_questions_to"
|
||||||
|
:label="__('Limit Questions To')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Questions -->
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center justify-between mb-4">
|
||||||
|
<div class="text-sm font-semibold">
|
||||||
|
{{ __('Questions') }}
|
||||||
|
</div>
|
||||||
|
<Button @click="openQuestionModal()">
|
||||||
|
<template #prefix>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
</template>
|
||||||
|
{{ __('New Question') }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<ListView
|
||||||
|
:columns="questionColumns"
|
||||||
|
:rows="quiz.questions"
|
||||||
|
row-key="name"
|
||||||
|
:options="{
|
||||||
|
showTooltip: false,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<ListHeader
|
||||||
|
class="mb-2 grid items-center space-x-4 rounded bg-gray-100 p-2"
|
||||||
|
>
|
||||||
|
<ListHeaderItem :item="item" v-for="item in questionColumns" />
|
||||||
|
</ListHeader>
|
||||||
|
<ListRows>
|
||||||
|
<ListRow
|
||||||
|
:row="row"
|
||||||
|
v-slot="{ idx, column, item }"
|
||||||
|
v-for="row in quiz.questions"
|
||||||
|
@click="openQuestionModal(row)"
|
||||||
|
>
|
||||||
|
<ListRowItem :item="item">
|
||||||
|
<div
|
||||||
|
v-if="column.key == 'question_detail'"
|
||||||
|
class="text-xs truncate h-4"
|
||||||
|
v-html="item"
|
||||||
|
></div>
|
||||||
|
<div v-else class="text-xs">
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
</ListRowItem>
|
||||||
|
</ListRow>
|
||||||
|
</ListRows>
|
||||||
|
<ListSelectBanner>
|
||||||
|
<template #actions="{ unselectAll, selections }">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
@click="deleteQuizzes(selections, unselectAll)"
|
||||||
|
>
|
||||||
|
<Trash2 class="h-4 w-4 stroke-1.5" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ListSelectBanner>
|
||||||
|
</ListView>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Question
|
||||||
|
v-model="showQuestionModal"
|
||||||
|
:questionDetail="currentQuestion"
|
||||||
|
v-model:quiz="quizDetails"
|
||||||
|
:title="
|
||||||
|
currentQuestion.question
|
||||||
|
? __('Edit the question')
|
||||||
|
: __('Add a new question')
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
Breadcrumbs,
|
||||||
|
createResource,
|
||||||
|
FormControl,
|
||||||
|
ListView,
|
||||||
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
|
ListRows,
|
||||||
|
ListRow,
|
||||||
|
ListRowItem,
|
||||||
|
ListSelectBanner,
|
||||||
|
Button,
|
||||||
|
} from 'frappe-ui'
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
inject,
|
||||||
|
onBeforeUnmount,
|
||||||
|
watch,
|
||||||
|
isReactive,
|
||||||
|
} from 'vue'
|
||||||
|
import { Plus, Trash2 } from 'lucide-vue-next'
|
||||||
|
import Question from '@/components/Modals/Question.vue'
|
||||||
|
import { showToast } from '../utils'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const showQuestionModal = ref(false)
|
||||||
|
const currentQuestion = reactive({
|
||||||
|
question: '',
|
||||||
|
marks: 0,
|
||||||
|
name: '',
|
||||||
|
})
|
||||||
|
const user = inject('$user')
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
quizID: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const quiz = reactive({
|
||||||
|
title: '',
|
||||||
|
total_marks: 0,
|
||||||
|
passing_percentage: 0,
|
||||||
|
max_attempts: 0,
|
||||||
|
limit_questions_to: 0,
|
||||||
|
show_answers: true,
|
||||||
|
show_submission_history: false,
|
||||||
|
shuffle_questions: false,
|
||||||
|
questions: [],
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (
|
||||||
|
props.quizID == 'new' &&
|
||||||
|
!user.data?.is_moderator &&
|
||||||
|
!user.data?.is_instructor
|
||||||
|
) {
|
||||||
|
router.push({ name: 'Courses' })
|
||||||
|
}
|
||||||
|
if (props.quizID !== 'new') {
|
||||||
|
quizDetails.reload()
|
||||||
|
}
|
||||||
|
window.addEventListener('keydown', keyboardShortcut)
|
||||||
|
})
|
||||||
|
|
||||||
|
const keyboardShortcut = (e) => {
|
||||||
|
if (
|
||||||
|
e.key === 's' &&
|
||||||
|
(e.ctrlKey || e.metaKey) &&
|
||||||
|
!e.target.classList.contains('ProseMirror')
|
||||||
|
) {
|
||||||
|
submitQuiz()
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('keydown', keyboardShortcut)
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.quizID !== 'new',
|
||||||
|
(newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
quizDetails.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const quizDetails = createResource({
|
||||||
|
url: 'frappe.client.get',
|
||||||
|
makeParams(values) {
|
||||||
|
return { doctype: 'LMS Quiz', name: props.quizID }
|
||||||
|
},
|
||||||
|
auto: false,
|
||||||
|
onSuccess(data) {
|
||||||
|
Object.keys(data).forEach((key) => {
|
||||||
|
if (Object.hasOwn(quiz, key)) quiz[key] = data[key]
|
||||||
|
})
|
||||||
|
|
||||||
|
let checkboxes = [
|
||||||
|
'show_answers',
|
||||||
|
'show_submission_history',
|
||||||
|
'shuffle_questions',
|
||||||
|
]
|
||||||
|
for (let idx in checkboxes) {
|
||||||
|
let key = checkboxes[idx]
|
||||||
|
quiz[key] = quiz[key] ? true : false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const quizCreate = createResource({
|
||||||
|
url: 'frappe.client.insert',
|
||||||
|
auto: false,
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doc: {
|
||||||
|
doctype: 'LMS Quiz',
|
||||||
|
...quiz,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const quizUpdate = createResource({
|
||||||
|
url: 'frappe.client.set_value',
|
||||||
|
auto: false,
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doctype: 'LMS Quiz',
|
||||||
|
name: values.quizID,
|
||||||
|
fieldname: {
|
||||||
|
total_marks: calculateTotalMarks(),
|
||||||
|
...quiz,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const submitQuiz = () => {
|
||||||
|
if (quizDetails.data?.name) updateQuiz()
|
||||||
|
else createQuiz()
|
||||||
|
}
|
||||||
|
|
||||||
|
const createQuiz = () => {
|
||||||
|
quizCreate.submit(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess(data) {
|
||||||
|
showToast(__('Success'), __('Quiz created successfully'), 'check')
|
||||||
|
router.push({
|
||||||
|
name: 'QuizCreation',
|
||||||
|
params: { quizID: data.name },
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
showToast(__('Error'), __(err.messages?.[0] || err), 'x')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateQuiz = () => {
|
||||||
|
quizUpdate.submit(
|
||||||
|
{ quizID: quizDetails.data?.name },
|
||||||
|
{
|
||||||
|
onSuccess(data) {
|
||||||
|
quiz.total_marks = data.total_marks
|
||||||
|
showToast(__('Success'), __('Quiz updated successfully'), 'check')
|
||||||
|
},
|
||||||
|
onError(err) {
|
||||||
|
showToast(__('Error'), __(err.messages?.[0] || err), 'x')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const calculateTotalMarks = () => {
|
||||||
|
let totalMarks = 0
|
||||||
|
if (quiz.limit_questions_to && quiz.questions.length > 0)
|
||||||
|
return quiz.questions[0].marks * quiz.limit_questions_to
|
||||||
|
quiz.questions.forEach((question) => {
|
||||||
|
totalMarks += question.marks
|
||||||
|
})
|
||||||
|
return totalMarks
|
||||||
|
}
|
||||||
|
|
||||||
|
const questionColumns = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: __('ID'),
|
||||||
|
key: 'question',
|
||||||
|
width: '25%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Question'),
|
||||||
|
key: __('question_detail'),
|
||||||
|
width: '60%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Marks'),
|
||||||
|
key: 'marks',
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const openQuestionModal = (question = null) => {
|
||||||
|
if (question) {
|
||||||
|
currentQuestion.question = question.question
|
||||||
|
currentQuestion.marks = question.marks
|
||||||
|
currentQuestion.name = question.name
|
||||||
|
} else {
|
||||||
|
currentQuestion.question = ''
|
||||||
|
currentQuestion.marks = 0
|
||||||
|
currentQuestion.name = ''
|
||||||
|
}
|
||||||
|
showQuestionModal.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteQuiz = createResource({
|
||||||
|
url: 'frappe.client.delete',
|
||||||
|
makeParams(values) {
|
||||||
|
return {
|
||||||
|
doctype: 'LMS Quiz Question',
|
||||||
|
name: values.quiz,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const deleteQuizzes = (selections, unselectAll) => {
|
||||||
|
selections.forEach(async (quiz) => {
|
||||||
|
deleteQuiz.submit({ quiz })
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
quizDetails.reload()
|
||||||
|
unselectAll()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
const breadcrumbs = computed(() => {
|
||||||
|
let crumbs = [
|
||||||
|
{
|
||||||
|
label: __('Quizzes'),
|
||||||
|
route: {
|
||||||
|
name: 'Quizzes',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
/* if (quizDetails.data) {
|
||||||
|
crumbs.push({
|
||||||
|
label: quiz.title,
|
||||||
|
})
|
||||||
|
} */
|
||||||
|
crumbs.push({
|
||||||
|
label: props.quizID == 'new' ? 'New Quiz' : quizDetails.data?.title,
|
||||||
|
route: { name: 'QuizCreation', params: { quizID: props.quizID } },
|
||||||
|
})
|
||||||
|
return crumbs
|
||||||
|
})
|
||||||
|
</script>
|
||||||
126
frontend/src/pages/Quizzes.vue
Normal file
126
frontend/src/pages/Quizzes.vue
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<template>
|
||||||
|
<header
|
||||||
|
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
|
||||||
|
>
|
||||||
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
|
<router-link
|
||||||
|
:to="{
|
||||||
|
name: 'QuizCreation',
|
||||||
|
params: {
|
||||||
|
quizID: 'new',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<Button variant="solid">
|
||||||
|
<template #prefix>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
</template>
|
||||||
|
{{ __('New Quiz') }}
|
||||||
|
</Button>
|
||||||
|
</router-link>
|
||||||
|
</header>
|
||||||
|
<div v-if="quizzes.data?.length" class="w-3/4 mx-auto py-5">
|
||||||
|
<ListView
|
||||||
|
:columns="quizColumns"
|
||||||
|
:rows="quizzes.data"
|
||||||
|
row-key="name"
|
||||||
|
:options="{ showTooltip: false, selectable: false }"
|
||||||
|
>
|
||||||
|
<ListHeader
|
||||||
|
class="mb-2 grid items-center space-x-4 rounded bg-gray-100 p-2"
|
||||||
|
>
|
||||||
|
<ListHeaderItem :item="item" v-for="item in quizColumns">
|
||||||
|
</ListHeaderItem>
|
||||||
|
</ListHeader>
|
||||||
|
<ListRows>
|
||||||
|
<router-link
|
||||||
|
v-for="row in quizzes.data"
|
||||||
|
:to="{
|
||||||
|
name: 'QuizCreation',
|
||||||
|
params: {
|
||||||
|
quizID: row.name,
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<ListRow :row="row" />
|
||||||
|
</router-link>
|
||||||
|
</ListRows>
|
||||||
|
</ListView>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
Breadcrumbs,
|
||||||
|
createListResource,
|
||||||
|
ListView,
|
||||||
|
ListRows,
|
||||||
|
ListRow,
|
||||||
|
ListHeader,
|
||||||
|
ListHeaderItem,
|
||||||
|
Button,
|
||||||
|
} from 'frappe-ui'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { computed, inject, onMounted } from 'vue'
|
||||||
|
import { Plus } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const user = inject('$user')
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (!user.data?.is_moderator && !user.data?.is_instructor) {
|
||||||
|
router.push({ name: 'Courses' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const quizFilter = computed(() => {
|
||||||
|
if (user.data?.is_moderator) return {}
|
||||||
|
return {
|
||||||
|
owner: user.data?.name,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const quizzes = createListResource({
|
||||||
|
doctype: 'LMS Quiz',
|
||||||
|
filters: quizFilter,
|
||||||
|
fields: ['name', 'title', 'passing_percentage', 'total_marks'],
|
||||||
|
auto: true,
|
||||||
|
cache: ['quizzes', user.data?.name],
|
||||||
|
orderBy: 'modified desc',
|
||||||
|
onSuccess(data) {
|
||||||
|
data.forEach((row) => {})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const quizColumns = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: __('Title'),
|
||||||
|
key: 'title',
|
||||||
|
width: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Total Marks'),
|
||||||
|
key: 'total_marks',
|
||||||
|
width: 1,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Passing Percentage'),
|
||||||
|
key: 'passing_percentage',
|
||||||
|
width: 1,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const breadcrumbs = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: __('Quizzes'),
|
||||||
|
route: {
|
||||||
|
name: 'Quizzes',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -97,20 +97,20 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/courses/:courseName/edit',
|
path: '/courses/:courseName/edit',
|
||||||
name: 'CreateCourse',
|
name: 'CourseForm',
|
||||||
component: () => import('@/pages/CreateCourse.vue'),
|
component: () => import('@/pages/CourseForm.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/courses/:courseName/learn/:chapterNumber-:lessonNumber/edit',
|
path: '/courses/:courseName/learn/:chapterNumber-:lessonNumber/edit',
|
||||||
name: 'CreateLesson',
|
name: 'LessonForm',
|
||||||
component: () => import('@/pages/CreateLesson.vue'),
|
component: () => import('@/pages/LessonForm.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/batches/:batchName/edit',
|
path: '/batches/:batchName/edit',
|
||||||
name: 'BatchCreation',
|
name: 'BatchForm',
|
||||||
component: () => import('@/pages/BatchCreation.vue'),
|
component: () => import('@/pages/BatchForm.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -141,6 +141,17 @@ const routes = [
|
|||||||
component: () => import('@/pages/Badge.vue'),
|
component: () => import('@/pages/Badge.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/quizzes',
|
||||||
|
name: 'Quizzes',
|
||||||
|
component: () => import('@/pages/Quizzes.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/quizzes/:quizID',
|
||||||
|
name: 'QuizCreation',
|
||||||
|
component: () => import('@/pages/QuizCreation.vue'),
|
||||||
|
props: true,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
let router = createRouter({
|
let router = createRouter({
|
||||||
|
|||||||
@@ -53,11 +53,18 @@ export const sessionStore = defineStore('lms-session', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const sidebarSettings = createResource({
|
||||||
|
url: 'lms.lms.api.get_sidebar_settings',
|
||||||
|
cache: 'Sidebar Settings',
|
||||||
|
auto: false,
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user,
|
user,
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
login,
|
login,
|
||||||
logout,
|
logout,
|
||||||
branding,
|
branding,
|
||||||
|
sidebarSettings,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
98
frontend/src/telemetry.ts
Normal file
98
frontend/src/telemetry.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import { useStorage } from "@vueuse/core";
|
||||||
|
import { call } from "frappe-ui";
|
||||||
|
import "../../../frappe/frappe/public/js/lib/posthog.js";
|
||||||
|
|
||||||
|
const APP = "lms";
|
||||||
|
const SITENAME = window.location.hostname;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
posthog: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const telemetry = useStorage("telemetry", {
|
||||||
|
enabled: false,
|
||||||
|
project_id: "",
|
||||||
|
host: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
export async function init() {
|
||||||
|
await set_enabled();
|
||||||
|
if (!telemetry.value.enabled) return;
|
||||||
|
try {
|
||||||
|
await set_credentials();
|
||||||
|
window.posthog.init(telemetry.value.project_id, {
|
||||||
|
api_host: telemetry.value.host,
|
||||||
|
autocapture: false,
|
||||||
|
person_profiles: "always",
|
||||||
|
capture_pageview: true,
|
||||||
|
capture_pageleave: true,
|
||||||
|
disable_session_recording: false,
|
||||||
|
session_recording: {
|
||||||
|
maskAllInputs: false,
|
||||||
|
maskInputOptions: {
|
||||||
|
password: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
loaded: (posthog) => {
|
||||||
|
window.posthog = posthog;
|
||||||
|
window.posthog.identify(SITENAME);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.trace("Failed to initialize telemetry", e);
|
||||||
|
telemetry.value.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_enabled() {
|
||||||
|
if (telemetry.value.enabled) return;
|
||||||
|
|
||||||
|
await call("lms.lms.telemetry.is_enabled").then((res) => {
|
||||||
|
telemetry.value.enabled = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function set_credentials() {
|
||||||
|
if (!telemetry.value.enabled) return;
|
||||||
|
if (telemetry.value.project_id && telemetry.value.host) return;
|
||||||
|
|
||||||
|
await call("lms.lms.telemetry.get_credentials").then((res) => {
|
||||||
|
telemetry.value.project_id = res.project_id;
|
||||||
|
telemetry.value.host = res.telemetry_host;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CaptureOptions {
|
||||||
|
data: {
|
||||||
|
user: string;
|
||||||
|
[key: string]: string | number | boolean | object;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function capture(
|
||||||
|
event: string,
|
||||||
|
options: CaptureOptions = { data: { user: "" } }
|
||||||
|
) {
|
||||||
|
if (!telemetry.value.enabled) return;
|
||||||
|
window.posthog.capture(`${APP}_${event}`, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function recordSession() {
|
||||||
|
if (!telemetry.value.enabled) return;
|
||||||
|
if (window.posthog && window.posthog.__loaded) {
|
||||||
|
window.posthog.startSessionRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stopSession() {
|
||||||
|
if (!telemetry.value.enabled) return;
|
||||||
|
if (
|
||||||
|
window.posthog &&
|
||||||
|
window.posthog.__loaded &&
|
||||||
|
window.posthog.sessionRecordingStarted()
|
||||||
|
) {
|
||||||
|
window.posthog.stopSessionRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import { createResource } from 'frappe-ui'
|
|||||||
|
|
||||||
export default function translationPlugin(app) {
|
export default function translationPlugin(app) {
|
||||||
app.config.globalProperties.__ = translate
|
app.config.globalProperties.__ = translate
|
||||||
|
window.__ = translate
|
||||||
if (!window.translatedMessages) fetchTranslations()
|
if (!window.translatedMessages) fetchTranslations()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -233,10 +233,10 @@ export function getEditorTools() {
|
|||||||
},
|
},
|
||||||
github: true,
|
github: true,
|
||||||
slides: {
|
slides: {
|
||||||
regex: /https:\/\/docs\.google\.com\/presentation\/d\/e\/([A-Za-z0-9_-]+)\/pub/,
|
regex: /https:\/\/docs\.google\.com\/presentation\/d\/([A-Za-z0-9_-]+)\/pub/,
|
||||||
embedUrl:
|
embedUrl:
|
||||||
'https://docs.google.com/presentation/d/e/<%= remote_id %>/embed',
|
'https://docs.google.com/presentation/d/<%= remote_id %>/embed',
|
||||||
html: "<iframe style='width: 100%; height: 30rem; border: 1px solid #D3D3D3; border-radius: 12px;' frameborder='0' allowfullscreen='true'></iframe>",
|
html: "<iframe style='width: 100%; height: 30rem; border: 1px solid #D3D3D3; border-radius: 12px; margin: 1rem 0' frameborder='0' allowfullscreen='true'></iframe>",
|
||||||
},
|
},
|
||||||
drive: {
|
drive: {
|
||||||
regex: /https:\/\/drive\.google\.com\/file\/d\/([A-Za-z0-9_-]+)\/view(\?.+)?/,
|
regex: /https:\/\/drive\.google\.com\/file\/d\/([A-Za-z0-9_-]+)\/view(\?.+)?/,
|
||||||
@@ -260,7 +260,7 @@ export function getEditorTools() {
|
|||||||
regex: /https:\/\/docs\.google\.com\/presentation\/d\/([A-Za-z0-9_-]+)\/edit(\?.+)?/,
|
regex: /https:\/\/docs\.google\.com\/presentation\/d\/([A-Za-z0-9_-]+)\/edit(\?.+)?/,
|
||||||
embedUrl:
|
embedUrl:
|
||||||
'https://docs.google.com/presentation/d/<%= remote_id %>/embed',
|
'https://docs.google.com/presentation/d/<%= remote_id %>/embed',
|
||||||
html: "<iframe style='width: 100%; height: 30rem; border: 1px solid #D3D3D3; border-radius: 12px;' frameborder='0' allowfullscreen='true'></iframe>",
|
html: "<iframe style='width: 100%; height: 30rem; border: 1px solid #D3D3D3; border-radius: 12px; margin: 1rem 0;' frameborder='0' allowfullscreen='true'></iframe>",
|
||||||
},
|
},
|
||||||
codesandbox: {
|
codesandbox: {
|
||||||
regex: /^https:\/\/codesandbox\.io\/(?:embed\/)?([A-Za-z0-9_-]+)(?:\?[^\/]*)?$/,
|
regex: /^https:\/\/codesandbox\.io\/(?:embed\/)?([A-Za-z0-9_-]+)(?:\?[^\/]*)?$/,
|
||||||
@@ -424,15 +424,15 @@ export function getSidebarLinks() {
|
|||||||
'Courses',
|
'Courses',
|
||||||
'CourseDetail',
|
'CourseDetail',
|
||||||
'Lesson',
|
'Lesson',
|
||||||
'CreateCourse',
|
'CourseForm',
|
||||||
'CreateLesson',
|
'LessonForm',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Batches',
|
label: 'Batches',
|
||||||
icon: 'Users',
|
icon: 'Users',
|
||||||
to: 'Batches',
|
to: 'Batches',
|
||||||
activeFor: ['Batches', 'BatchDetail', 'Batch', 'BatchCreation'],
|
activeFor: ['Batches', 'BatchDetail', 'Batch', 'BatchForm'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Certified Participants',
|
label: 'Certified Participants',
|
||||||
@@ -483,3 +483,19 @@ export function getLineStartPosition(string, position) {
|
|||||||
|
|
||||||
return position
|
return position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function singularize(word) {
|
||||||
|
const endings = {
|
||||||
|
ves: 'fe',
|
||||||
|
ies: 'y',
|
||||||
|
i: 'us',
|
||||||
|
zes: 'ze',
|
||||||
|
ses: 's',
|
||||||
|
es: 'e',
|
||||||
|
s: '',
|
||||||
|
}
|
||||||
|
return word.replace(
|
||||||
|
new RegExp(`(${Object.keys(endings).join('|')})$`),
|
||||||
|
(r) => endings[r]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -68,13 +68,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@codexteam/icons" "^0.0.5"
|
"@codexteam/icons" "^0.0.5"
|
||||||
|
|
||||||
"@editorjs/image@^2.9.2":
|
|
||||||
version "2.9.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@editorjs/image/-/image-2.9.2.tgz#c8bea65a578fab65a1a75df1223b4fd8f06b57d5"
|
|
||||||
integrity sha512-n09sMieGW8cksoeflpplzvbmFH2bdVzVTWbnidPWAHaeU467HRteoXU9yfGBB7+eeHZLnmCulQ2dr6ae+G2niw==
|
|
||||||
dependencies:
|
|
||||||
"@codexteam/icons" "^0.3.0"
|
|
||||||
|
|
||||||
"@editorjs/inline-code@^1.5.0":
|
"@editorjs/inline-code@^1.5.0":
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/@editorjs/inline-code/-/inline-code-1.5.0.tgz#ad5849bac3396b9dad22dceeda76198dd991e426"
|
resolved "https://registry.yarnpkg.com/@editorjs/inline-code/-/inline-code-1.5.0.tgz#ad5849bac3396b9dad22dceeda76198dd991e426"
|
||||||
@@ -1882,8 +1875,16 @@ source-map-js@^1.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
|
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
|
||||||
integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==
|
integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==
|
||||||
|
|
||||||
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
|
"string-width-cjs@npm:string-width@^4.2.0":
|
||||||
name string-width-cjs
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@^4.1.0:
|
||||||
version "4.2.3"
|
version "4.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
@@ -1901,8 +1902,14 @@ string-width@^5.0.1, string-width@^5.1.2:
|
|||||||
emoji-regex "^9.2.2"
|
emoji-regex "^9.2.2"
|
||||||
strip-ansi "^7.0.1"
|
strip-ansi "^7.0.1"
|
||||||
|
|
||||||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
||||||
name strip-ansi-cjs
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "2.0.0"
|
__version__ = "2.3.0"
|
||||||
|
|||||||
24
lms/hooks.py
24
lms/hooks.py
@@ -4,9 +4,11 @@ app_name = "frappe_lms"
|
|||||||
app_title = "Frappe LMS"
|
app_title = "Frappe LMS"
|
||||||
app_publisher = "Frappe"
|
app_publisher = "Frappe"
|
||||||
app_description = "Frappe LMS App"
|
app_description = "Frappe LMS App"
|
||||||
app_icon = "octicon octicon-file-directory"
|
app_icon_url = "/assets/lms/images/lms-logo.png"
|
||||||
|
app_icon_title = "Learning"
|
||||||
|
app_icon_route = "/lms"
|
||||||
app_color = "grey"
|
app_color = "grey"
|
||||||
app_email = "school@frappe.io"
|
app_email = "jannat@frappe.io"
|
||||||
app_license = "AGPL"
|
app_license = "AGPL"
|
||||||
|
|
||||||
# Includes in <head>
|
# Includes in <head>
|
||||||
@@ -61,8 +63,6 @@ web_include_js = ["website.bundle.js"]
|
|||||||
after_install = "lms.install.after_install"
|
after_install = "lms.install.after_install"
|
||||||
after_sync = "lms.install.after_sync"
|
after_sync = "lms.install.after_sync"
|
||||||
before_uninstall = "lms.install.before_uninstall"
|
before_uninstall = "lms.install.before_uninstall"
|
||||||
|
|
||||||
|
|
||||||
setup_wizard_requires = "assets/lms/js/setup_wizard.js"
|
setup_wizard_requires = "assets/lms/js/setup_wizard.js"
|
||||||
|
|
||||||
# Desk Notifications
|
# Desk Notifications
|
||||||
@@ -179,6 +179,12 @@ jinja = {
|
|||||||
"methods": [
|
"methods": [
|
||||||
"lms.lms.utils.get_signup_optin_checks",
|
"lms.lms.utils.get_signup_optin_checks",
|
||||||
"lms.lms.utils.get_tags",
|
"lms.lms.utils.get_tags",
|
||||||
|
"lms.lms.utils.get_lesson_count",
|
||||||
|
"lms.lms.utils.get_instructors",
|
||||||
|
"lms.lms.utils.get_lesson_index",
|
||||||
|
"lms.lms.utils.get_lesson_url",
|
||||||
|
"lms.page_renderers.get_profile_url",
|
||||||
|
"lms.overrides.user.get_palette",
|
||||||
],
|
],
|
||||||
"filters": [],
|
"filters": [],
|
||||||
}
|
}
|
||||||
@@ -225,3 +231,13 @@ profile_url_prefix = "/users/"
|
|||||||
signup_form_template = "lms.plugins.show_custom_signup"
|
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 = [
|
||||||
|
{
|
||||||
|
"name": "lms",
|
||||||
|
"logo": "/assets/lms/images/lms-logo.png",
|
||||||
|
"title": "Learning",
|
||||||
|
"route": "/lms",
|
||||||
|
"has_permission": "lms.lms.api.check_app_permission",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from frappe.translate import get_all_translations
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.query_builder import DocType
|
from frappe.query_builder import DocType
|
||||||
from frappe.query_builder.functions import Count
|
from frappe.query_builder.functions import Count
|
||||||
|
from frappe.utils import time_diff, now_datetime, get_datetime
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
@@ -265,7 +266,9 @@ def get_chart_details():
|
|||||||
"upcoming": 0,
|
"upcoming": 0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
details.users = frappe.db.count("User", {"enabled": 1})
|
details.users = frappe.db.count(
|
||||||
|
"User", {"enabled": 1, "name": ["not in", ("Administrator", "Guest")]}
|
||||||
|
)
|
||||||
details.completions = frappe.db.count(
|
details.completions = frappe.db.count(
|
||||||
"LMS Enrollment", {"progress": ["like", "%100%"]}
|
"LMS Enrollment", {"progress": ["like", "%100%"]}
|
||||||
)
|
)
|
||||||
@@ -559,3 +562,51 @@ def get_categories(doctype, filters):
|
|||||||
categoryOptions.append({"label": category, "value": category})
|
categoryOptions.append({"label": category, "value": category})
|
||||||
|
|
||||||
return categoryOptions
|
return categoryOptions
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_members(start=0, search=""):
|
||||||
|
"""Get members for the given search term and start index.
|
||||||
|
Args: start (int): Start index for the query.
|
||||||
|
search (str): Search term to filter the results.
|
||||||
|
Returns: List of members.
|
||||||
|
"""
|
||||||
|
|
||||||
|
filters = {"enabled": 1, "name": ["not in", ["Administrator", "Guest"]]}
|
||||||
|
|
||||||
|
if search:
|
||||||
|
filters["full_name"] = ["like", f"%{search}%"]
|
||||||
|
|
||||||
|
members = frappe.get_all(
|
||||||
|
"User",
|
||||||
|
filters=filters,
|
||||||
|
fields=["name", "full_name", "user_image", "username"],
|
||||||
|
page_length=20,
|
||||||
|
start=start,
|
||||||
|
)
|
||||||
|
|
||||||
|
for member in members:
|
||||||
|
roles = frappe.get_roles(member.name)
|
||||||
|
if "Moderator" in roles:
|
||||||
|
member.role = "Moderator"
|
||||||
|
elif "Course Creator" in roles:
|
||||||
|
member.role = "Course Creator"
|
||||||
|
elif "Batch Evaluator" in roles:
|
||||||
|
member.role = "Batch Evaluator"
|
||||||
|
elif "LMS Student" in roles:
|
||||||
|
member.role = "LMS Student"
|
||||||
|
|
||||||
|
return members
|
||||||
|
|
||||||
|
|
||||||
|
def check_app_permission():
|
||||||
|
"""Check if the user has permission to access the app."""
|
||||||
|
if frappe.session.user == "Administrator":
|
||||||
|
return True
|
||||||
|
|
||||||
|
roles = frappe.get_roles()
|
||||||
|
lms_roles = ["Moderator", "Course Creator", "Batch Evaluator", "LMS Student"]
|
||||||
|
if any(role in roles for role in lms_roles):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|||||||
@@ -11,74 +11,4 @@ from lms.lms.doctype.invite_request.invite_request import (
|
|||||||
|
|
||||||
|
|
||||||
class TestInviteRequest(unittest.TestCase):
|
class TestInviteRequest(unittest.TestCase):
|
||||||
@classmethod
|
pass
|
||||||
def setUpClass(self):
|
|
||||||
create_invite_request("test_invite@example.com")
|
|
||||||
|
|
||||||
def test_create_invite_request(self):
|
|
||||||
if frappe.db.exists("Invite Request", {"invite_email": "test_invite@example.com"}):
|
|
||||||
invite = frappe.db.get_value(
|
|
||||||
"Invite Request",
|
|
||||||
filters={"invite_email": "test_invite@example.com"},
|
|
||||||
fieldname=["invite_email", "status", "signup_email"],
|
|
||||||
as_dict=True,
|
|
||||||
)
|
|
||||||
self.assertEqual(invite.status, "Approved")
|
|
||||||
self.assertEqual(invite.signup_email, None)
|
|
||||||
|
|
||||||
def test_create_invite_request_update(self):
|
|
||||||
if frappe.db.exists("Invite Request", {"invite_email": "test_invite@example.com"}):
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"signup_email": "test_invite@example.com",
|
|
||||||
"username": "test_invite",
|
|
||||||
"full_name": "Test Invite",
|
|
||||||
"password": "Test@invite",
|
|
||||||
"invite_code": frappe.db.get_value(
|
|
||||||
"Invite Request", {"invite_email": "test_invite@example.com"}, "name"
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
||||||
update_invite(data)
|
|
||||||
invite = frappe.db.get_value(
|
|
||||||
"Invite Request",
|
|
||||||
filters={"invite_email": "test_invite@example.com"},
|
|
||||||
fieldname=[
|
|
||||||
"invite_email",
|
|
||||||
"status",
|
|
||||||
"signup_email",
|
|
||||||
"full_name",
|
|
||||||
"username",
|
|
||||||
"invite_code",
|
|
||||||
"name",
|
|
||||||
],
|
|
||||||
as_dict=True,
|
|
||||||
)
|
|
||||||
self.assertEqual(invite.signup_email, "test_invite@example.com")
|
|
||||||
self.assertEqual(invite.full_name, "Test Invite")
|
|
||||||
self.assertEqual(invite.username, "test_invite")
|
|
||||||
self.assertEqual(invite.invite_code, invite.name)
|
|
||||||
self.assertEqual(invite.status, "Registered")
|
|
||||||
|
|
||||||
user = frappe.db.get_value(
|
|
||||||
"User",
|
|
||||||
"test_invite@example.com",
|
|
||||||
fieldname=["first_name", "username", "send_welcome_email", "user_type"],
|
|
||||||
as_dict=True,
|
|
||||||
)
|
|
||||||
self.assertTrue(user)
|
|
||||||
self.assertEqual(user.first_name, invite.full_name.split(" ")[0])
|
|
||||||
self.assertEqual(user.username, invite.username)
|
|
||||||
self.assertEqual(user.send_welcome_email, 0)
|
|
||||||
self.assertEqual(user.user_type, "Website User")
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(self):
|
|
||||||
if frappe.db.exists("User", "test_invite@example.com"):
|
|
||||||
frappe.delete_doc("User", "test_invite@example.com")
|
|
||||||
|
|
||||||
invite_request = frappe.db.exists(
|
|
||||||
"Invite Request", {"invite_email": "test_invite@example.com"}
|
|
||||||
)
|
|
||||||
if invite_request:
|
|
||||||
frappe.delete_doc("Invite Request", invite_request)
|
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ class LMSCertificateRequest(Document):
|
|||||||
self.validate_if_existing_requests()
|
self.validate_if_existing_requests()
|
||||||
self.validate_evaluation_end_date()
|
self.validate_evaluation_end_date()
|
||||||
|
|
||||||
|
def after_insert(self):
|
||||||
|
self.send_notification()
|
||||||
|
|
||||||
def set_evaluator(self):
|
def set_evaluator(self):
|
||||||
if not self.evaluator:
|
if not self.evaluator:
|
||||||
self.evaluator = get_evaluator(self.course, self.batch_name)
|
self.evaluator = get_evaluator(self.course, self.batch_name)
|
||||||
@@ -108,6 +111,35 @@ class LMSCertificateRequest(Document):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def send_notification(self):
|
||||||
|
outgoing_email_account = frappe.get_cached_value(
|
||||||
|
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
||||||
|
)
|
||||||
|
if outgoing_email_account or frappe.conf.get("mail_login"):
|
||||||
|
subject = _("Your evaluation slot has been booked")
|
||||||
|
template = "certificate_request_notification"
|
||||||
|
|
||||||
|
args = {
|
||||||
|
"course": frappe.db.get_value("LMS Course", self.course, "title"),
|
||||||
|
"timezone": frappe.db.get_value("LMS Batch", self.batch_name, "timezone")
|
||||||
|
if self.batch_name
|
||||||
|
else "",
|
||||||
|
"date": format_date(self.date, "medium"),
|
||||||
|
"member_name": self.member_name,
|
||||||
|
"start_time": format_time(self.start_time, "short"),
|
||||||
|
"evaluator": frappe.db.get_value("User", self.evaluator, "full_name"),
|
||||||
|
}
|
||||||
|
|
||||||
|
frappe.sendmail(
|
||||||
|
recipients=[self.member],
|
||||||
|
cc=[self.evaluator],
|
||||||
|
subject=subject,
|
||||||
|
template=template,
|
||||||
|
args=args,
|
||||||
|
header=[subject, "green"],
|
||||||
|
retry=3,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def schedule_evals():
|
def schedule_evals():
|
||||||
if frappe.db.get_single_value("LMS Settings", "send_calendar_invite_for_evaluations"):
|
if frappe.db.get_single_value("LMS Settings", "send_calendar_invite_for_evaluations"):
|
||||||
|
|||||||
@@ -196,7 +196,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"make_attachments_public": 1,
|
"make_attachments_public": 1,
|
||||||
"modified": "2024-08-01 13:01:55.000072",
|
"modified": "2024-08-01 12:53:22.540990",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Question",
|
"name": "LMS Question",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from lms.lms.utils import has_course_instructor_role, has_course_moderator_role
|
|||||||
class LMSQuestion(Document):
|
class LMSQuestion(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
validate_correct_answers(self)
|
validate_correct_answers(self)
|
||||||
|
update_question_title(self)
|
||||||
|
|
||||||
|
|
||||||
def validate_correct_answers(question):
|
def validate_correct_answers(question):
|
||||||
@@ -62,6 +63,16 @@ def validate_possible_answer(question):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_question_title(question):
|
||||||
|
if not question.is_new():
|
||||||
|
question_rows = frappe.get_all(
|
||||||
|
"LMS Quiz Question", {"question": question.name}, pluck="name"
|
||||||
|
)
|
||||||
|
|
||||||
|
for row in question_rows:
|
||||||
|
frappe.db.set_value("LMS Quiz Question", row, "question_detail", question.question)
|
||||||
|
|
||||||
|
|
||||||
def get_correct_options(question):
|
def get_correct_options(question):
|
||||||
correct_options = []
|
correct_options = []
|
||||||
correct_option_fields = [
|
correct_option_fields = [
|
||||||
|
|||||||
@@ -9,16 +9,15 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"title",
|
"title",
|
||||||
"max_attempts",
|
"max_attempts",
|
||||||
"limit_questions_to",
|
"show_answers",
|
||||||
"column_break_gaac",
|
"column_break_gaac",
|
||||||
"total_marks",
|
"total_marks",
|
||||||
"passing_percentage",
|
"passing_percentage",
|
||||||
"section_break_hsiv",
|
|
||||||
"show_answers",
|
|
||||||
"column_break_rocd",
|
|
||||||
"show_submission_history",
|
"show_submission_history",
|
||||||
"column_break_dsup",
|
"section_break_tzbu",
|
||||||
"shuffle_questions",
|
"shuffle_questions",
|
||||||
|
"column_break_clsh",
|
||||||
|
"limit_questions_to",
|
||||||
"section_break_sbjx",
|
"section_break_sbjx",
|
||||||
"questions",
|
"questions",
|
||||||
"section_break_3",
|
"section_break_3",
|
||||||
@@ -74,6 +73,7 @@
|
|||||||
"default": "1",
|
"default": "1",
|
||||||
"fieldname": "show_answers",
|
"fieldname": "show_answers",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"in_standard_filter": 1,
|
||||||
"label": "Show Answers"
|
"label": "Show Answers"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -90,35 +90,25 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Show Submission History"
|
"label": "Show Submission History"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "section_break_hsiv",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"label": "Settings"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "passing_percentage",
|
"fieldname": "passing_percentage",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"in_standard_filter": 1,
|
||||||
"label": "Passing Percentage",
|
"label": "Passing Percentage",
|
||||||
"non_negative": 1,
|
"non_negative": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "column_break_rocd",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "total_marks",
|
"fieldname": "total_marks",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Total Marks",
|
"label": "Total Marks",
|
||||||
"non_negative": 1,
|
"non_negative": 1,
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "column_break_dsup",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "shuffle_questions",
|
"fieldname": "shuffle_questions",
|
||||||
@@ -126,14 +116,23 @@
|
|||||||
"label": "Shuffle Questions"
|
"label": "Shuffle Questions"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "shuffle_questions",
|
||||||
"fieldname": "limit_questions_to",
|
"fieldname": "limit_questions_to",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Limit Questions To"
|
"label": "Limit Questions To"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_tzbu",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_clsh",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-06-27 22:03:48.576489",
|
"modified": "2024-08-09 12:21:36.256522",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Quiz",
|
"name": "LMS Quiz",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cstr, comma_and
|
from frappe.utils import cstr, comma_and, cint
|
||||||
from fuzzywuzzy import fuzz
|
from fuzzywuzzy import fuzz
|
||||||
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
||||||
from lms.lms.utils import (
|
from lms.lms.utils import (
|
||||||
@@ -30,12 +30,12 @@ class LMSQuiz(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def validate_limit(self):
|
def validate_limit(self):
|
||||||
if self.limit_questions_to and self.limit_questions_to >= len(self.questions):
|
if self.limit_questions_to and cint(self.limit_questions_to) >= len(self.questions):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Limit cannot be greater than or equal to the number of questions in the quiz.")
|
_("Limit cannot be greater than or equal to the number of questions in the quiz.")
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.limit_questions_to and self.limit_questions_to < len(self.questions):
|
if self.limit_questions_to and cint(self.limit_questions_to) < len(self.questions):
|
||||||
marks = [question.marks for question in self.questions]
|
marks = [question.marks for question in self.questions]
|
||||||
if len(set(marks)) > 1:
|
if len(set(marks)) > 1:
|
||||||
frappe.throw(_("All questions should have the same marks if the limit is set."))
|
frappe.throw(_("All questions should have the same marks if the limit is set."))
|
||||||
@@ -43,10 +43,10 @@ class LMSQuiz(Document):
|
|||||||
def calculate_total_marks(self):
|
def calculate_total_marks(self):
|
||||||
if self.limit_questions_to:
|
if self.limit_questions_to:
|
||||||
self.total_marks = sum(
|
self.total_marks = sum(
|
||||||
question.marks for question in self.questions[: self.limit_questions_to]
|
question.marks for question in self.questions[: cint(self.limit_questions_to)]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.total_marks = sum(question.marks for question in self.questions)
|
self.total_marks = sum(cint(question.marks) for question in self.questions)
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
if not self.name:
|
if not self.name:
|
||||||
@@ -90,21 +90,19 @@ def quiz_summary(quiz, results):
|
|||||||
|
|
||||||
question_details = frappe.db.get_value(
|
question_details = frappe.db.get_value(
|
||||||
"LMS Quiz Question",
|
"LMS Quiz Question",
|
||||||
{"parent": quiz, "idx": result["question_index"]},
|
{"parent": quiz, "question": result["question_name"]},
|
||||||
["question", "marks"],
|
["question", "marks", "question_detail"],
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
result["question_name"] = question_details.question
|
result["question_name"] = question_details.question
|
||||||
result["question"] = frappe.db.get_value(
|
result["question"] = question_details.question_detail
|
||||||
"LMS Question", question_details.question, "question"
|
|
||||||
)
|
|
||||||
marks = question_details.marks if correct else 0
|
marks = question_details.marks if correct else 0
|
||||||
|
|
||||||
result["marks"] = marks
|
result["marks"] = marks
|
||||||
score += marks
|
score += marks
|
||||||
|
|
||||||
del result["question_index"]
|
del result["question_name"]
|
||||||
|
|
||||||
quiz_details = frappe.db.get_value(
|
quiz_details = frappe.db.get_value(
|
||||||
"LMS Quiz", quiz, ["total_marks", "passing_percentage", "lesson", "course"], as_dict=1
|
"LMS Quiz", quiz, ["total_marks", "passing_percentage", "lesson", "course"], as_dict=1
|
||||||
@@ -297,15 +295,6 @@ def check_choice_answers(question, answers):
|
|||||||
|
|
||||||
question_details = frappe.db.get_value("LMS Question", question, fields, as_dict=1)
|
question_details = frappe.db.get_value("LMS Question", question, fields, as_dict=1)
|
||||||
|
|
||||||
""" if question_details.multiple:
|
|
||||||
correct_answers = [ question_details[f"option_{num}"] for num in range(1,5) if question_details[f"is_correct_{num}"]]
|
|
||||||
print(answers)
|
|
||||||
for ans in correct_answers:
|
|
||||||
if ans not in answers:
|
|
||||||
is_correct.append(0)
|
|
||||||
else:
|
|
||||||
is_correct.append(1)
|
|
||||||
else: """
|
|
||||||
for num in range(1, 5):
|
for num in range(1, 5):
|
||||||
if question_details[f"option_{num}"] in answers:
|
if question_details[f"option_{num}"] in answers:
|
||||||
is_correct.append(question_details[f"is_correct_{num}"])
|
is_correct.append(question_details[f"is_correct_{num}"])
|
||||||
|
|||||||
@@ -6,7 +6,10 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"question",
|
"question",
|
||||||
"marks"
|
"column_break_qcpo",
|
||||||
|
"marks",
|
||||||
|
"section_break_huup",
|
||||||
|
"question_detail"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -25,12 +28,28 @@
|
|||||||
"label": "Marks",
|
"label": "Marks",
|
||||||
"non_negative": 1,
|
"non_negative": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fetch_from": "question.question",
|
||||||
|
"fieldname": "question_detail",
|
||||||
|
"fieldtype": "Text",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Question Detail",
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_qcpo",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_huup",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-10-16 19:51:03.893144",
|
"modified": "2024-07-29 15:10:09.662715",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Quiz Question",
|
"name": "LMS Quiz Question",
|
||||||
|
|||||||
@@ -10,14 +10,9 @@
|
|||||||
"column_break_zdel",
|
"column_break_zdel",
|
||||||
"unsplash_access_key",
|
"unsplash_access_key",
|
||||||
"livecode_url",
|
"livecode_url",
|
||||||
"course_settings_section",
|
|
||||||
"search_placeholder",
|
|
||||||
"column_break_iqxy",
|
|
||||||
"portal_course_creation",
|
|
||||||
"section_break_szgq",
|
"section_break_szgq",
|
||||||
"send_calendar_invite_for_evaluations",
|
"send_calendar_invite_for_evaluations",
|
||||||
"show_day_view",
|
"show_day_view",
|
||||||
"allow_student_progress",
|
|
||||||
"column_break_2",
|
"column_break_2",
|
||||||
"show_dashboard",
|
"show_dashboard",
|
||||||
"show_courses",
|
"show_courses",
|
||||||
@@ -48,7 +43,6 @@
|
|||||||
"notifications",
|
"notifications",
|
||||||
"section_break_qlss",
|
"section_break_qlss",
|
||||||
"sidebar_items",
|
"sidebar_items",
|
||||||
"mentor_request_tab",
|
|
||||||
"mentor_request_section",
|
"mentor_request_section",
|
||||||
"mentor_request_creation",
|
"mentor_request_creation",
|
||||||
"mentor_request_status_update",
|
"mentor_request_status_update",
|
||||||
@@ -98,11 +92,6 @@
|
|||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"label": "Show Tab in Batch"
|
"label": "Show Tab in Batch"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "search_placeholder",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "Course List Search Bar Placeholder"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "terms_of_use",
|
"fieldname": "terms_of_use",
|
||||||
@@ -139,13 +128,6 @@
|
|||||||
"fieldname": "column_break_12",
|
"fieldname": "column_break_12",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"default": "Course Creator Role",
|
|
||||||
"fieldname": "portal_course_creation",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"label": "Course Creation Access Through Website To",
|
|
||||||
"options": "Course Creator Role\nAnyone"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_9",
|
"fieldname": "column_break_9",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
@@ -203,19 +185,6 @@
|
|||||||
"fieldtype": "Tab Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Signup Settings"
|
"label": "Signup Settings"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "mentor_request_tab",
|
|
||||||
"fieldtype": "Tab Break",
|
|
||||||
"hidden": 1,
|
|
||||||
"label": "Mentor Request"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"default": "0",
|
|
||||||
"fieldname": "allow_student_progress",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 1,
|
|
||||||
"label": "Allow students to see each others progress in class"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "payment_section",
|
"fieldname": "payment_section",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
@@ -230,15 +199,6 @@
|
|||||||
"fieldname": "column_break_cfcv",
|
"fieldname": "column_break_cfcv",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "course_settings_section",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"label": "Course Settings"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_iqxy",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "razorpay_key",
|
"fieldname": "razorpay_key",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@@ -423,7 +383,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-06-27 21:57:02.193336",
|
"modified": "2024-08-13 19:02:58.714080",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Notification",
|
"doctype": "Notification",
|
||||||
"document_type": "LMS Certificate Request",
|
"document_type": "LMS Certificate Request",
|
||||||
"enabled": 1,
|
"enabled": 0,
|
||||||
"event": "New",
|
"event": "New",
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n{% set timezone = frappe.db.get_value(\"LMS Batch\", doc.batch, \"timezone\") %}\n{% set timezone = timezone if timezone else '' %}\n{% set evaluator_name = frappe.db.get_value(\"User\", doc.evaluator, \"full_name\") %}\n\n<p> {{ _(\"Hey {0}\").format(doc.member_name) }} </p>\n<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\"), timezone) }}</p>\n<p> {{ _(\"Your evaluator is {0}\").format(evaluator_name) }}\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
|
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n{% set timezone = frappe.db.get_value(\"LMS Batch\", doc.batch, \"timezone\") %}\n{% set timezone = timezone if timezone else '' %}\n{% set evaluator_name = frappe.db.get_value(\"User\", doc.evaluator, \"full_name\") %}\n\n<p> {{ _(\"Hey {0}\").format(doc.member_name) }} </p>\n<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\"), timezone) }}</p>\n<p> {{ _(\"Your evaluator is {0}\").format(evaluator_name) }} </p>\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
|
||||||
"message_type": "HTML",
|
"message_type": "HTML",
|
||||||
"modified": "2024-07-10 15:51:03.429317",
|
"modified": "2024-08-01 12:17:40.647724",
|
||||||
"modified_by": "sayali@erpnext.com",
|
"modified_by": "jannat@frappe.io",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Certificate Request Creation",
|
"name": "Certificate Request Creation",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
|
|||||||
18
lms/lms/telemetry.py
Normal file
18
lms/lms/telemetry.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def is_enabled():
|
||||||
|
return bool(
|
||||||
|
frappe.get_system_settings("enable_telemetry")
|
||||||
|
and frappe.conf.get("posthog_host")
|
||||||
|
and frappe.conf.get("posthog_project_id")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_credentials():
|
||||||
|
return {
|
||||||
|
"project_id": frappe.conf.get("posthog_project_id"),
|
||||||
|
"telemetry_host": frappe.conf.get("posthog_host"),
|
||||||
|
}
|
||||||
@@ -517,13 +517,6 @@ def can_create_courses(course, member=None):
|
|||||||
if has_course_instructor_role(member) and member in instructors:
|
if has_course_instructor_role(member) and member in instructors:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
portal_course_creation = frappe.db.get_single_value(
|
|
||||||
"LMS Settings", "portal_course_creation"
|
|
||||||
)
|
|
||||||
|
|
||||||
if portal_course_creation == "Anyone" and member in instructors:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if not course and has_course_instructor_role(member):
|
if not course and has_course_instructor_role(member):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"label": "Enrollments"
|
"label": "Enrollments"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"content": "[{\"id\":\"jNO4sdKxHu\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Get Started</b></span>\",\"col\":12}},{\"id\":\"5s0qRBc4rY\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/lms/courses\\\">Visit LMS Portal</a>\",\"col\":4}},{\"id\":\"lGMuNLpmv-\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/lms/courses/new/edit\\\">Create a Course</a>\",\"col\":4}},{\"id\":\"3TVyc9AkPy\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/app/web-page/new-web-page-1\\\">Setup a Home Page</a>\",\"col\":4}},{\"id\":\"9zcbqpu2gm\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/app/lms-settings/LMS%20Settings\\\">LMS Setting</a>\",\"col\":4}},{\"id\":\"0ATmnKmXjc\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"https://docs.frappe.io/learning\\\">Documentation</a>\",\"col\":4}},{\"id\":\"C128a4abjX\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"5q4sPiv2ci\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Signups\",\"col\":6}},{\"id\":\"8NSaRaEV5u\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Enrollments\",\"col\":6}},{\"id\":\"kMuzko0uAU\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"iuvIOHmztI\",\"type\":\"header\",\"data\":{\"text\":\"<span style=\\\"font-size: 18px;\\\"><b>Statistics</b></span>\",\"col\":12}},{\"id\":\"l0VTd66Uy2\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Users\",\"col\":4}},{\"id\":\"wAWZin1KKk\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"id\":\"RLrIlFx0Hd\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Enrollments\",\"col\":4}},{\"id\":\"OuhWkhCQmq\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"id\":\"3g8QmNqUXG\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Certificate\",\"col\":4}},{\"id\":\"EZsdsujs8N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Evaluation\",\"col\":4}},{\"id\":\"s-nfsFQbGV\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"jeOBWBzHEa\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Master</b></span>\",\"col\":12}},{\"id\":\"sVhgfS5GIh\",\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"id\":\"Iea0snm4Fg\",\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}},{\"id\":\"bZB7RqOl6a\",\"type\":\"card\",\"data\":{\"card_name\":\"Certification\",\"col\":4}}]",
|
"content": "[{\"id\":\"jNO4sdKxHu\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Get Started</b></span>\",\"col\":12}},{\"id\":\"5s0qRBc4rY\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/lms/courses\\\">Visit LMS Portal</a>\",\"col\":4}},{\"id\":\"lGMuNLpmv-\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/lms/courses/new/edit\\\">Create a Course</a>\",\"col\":4}},{\"id\":\"3TVyc9AkPy\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/app/web-page/new-web-page-1\\\">Setup a Home Page</a>\",\"col\":4}},{\"id\":\"9zcbqpu2gm\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/app/lms-settings/LMS%20Settings\\\">LMS Settings</a>\",\"col\":4}},{\"id\":\"0ATmnKmXjc\",\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"https://docs.frappe.io/learning\\\">Documentation</a>\",\"col\":4}},{\"id\":\"C128a4abjX\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"5q4sPiv2ci\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Signups\",\"col\":6}},{\"id\":\"8NSaRaEV5u\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Enrollments\",\"col\":6}},{\"id\":\"kMuzko0uAU\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"iuvIOHmztI\",\"type\":\"header\",\"data\":{\"text\":\"<span style=\\\"font-size: 18px;\\\"><b>Statistics</b></span>\",\"col\":12}},{\"id\":\"l0VTd66Uy2\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Users\",\"col\":4}},{\"id\":\"wAWZin1KKk\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"id\":\"RLrIlFx0Hd\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Enrollments\",\"col\":4}},{\"id\":\"OuhWkhCQmq\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"id\":\"3g8QmNqUXG\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Certificate\",\"col\":4}},{\"id\":\"EZsdsujs8N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Evaluation\",\"col\":4}},{\"id\":\"s-nfsFQbGV\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"jeOBWBzHEa\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Master</b></span>\",\"col\":12}},{\"id\":\"sVhgfS5GIh\",\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"id\":\"Iea0snm4Fg\",\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}},{\"id\":\"bZB7RqOl6a\",\"type\":\"card\",\"data\":{\"card_name\":\"Certification\",\"col\":4}}]",
|
||||||
"creation": "2021-10-21 17:20:01.358903",
|
"creation": "2021-10-21 17:20:01.358903",
|
||||||
"custom_blocks": [],
|
"custom_blocks": [],
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
"type": "Link"
|
"type": "Link"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2024-06-27 21:19:06.273056",
|
"modified": "2024-08-09 13:19:06.273056",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS",
|
"name": "LMS",
|
||||||
|
|||||||
4181
lms/locale/main.pot
4181
lms/locale/main.pot
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,10 @@ class CustomUser(User):
|
|||||||
super().validate()
|
super().validate()
|
||||||
self.validate_username_duplicates()
|
self.validate_username_duplicates()
|
||||||
|
|
||||||
|
def after_insert(self):
|
||||||
|
super().after_insert()
|
||||||
|
self.add_roles("LMS Student")
|
||||||
|
|
||||||
def validate_username_duplicates(self):
|
def validate_username_duplicates(self):
|
||||||
while not self.username or self.username_exists():
|
while not self.username or self.username_exists():
|
||||||
self.username = append_number_if_name_exists(
|
self.username = append_number_if_name_exists(
|
||||||
|
|||||||
BIN
lms/public/images/desk.png
Normal file
BIN
lms/public/images/desk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<p> {{ _("Hey {0}").format(member_name) }} </p>
|
||||||
|
<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, date, start_time, timezone) }}</p>
|
||||||
|
<p> {{ _("Your evaluator is {0}").format(evaluator) }} </p>
|
||||||
|
<p> {{ _("Please prepare well and be on time for the evaluations.") }} </p>
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{% 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") %}
|
|
||||||
|
|
||||||
|
|
||||||
<div class="modal fade search-modal" id="search-modal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-body">
|
|
||||||
<input class="search search-course" id="search-course" placeholder="{{ _(search_placeholder) or 'Search for courses' }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script> {% include "lms/templates/search_course/search_course.js" %} </script>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
frappe.ready(() => {
|
|
||||||
$("#search-course").keyup((e) => {
|
|
||||||
search_course(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#open-search").click((e) => {
|
|
||||||
show_search_bar(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#search-modal").on("hidden.bs.modal", () => {
|
|
||||||
hide_search_bar();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).keydown(function (e) {
|
|
||||||
if ((e.metaKey || e.ctrlKey) && e.key == "k") {
|
|
||||||
show_search_bar(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const search_course = (e) => {
|
|
||||||
let input = $(e.currentTarget).val();
|
|
||||||
if (input == window.input) return;
|
|
||||||
window.input = input;
|
|
||||||
|
|
||||||
if (input.length < 3 || input.trim() == "") {
|
|
||||||
$(".result-row").remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.call({
|
|
||||||
method: "lms.lms.doctype.lms_course.lms_course.search_course",
|
|
||||||
args: {
|
|
||||||
text: input,
|
|
||||||
},
|
|
||||||
callback: (data) => {
|
|
||||||
render_course_list(data);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const render_course_list = (data) => {
|
|
||||||
let courses = data.message;
|
|
||||||
$(".result-row").remove();
|
|
||||||
|
|
||||||
if (!courses.length) {
|
|
||||||
let element = `<a class="result-row">
|
|
||||||
${__("No result found")}
|
|
||||||
</a>`;
|
|
||||||
$(element).insertAfter("#search-course");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i in courses) {
|
|
||||||
let element = `<a class="result-row" href="/courses/${courses[i].name}">
|
|
||||||
${courses[i].title}
|
|
||||||
</a>`;
|
|
||||||
$(element).insertAfter("#search-course");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const show_search_bar = (e) => {
|
|
||||||
$("#search-modal").modal("show");
|
|
||||||
setTimeout(() => {
|
|
||||||
$("#search-course").focus();
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
const hide_search_bar = (e) => {
|
|
||||||
$("#search-course").val("");
|
|
||||||
$(".result-row").remove();
|
|
||||||
};
|
|
||||||
75
yarn.lock
75
yarn.lock
@@ -107,7 +107,7 @@ asn1@~0.2.3:
|
|||||||
dependencies:
|
dependencies:
|
||||||
safer-buffer "~2.1.0"
|
safer-buffer "~2.1.0"
|
||||||
|
|
||||||
assert-plus@^1.0.0, assert-plus@1.0.0:
|
assert-plus@1.0.0, assert-plus@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||||
integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==
|
integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==
|
||||||
@@ -294,7 +294,7 @@ concat-stream@^1.4.7:
|
|||||||
readable-stream "^2.2.2"
|
readable-stream "^2.2.2"
|
||||||
typedarray "^0.0.6"
|
typedarray "^0.0.6"
|
||||||
|
|
||||||
core-util-is@~1.0.0, core-util-is@1.0.2:
|
core-util-is@1.0.2, core-util-is@~1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||||
integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
|
integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
|
||||||
@@ -322,7 +322,7 @@ cypress-file-upload@^5.0.8:
|
|||||||
resolved "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz"
|
resolved "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz"
|
||||||
integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==
|
integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==
|
||||||
|
|
||||||
cypress@^13.9.0, cypress@>3.0.0:
|
cypress@^13.9.0:
|
||||||
version "13.9.0"
|
version "13.9.0"
|
||||||
resolved "https://registry.npmjs.org/cypress/-/cypress-13.9.0.tgz"
|
resolved "https://registry.npmjs.org/cypress/-/cypress-13.9.0.tgz"
|
||||||
integrity sha512-atNjmYfHsvTuCaxTxLZr9xGoHz53LLui3266WWxXJHY7+N6OdwJdg/feEa3T+buez9dmUXHT1izCOklqG82uCQ==
|
integrity sha512-atNjmYfHsvTuCaxTxLZr9xGoHz53LLui3266WWxXJHY7+N6OdwJdg/feEa3T+buez9dmUXHT1izCOklqG82uCQ==
|
||||||
@@ -430,7 +430,7 @@ end-of-stream@^1.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
once "^1.4.0"
|
once "^1.4.0"
|
||||||
|
|
||||||
enquirer@^2.3.6, "enquirer@>= 2.3.0 < 3":
|
enquirer@^2.3.6:
|
||||||
version "2.4.1"
|
version "2.4.1"
|
||||||
resolved "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz"
|
resolved "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz"
|
||||||
integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==
|
integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==
|
||||||
@@ -498,16 +498,16 @@ extract-zip@2.0.1:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
"@types/yauzl" "^2.9.1"
|
"@types/yauzl" "^2.9.1"
|
||||||
|
|
||||||
extsprintf@^1.2.0:
|
|
||||||
version "1.4.1"
|
|
||||||
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz"
|
|
||||||
integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==
|
|
||||||
|
|
||||||
extsprintf@1.3.0:
|
extsprintf@1.3.0:
|
||||||
version "1.3.0"
|
version "1.3.0"
|
||||||
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz"
|
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz"
|
||||||
integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==
|
integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==
|
||||||
|
|
||||||
|
extsprintf@^1.2.0:
|
||||||
|
version "1.4.1"
|
||||||
|
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz"
|
||||||
|
integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==
|
||||||
|
|
||||||
fd-slicer@~1.1.0:
|
fd-slicer@~1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz"
|
resolved "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz"
|
||||||
@@ -515,6 +515,11 @@ fd-slicer@~1.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
pend "~1.2.0"
|
pend "~1.2.0"
|
||||||
|
|
||||||
|
fflate@^0.4.8:
|
||||||
|
version "0.4.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.4.8.tgz#f90b82aefbd8ac174213abb338bd7ef848f0f5ae"
|
||||||
|
integrity sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==
|
||||||
|
|
||||||
figures@^3.2.0:
|
figures@^3.2.0:
|
||||||
version "3.2.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz"
|
resolved "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz"
|
||||||
@@ -836,16 +841,16 @@ minimist@^1.2.8:
|
|||||||
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"
|
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"
|
||||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||||
|
|
||||||
ms@^2.1.1:
|
|
||||||
version "2.1.3"
|
|
||||||
resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
|
|
||||||
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
|
|
||||||
|
|
||||||
ms@2.1.2:
|
ms@2.1.2:
|
||||||
version "2.1.2"
|
version "2.1.2"
|
||||||
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
|
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
|
||||||
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
ms@^2.1.1:
|
||||||
|
version "2.1.3"
|
||||||
|
resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
|
||||||
|
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
|
||||||
|
|
||||||
npm-run-path@^4.0.0:
|
npm-run-path@^4.0.0:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz"
|
resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz"
|
||||||
@@ -909,6 +914,15 @@ pify@^2.2.0:
|
|||||||
resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
|
resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
|
||||||
integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==
|
integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==
|
||||||
|
|
||||||
|
posthog-js@^1.154.4:
|
||||||
|
version "1.154.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.154.4.tgz#217524e45f7ceb68a268caf683da60dfa91eccbd"
|
||||||
|
integrity sha512-J6SvhjNGOqkL8uH/sL3h4rXN7bUz9MnCJ1bu/D9Vkf6Enft8LlkOnzackUwR8EpKdM/dhA0dUjDk5Fz/6dovbw==
|
||||||
|
dependencies:
|
||||||
|
fflate "^0.4.8"
|
||||||
|
preact "^10.19.3"
|
||||||
|
web-vitals "^4.0.1"
|
||||||
|
|
||||||
pre-commit@^1.2.2:
|
pre-commit@^1.2.2:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz"
|
resolved "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz"
|
||||||
@@ -918,6 +932,11 @@ pre-commit@^1.2.2:
|
|||||||
spawn-sync "^1.0.15"
|
spawn-sync "^1.0.15"
|
||||||
which "1.2.x"
|
which "1.2.x"
|
||||||
|
|
||||||
|
preact@^10.19.3:
|
||||||
|
version "10.23.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/preact/-/preact-10.23.1.tgz#d400107289bc979881c5212cb5f5cd22cd1dc38c"
|
||||||
|
integrity sha512-O5UdRsNh4vdZaTieWe3XOgSpdMAmkIYBCT3VhQDlKrzyCm8lUYsk0fmVEvoQQifoOjFRTaHZO69ylrzTW2BH+A==
|
||||||
|
|
||||||
pretty-bytes@^5.6.0:
|
pretty-bytes@^5.6.0:
|
||||||
version "5.6.0"
|
version "5.6.0"
|
||||||
resolved "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz"
|
resolved "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz"
|
||||||
@@ -1023,12 +1042,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.2:
|
|||||||
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
|
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
|
||||||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||||
|
|
||||||
safe-buffer@~5.1.0:
|
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
||||||
version "5.1.2"
|
|
||||||
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
|
|
||||||
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
|
||||||
|
|
||||||
safe-buffer@~5.1.1:
|
|
||||||
version "5.1.2"
|
version "5.1.2"
|
||||||
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
|
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
|
||||||
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
||||||
@@ -1135,13 +1149,6 @@ sshpk@^1.14.1:
|
|||||||
safer-buffer "^2.0.2"
|
safer-buffer "^2.0.2"
|
||||||
tweetnacl "~0.14.0"
|
tweetnacl "~0.14.0"
|
||||||
|
|
||||||
string_decoder@~1.1.1:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz"
|
|
||||||
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
|
|
||||||
dependencies:
|
|
||||||
safe-buffer "~5.1.0"
|
|
||||||
|
|
||||||
string-width@^4.1.0, string-width@^4.2.0:
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
version "4.2.3"
|
version "4.2.3"
|
||||||
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
||||||
@@ -1151,6 +1158,13 @@ string-width@^4.1.0, string-width@^4.2.0:
|
|||||||
is-fullwidth-code-point "^3.0.0"
|
is-fullwidth-code-point "^3.0.0"
|
||||||
strip-ansi "^6.0.1"
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string_decoder@~1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz"
|
||||||
|
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
|
||||||
|
dependencies:
|
||||||
|
safe-buffer "~5.1.0"
|
||||||
|
|
||||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
||||||
@@ -1276,7 +1290,12 @@ verror@1.10.0:
|
|||||||
core-util-is "1.0.2"
|
core-util-is "1.0.2"
|
||||||
extsprintf "^1.2.0"
|
extsprintf "^1.2.0"
|
||||||
|
|
||||||
which@^1.2.9, which@1.2.x:
|
web-vitals@^4.0.1:
|
||||||
|
version "4.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-4.2.2.tgz#e883245180b95e175eb75a5ca8903b1a11597d7a"
|
||||||
|
integrity sha512-nYfoOqb4EmElljyXU2qdeE76KsvoHdftQKY4DzA9Aw8DervCg2bG634pHLrJ/d6+B4mE3nWTSJv8Mo7B2mbZkw==
|
||||||
|
|
||||||
|
which@1.2.x, which@^1.2.9:
|
||||||
version "1.2.14"
|
version "1.2.14"
|
||||||
resolved "https://registry.npmjs.org/which/-/which-1.2.14.tgz"
|
resolved "https://registry.npmjs.org/which/-/which-1.2.14.tgz"
|
||||||
integrity sha512-16uPglFkRPzgiUXYMi1Jf8Z5EzN1iB4V0ZtMXcHZnwsBtQhhHeCqoWw7tsUY42hJGNDWtUsVLTjakIa5BgAxCw==
|
integrity sha512-16uPglFkRPzgiUXYMi1Jf8Z5EzN1iB4V0ZtMXcHZnwsBtQhhHeCqoWw7tsUY42hJGNDWtUsVLTjakIa5BgAxCw==
|
||||||
|
|||||||
Reference in New Issue
Block a user