Skip to content

Commit

Permalink
Merge branch '3.x' into uuid-support
Browse files Browse the repository at this point in the history
  • Loading branch information
ifox authored Jan 25, 2024
2 parents 165ebae + 854b5af commit d58d11f
Show file tree
Hide file tree
Showing 200 changed files with 5,735 additions and 13,492 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1, 8.0]
php: [8.3, 8.2, 8.1, 8.0]
laravel: [9.*, 10.*]
exclude:
- laravel: 10.*
Expand Down
80 changes: 76 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,81 @@

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

## UNRELEASED (3.1.0)

### Added
- Add connected fields support to the Twill 3 form builder by @joyceverheije in #2323
- Support block component classes in the block editor `blocks` array by @joyceverheije in 8778ab7e
- Add `max` option to form builder `InlineRepeater` field by @joyceverheije in 4a773869
- Make preview breakpoints configurable by @florrie-90 in #2299
- Add `Link` column type to table builder by @agnonym in #2376
- PHP 8.3 support by @antonioribeiro in #2374
- Add `routePrefix` support to nested breadcrumbs by @yamaha252 in #2312
- Add direction option to form input, textarea and WYSIWYG fields by @13twelve in #2295
- Add read-only support to the form builder's Input field by @zachgarwood in #2331
- Make permissions and roles table names configurable by @Keania-Eric in #2350
- Support multiple nested table columns by @yamaha252 and @joyceverheije in #2314 and 1edbfbb1
- Add support for current request only tertiary nav links by @joyceverheije
- Add support for titleInBrowser and adminEditUrl accessors in browsers by @joyceverheije
- Add configuration to controls whether a user should be created or not when a new user is logging in through Oauth by @joyceverheije
- Allow QuickFilter extension by @joyceverheije
- Automatically add `active` to `$translatedAttributes` by @driftingly in #2401
- Add `--factory` and `--seeder` to `twill:make:module` by @driftingly in #2402
- Update migration stub and existing migrations to use anonymous class by @driftingly in #2406
- Add predefined class selection to TipTap link component by @zipavlin in #2336
- Fix `parseInternalLinks` helper issues by @avinash403 in #2338

### Fixed
- Fix custom components registration by @joyceverheije in 7c233334
- Turn move dropdowns off for settings blocks by @droplister in #2293
- Fix scheduled filter label by @droplister in #2291
- Fix related table name in migration down method by @droplister in #2290
- Updated namespace paths from Admin to Twill on custom pages by @pauldwight in #2317
- Fix type of $forceLocale in translatedInput() by @pvdbroek in #2315
- Fix duplication when translated media fields are enabled by @petertsoisstuff in #2320
- Support using a dot as `fieldsGroupsFormFieldNameSeparator` by @yamaha252 in #2277
- Allow dashboard modules to wrap onto the next line by @florrie-90 in #2298
- Always include locale in the mediables pivot by @bonroyage in #2368
- Fixes to reduce excessive number of queries when using Twill 3 settings by @bonroyage in #2369
- Update migration helper for translations table by @sauron in #2327
- Fix x-position of full height crops being reset at some ratios/screen sizes by @13twelve in #2297
- Fix optional feature migrations publication by @Tofandel in #2384
- Fix build error with custom icons by @emanueljacob in #2392
- Fix position value for blocks in non-default editors by @joyceverheije in #2381
- Fix user list errors when deleting roles by @antonioribeiro in #2372
- Fix keepAlive on connected non localized fields by @joyceverheije
- Fix active navigation check when a child module uses the same name as another module by @joyceverheije
- Avoid unused data and hooks when using the default role level by @joyceverheije
- Check user permission when displaying activity log items by @joyceverheije
- Remove block actions in settings blocks by @ifox
- Fix datepicker selection by @ifox
- Fix create button alignement in listings by @ifox
- Fixes incorrect order of nested items slug when item is more than 2 levels deep by @pauldwight in #2388
- Fix getCapsuleForModel() for when passing a Model object by @antonioribeiro in #2400
- Preserve default vselect value when undefined by @bwat-dev in #2311
- Don't load DuskServiceProvider if dusk doesn't exist by @Tofandel in #2366
- Use custom model configuration in the relationship morph map by @redelschaap in #2408

### Docs
- Add instructions on how to use the browser field with a custom pivot table by @poncianodiego and @ifox in https://github.com/area17/twill/pull/2385
- Fix wrong property name in 12_nested-modules.md by @Viliasas in #2282
- Fix artisan command by @thecrazybob in #2365
- Fix typo in create page module guide by @colegeissinger in #2367
- Content - Modules - TableBuilder: typo by @agnonym in #2375
- Updates to the docs for nested modules by @pauldwight in #2389
- Fix typo in 8_building-a-front-end.md by @driftingly in #2396
- Changed example value to better reflect given example on 16_field-groups.md by @Viliasas in #2283

