Skip to content

Commit b9e4abc

Browse files
authored
Fix locale detection and add $dir for backward compatibility (#96)
* fix getViewVars * remove translation artifact * add compatibility with jqueryUI 1.13+
1 parent 126904f commit b9e4abc

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

resources/views/common_scripts.blade.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,5 @@
1515
{{-- elFinder JS (REQUIRED) --}}
1616
@basset(base_path('vendor/studio-42/elfinder/js/elfinder.min.js'))
1717

18-
{{-- elFinder translation (OPTIONAL) --}}
19-
@if($locale)
20-
@basset('bp-elfinder-i18n-'.$locale)
21-
@endif
22-
2318
{{-- elFinder sounds --}}
2419
@basset(base_path('vendor/studio-42/elfinder/sounds/rm.wav'))

resources/views/elfinder.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
<script type="text/javascript" charset="utf-8">
2727
// Documentation for client options:
2828
// https://github.com/Studio-42/elFinder/wiki/Client-configuration-options
29+
30+
// elFinder does not fully support jQuery UI 1.13+ yet, so we need to add this workaround.
31+
if (typeof $.fn.buttonset !== 'function' && typeof $.fn.controlgroup === 'function') {
32+
$.fn.buttonset = $.fn.controlgroup;
33+
}
34+
2935
$(document).ready(function() {
3036
$('#elfinder').elfinder({
3137
// set your elFinder options here

src/BackpackElfinderController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Backpack\FileManager;
44

5-
use Backpack\Basset\Facades\Basset;
65
use Illuminate\Support\Facades\Crypt;
76
use Illuminate\Support\Facades\Log;
87

@@ -49,14 +48,15 @@ public function showIndex()
4948

5049
protected function getViewVars()
5150
{
51+
$dir = 'packages/barryvdh/'.$this->package;
5252
$locale = str_replace('-', '_', $this->app->config->get('app.locale'));
5353

54-
if (! array_key_exists('bp-elfinder-i18n-'.$locale, Basset::getNamedAssets())) {
54+
if (! file_exists(base_path("vendor/studio-42/elfinder/js/i18n/elfinder.{$locale}.js"))) {
5555
$locale = false;
5656
}
5757

5858
$csrf = true;
5959

60-
return compact('locale', 'csrf');
60+
return compact('dir', 'locale', 'csrf');
6161
}
6262
}

0 commit comments

Comments
 (0)