Skip to content

Commit

Permalink
TTK-26800: Show track in large files
Browse files Browse the repository at this point in the history
  • Loading branch information
albacodina committed Jan 31, 2024
1 parent 17abd12 commit 5ff08d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ uppy.on('upload-success', (file, response) => {
window.location.href = response.body.endPage;
}
if ('window' in parent && 'mmId' in response.body) {
parent.$('#myModal').modal('hide');
parent.window.postMessage({'mmId': response.body.mmId}, '*');
parent.success('{% trans %}New Track added.{% endtrans %}');
parent.window.location.reload();
}
} else if(response.body.uploaded && response.body.uploaded === 'failed') {
parent.$('#myModal').modal('hide');
parent.no_success(response.body.message);
parent.window.location.reload();
} else {
file_data_clear();
return false;
Expand Down
12 changes: 6 additions & 6 deletions src/Pumukit/NewAdminBundle/Controller/TrackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ public function createAction(Request $request, MultimediaObject $multimediaObjec
}

/**
* @Template("@PumukitNewAdmin/Track/upload.html.twig")
*
* @Security("is_granted('ROLE_ACCESS_ADVANCED_UPLOAD')")
*/
public function uploadAction(Request $request, MultimediaObject $multimediaObject)
Expand All @@ -117,18 +115,20 @@ public function uploadAction(Request $request, MultimediaObject $multimediaObjec

$message = ('dev' === $this->kernelEnvironment) ? $e->getMessage() : 'The file is not a valid video or audio file';

return [
return new JsonResponse([
'mm' => $multimediaObject,
'mmId' => $multimediaObject->getId(),
'uploaded' => 'failed',
'message' => $message,
];
]);
}

return [
return new JsonResponse([
'mm' => $multimediaObject,
'mmId' => $multimediaObject->getId(),
'uploaded' => 'success',
'message' => 'New Track added.',
];
]);
}

/**
Expand Down

0 comments on commit 5ff08d6

Please sign in to comment.