Skip to content

Commit 3b4ad04

Browse files
authored
Merge branch '3.x' into fix/module-route-helper
2 parents 10083cf + dc08371 commit 3b4ad04

File tree

224 files changed

+1616
-1017
lines changed

Some content is hidden

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

224 files changed

+1616
-1017
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ jobs:
6565
fail-fast: false
6666
matrix:
6767
os: [ubuntu-latest]
68-
php: [8.3, 8.2, 8.1]
69-
laravel: [10.*, 11.*]
68+
php: [8.4, 8.3, 8.2, 8.1]
69+
laravel: [10.*, 11.*, 12.*]
7070
dbal: [3.*, 4.*]
7171
exclude:
7272
- laravel: 10.*
@@ -75,11 +75,15 @@ jobs:
7575
php: 8.1
7676
- laravel: 11.*
7777
dbal: 3.*
78+
- laravel: 12.*
79+
php: 8.1
7880
include:
7981
- laravel: 10.*
8082
testbench: 8.*
8183
- laravel: 11.*
8284
testbench: 9.*
85+
- laravel: 12.*
86+
testbench: 10.*
8387

8488
steps:
8589
- name: Set timezone?
@@ -108,7 +112,7 @@ jobs:
108112
id: composer-cache
109113
run: |
110114
echo "::set-output name=dir::$(composer config cache-files-dir)"
111-
- uses: actions/cache@v2
115+
- uses: actions/cache@v4
112116
with:
113117
path: ${{ steps.composer-cache.outputs.dir }}
114118
key: ${{ matrix.os }}-${{ matrix.laravel }}-${{ matrix.php }}-${{ matrix.dbal }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -129,10 +133,6 @@ jobs:
129133
run: |
130134
npm ci
131135
132-
- name: Create blocks dir
133-
run: |
134-
mkdir ./frontend/js/components/blocks/customs
135-
136136
- name: Build twill.
137137
run: ./vendor/bin/testbench twill:build --forTesting
138138
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

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@
110110
'phpdoc_types' => true,
111111
'phpdoc_var_without_name' => true,
112112
'short_scalar_cast' => true,
113+
'nullable_type_declaration_for_default_null_value' => true,
113114
'simplified_null_return' => false, // disabled by Shift
114115
'single_blank_line_at_eof' => true,
115-
'single_blank_line_before_namespace' => true,
116116
'single_class_element_per_statement' => true, // here
117117
'single_import_per_statement' => true,
118118
'single_line_after_imports' => true,

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,54 @@
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+
553
## 3.4.1
654

755
### Improved
@@ -66,6 +114,12 @@ All notable changes to `twill` will be documented in this file.
66114
- Bump body-parser and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2659
67115
- Bump cookie and express by [@dependabot](https://github.com/dependabot) in https://github.com/area17/twill/pull/2664
68116

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+
69123
## 3.3.1
70124

71125
### Fixed

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
"php": "^8.0",
2727
"ext-json": "*",
2828
"ext-pdo": "*",
29-
"astrotomic/laravel-translatable": "^v11.12",
30-
"cartalyst/tags": "^12.0 || ^13.0 || ^14.0",
29+
"astrotomic/laravel-translatable": "^v11.16",
30+
"cartalyst/tags": "^12.0 || ^13.0 || ^14.0 || ^15.0",
3131
"doctrine/dbal": "^3.0 || ^4.0",
3232
"guzzlehttp/guzzle": "^7.0",
3333
"imgix/imgix-php": "^3.0",
3434
"kalnoy/nestedset": "^6.0",
35-
"laravel/framework": "^9.0 || ^10.0 || ^11.0",
35+
"laravel/framework": "^9.0 || ^10.0 || ^11.0 || ^12.0",
3636
"laravel/socialite": "^5.3",
3737
"laravel/ui": "^4.0",
3838
"league/flysystem-aws-s3-v3": "^3.0",
@@ -48,14 +48,14 @@
4848
"area17/phptorch": "dev-main",
4949
"chillerlan/php-qrcode": "~4.0",
5050
"friendsofphp/php-cs-fixer": "^3.0",
51+
"larastan/larastan": "^2.9 | ^3.0",
5152
"nette/php-generator": "^4.0.3",
5253
"nunomaduro/collision": "^6.0 || ^7.0 || ^8.0",
53-
"nunomaduro/larastan": "^2.0",
54-
"orchestra/testbench": "^7.8 || ^8.0 || ^9.0",
55-
"orchestra/testbench-dusk": "^7.8 || ^8.0 || ^9.0",
56-
"phpunit/php-invoker": "^3.1 || ^4.0",
57-
"phpunit/phpunit": "~9.0 || ~10.0",
58-
"rector/rector": "^0.19.2 || ^1.0 ",
54+
"orchestra/testbench": "^7.8 || ^8.0 || ^9.0 || ^10.0",
55+
"orchestra/testbench-dusk": "^7.8 || ^8.0 || ^9.0 || ^10.0",
56+
"phpunit/php-invoker": "^3.1 || ^4.0 || ^5.0",
57+
"phpunit/phpunit": "~9.0 || ~10.0 || ~11.0",
58+
"rector/rector": "^0.19.2 || ^1.0 || ^2.0",
5959
"spatie/invade": "^1.1",
6060
"squizlabs/php_codesniffer": "*"
6161
},

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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,43 @@ class ProjectController extends BaseModuleController
162162
}
163163
}
164164
```
165+
### Medias
166+
167+
If your json repeater contains media formField, you need to define the
168+
`mediasParams` at `config/twill.php` under `repeaters.crops` or `block_editor.crops`.
169+
170+
```
171+
'repeaters' => [
172+
'crops' => [
173+
‘your-media-field-name’ => [
174+
175+
]
176+
],
177+
]
178+
```
179+
180+
OR
181+
```
182+
'block_editor' => [
183+
'crops' => [
184+
‘your-media-field-name’ => [
185+
186+
]
187+
],
188+
]
189+
190+
```
191+
192+
| Option | Description | Type | Default value |
193+
|:---------------|:---------------------------------------------|:--------|:-----------------|
194+
| type | Type of repeater items | string | |
195+
| name | Name of the field | string | same as `type` |
196+
| max | Maximum amount that can be created | number | null (unlimited) |
197+
| buttonAsLink | Displays the `Add` button as a centered link | boolean | false |
198+
| disableCreate | Disables ability to add new items | boolean | false |
199+
| disableActions | Removes row item actions | boolean | false |
200+
| disableReorder | Disables reordering of repeater items | boolean | false |
201+
165202

166203
## Blade repeater fields
167204

docs/content/1_docs/5_block-editor/02_creating-a-block-editor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ See also [Default Configuration](./11_default-configuration.md).
393393

394394
If the `resource_path('assets/admin/icons')` directory contains a `my-custom-icon.svg` file, you can use this icon in your block by using its basename: `@twillBlockIcon('my-custom-icon')`.
395395

396+
In order to make the icons appear in the CMS, you'll need to run `php artisan twill:build`
397+
396398
## Use Block traits in your Model and Repository
397399

398400
Now, to handle the block data you must integrate it with your module. *Use* the *Blocks* traits in the Model and Repository associated with your module.

docs/content/1_docs/7_media-library/03_role-crop-params.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A _role_ is a way to define different contexts in which an image might be placed
66

77
_Crops_ are more self-explanatory. Twill comes with some pre-defined crop settings to allow you to set different variants of a given image, so crops can be used in combination with _roles,_ or they can be used on their own with a single role to define multiple cropping ratios on the same image.
88

9-
Using the Person example, your `cover` image could have a `square` crop for mobile screens, but could use a `16/9` crop on larger screens. Those values are editable at your convenience for each model, even if there are already some crops created in the CMS.
9+
Using the Person example, your `cover` image could have a `square` crop for mobile screens, but could use a `16/9` crop on larger screens. Those values are editable at your convenience for each model in the `ratio` option, even if there are already some crops created in the CMS. By specifying `null` or `0` as a `ratio`, no automatic crop will happen and you'll be able to crop freely.
1010

1111
The only thing you have to do to make it work is to compose your model and repository with the appropriate traits, respectively `HasMedias` and `HandleMedias`, set up your `$mediasParams` configuration and use the `medias` form partial in your form view (more info in the CRUD section).
1212

docs/content/2_guides/4_creating_custom_components_form_fields_and_blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ npm install vue-numeric --save
409409
### Blade view
410410

411411
:::filename:::
412-
`resources/views/admin/partials/form/_custom_number.blade.php`
412+
`resources/views/twill/partials/form/_custom_number.blade.php`
413413
:::#filename:::
414414

415415
```blade

0 commit comments

Comments
 (0)