Commit Graph

163 Commits

Author SHA1 Message Date
merdan 9489f49958 home page start 2021-03-11 15:16:57 +05:00
Ben Thomson af6db51b79
Allow "no records" message to be defined for relation widgets.
Both the "view" and "manage" widgets, in list mode, now support a custom message when no records are available. To maintain BC, if "emptyMessage" is provided in the relation config, this is still used for the "view" widget in list mode.

Fixes https://github.com/octobercms/october/issues/3594
2020-10-07 14:05:17 +08:00
Ben Thomson 684d18ffc4
Clean up 2020-08-24 15:23:49 +08:00
Ben Thomson d104d47911
Clear relation fields when unlinking a relation 2020-08-24 15:18:33 +08:00
Ben Thomson b51428f585
Unassign previous hasOne relation when creating or linking a new record.
Prevents multiple relations existing for a hasOne relation when used in a Relation widget.
2020-08-24 15:17:38 +08:00
Ben Thomson e384a37457
Apply same fix from 5a843bc to the create action as well 2020-08-24 15:16:01 +08:00
Luke Towers d3e346013d minor inline doc correction 2020-08-23 23:58:31 -06:00
Luke Towers 5a843bc909 Fix support for updating belongsTo relationships with the RelationController.
Fixes #5198, #5243; replaces #5217. Related: 6e25c5a8d0#
2020-08-23 23:57:05 -06:00
Luke Towers 24f87ae10e Also remove custom sorts from relationcontroller lists / pivot manage modes.
Fixes https://github.com/octobercms/october/issues/4335#issuecomment-643706004, refs: 5f8a5454ee
2020-06-14 14:29:21 -06:00
Luke Towers 4b4a9af266 satisfy the code sniffer 2020-04-04 22:26:52 -06:00
Luke Towers ed2d63dd0e add missing break statements 2020-04-04 21:41:24 -06:00
Luke Towers c2544d40b4 Fixed bug from relation controller customization improvements PR 2020-04-04 21:24:53 -06:00
Tobias Kündig 6e25c5a8d0
Fix saving of translations in relation controller by re-using the form widget's model (#4822)
This PR is an addition to https://github.com/octobercms/october/pull/4193

Re-using the pivotWidget's and manageWidget's models for saving form data fixes https://github.com/rainlab/translate-plugin/issues/209, where translations are not saved for the model when editing it in a relation widget.

I did some manual testing with this change and everything was working as expected: Translations are now properly saved when creating or editing related models with pivot data. Creating related models in `single` mode now works as well.

