Skip to content

Commit ea8816f

Browse files
authored
Merge pull request #30 from tattersoftware/settings
Settings
2 parents 3085b77 + 964cd65 commit ea8816f

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

.github/workflows/compare.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ on:
88
- develop
99
paths:
1010
- 'src/**'
11-
push:
12-
branches:
13-
- develop
14-
paths:
15-
- 'src/**'
1611

1712
jobs:
1813
compare:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ File uploads and management, for CodeIgniter 4
33

44
[![](https://github.com/tattersoftware/codeigniter4-files/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-files/actions?query=workflow%3A%22PHPUnit%22)
55
[![](https://github.com/tattersoftware/codeigniter4-files/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-files/actions?query=workflow%3A%PHPStan%22)
6+
[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/codeigniter4-files/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/codeigniter4-files?branch=develop)
67

78
## Quick Start
89

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"tatter/audits": "^1.0",
3030
"tatter/exports": "^2.0",
3131
"tatter/permits": "^2.0",
32-
"tatter/settings": "^1.0",
32+
"tatter/settings": "^1.0 || ^2.0",
3333
"tatter/thumbnails": "^1.2",
3434
"twbs/bootstrap": "^4.5"
3535
},

src/Database/Seeds/FileSeeder.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,39 @@ class FileSeeder extends \CodeIgniter\Database\Seeder
66
{
77
public function run()
88
{
9+
// Compatible with Settings v1 and v2
910
$templates = [
1011
[
1112
'name' => 'perPage',
12-
'scope' => 'user',
13-
'content' => '10',
13+
'datatype' => 'int',
1414
'summary' => 'Number of items to show per page',
15+
'content' => '10',
16+
'scope' => 'user',
1517
'protected' => 1,
1618
],
1719
[
1820
'name' => 'filesFormat',
19-
'scope' => 'user',
21+
'datatype' => 'string',
22+
'summary' => 'Display format for listing files',
2023
'content' => 'cards',
24+
'scope' => 'user',
2125
'protected' => 0,
22-
'summary' => 'Display format for listing files',
2326
],
2427
[
2528
'name' => 'filesSort',
26-
'scope' => 'user',
29+
'datatype' => 'string',
30+
'summary' => 'Sort field for listing files',
2731
'content' => 'filename',
32+
'scope' => 'user',
2833
'protected' => 0,
29-
'summary' => 'Sort field for listing files',
3034
],
3135
[
3236
'name' => 'filesOrder',
33-
'scope' => 'user',
37+
'datatype' => 'string',
38+
'summary' => 'Sort order for listing files',
3439
'content' => 'asc',
40+
'scope' => 'user',
3541
'protected' => 0,
36-
'summary' => 'Sort order for listing files',
3742
],
3843
];
3944

src/Models/FileModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function storage(): string
6868
$thumbnails = $storage . 'thumbnails';
6969
if (! is_dir($thumbnails) && ! @mkdir($thumbnails, 0775, true))
7070
{
71-
throw FilesException::forDirFail($thumbnails);
71+
throw FilesException::forDirFail($thumbnails); // @codeCoverageIgnore
7272
}
7373

7474
return $storage;

tests/unit/ControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function testGetSortUsesSettings()
8080

8181
public function testGetSortIgnoresInvalid()
8282
{
83-
$_REQUEST['sort'] = 'foobar';
83+
$_REQUEST['sort'] = 'foobar';
84+
service('settings')->filesSort = 'bambaz';
8485

8586
$this->controller(Files::class);
8687

0 commit comments

Comments
 (0)