### Translations
- Added Slovenian language to translations by @Neoglyph in #2373
- Update dutch lang files by @lindeVW in #2378

### Chores
- Update frontend dependencies by @ifox

## 3.0.2

## Fixed
### Fixed

- Rendering of nested components blocks by @haringsrob in https://github.com/area17/twill/pull/2243
- Rendering of side form if it only contains fieldsets by @agnonym in https://github.com/area17/twill/pull/2234
Expand All @@ -14,7 +86,7 @@ All notable changes to `twill` will be documented in this file.
- `Options::fromArray` argument order by @bonroyage in https://github.com/area17/twill/pull/2231
- Update package generator stub by @ifox in https://github.com/area17/twill/commit/78cc5b5dc023134356210f8c8940f77ff7745ea3

## Improved
### Improved

- Fix activity log typo by @DanielSpravtsev in https://github.com/area17/twill/pull/2264
- Fix two misspellings by @skoontastic in https://github.com/area17/twill/pull/2250
Expand All @@ -29,11 +101,11 @@ All notable changes to `twill` will be documented in this file.

## 3.0.1

## Fixed
### Fixed

- Fix Blade components resolution (causing an issue with Laravel Jetstream) by @haringsrob in https://github.com/area17/twill/pull/2223

## Improved
### Improved

- Add mobile nav to all docs site pages by @13twelve in https://github.com/area17/twill/pull/2224
- Fix WYSIWYG maxlength docs by @tttogo in https://github.com/area17/twill/pull/2226
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"area17/phptorch": "dev-main",
"chillerlan/php-qrcode": "~4.0",
"friendsofphp/php-cs-fixer": "^3.0",
"nette/php-generator": "v4.0.3",
"nunomaduro/collision": "^6.0",
"nette/php-generator": "^4.0.3",
"nunomaduro/collision": "^6.0|^7.0|^8.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^7.8|^8.0",
"orchestra/testbench-dusk": "^7.8|^8.0",
Expand Down
2 changes: 1 addition & 1 deletion config/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
'modules' => [],
'analytics' => ['enabled' => false],
'search_endpoint' => 'twill.search',
'search_endpoint' => config('twill.admin_route_name_prefix') . 'search',

/*
|--------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions config/oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
*/
'providers' => ['google'],

/*
|--------------------------------------------------------------------------
| This boolean controls whether a user should be created or not
| when a new user is logging in through Oauth
|--------------------------------------------------------------------------
|
| Possible values: true, false
|
*/
'create_user_with_default_role' => true,

