NPM Resource Changed ?

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
23 Dec 2021

First pass for files already using $wa to make sure all scripts are loaded with the web asset manager

code review

avatar brianteeman brianteeman - open - 23 Dec 2021
avatar brianteeman brianteeman - change - 23 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Dec 2021
Category Administration com_associations com_cache com_config com_content com_contenthistory com_finder com_installer com_joomlaupdate com_menus com_users
124512d 23 Dec 2021 avatar brianteeman more
avatar brianteeman brianteeman - change - 23 Dec 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Dec 2021
Category Administration com_associations com_cache com_config com_content com_contenthistory com_finder com_installer com_joomlaupdate com_menus com_users Administration com_associations com_cache com_config com_content com_contenthistory com_finder com_installer com_joomlaupdate com_menus com_messages com_plugins com_redirect com_users com_workflow Front End com_contact
avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

The indentation of the chained method calls is wrong in almost every file modified and should be corrected.

avatar brianteeman
brianteeman - comment - 23 Dec 2021

Can you give me an example please - as the current core was kind of hard to work out how it should be

avatar brianteeman
brianteeman - comment - 23 Dec 2021

did you mean that this

$wa	->useScript('multiselect')
	->useScript('com_installer.changelog');

should be

$wa->useScript('multiselect')
	->useScript('com_installer.changelog');

734e00f 23 Dec 2021 avatar brianteeman tab
avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Well once again we reach a corner of the decade old Joomla Coding Standards that doesn't take modern code into account and there is no defined example in the standard (hence why phpcs passes in drone) however there are some examples (that contradict each other) in the last 2 code blocks on the https://developer.joomla.org/coding-standards/php-code.html page.

Yes, I mean those chained things.

In the absence of a defined standard I would go for something with the arrows aligned and no spaces before the first arrow and the object:

$wa->useScript('multiselect')
   ->useScript('com_installer.changelog');

PHPStorm seems to do something different

PSR-12 has nothing to say on the matter and neither does PSR-2

So I guess just pick one, and implement it consistently.

At the moment your PR has a myriad of different examples of indentation and spaces after the initial object.

avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Other well used examples are:

$this->fooService
    ->doBar()
    ->doBaz();
$this
    ->fooService
    ->doBar()
    ->doBaz();
avatar brianteeman
brianteeman - comment - 23 Dec 2021

they should all be the same now. viewing on github always accentuates the tab display

avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Yes I see they are all the same now and using tabs.... looks horrid in the Github diff still

Screenshot 2021-12-23 at 14 09 43

Looks wrong in phpStorm too

Screenshot 2021-12-23 at 14 09 15

but looks ok in markdown before submitting
Screenshot 2021-12-23 at 14 09 56

and after using phpStorm to "cleanup" the file it looks even more crazy
Screenshot 2021-12-23 at 14 10 22

I give up :) as long as they are consistent its not so obvious I guess. Thanks for trying.

avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Actually looking again the GitHub and the phpStorm(after cleanup) look the same - so lets go with what you have now.
Screenshot 2021-12-23 at 14 10 22

avatar brianteeman
brianteeman - comment - 23 Dec 2021

the pr is just for using web assets and not coding standards. It was my copy/paste error that introduced an extra tab that I have now removed

avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Every PR should be about Code Standards. That's literally the whole point of standards.

avatar PhilETaylor
PhilETaylor - comment - 23 Dec 2021

Here is an example from Joomla 4 - which contradicts your chosen indentation (two tabs tab) for multi line chained selects and uses one tab and not two... I guess its acceptable to just do whatever...

Screenshot 2021-12-23 at 14 17 21

avatar brianteeman
brianteeman - comment - 23 Dec 2021

sorry phil but that is exactly the same as this pr. you are getting confused by the github ui using 8spaces for a tab

avatar brianteeman
brianteeman - comment - 2 Jan 2022

Would be great if this could be tested and merged as there are dependent pull requests to be created afterwards

avatar brianteeman
brianteeman - comment - 4 Jan 2022

oh well another release goes by

avatar Fedik
Fedik - comment - 7 Jan 2022

There a bug in multiselect.js, it require scriptOption.
Your changes will load multiselect.js but it will be inactive.

Need to update this:

