Skip to content

Commit

Permalink
Merge branch '3.x' into pr/2366
Browse files Browse the repository at this point in the history
  • Loading branch information
ifox committed Jan 18, 2024
2 parents ed6edb2 + ff762bf commit c66a7c6
Show file tree
Hide file tree
Showing 80 changed files with 3,848 additions and 12,833 deletions.
67 changes: 63 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,68 @@

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
- Make preview breakpoints configurable by @florrie-90 in #2299
- Add `Link` column type for 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 text and WYSIWYG inputs 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

### 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
- Fix position value for blocks in non-default editors by @joyceverheije
- Remove block actions in settings blocks by @ifox
- Fix datepicker selection by @ifox
- Fix create button alignement in listings by @ifox

### Docs
- 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

### 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 +73,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 +88,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
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
46 changes: 45 additions & 1 deletion docs/content/1_docs/4_form-fields/10_browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ titled [Adding browser fields to a block](../5_block-editor/04_adding-browser-fi
explanation.

Outside the block editor, browser fields are used to save `belongsToMany` relationships. The relationships can be stored
in Twill's own `related` table or in a custom pivot table.
in Twill's own `twill_related` table or in a custom pivot table.

## Using browser fields as related items

Expand Down Expand Up @@ -266,6 +266,50 @@ public function getBrowserData($prependScope = [])
In the presented example, this will make sure only variants of the selected product in the first browser can be selected
in the second one.

## Using a custom pivot table

Using the `HasRelated` trait means that Twill is storing the relationship in a polymorphic table, which can make efficient database queries harder to implement depending on the needs of your frontend. Using a pivot table between 2 Twill models is available if you need it.

- Create your pivot table:

```php
Schema::create('artist_artwork', function (Blueprint $table) {
createDefaultRelationshipTableFields($table, 'artist', 'artwork');
$table->integer('position')->unsigned()->nullable();
});
```

- Add the relationship to your model (i.e. `Artist`):
```php
public function artworks(): BelongsToMany
{
return $this->belongsToMany('artworks')->orderByPivot('position');
}
```

- Configure the `$browsers` property in your repository (i.e. `ArtistRepository`):

```php
protected $browsers = ['artworks'];
```

Additional parameters can also be overridden with an array. When only the browser name is given, the rest of the parameters are inferred from the name.


```php
protected $browsers = [
'artworks' => [
'titleKey' => 'title',
'relation' => 'artworks',
'browserName' => 'artworks',
'moduleName' => 'artworks',
'positionAttribute' => 'position',
],
];
```

For even more control, you can use [updateBrowser()](https://twillcms.com/docs/api/3.x/A17/Twill/Repositories/Behaviors/HandleBrowsers.html#method_updateBrowser) in your own `afterSave()` method and [getFormFieldsForBrowser()](https://twillcms.com/docs/api/3.x/A17/Twill/Repositories/Behaviors/HandleBrowsers.html#method_getFormFieldsForBrowser) in your own `getFormFields()` method.

## Morphable browser fields

While a bit more complex to setup, you can target a morphTo.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1_docs/4_form-fields/16_field-grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ In the repository file you can setup the following parameters:

```php
public bool $fieldsGroupsFormFieldNamesAutoPrefix = true;
public string $fieldsGroupsFormFieldNameSeparator = '-'; // Default is _
public string $fieldsGroupsFormFieldNameSeparator = '.'; // Default is _
```

This will automatically group/ungroup these fields based on the separator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Refresh the page and you now see that the slug is cleaned up.
These changes do not affect how the model's slug is stored in the database, it just changes the visual representation of
it.

Model slugs are always saved purely based on the content you enter. If you enter 'example' in the url field when
creating or editing the model, that is what will be saved.
Model slugs are always saved purely based on the content you enter. If you enter 'example' in the url field when
creating or editing the model, that is what will be saved.

The front-end is always responsible for handling the slugs.
:::#alert:::
Expand Down Expand Up @@ -166,7 +166,6 @@ class Page extends Model
public $translatedAttributes = [
'title',
'description',
'active',
];
public $slugAttributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Article extends Model implements LocalizedUrlRoutable
public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
Expand Down
1 change: 0 additions & 1 deletion examples/basic-page-builder/app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Page extends Model
public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
Expand Down
1 change: 0 additions & 1 deletion examples/portfolio/app/Models/Partner.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Partner extends Model
public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
Expand Down
1 change: 0 additions & 1 deletion examples/portfolio/app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Project extends Model
public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use A17\Twill\Models\Behaviors\HasRevisions;
use A17\Twill\Models\Model;

class Homepage extends Model
class Homepage extends Model
{
use HasBlocks, HasTranslation, HasMedias, HasFiles, HasRevisions;

Expand All @@ -18,11 +18,10 @@ class Homepage extends Model
'title',
'description',
];

public $translatedAttributes = [
'title',
'description',
'active',
];

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Post extends Model implements Sortable

protected $fillable = ['published', 'title', 'description', 'position'];

public $translatedAttributes = ['title', 'description', 'active'];
public $translatedAttributes = ['title', 'description'];

public $slugAttributes = ['title'];

Expand Down
2 changes: 1 addition & 1 deletion examples/tests-modules/app/Models/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Author extends Model implements Sortable
];

// uncomment and modify this as needed if you use the HasTranslation trait
public $translatedAttributes = ['name', 'description', 'active', 'bio'];
public $translatedAttributes = ['name', 'description', 'bio'];

// uncomment and modify this as needed if you use the HasSlug trait
public $slugAttributes = ['name'];
Expand Down
2 changes: 1 addition & 1 deletion examples/tests-modules/app/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Category extends Model
protected $fillable = ['published', 'title', 'description', 'position'];

// uncomment and modify this as needed if you use the HasTranslation trait
public $translatedAttributes = ['title', 'active'];
public $translatedAttributes = ['title'];

// uncomment and modify this as needed if you use the HasSlug trait
public $slugAttributes = ['title'];
Expand Down
1 change: 0 additions & 1 deletion examples/tests-singleton/app/Models/ContactPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ContactPage extends Model
public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
Expand Down
7 changes: 3 additions & 4 deletions examples/tests-subdomain-routing/app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ class Page extends Model implements Sortable
'description',
'position',
];

public $translatedAttributes = [
'title',
'description',
'active',
];

public $slugAttributes = [
'title',
];

public $mediasParams = [
'cover' => [
'default' => [
Expand Down
10 changes: 6 additions & 4 deletions frontend/js/components/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@
},
onClose: function (selectedDates, dateStr, instance) {
self.$emit('input', dateStr)
self.$emit('close', dateStr)
self.$nextTick(function () { // wait for the datepicker to properly update the UI
self.$emit('input', self.date)
self.$emit('close', self.date)
// see formStore mixin
self.saveIntoStore()
// see formStore mixin
self.saveIntoStore()
})
}
}
Expand Down
Loading

0 comments on commit c66a7c6

Please sign in to comment.