? Pending

User tests: Successful: Unsuccessful:

avatar dgt41
dgt41
18 Mar 2017

Redo of #12399 .

Summary of Changes

Remove inline scripts:

  • submitbutton is beefed up in core.js
  • editor save is controlled by the editor (editor.on('submit', ...)
  • permissions override is controlled by the permissions.js

Testing Instructions

Test that article save, save and new, save and close and cancel still works
Test that http://j4a.dev/administrator/index.php?option=com_config buttons: save, save and close, cancel still work as expected

Expected result

Same as before

Actual result

Same as before

Documentation Changes Required

There is one extra data attribute in the form tag named data-cancel-task="string", which is required only for forms that the cancel task is not the default e.g. controllerName.cancel.
This will not affect any 3rd party app, the override still works as before 100% B/C !!!

avatar dgt41 dgt41 - open - 18 Mar 2017
avatar dgt41 dgt41 - change - 18 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Mar 2017
Category Administration com_admin com_banners com_categories com_config com_contact com_content com_fields com_finder com_languages com_menus com_messages com_modules com_newsfeeds com_plugins com_redirect com_tags com_templates com_users JavaScript
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 Mar 2017

Save result in Error:
bildschirmfoto 2017-03-18 um 11 48 11

avatar dgt41
dgt41 - comment - 18 Mar 2017

@franz-wohlkoenig that's unrelated to this PR, this is a PHP error meaning that the js functioned as expected (the form was submitted) but for some reason the actual save failed.
So although you got an error you have a successful test :)

avatar wilsonge wilsonge - change - 18 Mar 2017
Labels Added: ?
avatar wilsonge wilsonge - change - 18 Mar 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-03-18 11:37:21
Closed_By wilsonge
avatar wilsonge wilsonge - close - 18 Mar 2017
avatar wilsonge wilsonge - merge - 18 Mar 2017
avatar Fedik
Fedik - comment - 19 Mar 2017

here was merged 3 issue:

data-cancel-task="string"

It is wrong approach, really wrong. And it need just for skip validation, and nothing more.
Then would be better to improve the toolbar buttons, to allow to define "which action should be validated", see: standard.php#L96 _getCommand
Instead of use data-cancel-task hack

permissions in the core

why it here at all?
it can be moved to permissions.js easily, see another example permissions.js#L136

var form = document.querySelectorAll( 'form.form-validate' );

this can return multiple forms, BUT you cannot submit them all (without ajax), always will be submitted only last from the array.
Possible solution is use generic id for the content forms, as it was in the past with adminForm id.

avatar dgt41
dgt41 - comment - 19 Mar 2017

@Fedik the permission part has been already moved to permissions.js
The cancel part needs some touches to the toolbar as the plan is to remove all the crappy inline scripts then that will be fixed there.
For the third issue I guess a simple if id===adminForm will do
The javascript is a WIP, feel free to PR other solution if you feel that the proposed one is not enough ;)

Add a Comment

Login with GitHub to post a comment