353 Commits

Author SHA1 Message Date
yfktn
158fc43f62
Trigger change events when RelationController pivot records are created or updated (#4997)
Fixes #4996. When any pivot value change or add with relationManager, the filterFields will triggered too.
2020-04-02 09:33:41 -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
Luke Towers
802d8c8e09 Temporary workaround until the L6 upgrade can be merged in to use league/csv >= 9.1 2020-03-31 09:53:35 -06:00
Rike-cz
2fa306b5a7
Add iconv fallback support for mbstring unsupported encodings (#5015) 2020-03-31 09:15:17 -06:00
Luke Towers
cd0b6a791f escape import CSV column names 2020-03-31 04:17:41 -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
Fl0Cri
bd2a774a58
Add UTF-8 BOM when exporting with useList option (#4873)
Same as #1958 but when using the list controller without an ExportModel (with `useList` in the export options)
2020-03-26 13:17:51 -06:00
jacobdekeizer
3450921c26
Fix docbocks ListController behaviour. (#4989)
* Fix docbocks ListController behaviour.
2020-03-23 20:12:49 +11:00
Flynsarmy
39980d8346
Add formGetRedirectUrl method. (#4954)
Fixes #4946. Documented in https://github.com/octobercms/docs/pull/432
2020-03-22 00:32:27 -06:00
jacobdekeizer
2a86f7b32f
Fix docblocks and imports in FormController behaviour. (#4972) 2020-03-16 11:47:26 +08:00
Samuell
a68f3abf1c
Fix pagination reset if search input is filled (#4918)
Fixes #4914.
2020-02-12 07:52:09 -08: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
Robin Bonnes
9145955978 Adds the ability to override the column header label in import/export. (#4737)
Now we can use the `backend.list.overrideHeaderValue` event also in the import/export.
2019-12-10 20:06:10 +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
Luke Towers
06ba8c712f
Trigger the change.oc.formwidget event on update of records through relationcontroller. (#4673)
Fixes #4625. Credit to @danielbidala for the initial report and proposed fix.
2019-10-08 17:30:02 -06:00
Samuel Georges
2962f75221 Include the JSON parser natively in framework.js
We've also included it as a separate framework.parser.js file in case its needed by some external lib, such as Storm UI
2019-09-14 17:56:18 +10:00
Samuel Georges
ebcb7ee6fd
Add a small JSON Parser to October framework lib (#4527)
* Add a small JSON Parser to October framework lib
2019-09-14 17:29:31 +10: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
Marc Jauvin
a2cb01b65d Add $options param to formRenderField (#4239)
Allow passing options to Form widget's renderField() method. Credit to @mjauvin
2019-04-05 09:06:52 -06:00
Alexander Guth
b3eb95bb62 Make default format options in ImportExportBehaviour configurable (#4200)
Credit to @alxy.

If the default format mode is selected, there is no chance to configure the format options for delimiter, enclosure, escape and encoding. This considers a new config file item `defaultFormatOptions` and falls back to `null` if it is not specified.

To keep things consistent, the old default values remain untouched.
2019-04-01 13:00:41 -06:00
Samuel Georges
5190c8177b Avoid terminating the app using exit() or die()
Refs #3783
Refs #3746
2019-03-29 07:10:07 +11: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
fansaien
8a60d3c19a Fire backend.list.extendRecords event during export useList (#4148)
Provides an opportunity to modify and / or return the $results collection object before the controller exports it. Credit to @fansaien
2019-02-19 17:14:32 -06:00
Luke Towers
5853cc54c4 Ensure that FormWidgets are correctly initialized with previewMode even on AJAX requests 2019-01-10 17:39:41 -06:00
Ben Thomson
63dfb7fad3 Replace deprecated prepareModel call in ImportExport behavior 2018-12-30 16:35:17 +08:00
Jim Cottrell
34da61805b Replace URL parameters dynamically without needing a list in advance (#3361)
Fixes #3358. Credit to @jimcottrell
2018-12-18 10:03:03 -06:00
Tobias Kündig
7a277b4b9c Added support for dependsOn with relationships (#3539)
Credit to @tobias-kuendig. Added $.oc.relationBehavior.changed function. To keep track of changes made using the relation controller this new "changed" function is called every time a record is created, added, removed or deleted. The function triggers the change.oc.formwidget event on the form field that belongs to this relation controller so other form fields are notified about the changes.
2018-12-03 10:08:00 -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
Nathan van der Werf
6fb6211c56 Escape output to prevent XSS injections (#3924)
Credit to @nathan-van-der-werf
2018-11-15 15:05:44 -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
743252c3ff
Merge branch 'develop' into feature/cleanup
# Conflicts:
#	modules/backend/widgets/Form.php
2018-08-29 19:18:01 +02:00
Samuel Georges
2d77565e6c Peer review 52d1388e4e7d7165695af889f8dcc861086ad012
This uses a simpler approach and leverages improvements to the validation trait
See 574031d3ee
Refs #2489
2018-08-29 12:19:33 +10:00
Luke Towers
52d1388e4e Automatically use field labels as custom attribute names for a nicer validation message
Fixes #2489
2018-08-26 13:39:49 -06:00
Nathan van der Werf
8fd16d4db6
Merge branch 'develop' into feature/cleanup
# Conflicts:
#	modules/backend/formwidgets/FileUpload.php
2018-08-24 19:52:54 +02:00
Nathan van der Werf
0f0d108da0
Remove unused imports 2018-08-24 19:51:59 +02:00
Luke Towers
4078e6a56f Provide inline documentation for the FormWidget events:
Documented the following:
backend.form.beforeRefresh
backend.form.refreshFields
backend.form.refresh
backend.form.extendFieldsBefore
backend.form.extendFields
model.form.filterFields
2018-08-15 21:00:31 -06: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
Nathan van der Werf
3a918ad200 Remove "null" assignments 2018-08-15 18:33:24 +02:00
Steve Mortimer
5936107c07 Reset pagination on filter scope change (#3632)
Fixes #3610. Credit to @stevemortimer
2018-07-16 09:43:47 -04:00