const onBoot = () => {
if (!Joomla) {
// eslint-disable-next-line no-new
new JMultiSelect('#adminForm');
} else if (Joomla.getOptions && typeof Joomla.getOptions === 'function' && Joomla.getOptions('js-multiselect')) {
if (Joomla.getOptions('js-multiselect').formName) {
// eslint-disable-next-line no-new
new JMultiSelect(`#${Joomla.getOptions('js-multiselect').formName}`);
} else {
// eslint-disable-next-line no-new
new JMultiSelect('#adminForm');
}
}
};

To:

  const onBoot = () => {
    let formId = '#adminForm';
    if (Joomla && Joomla.getOptions('js-multiselect', {}).formName) {
      formId = `#${Joomla.getOptions('js-multiselect', {}).formName}`;
    }
    // eslint-disable-next-line no-new
    new JMultiSelect(formId);
  };

And it need to be tested, at least on "articles" view, if it works there, then it will work in other places also.

avatar brianteeman
brianteeman - comment - 7 Jan 2022

Are you sure that its this change that is stopping it working?

There is already an open issue from 2019 that it didnt work #25500

avatar brianteeman
brianteeman - comment - 7 Jan 2022

forgot to add I tested your change and it didnt fix it

avatar Fedik
Fedik - comment - 7 Jan 2022

Are you sure that its this change that is stopping it working?

Yes, I do not know all features, but I tested simple click on the row (and console.log() for check initialization), before the patch it worked, and after the patch it stopped.
So I did code changes (that I suggested previously), to fix the boot() method.

avatar brianteeman
brianteeman - comment - 7 Jan 2022

I didn't observe any change in behaviour

avatar Fedik
Fedik - comment - 8 Jan 2022

I didn't observe any change in behaviour

Do next:
Open Articles table. Click on any row (not checkbox directly). You should see that associated checkbox checked automatically.
Then remove HTMLHelper::_('behavior.multiselect'); and add useScript('multiselect') in administrator/components/com_content/tmpl/articles/default.php, and try the same test, now the click on the row does not do anything.

avatar brianteeman
brianteeman - comment - 8 Jan 2022

didnt know you could click on the row - will fix that in this pr with your code. Still leaves the open shift select issue

avatar Fedik
Fedik - comment - 8 Jan 2022

Still leaves the open shift select issue

Yeap, that seems a main point of use multiselect.js (in joomla 2 and 3), without this feature it useless and can be just trashed.
But it another issue.

avatar brianteeman
brianteeman - comment - 8 Jan 2022

Also didnt help my tests that I had made a mistake in com_content and put the change inside an if block for workflows

avatar joomla-cms-bot joomla-cms-bot - change - 8 Jan 2022
Category Administration com_associations com_cache com_config com_content com_contenthistory com_finder com_installer com_joomlaupdate com_menus com_users com_messages com_plugins com_redirect com_workflow Front End com_contact Administration com_associations com_cache com_config com_content com_contenthistory com_finder com_installer com_joomlaupdate com_menus com_messages com_plugins com_redirect com_users com_workflow JavaScript Repository NPM Change Front End com_contact
avatar brianteeman
brianteeman - comment - 8 Jan 2022

Multiselect is now working exactly as it was before this pr

avatar brianteeman brianteeman - change - 8 Jan 2022
Labels Added: NPM Resource Changed
avatar Fedik
Fedik - comment - 8 Jan 2022

I have tested this item successfully on 1805818


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36373.

avatar Fedik Fedik - test_item - 8 Jan 2022 - Tested successfully
avatar Quy
Quy - comment - 26 Jan 2022

Please fix conflicts.

avatar brianteeman
brianteeman - comment - 26 Jan 2022

Please fix conflicts.

Less of a conflict and more of a "shouldnt have been merged in the first place" - fixed

avatar Quy Quy - test_item - 26 Jan 2022 - Tested successfully
avatar Quy
Quy - comment - 26 Jan 2022

I have tested this item successfully on 2e7d7b6


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36373.

avatar Quy Quy - alter_testresult - 26 Jan 2022 - Fedik: Tested successfully
avatar Quy Quy - change - 26 Jan 2022
Status Pending Ready to Commit
avatar Quy
Quy - comment - 26 Jan 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36373.

avatar bembelimen
bembelimen - comment - 31 Jan 2022

Thx

avatar brianteeman
brianteeman - comment - 31 Jan 2022

great thanks - now I can fix the rest

Add a Comment

Login with GitHub to post a comment