Skip to content

Commit b44b264

Browse files
authored
Merge pull request #148 from gwleuverink/standard-viewtype-config
Choose list or gridview for the filemanager using a config variable
2 parents ac019be + 71097d2 commit b44b264

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/config/lfm.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,19 @@
2424
// The database field to identify a user.
2525
// When set to 'id', the private folder will be named as the user id.
2626
// NOTE: make sure to use an unique field.
27+
// When choosing a startup view you can fill either 'grid' or 'list'.
2728
'user_field' => 'id',
2829

2930
'shared_folder_name' => 'shares',
3031
'thumb_folder_name' => 'thumbs',
3132

3233
'images_dir' => 'public/photos/',
3334
'images_url' => '/photos/',
35+
'images_startup_view' => 'list',
3436

3537
'files_dir' => 'public/files/',
3638
'files_url' => '/files/',
39+
'files_startup_view' => 'grid',
3740

3841
'max_image_size' => 500,
3942
'max_file_size' => 1000,

src/controllers/LfmController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class LfmController extends Controller {
1717
public $file_location = null;
1818
public $dir_location = null;
1919
public $file_type = null;
20+
public $startup_view = null;
2021
protected $user;
2122

2223
/**
@@ -29,9 +30,11 @@ public function __construct()
2930
if ('Images' === $this->file_type) {
3031
$this->dir_location = Config::get('lfm.images_url');
3132
$this->file_location = Config::get('lfm.images_dir');
33+
$this->startup_view = Config::get('lfm.images_startup_view');
3234
} elseif ('Files' === $this->file_type) {
3335
$this->dir_location = Config::get('lfm.files_url');
3436
$this->file_location = Config::get('lfm.files_dir');
37+
$this->startup_view = Config::get('lfm.files_startup_view');
3538
} else {
3639
throw new \Exception('unexpected type parameter');
3740
}
@@ -57,6 +60,7 @@ public function show()
5760
return view('laravel-filemanager::index')
5861
->with('working_dir', $working_dir)
5962
->with('file_type', $this->file_type)
63+
->with('startup_view', $this->startup_view)
6064
->with('extension_not_found', $extension_not_found);
6165
}
6266

src/views/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
</div>
120120
</div>
121121
<input type='hidden' name='working_dir' id='working_dir' value='{{$working_dir}}'>
122-
<input type='hidden' name='show_list' id='show_list' value='0'>
122+
<input type='hidden' name='show_list' id='show_list' value='{{ ($startup_view == 'list') ? 1 : 0 }}'>
123123
<input type='hidden' name='type' id='type' value='{{$file_type}}'>
124124
<input type='hidden' name='_token' value='{{csrf_token()}}'>
125125
</form>

0 commit comments

Comments
 (0)