Skip to content

Commit

Permalink
Merge pull request #1155 from frappe/develop
Browse files Browse the repository at this point in the history
chore: merge 'develop' into 'main'
  • Loading branch information
pateljannat authored Nov 29, 2024
2 parents 95e9087 + c471d39 commit ec30aa3
Show file tree
Hide file tree
Showing 38 changed files with 4,608 additions and 2,056 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@editorjs/nested-list": "^1.4.2",
"@editorjs/paragraph": "^2.11.3",
"@editorjs/simple-image": "^1.6.0",
"@editorjs/table": "^2.4.2",
"ace-builds": "^1.36.2",
"chart.js": "^4.4.1",
"codemirror-editor-vue3": "^2.8.0",
Expand Down
31 changes: 20 additions & 11 deletions frontend/src/components/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,27 @@ const addQuizzes = () => {
}
const addPrograms = () => {
if (settingsStore.learningPaths.data) {
let activeFor = ['Programs', 'ProgramForm']
let index = 1
if (!isInstructor.value && !isModerator.value) {
sidebarLinks.value = sidebarLinks.value.filter(
(link) => link.label !== 'Courses'
)
activeFor.push('CourseDetail')
activeFor.push('Lesson')
index = 0
}
let activeFor = ['Programs', 'ProgramForm']
let index = 1
let canAddProgram = false
if (
!isInstructor.value &&
!isModerator.value &&
settingsStore.learningPaths.data
) {
sidebarLinks.value = sidebarLinks.value.filter(
(link) => link.label !== 'Courses'
)
activeFor.push('CourseDetail')
activeFor.push('Lesson')
index = 0
canAddProgram = true
} else if (isInstructor.value || isModerator.value) {
canAddProgram = true
}
if (canAddProgram) {
sidebarLinks.value.splice(index, 0, {
label: 'Programs',
icon: 'Route',
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/DesktopLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<AppSidebar />
</div>
<div class="w-full overflow-auto" id="scrollContainer">
<OnboardingBanner />
<slot />
</div>
</div>
Expand All @@ -17,5 +16,4 @@
</template>
<script setup>
import AppSidebar from './AppSidebar.vue'
import OnboardingBanner from '@/components/OnboardingBanner.vue'
</script>
13 changes: 10 additions & 3 deletions frontend/src/components/LessonHelp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@click="openHelpDialog('upload')"
>
<span class="leading-5">
{{ __('How to upload content from your system?') }}
{{ __(contentMap['upload']) }}
</span>
<Info class="w-3 h-3 text-gray-700" />
</div>
Expand All @@ -44,7 +44,7 @@
@click="openHelpDialog('youtube')"
>
<span>
{{ __('How to add a YouTube Video?') }}
{{ __(contentMap['youtube']) }}
</span>
<Info class="w-3 h-3 text-gray-700" />
</div>
Expand Down Expand Up @@ -72,7 +72,7 @@
</div>
</div>
</div>
<ExplanationVideos v-model="showExplanation" :type="type" />
<ExplanationVideos v-model="showExplanation" :title="title" :type="type" />
</template>
<script setup>
import { Info } from 'lucide-vue-next'
Expand All @@ -81,9 +81,16 @@ import ExplanationVideos from '@/components/Modals/ExplanationVideos.vue'
const showExplanation = ref(false)
const type = ref(null)
const title = ref(null)
const contentMap = {
quiz: 'How to add a Quiz?',
upload: 'How to upload content from your system?',
youtube: 'How to add a YouTube Video?',
}
const openHelpDialog = (contentType) => {
type.value = contentType
title.value = contentMap[contentType]
showExplanation.value = true
}
</script>
9 changes: 7 additions & 2 deletions frontend/src/components/Modals/ExplanationVideos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
v-model="show"
:options="{
size: '4xl',
title: title,
}"
>
<template #body>
<div class="p-4">
<template #body-content>
<div>
<VideoBlock :file="file" />
</div>
</template>
Expand All @@ -24,6 +25,10 @@ const props = defineProps({
type: [String, null],
required: true,
},
title: {
type: String,
required: true,
},
})
const file = computed(() => {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/Modals/Question.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@
type="select"
:options="['Choices', 'User Input', 'Open Ended']"
class="pb-2"
:required="true"
/>
<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}`]"
:required="n <= 2 ? true : false"
/>
<FormControl
:label="__('Explanation')"
Expand All @@ -82,6 +84,7 @@
<FormControl
:label="__('Possibility') + ' ' + n"
v-model="question[`possibility_${n}`]"
:required="n == 1 ? true : false"
/>
</div>
</div>
Expand Down
22 changes: 11 additions & 11 deletions frontend/src/components/OnboardingBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@click="redirectToCourseForm()"
class="flex items-center space-x-2"
:class="{
'cursor-pointer': !onboardingDetails.data.course_created.length,
'cursor-pointer': !onboardingDetails.data.course_created?.length,
}"
>
<span
v-if="onboardingDetails.data.course_created.length"
v-if="onboardingDetails.data.course_created?.length"
class="py-1 px-1 bg-white rounded-full"
>
<Check class="h-4 w-4 stroke-2 text-green-600" />
Expand All @@ -32,13 +32,13 @@
class="flex items-center space-x-2"
:class="{
'cursor-pointer':
onboardingDetails.data.course_created.length &&
!onboardingDetails.data.chapter_created.length,
'text-gray-400': !onboardingDetails.data.course_created.length,
onboardingDetails.data.course_created?.length &&
!onboardingDetails.data.chapter_created?.length,
'text-gray-400': !onboardingDetails.data.course_created?.length,
}"
>
<span
v-if="onboardingDetails.data.chapter_created.length"
v-if="onboardingDetails.data.chapter_created?.length"
class="py-1 px-1 bg-white rounded-full"
>
<Check class="h-4 w-4 stroke-2 text-green-600" />
Expand All @@ -55,15 +55,15 @@
class="flex items-center space-x-2"
:class="{
'cursor-pointer':
onboardingDetails.data.course_created.length &&
onboardingDetails.data.chapter_created.length,
onboardingDetails.data.course_created?.length &&
onboardingDetails.data.chapter_created?.length,
'text-gray-400':
!onboardingDetails.data.course_created.length ||
!onboardingDetails.data.chapter_created.length,
!onboardingDetails.data.course_created?.length ||
!onboardingDetails.data.chapter_created?.length,
}"
>
<span
v-if="onboardingDetails.data.lesson_created.length"
v-if="onboardingDetails.data.lesson_created?.length"
class="py-1 px-1 bg-white rounded-full"
>
<Check class="h-4 w-4 stroke-2 text-green-600" />
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/pages/JobCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
v-model="job.job_title"
:label="__('Title')"
class="mb-4"
:required="true"
/>
<FormControl
v-model="job.location"
:label="__('Location')"
:required="true"
/>
<FormControl v-model="job.location" :label="__('Location')" />
</div>
<div>
<FormControl
Expand All @@ -29,18 +34,21 @@
type="select"
:options="jobTypes"
class="mb-4"
:required="true"
/>
<FormControl
v-model="job.status"
:label="__('Status')"
type="select"
:options="jobStatuses"
:required="true"
/>
</div>
</div>
<div class="mt-4">
<label class="block text-gray-600 text-xs mb-1">
{{ __('Description') }}
<span class="text-red-500">*</span>
</label>
<TextEditor
:content="job.description"
Expand All @@ -61,20 +69,24 @@
v-model="job.company_name"
:label="__('Company Name')"
class="mb-4"
:required="true"
/>
<FormControl
v-model="job.company_website"
:label="__('Company Website')"
:required="true"
/>
</div>
<div>
<FormControl
v-model="job.company_email_address"
:label="__('Company Email Address')"
class="mb-4"
:required="true"
/>
<label class="block text-gray-600 text-xs mb-1 mt-4">
{{ __('Company Logo') }}
<span class="text-red-500">*</span>
</label>
<FileUploader
v-if="!job.image"
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/pages/ProgramForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class="sticky top-0 z-10 flex flex-col md:flex-row md:items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
>
<Breadcrumbs :items="breadbrumbs" />
<Button variant="solid">
<Button variant="solid" @click="saveProgram()">
{{ __('Save') }}
</Button>
</header>
Expand Down Expand Up @@ -50,6 +50,7 @@
item-key="name"
group="items"
@end="updateOrder"
class="cursor-move"
>
<template #item="{ element: row }">
<ListRow :row="row" />
Expand Down Expand Up @@ -191,11 +192,13 @@ import { Plus, Trash2 } from 'lucide-vue-next'
import Link from '@/components/Controls/Link.vue'
import { showToast } from '@/utils/'
import Draggable from 'vuedraggable'
import { useRouter } from 'vue-router'
const showDialog = ref(false)
const currentForm = ref(null)
const course = ref(null)
const member = ref(null)
const router = useRouter()
const props = defineProps({
programName: {
Expand Down Expand Up @@ -302,6 +305,16 @@ const updateOrder = (e) => {
)
}
const saveProgram = () => {
call('frappe.model.rename_doc.update_document_title', {
doctype: 'LMS Program',
docname: program.doc.name,
name: program.doc.title,
}).then((data) => {
router.push({ name: 'ProgramForm', params: { programName: data } })
})
}
const courseColumns = computed(() => {
return [
{
Expand Down Expand Up @@ -332,10 +345,10 @@ const memberColumns = computed(() => {
align: 'left',
},
{
label: 'Progress',
label: 'Progress (%)',
key: 'progress',
width: 3,
align: 'left',
align: 'right',
},
]
})
Expand Down
Loading

0 comments on commit ec30aa3

Please sign in to comment.