Skip to content

Commit

Permalink
Remove framework assets version to be able to work with RequireJs. (#489
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rsantellan authored Jan 28, 2023
1 parent 2e8d9d1 commit 8ad5ec8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Controller/ElFinderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Exception;
use FM\ElfinderBundle\Loader\ElFinderLoader;
use FM\ElfinderBundle\Session\ElFinderSession;
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down Expand Up @@ -222,8 +224,11 @@ public function load(SessionInterface $session, HttpKernelInterface $httpKernel,

public function mainJS()
{
$version = new EmptyVersionStrategy();
$package = new Package($version);
$mainUrl = $package->getUrl('bundles/fmelfinder/js');
return new Response(
$this->twig->render('@FMElfinder/Elfinder/helper/main.js.twig'),
$this->twig->render('@FMElfinder/Elfinder/helper/main.js.twig',['mainUrl' => $mainUrl]),
200,
[
'Content-type' => 'text/javascript',
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Elfinder/helper/main.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

// config of RequireJS (REQUIRED)
require.config({
baseUrl : "{{ asset('bundles/fmelfinder/js') }}",
baseUrl : "{{ mainUrl }}",
paths : {
'jquery' : '//cdnjs.cloudflare.com/ajax/libs/jquery/'+(old? '1.12.4' : jqver)+'/jquery.min',
'jquery-ui': '//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/jquery-ui.min',
Expand Down

0 comments on commit 8ad5ec8

Please sign in to comment.