Skip to content

Commit 14df81e

Browse files
committed
fix update of file manager
1 parent 0edef98 commit 14df81e

6 files changed

Lines changed: 35 additions & 19 deletions

File tree

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ You can use elFinder in Backpack:
4141
You can publish the views to your `resources/views/vendor/backpack/filemanager` folder by running:
4242

4343
```bash
44-
php vendor:publish --provider="Backpack\FileManager\FileManagerServiceProvider" --tag="views"
44+
php vendor:publish --provider="Backpack\FileManager\FileManagerServiceProvider" --tag="elfinder-views"
45+
php vendor:publish --provider="Backpack\FileManager\FileManagerServiceProvider" --tag="elfinder-fields"
46+
php vendor:publish --provider="Backpack\FileManager\FileManagerServiceProvider" --tag="elfinder-columns"
47+
4548
```
4649

4750
## Upgrade
4851

49-
To upgrade from v2 to v3 of this package:
52+
To upgrade from v3 to v4 of this package:
5053
```bash
5154
# remove the published blade views
5255
rm -rf resources/views/vendor/elfinder
53-
54-
# publish the new blade views
55-
php artisan backpack:filemanager:install
5656
```
5757

5858
## Security

resources/views/elfinder.blade.php

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

33
@section('after_scripts')
44

5-
@include('backpack.elfinder::common_scripts')
6-
@include('backpack.elfinder::common_styles')
5+
@include('backpack.filemanager::common_scripts')
6+
@include('backpack.filemanager::common_styles')
77

88
<!-- elFinder initialization (REQUIRED) -->
99
<script type="text/javascript" charset="utf-8">

resources/views/standalonepopup.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html lang="{{ app()->getLocale() }}">
33
<head>
44

5-
@include('backpack.elfinder::common_scripts')
6-
@include('backpack.elfinder::common_styles', ['styleBodyElement' => true])
5+
@include('backpack.filemanager::common_scripts')
6+
@include('backpack.filemanager::common_styles', ['styleBodyElement' => true])
77
<style type="text/css">
88
.elfinder-workzone {
99
min-height: max-content !important;

src/BackpackElfinderController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public function showPopup($input_id)
3030
}
3131

3232
return $this->app['view']
33-
->make('backpack.elfinder::standalonepopup')
33+
->make('backpack.filemanager::standalonepopup')
3434
->with($this->getViewVars())
3535
->with(compact('input_id'));
3636
}
3737

3838
public function showIndex()
3939
{
4040
return $this->app['view']
41-
->make('backpack.elfinder::elfinder')
41+
->make('backpack.filemanager::elfinder')
4242
->with($this->getViewVars());
4343
}
4444
}

src/Console/Commands/Install.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function handle()
3838
$this->infoBlock('Installing Backpack FileManager', 'Step 1');
3939

4040
// Creating uploads directory
41-
$this->progressBlock('Creating uploads directory');
41+
$this->progressBlock('Creating uploads directory in case it does not exist');
4242
File::ensureDirectoryExists('public/uploads');
4343
$this->closeProgressBlock();
4444

@@ -60,7 +60,7 @@ public function handle()
6060
// Done
6161
$url = Str::of(config('app.url'))->finish('/')->append('admin/elfinder');
6262
$this->infoBlock('Backpack FileManager installation complete.', 'done');
63-
$this->note('Go to <fg=blue>$url</> to access your filemanager.');
63+
$this->note('Go to <fg=blue>'.$url.'</> to access your filemanager.');
6464
$this->note('You may need to run <fg=blue>php artisan serve</> to serve your Laravel project.');
6565
$this->newLine();
6666
}

src/FileManagerServiceProvider.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public function boot()
2626
$this->bootForConsole();
2727
}
2828

29-
$this->loadViewsFrom(__DIR__.'/../resources/views', 'backpack.elfinder');
29+
if (is_dir(base_path('resources/views/vendor/backpack/filemanager'))) {
30+
$this->loadViewsFrom(base_path('resources/views/vendor/backpack/filemanager'), 'backpack.filemanager');
31+
}
32+
33+
// Fallback to package views
34+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'backpack.filemanager');
3035

3136
$crudLanguages = array_keys(config('backpack.crud.languages', []));
3237
foreach ($crudLanguages as $language) {
@@ -45,11 +50,11 @@ public function register()
4550
Basset::addViewPath(realpath(__DIR__.'/../resources/views'));
4651

4752
ViewNamespaces::addFor('fields', [
48-
'backpack.elfinder::fields',
53+
'backpack.filemanager::fields',
4954
]);
5055

5156
ViewNamespaces::addFor('columns', [
52-
'backpack.elfinder::columns',
57+
'backpack.filemanager::columns',
5358
]);
5459
}
5560

@@ -60,10 +65,21 @@ public function register()
6065
*/
6166
protected function bootForConsole()
6267
{
63-
// Publishing the views.
68+
// Publishing exclusively the elfinder files, not the columns and fields folders
69+
$this->publishes([
70+
__DIR__.'/../resources/views/elfinder.blade.php' => resource_path('views/vendor/backpack/filemanager/elfinder.blade.php'),
71+
__DIR__.'/../resources/views/standalonepopup.blade.php' => resource_path('views/vendor/backpack/filemanager/standalonepopup.blade.php'),
72+
__DIR__.'/../resources/views/common_scripts.blade.php' => resource_path('views/vendor/backpack/filemanager/common_scripts.blade.php'),
73+
__DIR__.'/../resources/views/common_styles.blade.php' => resource_path('views/vendor/backpack/filemanager/common_styles.blade.php'),
74+
], 'elfinder-views');
75+
76+
$this->publishes([
77+
__DIR__.'/../resources/views/columns' => resource_path('views/vendor/backpack/filemanager/columns'),
78+
], 'filemanager-columns');
79+
6480
$this->publishes([
65-
__DIR__.'/../resources/views' => resource_path('views/vendor/backpack/filemanager'),
66-
], 'views');
81+
__DIR__.'/../resources/views/fields' => resource_path('views/vendor/backpack/filemanager/fields'),
82+
], 'filemanager-fields');
6783

6884
// Publishing config file.
6985
$this->publishes([

0 commit comments

Comments
 (0)