Credits to @alxy for his previous work on this issue!
2020-03-31 11:44:13 -06:00
Dan Harrin cd86c62b94
Relation Manager Customisation Improvements (#4444)
This change allows for easy customisation of the relation manager titles and toolbar buttons.

For buttons - define your custom strings directly in the standard `toolbarButtons` syntax...

```
toolbarButtons:
    create: acme.blog::lang.subcategory.CreateButtonText
    delete: # omit the string to fall back to the default button text
```

...and the old syntax still works...

```
toolbarButtons: create|delete
```

For titles - define different strings for each mode (form, list or pivot)...

```
title:
    form: acme.blog::lang.subcategory.FormTitle
    list: acme.blog::lang.subcategory.ListTitle
```

This feature provides developer convenience, for example in this situation where I have a relation manager that is used to assign user permissions to a project:
Before
![Screenshot 2019-07-10 at 09 28 22](https://user-images.githubusercontent.com/41773797/60953626-6bc0de80-a2f5-11e9-8001-04e816ad6967.png)
After
![Screenshot 2019-07-10 at 09 32 51](https://user-images.githubusercontent.com/41773797/60953773-b9d5e200-a2f5-11e9-93a9-69238ea696aa.png)

This PR contains no breaking changes.
2020-03-27 12:56:07 -06:00
Samuel Georges 321f7eaa1f Catch fatal errors after cycling page action
This is a complex issues where a "model not found" exception is getting thrown during the `pageAction` cycle, then getting suppressed by the fatal error handler:

try {
    // RelationController throws error here
}
catch (Exception $ex) {
    $this->controller->handleError($ex);
}

Fixes #4784
2019-12-29 15:40:28 +11:00
Dan Harrin 3fc7f6aa76 Refresh Relation Manager on Unlink and Delete (#4741)
Credit to @DanHarrin. Fixes #3470 and #4718. Replaces #3476.
2019-12-17 23:16:55 +08:00
Philipp Lang d4d1874311 Allow setting customview path for relation list (#4680) 2019-12-10 20:21:56 +11:00
Luke Towers 5f8a5454ee Narrow the scope of when Lists orderBy conditions are reset.
Credit to @bennothommo & @daftspunk
Replaces: 9f8d8ec9fa. Refs: #4439
2019-12-04 02:36:51 -06:00
Ben Thomson a59d3b83eb Code quality clean up (#4449)
Credit to @bennothommo
2019-07-18 08:50:37 -06:00
Luke Towers a1b1018083 Typo fix 2019-06-21 12:08:36 -06:00
Luke Towers 71241ee6d4 Fix error messages in RelationController
Fixes #4342
2019-06-12 00:26:55 -06:00
Alexander Guth 4e92686c1a Add support for filters in the RelationController configuration (#4241)
Credit to @alxy. Docs: https://github.com/octobercms/docs/pull/368
2019-05-04 09:08:12 +08:00
Luke Towers 9fa7cbf70e Hide backend controller behavior public methods from controller actions.
Fixes #3762, replaces #3764
2019-04-19 14:01:01 -06:00
Alexander Guth 132336dcb8 Add getters for relation widgets (#3164)
These are available for the FormController as well, so this is just consistent and useful in some cases. Credit to @alxy
2019-04-19 12:51:51 -06:00
Alexander Guth 13d710b161 Reuse the model instance from Form widget (#4193)
Credit to @alxy & @jimcottrell . Refs:
https://github.com/rainlab/translate-plugin/issues/209
https://github.com/rainlab/translate-plugin/issues/242
https://github.com/rainlab/translate-plugin/issues/330
https://github.com/rainlab/translate-plugin/issues/380
https://github.com/jan-vince/smallextensions/issues/11
https://github.com/OFFLINE-GmbH/oc-mall-plugin/issues/128
https://github.com/OFFLINE-GmbH/oc-gdpr-plugin/issues/21
https://github.com/OFFLINE-GmbH/oc-gdpr-plugin/pull/55
df9c8fd365
https://github.com/octobercms/october/pull/3984
2019-03-15 22:32:36 -06:00
Francesco Passanti 329bb6f202 Fix relation controller lists onClick handling for VARCHAR keys (#3544)
Credit to @FrancescoPassanti
2018-11-23 00:58:28 -06:00
Kanstantsin 69a26aa8f2 Commit deferred bindings on model created with RelationController (#3843)
Fixes #3829. Credit to @iotch. Tested by the fantastic Octodock provided by @petehalverson
2018-10-04 08:35:30 -06:00
Nathan van der Werf 0f0d108da0
Remove unused imports 2018-08-24 19:51:59 +02:00
Nathan van der Werf 8b6f11e6ac Extract child instructions 2018-08-15 19:25:42 +02:00
Nathan van der Werf fbca3bea92 Remove redundant variables 2018-08-15 19:23:12 +02:00
Nathan van der Werf 62c59a4903 Refactor ternary operators to null coalescing operators 2018-08-15 19:15:13 +02:00
Nathan van der Werf 123145fd54 Remove unnecessary parentheses 2018-08-15 18:49:52 +02:00
Nathan van der Werf 02bd38cfb1 Merge if constructs 2018-08-15 18:45:37 +02:00
Samuel Georges 2036823eee Removes non functional buttons in pivot mode
Refs https://github.com/daftspunk/oc-test-plugin/issues/28
2017-12-06 17:19:37 +11:00
Samuel Georges 605c8221a9 getPlainForeignKey -> getForeignKeyName 2017-05-20 20:03:48 +10:00
Quezler cc17b679f1 Code dusting (#2826)
Code cleaning according to PSR-2 w/ exemptions (mostly dust).
2017-04-24 21:38:19 +10:00
Samuel Georges 330a41f39c Improve form controller docs 2017-03-23 08:48:26 +11:00
Samuel Georges b841f9e066 {@inheritDoc} -> @inheritDoc 2017-03-16 06:26:14 +11:00
Samuel Georges 18c6bb63a2 API docs progress 2017-03-15 18:03:26 +11:00
Luke Towers 749835f73d Merge pull request #2642 from norotaro/patch-1
Update RelationController::onRelationManageUpdate
2017-02-01 15:07:46 -06:00
Samuel Georges bf17fa44e6 Merge pull request #2610 from lukaszbanas-extremecoding/issue_2609
Support deferred binding for single view modes in RelationController
2017-02-02 06:46:09 +11:00
norotaro 2ac4dad4e9 Update RelationController::onRelationManageUpdate
As in `onRelationManageCreate()`, `onRelationManageDelete()`, `onRelationManageAdd()`, etc, it needs to return `$this->relationRefresh()` for `relationExtendRefreshResults()` to be executed
2017-02-01 12:14:41 -03:00
Luke Towers a3b98944be Fix typo in RelationController (original #2460)
Fixes minor typo initially proposed in #2460, resubmitted here as original author vanished.
2017-01-28 15:47:25 -06:00
lbanas b6683c2329 issue 2609 2017-01-13 09:59:11 +01:00
Luke Towers 102831ecc2 Improve RelationController evalManageTitle()
Improves the evalManageTitle() method of the RelationController by making it possible to detect being the create manage form, which will enable us to utilize the results of the evalManageTitle in the manage_form partial.
2017-01-06 17:45:58 -06:00
Luke Towers 05ab8bdb01 Pass current model to RelationController view & manage scopes
This improves the extensibility of the relation controller by passing the parent relation model to the query scope that will be applied to both the view and manage options. It allows the use of attributes of the parent relation model in the query scope applied to the relation.

This is a mirror of october/octobercms#2419, except for the relation controller instead of the record finder widget. If necessary, I can create a case in the test plugin, but if this is simple enough with the added reference to the prior PR to not require a case in the test plugin, that would be simpler for me :) 

@daftspunk, let me know what you think.
2016-11-16 12:05:44 -06:00
Samuel Georges ced920e5d2 Exception handling
Addresses issue specified in https://github.com/daftspunk/oc-test-plugin/issues/21
2016-11-02 07:21:04 +11:00
Samuel Georges 88196fb660 Allow passing an explicit format to datepicker
Refs #1919
Recompile assets
2016-10-20 08:44:14 +11:00
Samuel Georges 535dc78db1 Pass model as 3rd arg in relation extend overrides
Refs #2308
2016-10-19 08:45:43 +11:00
Samuel Georges 259e0c0226 Add support for recordOnClick in relationRender 2016-10-15 10:11:54 +11:00