Skip to content

Commit 3f8ec2a

Browse files
authored
Merge branch '3.x' into fix-nested-repeaters
2 parents 27ccbb5 + 5ad2237 commit 3f8ec2a

File tree

86 files changed

+967
-269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+967
-269
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
id: composer-cache
109109
run: |
110110
echo "::set-output name=dir::$(composer config cache-files-dir)"
111-
- uses: actions/cache@v2
111+
- uses: actions/cache@v4
112112
with:
113113
path: ${{ steps.composer-cache.outputs.dir }}
114114
key: ${{ matrix.os }}-${{ matrix.laravel }}-${{ matrix.php }}-${{ matrix.dbal }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -129,10 +129,6 @@ jobs:
129129
run: |
130130
npm ci
131131
132-
- name: Create blocks dir
133-
run: |
134-
mkdir ./frontend/js/components/blocks/customs
135-
136132
- name: Build twill.
137133
run: ./vendor/bin/testbench twill:build --forTesting
138134
env:

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump_type:
7+
description: 'Type of version bump (patch, minor, major)'
8+
required: true
9+
default: 'patch'
10+
11+
jobs:
12+
build-and-pr:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
with:
19+
ref: 3.x
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build project
31+
run: npm run build
32+
33+
- name: Copy build artifacts
34+
run: |
35+
mkdir -p twill-assets/assets
36+
rm -rf twill-assets/assets/*
37+
cp -r dist/assets/* twill-assets/assets/
38+
39+
- name: Bump version
40+
id: bump_version
41+
run: |
42+
npm version ${{ github.event.inputs.version_bump_type }} --no-git-tag-version
43+
echo "::set-output name=new_version::$(node -p "require('./package.json').version")"
44+
45+
- name: Update version in PHP file
46+
run: |
47+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
48+
sed -i "s/\(public const VERSION = '\)[^']*\(';\)/\1${NEW_VERSION}\2/" src/TwillServiceProvider.php
49+
50+
- name: Create Pull Request
51+
uses: peter-evans/create-pull-request@v5
52+
with:
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
commit-message: |
55+
Update assets and bump version to ${{ steps.bump_version.outputs.new_version }}
56+
title: |
57+
Twill ${{ steps.bump_version.outputs.new_version }} release
58+
body: |
59+
This PR updates the build and bumps the version number to ${{ steps.bump_version.outputs.new_version }}.
60+
branch: release-${{ steps.bump_version.outputs.new_version }}
61+
base: 3.x

CHANGELOG.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,124 @@
22

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

5+
## 3.5.2
6+
7+
### Fixed
8+
9+
- Fix cropper regression (likely a from a recent browser update) by [@13twelve](https://github.com/13twelve) in [#2744](https://github.com/area17/twill/pull/2744)
10+
11+
12+
## 3.5.1
13+
14+
### Fixed
15+
16+
- Fix file library uploader regression by [@joyceverheije](https://github.com/joyceverheije) in https://github.com/area17/twill/pull/2740
17+
- Fix `timeOnly` variant of the `Datepicker` field by [@MamlukiSn](https://github.com/MamlukiSn) in https://github.com/area17/twill/pull/2739
18+
19+
### Improved
20+
21+
- Add a warning during the `twill:update` and `twill:build` commands for developers that have `twill.load_default_migrations` set to false by [@ifox](https://github.com/ifox) in [de274175](https://github.com/area17/twill/commit/de274175)
22+
23+
## 3.5.0
24+
25+
### Added
26+
27+
- Add a `ModuleController::setPreviewView()` method by @zachgarwood in https://github.com/area17/twill/pull/2724
28+
- Add a `disableCrop()` method to `medias` fields by @ifox in https://github.com/area17/twill/pull/2686
29+
30+
### Fixed
31+
32+
- Fix position management in `medias` and `files` fields by @zeezo887 in https://github.com/area17/twill/pull/2694
33+
- Fix issues with touch actions by @13twelve in https://github.com/area17/twill/pull/2713
34+
- Fix issue with `Relation` column by @zachgarwood in https://github.com/area17/twill/pull/2720
35+
- Fix endpoints initialization for `Browser` component by @zeezo887 in https://github.com/area17/twill/pull/2722
36+
- Fix image cropper for erroneous EXIF orientation: Use JS to read image dimensions on upload by @13twelve in https://github.com/area17/twill/pull/2705
37+
- Fix square crops having mismatching width/height values by @13twelve in https://github.com/area17/twill/pull/2706
38+
- Fix `hideActiveCrop()` not working for medias form field when max is greater than 1 by @zeezo887 in https://github.com/area17/twill/pull/2686
39+
- Fix #2641: `InlineRepeater` updates by @13twelve in https://github.com/area17/twill/pull/2714
40+
- Fix Vue dropdown console warnings: update useCapture param for removeEventListener to match addEventListener by @zeezo887 in https://github.com/area17/twill/pull/2687
41+
- Fix #2657: adds missing Vue draggable deprecations by @13twelve in https://github.com/area17/twill/pull/2707
42+
43+
### Docs
44+
45+
- Added instructions to disable publish switch in create modal by @ordigital in https://github.com/area17/twill/pull/2698
46+
- Added instructions for `MultiSelect` field with dynamic values in form builder by @ordigital in https://github.com/area17/twill/pull/2699
47+
- Added instructions for free cropping with `null` or `0` ratio value by @LucaRed in https://github.com/area17/twill/pull/2715
48+
49+
### Translations
50+
51+
- Fix #2619: adds missing iso languages by @13twelve in https://github.com/area17/twill/pull/2708
52+
53+
## 3.4.1
54+
55+
### Improved
56+
57+
- Allow media and file library disk configuration using an environement variable by [@antonioribeiro](https://github.com/antonioribeiro) in https://github.com/area17/twill/pull/2676
58+
59+
### Fixed
60+
61+
- Fix #2671: 3.4.0 regression on related browsers previews by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2672
62+
- Fix #2674: 3.4.0 regression on relation column using a one-to-one relationship by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2675
63+
64+
## 3.4.0
65+
66+
### Added
67+
68+
- 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
69+
- Add `clearable` method to select form field by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2581
70+
71+
### Improved
72+
73+
- Rethink the way the error handler works by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2612
74+
- Improve related save by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2599
75+
- Limits Access Key exposition to S3 storage by [@luislavena](https://github.com/luislavena) in https://github.com/area17/twill/pull/2611
76+
- 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
77+
- Filter - Select: expand to the longest option by [@mrdoinel](https://github.com/mrdoinel) in https://github.com/area17/twill/pull/2627
78+
- 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
79+
80+
### Fixed
81+
82+
- Fix trim function to get corresponding input by [@DCrepper](https://github.com/DCrepper) in https://github.com/area17/twill/pull/2609
83+
- Fix published scope by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2606
84+
- Fix sync of medias and files with multiple fields by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2628
85+
- Fix positioning of the close button in media library tags by [@mrdoinel](https://github.com/mrdoinel) in https://github.com/area17/twill/pull/2626
86+
- Fix search functionality for buckets by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2661
87+
- 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
88+
- Fix deleted users causes error 500 by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2643
89+
- Fix wrong crops for Blocks in `twill:refresh-crops` by [@ptrckvzn](https://github.com/ptrckvzn) in https://github.com/area17/twill/pull/2642
90+
- 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
91+
- 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
92+
- Fix repeaters are registered without a populated item by [@Tofandel](https://github.com/Tofandel) in https://github.com/area17/twill/pull/2605
93+
- 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
94+
- Fix weird behaviour of slugs table active column by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2531
95+
- 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
96+
- 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
97+
- Rename moduleName variable in permissionModules loop by [@zeezo887](https://github.com/zeezo887) in https://github.com/area17/twill/pull/2635
98+
- Ensure catch-all routes do not take precedence by [@ifox](https://github.com/ifox) in https://github.com/area17/twill/pull/2669
99+
100+
### Docs
101+
102+
- Update one-to-many docs to use correct Artisan command by [@daisonth](https://github.com/daisonth) in https://github.com/area17/twill/pull/2615
103+
- Fix basic page builder guide block file reference by [@amiraezz](https://github.com/amiraezz) in https://github.com/area17/twill/pull/2630
104+
105+
### Translations
106+
107+
- Update both Portuguese from Brazil and Portugal by [@antonioribeiro](https://github.com/antonioribeiro) in https://github.com/area17/twill/pull/2602
108+
- 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
109+
110+
### Chores
111+
112+
- Upgrade GitHub Actions artefact upload to v4 by [@ifox](https://github.com/ifox)
113+
- Bump webpack from 5.91.0 to 5.95.0 by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2665
114+
- Bump body-parser and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2659
115+
- Bump cookie and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2664
116+
117+
## 3.3.2
118+
119+
### Fixed
120+
121+
- Backport fix from 3.5.1: `timeOnly` variant of the `Datepicker` field by [@MamlukiSn](https://github.com/MamlukiSn) in https://github.com/area17/twill/pull/2739
122+
5123
## 3.3.1
6124

7125
### Fixed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"area17/phptorch": "dev-main",
4949
"chillerlan/php-qrcode": "~4.0",
5050
"friendsofphp/php-cs-fixer": "^3.0",
51+
"larastan/larastan": "^2.9",
5152
"nette/php-generator": "^4.0.3",
5253
"nunomaduro/collision": "^6.0 || ^7.0 || ^8.0",
53-
"nunomaduro/larastan": "^2.0",
5454
"orchestra/testbench": "^7.8 || ^8.0 || ^9.0",
5555
"orchestra/testbench-dusk": "^7.8 || ^8.0 || ^9.0",
5656
"phpunit/php-invoker": "^3.1 || ^4.0",

config/file_library.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| - 'A17\Twill\Services\FileLibrary\Disk'
1919
|
2020
*/
21-
'disk' => 'twill_file_library',
21+
'disk' => env('FILE_LIBRARY_DISK', 'twill_file_library'),
2222
'endpoint_type' => env('FILE_LIBRARY_ENDPOINT_TYPE', 'local'),
2323
'cascade_delete' => env('FILE_LIBRARY_CASCADE_DELETE', false),
2424
'local_path' => env('FILE_LIBRARY_LOCAL_PATH', 'uploads'),

config/media_library.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
| - 'A17\Twill\Services\MediaLibrary\Local'
2121
|
2222
*/
23-
'disk' => 'twill_media_library',
23+
'disk' => env('MEDIA_LIBRARY_DISK', 'twill_media_library'),
2424
'endpoint_type' => env('MEDIA_LIBRARY_ENDPOINT_TYPE', 'local'),
2525
'cascade_delete' => env('MEDIA_LIBRARY_CASCADE_DELETE', false),
2626
'local_path' => env('MEDIA_LIBRARY_LOCAL_PATH', 'uploads'),

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

Lines changed: 6 additions & 5 deletions
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

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

Lines changed: 2 additions & 2 deletions
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:::

docs/content/1_docs/4_form-fields/06_multi-select.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,38 @@ public function sectors() {
200200
- In your repository, make sure to sync the association when saving:
201201

202202
```php
203-
public function afterSave($object, $fields)
203+
public function afterSave($object, $fields): void
204204
{
205205
$object->sectors()->sync($fields['sectors'] ?? []);
206206

207207
parent::afterSave($object, $fields);
208208
}
209209
```
210210

211+
:::tabs=currenttab.FormBuilder&items.FormBuilder|FormView:::
212+
:::tab=name.FormBuilder:::
213+
214+
```php
215+
$form->add(
216+
MultiSelect::make()
217+
->name('sectors')
218+
->options(
219+
Options::fromArray(app()->make(SectorsRepository::class)->listAll()->toArray())
220+
)
221+
);
222+
```
223+
224+
:::#tab:::
225+
226+
:::tab=name.FormView:::
227+
211228
- In your controller, add to the formData the collection of options:
212229

213230
```php
214231
protected function formData($request)
215232
{
216233
return [
217-
'sectors' => app()->make(SectorRepository::class)->listAll()
234+
'sectors' => app()->make(SectorRepository::class)->listAll()->toArray()
218235
];
219236
}
220237
```
@@ -229,6 +246,9 @@ protected function formData($request)
229246
/>
230247
```
231248

249+
:::#tab:::
250+
:::#tabs:::
251+
232252
When used in a [block](../5_block-editor), no migration is needed.
233253

234254
## Multi Select Inline

docs/content/1_docs/4_form-fields/11_repeater.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ class ProjectController extends BaseModuleController
163163
}
164164
```
165165

166+
| Option | Description | Type | Default value |
167+
|:---------------|:---------------------------------------------|:--------|:-----------------|
168+
| type | Type of repeater items | string | |
169+
| name | Name of the field | string | same as `type` |
170+
| max | Maximum amount that can be created | number | null (unlimited) |
171+
| buttonAsLink | Displays the `Add` button as a centered link | boolean | false |
172+
| disableCreate | Disables ability to add new items | boolean | false |
173+
| disableActions | Removes row item actions | boolean | false |
174+
| disableReorder | Disables reordering of repeater items | boolean | false |
175+
176+
166177
## Blade repeater fields
167178

168179
The following example demonstrates how to define a relationship between `Team` and `TeamMember` modules to implement

0 commit comments

Comments
 (0)