Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
876eebe
fix: let the page choose the discussions heading size
raizasafeel Nov 15, 2026
f364b13
fix: show every form's refusal and loading state through FormShell
raizasafeel Nov 15, 2026
a0a3e0c
fix(batches): open on Enrolled for signed-in learners
raizasafeel Nov 15, 2026
a366543
fix(discussions): post a reply or topic once on a double click
raizasafeel Nov 15, 2026
82333f8
fix(batches): send announcements in the background, once
raizasafeel Nov 15, 2026
c089121
feat(sidebar): show visitors a Log in card that returns them to the page
raizasafeel Nov 15, 2026
14c48e2
fix(programs): show member names in the program form
raizasafeel Nov 15, 2026
c204e25
fix: replace a repeated toast instead of stacking copies
raizasafeel Nov 15, 2026
5d65c3a
fix: block a second click on action buttons while they run
raizasafeel Nov 15, 2026
15f6ac5
fix(batches): sum up certificate failures in one toast
raizasafeel Nov 15, 2026
283b3cb
test: drop the UI tests added on this branch
raizasafeel Nov 15, 2026
f5ec3b8
test: drop mocked frontend tests that only pin wiring or markup
raizasafeel Nov 15, 2026
ae74d62
refactor: trim history and restating comments
raizasafeel Nov 15, 2026
4ca6e85
refactor: align assignment delete toasts and translate the import toast
raizasafeel Nov 15, 2026
bc89216
fix: show a modal's refusal as a toast and its loading as a centered …
raizasafeel Nov 16, 2026
5aed5d9
fix(batches): hide announcement and certificate actions until a stude…
raizasafeel Nov 16, 2026
2784ba8
test(e2e): find the preview video input by its accessible name
raizasafeel Nov 16, 2026
c549c66
test: clear the cached website settings in the sign-up tests
raizasafeel Nov 16, 2026
9b8af8e
chore: resolve conflict
raizasafeel Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions e2e/course_creation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,10 @@ test.describe("Course Creation", () => {
// Configure settings
await settingsTab(page).click();

// Preview video: the redesigned field has a URL input (plus a hidden
// file input), so target the YouTube URL input by its placeholder.
// Preview video: the field has a URL input beside a hidden file input,
// so target the URL input by its accessible name.
await page
.locator("label")
.filter({ hasText: "Preview video" })
.locator("xpath=..")
.getByPlaceholder("Paste a YouTube link")
.getByRole("textbox", { name: "YouTube link" })
.fill("https://www.youtube.com/embed/-LPmw2Znl2c");

// Tags. A new tag is the `Create "<tag>"` option CourseDetailsSection
Expand Down
47 changes: 29 additions & 18 deletions frontend/src/components/ContactUsEmail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@
</template>
<template #actions="{ close }">
<div class="pb-5 float-end">
<Button variant="solid" @click="sendMail(close)">
<Button
variant="solid"
:loading="contactUsEmail.loading"
@click="sendMail(close)"
>
{{ __('Send') }}
</Button>
</div>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { Button, call, Dialog, FormControl, toast } from 'frappe-ui'
import { Button, createResource, Dialog, FormControl, toast } from 'frappe-ui'
import { ref, useId } from 'vue'
import { InputLabel } from 'frappe-ui/experimental'
import { resourceErrorMessage } from '@/utils/resource'
import { resourceErrorMessage, submitResource } from '@/utils/resource'
import RichTextEditor from '@/components/RichTextEditor.vue'

const messageLabelId = useId()
Expand All @@ -48,21 +52,28 @@ const message = ref('')
request, and so an image pasted into the message is embedded into the mail
itself. Its upload is private, and a /private/files/ URL in an email is
served to nobody. */
const contactUsEmail = createResource({
url: 'lms.lms.api.send_contact_us_email',
})

const sendMail = (close: Function) => {
call('lms.lms.api.send_contact_us_email', {
subject: subject.value,
content: message.value,
})
.then(() => {
toast.success(__('Email sent successfully'))
close()
subject.value = ''
message.value = ''
})
.catch((error: unknown) => {
// The dialog stays open: the message is worth keeping when the
// failure is something the sender can fix.
toast.error(resourceErrorMessage(error, __('Failed to send email')))
})
if (contactUsEmail.loading) return
submitResource(
contactUsEmail,
{ subject: subject.value, content: message.value },
{
onSuccess() {
toast.success(__('Email sent successfully'))
close()
subject.value = ''
message.value = ''
},
onError(error) {
// The dialog stays open: the message is worth keeping when the
// failure is something the sender can fix.
toast.error(resourceErrorMessage(error, __('Failed to send email')))
},
}
)
}
</script>
9 changes: 2 additions & 7 deletions frontend/src/components/Controls/Uploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

<script setup lang="ts">
import { validateFile } from '@/utils'
import { Button, FileUploader, UploadError, toast } from 'frappe-ui'
import { Button, FileUploader, toast } from 'frappe-ui'
import {
InputDescription,
InputError,
Expand All @@ -105,6 +105,7 @@ import {
import { Image, Video } from 'lucide-vue-next'
import { computed } from 'vue'
import { safeUrl } from '@/utils/safeUrl'
import { uploadErrorMessage } from '@/utils/uploadErrorMessage'

const emit = defineEmits<{
(e: 'update:modelValue', value: string): void
Expand Down Expand Up @@ -157,12 +158,6 @@ const removeImage = () => {
emit('update:modelValue', '')
}

const uploadErrorMessage = (error: unknown): string => {
if (typeof error === 'string') return error
if (error instanceof UploadError) return error.messages[0] || error.message
return __('Error Uploading File')
}

const onUploadFailure = (error: unknown) => {
toast.error(uploadErrorMessage(error))
}
Expand Down
14 changes: 12 additions & 2 deletions frontend/src/components/CourseCardOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
/>
<Button
v-else-if="!isAdmin"
:loading="enrolling"
@click="enrollStudent()"
variant="solid"
class="w-full mb-8"
Expand All @@ -84,6 +85,7 @@
</Button>
<Button
v-if="canGetCertificate"
:loading="certificate.loading"
@click="fetchCertificate()"
variant="subtle"
class="w-full mt-2"
Expand Down Expand Up @@ -149,7 +151,7 @@
</div>
</template>
<script setup lang="ts">
import { computed, inject, watch } from 'vue'
import { computed, inject, ref, watch } from 'vue'
import { Alert, Button, call, createResource, toast } from 'frappe-ui'
import type { FrappeResourceError } from 'frappe-ui'
import { resourceErrorMessage } from '@/utils/resource'
Expand All @@ -158,6 +160,7 @@ import CertificationLinks from '@/components/CertificationLinks.vue'
import ProgressBar from '@/components/ProgressBar.vue'
import VideoPreview from '@/components/VideoPreview.vue'
import { openExternal } from '@/utils/openExternal'
import { redirectToLogin } from '@/utils/login'
import type { CourseDetails, Resource, SessionUser } from '@/types'
import { isInstructorOf } from '@/utils/instructors'

Expand All @@ -173,16 +176,20 @@ const props = withDefaults(
{}
)

const enrolling = ref(false)

function enrollStudent() {
if (enrolling.value) return
if (!user.data) {
toast.warning(__('You need to login first to enroll for this course'))
setTimeout(() => {
window.location.href = `/login?redirect-to=${window.location.pathname}`
redirectToLogin()
}, 500)
return
}
const courseName = props.course.data?.name
if (!courseName) return
enrolling.value = true
call('frappe.client.insert', {
doc: {
doctype: 'LMS Enrollment',
Expand All @@ -204,6 +211,8 @@ function enrollStudent() {
}, 1000)
})
.catch((err: FrappeResourceError) => {
// Reset only on failure: success redirects after a delay.
enrolling.value = false
const msg = resourceErrorMessage(err, 'Error')
toast.warning(__(msg))
console.error(err)
Expand Down Expand Up @@ -296,6 +305,7 @@ const certificate = createResource({
}) as Resource<{ name: string; template: string } | null>

const fetchCertificate = () => {
if (certificate.loading) return
certificate.submit({
course: props.course.data?.name,
member: user.data?.name,
Expand Down
41 changes: 25 additions & 16 deletions frontend/src/components/DiscussionReplies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
/>
<div v-if="!readOnlyMode" class="flex justify-between mt-2">
<span> </span>
<Button @click="postReply()">
<Button :loading="newReplyResource.loading" @click="postReply()">
<span>
{{ __('Post') }}
</span>
Expand All @@ -139,6 +139,7 @@ import UserAvatar from '@/components/UserAvatar.vue'
import { ref, inject, onMounted, onUnmounted } from 'vue'
import { useTelemetry } from '@framework/ui/telemetry/index'
import RichTextEditor from '@/components/RichTextEditor.vue'
import { submitResource } from '@/utils/resource'

const showTopics = defineModel('showTopics')
const newReply = ref('')
Expand Down Expand Up @@ -214,27 +215,35 @@ const fetchMentionUsers = () => {
)
}

const newReplyResource = createResource({ url: 'frappe.client.insert' })

const postReply = () => {
if (newReplyResource.loading) return
if (!newReply.value) {
toast.error(__('Reply cannot be empty.'))
return
}
call('frappe.client.insert', {
doc: {
doctype: 'Discussion Reply',
reply: newReply.value,
topic: props.topic.name,
submitResource(
newReplyResource,
{
doc: {
doctype: 'Discussion Reply',
reply: newReply.value,
topic: props.topic.name,
},
},
})
.then((data) => {
newReply.value = ''
replies.reload()
capture('discussion_reply_created')
})
.catch((err) => {
toast.error(err.messages?.[0] || err)
console.error(err)
})
{
onSuccess() {
newReply.value = ''
replies.reload()
capture('discussion_reply_created')
},
onError(err) {
toast.error(err.messages?.[0] || err)
console.error(err)
},
}
)
}

const postEdited = (reply) => {
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/components/Discussions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
</Button>
<div
class="text-ink-gray-9"
:class="
doctype === 'LMS Batch' ? 'text-lg-semibold' : 'text-2xl-semibold'
"
:class="headingSize === 'lg' ? 'text-lg-semibold' : 'text-2xl-semibold'"
>
{{ __(title) }}
</div>
Expand Down Expand Up @@ -174,6 +172,11 @@ const props = defineProps({
type: Boolean,
default: false,
},
headingSize: {
type: String,
default: '2xl',
validator: (size) => ['lg', '2xl'].includes(size),
},
})

onMounted(() => {
Expand Down
19 changes: 10 additions & 9 deletions frontend/src/components/Enrollment/EnrollStudentsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
:title="__('Enroll Students')"
size="4xl"
position="top"
:loading
:message="refusal"
:statusClass="bodyHeight"
@close="onClose"
>
<DefinePanel>
Expand All @@ -25,16 +28,10 @@
<div
data-testid="enroll-body"
class="flex flex-col gap-5"
:class="isMobile ? 'h-full' : 'h-[min(32rem,calc(80dvh-17rem))]'"
:class="bodyHeight"
>
<div v-if="loading" class="text-base text-ink-gray-6">
{{ __('Loading...') }}
</div>
<div v-else-if="refusal" class="text-p-base text-ink-gray-6">
{{ refusal }}
</div>
<div
v-else-if="target"
v-if="target"
data-testid="enroll-content"
role="group"
tabindex="-1"
Expand Down Expand Up @@ -93,7 +90,7 @@
</div>
<template #actions>
<div
v-if="target && !refusal && !loading"
v-if="target"
data-testid="enroll-footer"
class="flex w-full items-center justify-between gap-2"
>
Expand Down Expand Up @@ -225,6 +222,10 @@ const panelOpen = ref<boolean>(false)
const ticked = ref<string[]>([])
const previewLoading = ref<boolean>(false)
const { isMobile } = useScreenSize()
// Fixed so the dialog keeps its size from the spinner to the loaded list.
const bodyHeight = computed<string>(() =>
isMobile.value ? 'h-full' : 'h-[min(32rem,calc(80dvh-17rem))]'
)

const NONE = '—'

Expand Down
Loading
Loading