/*
|--------------------------------------------------------------------------
| New user default role name (legacy)
Expand Down
27 changes: 20 additions & 7 deletions docs/content/1_docs/16_artisan-commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ php artisan twill:refresh-crops
{--dry : Print the operations that would be performed without modifying the database}` -
```

* `php artisan twill:make:module` - Generate a new module, see [CLI Generator](./../3_modules/2_cli-generator.md)
* `php artisan twill:make:module` - Generate a new module, see [CLI Generator](./../3_modules/2_cli-generator.md)

```
php artisan twill:make:module {moduleName}
Expand All @@ -39,10 +39,15 @@ php artisan twill:make:module {moduleName}
{--N|hasNesting}
{--bladeForm}
{--E|generatePreview}
{--parentModel=}
{--all}
{--force}
{--factory}
{--seeder}
{--packageDirectory=}
{--packageNamespace=}
{--parentModel=}
```


* `php artisan twill:make:singleton` - Generate a new singleton, see [CLI Generator](./../3_modules/2_cli-generator.md)
```
Expand All @@ -56,14 +61,16 @@ php artisan twill:make:singleton {moduleName}
{--E|generatePreview}
{--bladeForm}
{--all}
{--force}
{--factory}
{--packageDirectory=}
{--packageNamespace=}
{--parentModel=}
```

* `php artisan twill:make:capsule` - Generate a new capsule, see [CLI Generator](./../3_modules/2_cli-generator.md)
```
php artisan twill:make:capsule {moduleName}
{--singleton}
{--packageDirectory=}
{--packageNamespace=}
php artisan twill:make:capsule {moduleName}
{--B|hasBlocks}
{--T|hasTranslation}
{--S|hasSlug}
Expand All @@ -73,9 +80,15 @@ php artisan twill:make:capsule {moduleName}
{--R|hasRevisions}
{--N|hasNesting}
{--E|generatePreview}
{--singleton}
{--bladeForm}
{--all}
{--force}
{--factory}
{--seeder}
{--packageDirectory=}
{--packageNamespace=}
{--parentModel=}
```

* `php artisan twill:list:icons {filter? : Filter icons by name}` - List available icons
Expand Down
40 changes: 26 additions & 14 deletions docs/content/1_docs/3_modules/12_nested-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ $slug = $item->getNestedSlug($lang);
To include all ancestor slugs in the permalink of an item in the CMS, you can dynamically set the `$permalinkBase` property from the `form()` method of your module controller:

```php
class PageController extends ModuleController
class PageController extends NestedModuleController
{
//...

protected function form($id, $item = null)
protected function form(?int $id, TwillModelContract $item = null): array
{
$item = $this->repository->getById($id, $this->formWith, $this->formWithCount);

Expand All @@ -68,9 +68,24 @@ Route::get('{slug}', function ($slug) {
})->where('slug', '.*');
```

For more information on how to work with nested items in your application, you can refer to the
For more information on how to work with nested items in your application, you can refer to the
[laravel-nestedset package documentation](https://github.com/lazychaser/laravel-nestedset#retrieving-nodes).

### Setting a maximum nested depth

You can also define the maximum depth allowed for the module changing the following:
```php
protected $nestedItemsDepth = 1;
```
Note: a depth of 1 means parent and child.

### Working with browser fields

By default only a parent item will be visible to the browser field. If you want to show child items when browsing for the module you can set `$showOnlyParentItemsInBrowsers` to false:
```php
protected $showOnlyParentItemsInBrowsers = false; // default is true
```

## Parent-child modules

Parent-child modules are 2 distinct modules, where items of the child module are attached to items of the parent module (e.g. Issues can contain Articles):
Expand All @@ -85,23 +100,20 @@ We'll use the `slug` and `position` features in this example but you can customi

```
php artisan twill:make:module issues -SP
php artisan twill:make:module issueArticles -SP --parentModel=Issue
php artisan twill:make:module issueArticles -SP --parentModel=Issue
```

Add the `issue_id` foreign key to the child module's migration:

```php
class CreateIssueArticlesTables extends Migration
public function up()
{
public function up()
{
Schema::create('issue_articles', function (Blueprint $table) {
// ...
$table->foreignIdFor(Issue::class);
});

Schema::create('issue_articles', function (Blueprint $table) {
// ...
}
$table->foreignIdFor(Issue::class);
});

// ...
}
```

Expand All @@ -122,7 +134,7 @@ class IssueArticle extends Model implements Sortable
// ...
'issue_id',
];

public function issue()
{
return $this->belongsTo(Issue::class);
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1_docs/3_modules/6_table-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ The example blow illustrates a possible usage:
Text::make()
->field('customField')
->customRender(function (Model $model) {
return view('my.view', ['title' => $model->title'])->render();
return view('my.view', ['title' => $model->title])->render();
});
```

Expand Down
23 changes: 20 additions & 3 deletions docs/content/1_docs/4_form-fields/02_wysiwyg.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ $wysiwygOptions = [
'underline',
'strike',
'blockquote',
"code-block",
'code-block',
'ordered',
'bullet',
'hr',
'code',
'link',
'clean',
'table',
'align',
];
@endphp
Expand Down Expand Up @@ -148,11 +149,12 @@ With the Tiptap wysiwyg editor you can access some additional features. Below is
When needed, you can let users browse internal content, this can be especially useful to maintain correct links inside
wysiwyg editors.

This can currently only be done using the Form builder by adding the browsermodules to the
This can currently only be done using the Form builder by adding `browserModules` to the
wysiwyg field:

```php
Wysiwyg::make()->name('description')
Wysiwyg::make()
->name('description')
->label('Description')
->translatable()
->browserModules([Page::class])
Expand All @@ -173,6 +175,21 @@ For regular fields on models you will have to manually call `parseInternalLinks`
{{ \A17\Twill\Facades\TwillUtil::parseInternalLinks($item->description) }}
```

### Link style

If needed, you can let users add specific classes to links, which can be especially useful to create CTA or similar button-like hyperlinks that are styled differently than regular links.

This can currently only be done using the Form builder by adding `classList` to the
wysiwyg field:

```php
Wysiwyg::make()
->name('description')
->label('Description')
->translatable()
->classList(['btn' => 'Show this link as button'])
```

## Manually setting input direction

Introduced in `v3.1.0`
Expand Down
Loading

0 comments on commit d58d11f

Please sign in to comment.