Skip to content

Commit

Permalink
Merge branch 'release/v2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexusmai committed May 1, 2019
2 parents 2d200d0 + 5e3c4cc commit e09df1b
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 25 deletions.
60 changes: 49 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,64 @@
* Events (v2.2)
* Supported locales : ru, en, ar

## Upgrading to version 2.2
## In new version 2.3

If you using ACL change namespace in config file for 'aclRepository'
In new version you can set default disk and default path

You have two variants for how to do it:

1. Add this params to the config file (config/file-manager.php)

```php
// From
'aclRepository' => Alexusmai\LaravelFileManager\ACLService\ConfigACLRepository::class,
/**
* Default path for left manager
* null - root directory
*/
'leftPath' => 'directory/sub-directory',

/**
* Default path for right manager
* null - root directory
*/
'rightPath' => null,
```

// To
'aclRepository' => Alexusmai\LaravelFileManager\Services\ACLService\ConfigACLRepository::class,
2 Or you can add this params in URL

```
http://site.name/?leftDisk=diskName&leftPath=directory
http://site.name/?leftDisk=diskName&leftPath=directory2&rightDisk=diskName2&rightPath=images
```

if you create your own repository for ACL rules, don't be forget change namespace to:
leftDisk and leftPath is default for the file manager windows configuration - 1,2


## Upgrading to version 2.3

Update pre-compiled css and js files and config file - file-manager.php


```php
// From
Alexusmai\LaravelFileManager\ACLService;
// config
php artisan vendor:publish --tag=fm-config --force
// js, css
php artisan vendor:publish --tag=fm-assets --force
```

You can update the config file manually - add new params:

// To
Alexusmai\LaravelFileManager\Services\ACLService;
```php
/**
* Default path for left manager
* null - root directory
*/
'leftPath' => null,

/**
* Default path for right manager
* null - root directory
*/
'rightPath' => null,
```


Expand Down
12 changes: 12 additions & 0 deletions config/file-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
*/
'rightDisk' => null,

/**
* Default path for left manager
* null - root directory
*/
'leftPath' => null,

/**
* Default path for right manager
* null - root directory
*/
'rightPath' => null,

/**
* Image cache ( Intervention Image Cache )
* set null, 0 - if you don't need cache (default)
Expand Down
65 changes: 53 additions & 12 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,59 @@ Open configuration file - config/file-manager.php

**Don't forget to configure your php and Nginx**

### You can set default disk and default path

You have two variants for how to do it:

1. Add this params to the config file (config/file-manager.php)

```php
/**
* Default disk for left manager
* null - auto select the first disk in the disk list
*/
'leftDisk' => 'public',

/**
* Default disk for right manager
* null - auto select the first disk in the disk list
*/
'rightDisk' => null,

/**
* Default path for left manager
* null - root directory
*/
'leftPath' => 'directory/sub-directory',

/**
* Default path for right manager
* null - root directory
*/
'rightPath' => null,
```

2 Or you can add this params in URL

```
http://site.name/?leftDisk=public
http://site.name/?leftDisk=public&rightDisk=images
http://site.name/?leftDisk=public&leftPath=directory/sub-directory
http://site.name/?leftDisk=public&leftPath=directory2&rightDisk=images&rightPath=cars/vw/golf
// %2F - /, %20 - space
http://site.name/?leftDisk=public&leftPath=directory2&rightDisk=images&rightPath=cars%2Fvw%2Fgolf
```

leftDisk and leftPath is default for the file manager windows configuration - 1,2

**You can't add a disk that does not exist in the diskList array !**

**! Params in URL have more weight than params in config file. It means that URL params can overwrite your config params. !**


```
// PHP
upload_max_filesize,
Expand Down Expand Up @@ -59,18 +112,6 @@ client_max_body_size
'diskList' => ['images', 'public'],
```

>If you want to change default disk at runtime, you can add search params to the URL:
```
// !!! The disk must be in diskList !!!
// one window
http://site-name.com/your-url?leftDisk=public
// two windows
http://site-name.com/your-url?leftDisk=public&rightDisk=images
```

## What's next

[ACL](./acl.md)
Expand Down
4 changes: 2 additions & 2 deletions resources/assets/js/file-manager.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public function initialize()
'acl',
'leftDisk',
'rightDisk',
'leftPath',
'rightPath',
'windowsConfig',
]);

Expand Down

0 comments on commit e09df1b

Please sign in to comment.