Skip to content

Commit 376de7a

Browse files
authored
Merge branch '3.x' into fix/2278
2 parents 019a135 + 3297066 commit 376de7a

32 files changed

+130
-42
lines changed

Diff for: CHANGELOG.md

+53
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,59 @@
22

33
All notable changes to `twill` will be documented in this file.
44

5+
## 3.4.0
6+
7+
### Added
8+
9+
- Add `searchQuery` method to controller for finer control over the search by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2614
10+
- Add `clearable` method to select form field by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2581
11+
12+
### Improved
13+
14+
- Rethink the way the error handler works by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2612
15+
- Improve related save by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2599
16+
- Limits Access Key exposition to S3 storage by [@luislavena](https://github.com/luislavena) in https://github.com/area17/twill/pull/2611
17+
- Don't load relation for each column and allow dot notation in field name for index table by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2603
18+
- Filter - Select: expand to the longest option by [@mrdoinel](https://github.com/mrdoinel) in https://github.com/area17/twill/pull/2627
19+
- Preview: Update default width value for the mobile preview (to a more realistic value) by [@mrdoinel](https://github.com/mrdoinel) in https://github.com/area17/twill/pull/2624
20+
21+
### Fixed
22+
23+
- Fix trim function to get corresponding input by [@DCrepper](https://github.com/DCrepper) in https://github.com/area17/twill/pull/2609
24+
- Fix published scope by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2606
25+
- Fix sync of medias and files with multiple fields by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2628
26+
- Fix positioning of the close button in media library tags by [@mrdoinel](https://github.com/mrdoinel) in https://github.com/area17/twill/pull/2626
27+
- Fix search functionality for buckets by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2661
28+
- Fix #2650: Added parentheses to fix the order of evaluation between t… by [@HarryThe3rd](https://github.com/HarryThe3rd) in https://github.com/area17/twill/pull/2651
29+
- Fix deleted users causes error 500 by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2643
30+
- Fix wrong crops for Blocks in `twill:refresh-crops` by [@ptrckvzn](https://github.com/ptrckvzn) in https://github.com/area17/twill/pull/2642
31+
- Fix server error in the dashboard when a nested module has a deleted parent by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2633
32+
- Fix slugs are not created when saving models outside of Twill or when duplicating by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2618
33+
- Fix repeaters are registered without a populated item by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2605
34+
- Fix block previews don't update when browser items are added or changed by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2535
35+
- Fix weird behaviour of slugs table active column by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2531
36+
- Fix blocks take crop settings from parent model if name is the same by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2542
37+
- Use strict check for is null, as it otherwise causes empty arrays to not have any field by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2604
38+
- Rename moduleName variable in permissionModules loop by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2635
39+
- Ensure catch-all routes do not take precedence by [@ifox](https://github.com/ifox) in https://github.com/area17/twill/pull/2669
40+
41+
### Docs
42+
43+
- Update one-to-many docs to use correct Artisan command by [@daisonth](https://github.com/daisonth) in https://github.com/area17/twill/pull/2615
44+
- Fix basic page builder guide block file reference by [@amiraezz](https://github.com/amiraezz) in https://github.com/area17/twill/pull/2630
45+
46+
### Translations
47+
48+
- Update both Portuguese from Brazil and Portugal by [@antonioribeiro](https://github.com/antonioribeiro) in https://github.com/area17/twill/pull/2602
49+
- Improved i18n: added missing translation key (#2616) and improved German translations by [@C2H6-383](https://github.com/C2H6-383) in https://github.com/area17/twill/pull/2634
50+
51+
### Chores
52+
53+
- Upgrade GitHub Actions artefact upload to v4 by [@ifox](https://github.com/ifox)
54+
- Bump webpack from 5.91.0 to 5.95.0 by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2665
55+
- Bump body-parser and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2659
56+
- Bump cookie and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2664
57+
558
## 3.3.1
659

760
### Fixed

Diff for: docs/content/1_docs/2_getting-started/1_index.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
## Environment requirements
44

5-
Twill `3.x` is compatible with Laravel versions above `9.x`, running on PHP `8.0` and above. As a dependency to your
5+
Twill `3.x` is compatible with Laravel versions `9.x`. `10.x` and `11.x` running on PHP `8.0` and above. As a dependency to your
66
own application, Twill shares Laravel's
77
[server requirements](https://laravel.com/docs/10.x/deployment#server-requirements).
88

99
## Development
1010

1111
For development, those requirements are satisfied by the following first-party solutions:
1212

13+
- [Herd](https://herd.laravel.com) (macOS and Windows)
14+
- [Valet](https://laravel.com/docs/10.x/valet) (macOS)
1315
- [Sail](https://laravel.com/docs/10.x/sail) (All platforms)
1416
- [Homestead](https://laravel.com/docs/10.x/homestead) (All platforms)
15-
- [Valet](https://laravel.com/docs/10.x/valet) (macOS)
1617

1718
## Production
1819

@@ -42,9 +43,9 @@ developed and tested against MySQL (`>=5.7`) and PostgreSQL(`>=9.3`) databases.
4243

4344
| | Supported versions | Recommended version |
4445
|:-----------|:------------------:|:-------------------:|
45-
| PHP | >= 8.0 | 8.2 |
46-
| Laravel | >= 9.0 | 10.x |
47-
| Node.js | >= 16 | 18.x |
46+
| PHP | >= 8.0 | 8.3 |
47+
| Laravel | >= 9.0 | 11.x |
48+
| Node.js | >= 16 | 20.x |
4849
| MySQL | >= 5.7 | 8.x |
4950
| PostgreSQL | >= 9.3 | 15.x |
5051

Diff for: docs/content/1_docs/2_getting-started/2_installation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The starter kit setup is a basic page builder. It comes with:
2121
You can install it in a Laravel application using:
2222

2323
```bash
24-
composer require area17/twill:"^3.2"
24+
composer require area17/twill:"^3.4"
2525
```
2626

2727
:::alert=type.warning:::
@@ -40,7 +40,7 @@ See [`examples/basic-page-builder`](https://github.com/area17/twill/tree/3.x/exa
4040
Twill package can be added to your application using Composer:
4141

4242
```bash
43-
composer require area17/twill:"^3.2"
43+
composer require area17/twill:"^3.4"
4444
```
4545

4646
:::alert=type.warning:::

Diff for: docs/content/2_guides/1_page-builder-with-blade/3_installing-twill.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Twill is a standard Laravel package, that means, we only have to require it (and
44

55
So, before we get to the process of building our CMS, let's install Twill.
66

7-
We can do this using `composer require area17/twill:"^3.2"`.
7+
We can do this using `composer require area17/twill:"^3.4"`.
88

99
This will install Twill 3 alongside all other required packages.
1010

Diff for: frontend/js/components/VSelect.vue

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
:searchable="searchable"
1414
:selectable="selectable"
1515
:clearSearchOnSelect="clearSearchOnSelect"
16+
:clearable="clearable"
1617
:label="optionsLabel"
1718
:taggable="taggable"
1819
:pushTags="pushTags"
@@ -81,6 +82,10 @@
8182
type: Boolean,
8283
default: false
8384
},
85+
clearable: {
86+
type: Boolean,
87+
default: false
88+
},
8489
selectable: {
8590
type: Function,
8691
default: option => option.selectable ?? true,

Diff for: frontend/js/components/VSelect/ExtendedVSelect.vue

-5
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
mutableValue: this.value
3939
}
4040
},
41-
computed: {
42-
showClearButton () {
43-
return false
44-
}
45-
},
4641
methods: {
4742
/**
4843
* Delete the value on Delete keypress when there is no

Diff for: frontend/scss/vendor/_vselect.scss

+7-2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ $multiSelectHeight: 45px;
132132
padding-left: 0;
133133
}
134134

135+
.vs__clear {
136+
margin-right: 35px;
137+
margin-top: 2px;
138+
}
139+
135140
.vs__selected-options {
136141
padding: 0 30px 0 15px;
137142
}
@@ -414,11 +419,11 @@ $multiSelectHeight: 45px;
414419
transform: none;
415420
background-color:transparent;
416421
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDEwIDEwIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNhNmE2YTYiIGQ9Ik0yIDJsNiA2TTggMkwyIDgiLz48L3N2Zz4=);
417-
color:$color__fborder--hover;
422+
color: $color__fborder--hover;
418423

419424
span,
420425
svg {
421-
display:none
426+
display: none
422427
}
423428
}
424429
}

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@area17/twill",
3-
"version": "3.3.1",
3+
"version": "3.4.0",
44
"private": true,
55
"scripts": {
66
"inspect": "vue-cli-service inspect --mode production",

Diff for: src/Commands/stubs/package/package-composer-json.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "{{homepage}}",
55
"license": "{{licence}}",
66
"require": {
7-
"area17/twill": "^3.0"
7+
"area17/twill": "^3.4"
88
},
99
"autoload": {
1010
"psr-4": {

Diff for: src/Repositories/Behaviors/HandleSlugs.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use A17\Twill\Models\Contracts\TwillModelContract;
66
use Illuminate\Support\Arr;
7+
use Illuminate\Support\Collection;
78
use Illuminate\Support\Str;
89

910
trait HandleSlugs
@@ -12,12 +13,18 @@ public function beforeSaveHandleSlugs(TwillModelContract $object, array $fields)
1213
{
1314
if (property_exists($this->model, 'slugAttributes')) {
1415
$object->twillSlugData = [];
16+
$submittedLanguages = Collection::make($fields['languages'] ?? []);
17+
1518
foreach (getLocales() as $locale) {
19+
$submittedLanguage = Arr::first($submittedLanguages->filter(function ($lang) use ($locale) {
20+
return $lang['value'] === $locale;
21+
}));
22+
1623
if (isset($fields['slug'][$locale]) && !empty($fields['slug'][$locale])) {
1724
$currentSlug = [];
1825
$currentSlug['slug'] = $fields['slug'][$locale];
1926
$currentSlug['locale'] = $locale;
20-
$currentSlug['active'] = !$this->model->isTranslatable() || $object->translate($locale)?->active ?? false;
27+
$currentSlug['active'] = $submittedLanguage['published'] ?? true;
2128
$currentSlug = $this->getSlugParameters($object, $fields, $currentSlug);
2229
$object->twillSlugData[] = $currentSlug;
2330
} else {
@@ -31,7 +38,7 @@ public function beforeSaveHandleSlugs(TwillModelContract $object, array $fields)
3138
if (!empty(Arr::join($slugData, '-'))) {
3239
$object->twillSlugData[] = [
3340
'slug' => Str::slug(Arr::join($slugData, '-')),
34-
'active' => $this->model->isTranslatable() ? $object->translate($locale)->active : 1,
41+
'active' => $submittedLanguage['published'] ?? 1,
3542
'locale' => $locale
3643
];
3744
}

Diff for: src/Services/Forms/Fields/Select.php

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use A17\Twill\Services\Forms\Fields\Traits\HasPlaceholder;
77
use A17\Twill\Services\Forms\Fields\Traits\IsTranslatable;
88
use A17\Twill\Services\Forms\Fields\Traits\Unpackable;
9+
use A17\Twill\Services\Forms\Option;
10+
use A17\Twill\Services\Forms\Options;
911

1012
class Select extends BaseFormField
1113
{
@@ -15,6 +17,7 @@ class Select extends BaseFormField
1517
use Unpackable;
1618

1719
protected bool $searchable = false;
20+
protected bool $clearable = false;
1821

1922
public static function make(): static
2023
{
@@ -33,4 +36,14 @@ public function searchable(bool $searchable = true): static
3336

3437
return $this;
3538
}
39+
40+
/**
41+
* If the field should be clearable.
42+
*/
43+
public function clearable(bool $clearable = true): static
44+
{
45+
$this->clearable = $clearable;
46+
47+
return $this;
48+
}
3649
}

Diff for: src/TwillBlocks.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use A17\Twill\Services\Blocks\BlockCollection;
77
use A17\Twill\Services\Forms\InlineRepeater;
88
use A17\Twill\View\Components\Blocks\TwillBlockComponent;
9+
use Illuminate\Support\Arr;
910
use Illuminate\Support\Collection;
1011
use Illuminate\Support\Facades\File;
1112
use Illuminate\Support\Facades\Storage;
@@ -307,7 +308,7 @@ public function readBlocksFromDirectory(
307308
/**
308309
* Gets all the crop configs, also those of component blocks.
309310
*/
310-
public function getAllCropConfigs(): array
311+
public function getAllCropConfigs($prefixKey = false): array
311312
{
312313
if (! $this->cropConfigs) {
313314
$this->cropConfigs = config()->get('twill.block_editor.crops');
@@ -325,6 +326,10 @@ public function getAllCropConfigs(): array
325326
}
326327
}
327328

329+
if ($prefixKey) {
330+
return Arr::prependKeysWith($this->cropConfigs, 'block_');
331+
}
332+
328333
return $this->cropConfigs;
329334
}
330335
}

Diff for: src/TwillRoutes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ public function isTwillRequest(): bool
414414
Str::startsWith($requestHost, config('twill.admin_app_subdomain', 'admin') . '.') && Str::endsWith($requestHost, '.' . $adminAppUrl)
415415
: !config('twill.admin_app_strict') || $requestHost === $adminAppUrl;
416416

417-
$matchesPath = empty(config('twill.admin_app_path')) || request()->is(config('twill.admin_app_path', '') . '*');
417+
$matchesPath = empty(config('twill.admin_app_path')) || request()->is(config('twill.admin_app_path', '') . '/*');
418418

419419
return $matchesDomain && $matchesPath;
420420
}

Diff for: src/TwillServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class TwillServiceProvider extends ServiceProvider
6565
*
6666
* @var string
6767
*/
68-
public const VERSION = '3.3.1';
68+
public const VERSION = '3.4.0';
6969

7070
/**
7171
* Service providers to be registered.

Diff for: src/View/Components/Fields/FieldWithOptions.php

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function __construct(
3030
public bool $unpack = false,
3131
public int $columns = 0,
3232
public bool $searchable = false,
33+
public bool $clearable = false,
3334
public ?string $placeholder = null,
3435
public bool $addNew = false,
3536
public ?string $moduleName = null,

Diff for: src/View/Components/Fields/Select.php

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(
2626
bool $unpack = false,
2727
int $columns = 0,
2828
bool $searchable = false,
29+
bool $clearable = false,
2930
?string $placeholder = '',
3031
bool $addNew = false,
3132
?string $moduleName = null,
@@ -51,6 +52,7 @@ public function __construct(
5152
$unpack,
5253
$columns,
5354
$searchable,
55+
$clearable,
5456
$placeholder,
5557
$addNew,
5658
$moduleName,

Diff for: tests/integration/Capsules/CapsulesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function testCanSeeModelInListing()
224224

225225
$this->assertSee('Title');
226226

227-
$this->assertSee($model->title);
227+
$this->assertSee(htmlspecialchars($model->title, ENT_QUOTES, 'UTF-8'));
228228
}
229229

230230
public function testCanPublishModel()

Diff for: twill-assets/assets/twill/css/chunk-common.b2b20949.css

-1
This file was deleted.

Diff for: twill-assets/assets/twill/css/chunk-common.e1b8e245.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: twill-assets/assets/twill/css/main-form.9e877b2c.css renamed to twill-assets/assets/twill/css/main-form.b024f2ed.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: twill-assets/assets/twill/js/chunk-common.035511b4.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: twill-assets/assets/twill/js/chunk-common.a9fd20cf.js

-1
This file was deleted.

Diff for: twill-assets/assets/twill/js/main-buckets.42cfb8bd.js renamed to twill-assets/assets/twill/js/main-buckets.078833b8.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: twill-assets/assets/twill/js/main-form.8ced55c1.js renamed to twill-assets/assets/twill/js/main-form.9a0b7d62.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: twill-assets/assets/twill/twill-manifest.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
"Inter-MediumItalic.woff2": "/assets/twill/fonts/Inter-MediumItalic.7cd62035.woff2",
1212
"Inter-Regular.woff": "/assets/twill/fonts/Inter-Regular.4f8a0d7b.woff",
1313
"Inter-Regular.woff2": "/assets/twill/fonts/Inter-Regular.a2b4ebbf.woff2",
14-
"chunk-common.css": "/assets/twill/css/chunk-common.b2b20949.css",
15-
"chunk-common.js": "/assets/twill/js/chunk-common.a9fd20cf.js",
14+
"chunk-common.css": "/assets/twill/css/chunk-common.e1b8e245.css",
15+
"chunk-common.js": "/assets/twill/js/chunk-common.035511b4.js",
1616
"chunk-vendors.css": "/assets/twill/css/chunk-vendors.96caa2e9.css",
17-
"chunk-vendors.js": "/assets/twill/js/chunk-vendors.d84e57fa.js",
17+
"chunk-vendors.js": "/assets/twill/js/chunk-vendors.ff427095.js",
1818
"icons-files.php": "/views/partials/icons/icons-files-svg.blade.php",
1919
"icons-wysiwyg.php": "/views/partials/icons/icons-wysiwyg-svg.blade.php",
2020
"icons.php": "/views/partials/icons/icons-svg.blade.php",
2121
"main-buckets.css": "/assets/twill/css/main-buckets.bd3bf89d.css",
2222
"main-buckets.html": "/main-buckets.html",
23-
"main-buckets.js": "/assets/twill/js/main-buckets.42cfb8bd.js",
23+
"main-buckets.js": "/assets/twill/js/main-buckets.078833b8.js",
2424
"main-dashboard.css": "/assets/twill/css/main-dashboard.08050331.css",
2525
"main-dashboard.html": "/main-dashboard.html",
26-
"main-dashboard.js": "/assets/twill/js/main-dashboard.4d297c74.js",
27-
"main-form.css": "/assets/twill/css/main-form.9e877b2c.css",
26+
"main-dashboard.js": "/assets/twill/js/main-dashboard.1095cd8e.js",
27+
"main-form.css": "/assets/twill/css/main-form.b024f2ed.css",
2828
"main-form.html": "/main-form.html",
29-
"main-form.js": "/assets/twill/js/main-form.8ced55c1.js",
29+
"main-form.js": "/assets/twill/js/main-form.9a0b7d62.js",
3030
"main-free.html": "/main-free.html",
3131
"main-free.js": "/assets/twill/js/main-free.27ba379e.js",
3232
"main-listing.css": "/assets/twill/css/main-listing.ecd5753d.css",
3333
"main-listing.html": "/main-listing.html",
34-
"main-listing.js": "/assets/twill/js/main-listing.01721c44.js"
34+
"main-listing.js": "/assets/twill/js/main-listing.faa05ab3.js"
3535
}

0 commit comments

Comments
 (0)