? NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
31 Dec 2019

@HLeithner
as discussed this is a draft of displaying a static message in com_redirects instead of the ever repeating alerts.

I would massively appreciate a code review to see if this is correct (it works but maybe the code can be improved).

We will also need something (javascript?) to reload the page after saving a change in the plugin modal so that the message is refreshed. I assume that this will be something like the code in admin-add_module.js but I really am stabbing in the dark with es6

I did look at various other ways of achieving this including a layout override for messages.php but nothing else worked well and didnt also effect the alerts that we want for item saved etc

The same approach can be used for com_finder

Related discussion at #27380

avatar brianteeman brianteeman - open - 31 Dec 2019
avatar brianteeman brianteeman - change - 31 Dec 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Dec 2019
Category Administration com_redirect
avatar brianteeman brianteeman - change - 31 Dec 2019
Title
[4.0] static messages for com_redirect etc
[4.0] DRAFT static messages for com_redirect etc
avatar brianteeman brianteeman - edited - 31 Dec 2019
avatar brianteeman brianteeman - change - 31 Dec 2019
The description was changed
avatar brianteeman brianteeman - edited - 31 Dec 2019
avatar richard67
richard67 - comment - 31 Dec 2019

@brianteeman Shouldn't the COM_REDIRECT_PLUGIN_MODAL_DISABLED message be shown in any case if the plugin is disabled, regardless of collectUrlsEnabled?

If so, code could be changed and simplified from

if (!$pluginEnabled && !$collectUrlsEnabled)
{
	$this->msg = Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link);
}
if ($pluginEnabled && !$collectUrlsEnabled)
{
	$this->msg = Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link);
}

to

if (!$pluginEnabled)
{
	$this->msg = Text::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link);
}
elseif (!$collectUrlsEnabled)
{
	$this->msg = Text::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', Text::_('COM_REDIRECT_PLUGIN_ENABLED'), $link);
}
avatar brianteeman
brianteeman - comment - 31 Dec 2019

it should be

  • if plugin disabled
  • if plugin enabled and collect disabled
avatar richard67
richard67 - comment - 31 Dec 2019

it should be

* if plugin disabled

* if plugin enabled and collect disabled

@brianteeman Yes, but like you have it now it is

  • if plugin disabled and collect disabled
  • if plugin enabled and collect disabled

If you use 2 if or one if and else is then a matter of taste.

But the first if condition if (!$pluginEnabled && !$collectUrlsEnabled) for showing the COM_REDIRECT_PLUGIN_MODAL_DISABLEDtext needs to be corrected to if (!$pluginEnabled).

avatar brianteeman brianteeman - change - 31 Dec 2019
Labels Added: ?
avatar richard67
richard67 - comment - 31 Dec 2019

@brianteeman Code review looks good to me. Is it still a draft, or shall we start testing?

avatar brianteeman
brianteeman - comment - 31 Dec 2019

you can test but I really want to k ow from @HLeithner if this is a valid approach
and still need some help with js part

avatar richard67
richard67 - comment - 31 Dec 2019

Ah, yes, I forgot about the js part. Sorry I can't help with that.

avatar Quy
Quy - comment - 31 Dec 2019

Richard’s proposed code is better in that when the first check is true then there is no need to perform the second check.

avatar richard67
richard67 - comment - 31 Dec 2019

Well, my code maybe might save a few atoseconds, but maybe Brian's code is easier to understand when reading, so I am ok with it.

avatar HLeithner
HLeithner - comment - 31 Dec 2019

There is way too much logic in the template, that should all be done in the model and view in my opinion and only a "if $showwarning then echo" should be in the template...

avatar brianteeman
brianteeman - comment - 31 Dec 2019

I thought that would be the case. Any help greatly appreciated

avatar HLeithner
HLeithner - comment - 31 Dec 2019

I will see what I can do tomorrow

avatar infograf768
infograf768 - comment - 1 Jan 2020

There is way too much logic in the template, that should all be done in the model and view in my opinion and only a "if $showwarning then echo" should be in the template...

That is exactly what I suggested in #27380 (comment)

  1. Create a new method in the model
  2. Set the variable obtained in the display method in HtmlView
  3. And only the div and echo in default.php if variable is not null
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jan 2020
Category Administration com_redirect Administration com_redirect Language & Strings
2da2f74 1 Jan 2020 avatar brianteeman cs
avatar brianteeman brianteeman - change - 1 Jan 2020
Labels Added: ?
avatar richard67
richard67 - comment - 1 Jan 2020

PHP code review looks good to me, and I've just tested it with success. Now only JS part is missing. Maybe this could also update the redirect view after having enabled the plugin, so the displayed messages adapt accordingly.

P.S.: Maybe just force a page reload after having enabled the plugin?

avatar joomla-cms-bot joomla-cms-bot - change - 1 Jan 2020
Category Administration com_redirect Language & Strings Administration com_finder com_redirect Language & Strings
avatar brianteeman brianteeman - change - 1 Jan 2020
Title
[4.0] DRAFT static messages for com_redirect etc
[4.0] DRAFT static messages for com_redirect/finder etc
avatar brianteeman brianteeman - edited - 1 Jan 2020
avatar brianteeman
brianteeman - comment - 1 Jan 2020

Now added the same for com_finder with the added bonus that the plugin settings are now changed in a modal and not by redirevting to com_plugins

avatar brianteeman
brianteeman - comment - 15 Jan 2020

@Fedik any help on the javascript?

avatar Fedik
Fedik - comment - 15 Jan 2020

@brianteeman I have made pull request, please check

Note, I would prefer inline editing, without modal. Modal always hard on mobiles.

Like:
Open plugin form => save&close => redirect back to com_finder,
In theory that should be possible with append of &return=base64-url-to-return, and maybe with some editing of the plugin form layout .

avatar joomla-cms-bot joomla-cms-bot - change - 15 Jan 2020
Category Administration com_redirect Language & Strings com_finder Administration com_finder com_redirect Language & Strings JavaScript Repository NPM Change
avatar brianteeman
brianteeman - comment - 15 Jan 2020

@Fedik maybe i did something wrong or maybe i explained the problem wrong

with content-smart search plugin disabled you get the message to enable the plugin
you click on the plugin and enable it and save and close

at this point I was expecting the page to refresh so that the message is no longer displayed

avatar Fedik
Fedik - comment - 16 Jan 2020

Did you get the page reload after "save and close"? (even if message still there)

After JS changes, it should be like you said (not forget npm , to update JS).
One thing I am afraid, it can show cached page, by browser.

avatar brianteeman brianteeman - change - 3 Feb 2020
Labels Added: NPM Resource Changed
avatar brianteeman
brianteeman - comment - 16 Feb 2020

Did you get the page reload after "save and close"? (even if message still there)

No

avatar brianteeman
brianteeman - comment - 20 Jun 2020

Closing as we no longer have popup alerts

avatar brianteeman brianteeman - close - 20 Jun 2020
avatar brianteeman brianteeman - change - 20 Jun 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-06-20 18:33:33
Closed_By brianteeman

Add a Comment

Login with GitHub to post a comment