Skip to content

Commit da2dfa6

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents a79d2fb + ff95aa7 commit da2dfa6

13 files changed

Lines changed: 1112 additions & 325 deletions

File tree

assets/vue/views/documents/DocumentsUpload.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,31 @@ const uppy = new Uppy({ autoProceed: false })
183183
endpoint: ENTRYPOINT + "documents",
184184
formData: true,
185185
fieldName: "uploadFile",
186+
getResponseError: (responseText, xhr) => {
187+
const status = xhr?.status
188+
189+
if (!responseText) {
190+
return new Error(`Upload failed (HTTP ${status ?? "unknown"}).`)
191+
}
192+
193+
try {
194+
const json = JSON.parse(responseText)
195+
const msg =
196+
json.error ||
197+
json.message ||
198+
json.detail ||
199+
json["hydra:description"] ||
200+
(Array.isArray(json.violations) && json.violations.length ? json.violations[0].message : null)
201+
202+
return new Error(msg || `Upload failed (HTTP ${status ?? "unknown"}).`)
203+
} catch {
204+
return new Error(String(responseText))
205+
}
206+
},
207+
})
208+
.on("upload-error", (_file, error) => {
209+
const msg = error?.message || "Upload failed."
210+
uppy.info(msg, "error", 9000)
186211
})
187212
.on("upload-success", (_item, response) => {
188213
onCreated(response.body)

public/main/admin/questions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ function build_question_type_icon_html(int $type): string
10191019

10201020
if (!empty($deleteUrl)) {
10211021
$question->questionData .= Display::url(
1022-
get_lang('Delete'),
1022+
Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon text-white', null, ICON_SIZE_SMALL, get_lang('Delete')).' '.get_lang('Delete'),
10231023
$deleteUrl,
10241024
[
10251025
'class' => 'inline-flex items-center rounded-lg bg-danger px-3 py-1.5 text-sm font-semibold text-white hover:bg-danger/90',

0 commit comments

Comments
 (0)