J4 Issue ?
avatar chmst
chmst
25 May 2018

Open a new article of a multilingual site. Got to Tab Associations.
There are as many alerts as you have content languages.

Expected result

One info-alert for content languages

Actual result

As many alerts as languages

System information

Joomla V4.0 dev.
The message is used in media/com_associations/js/associations.edit.js: Joomla.showAssociationMessage = function(),
screen shot 2018-05-25 at 09 54 56

avatar chmst chmst - open - 25 May 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 May 2018
avatar chmst chmst - change - 25 May 2018
The description was changed
Title
Multiple alerts on mltilingual associations
Multiple alerts on multilingual associations
avatar chmst chmst - edited - 25 May 2018
avatar chmst chmst - edited - 25 May 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 25 May 2018
Title
Multiple alerts on multilingual associations
[4.0] Multiple alerts on multilingual associations
avatar joomla-cms-bot joomla-cms-bot - edited - 25 May 2018
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 25 May 2018

changed Title to make clear its about 4.0

avatar infograf768
infograf768 - comment - 25 May 2018

Issue confirmed.
@dgrammatiko
This happened when you modified the file to not use JQuery

avatar infograf768
infograf768 - comment - 25 May 2018

I think I found the reason:
Joomla.showAssociationMessage = function() is adding the message for each Control group.

Can you set debug on (which will use the non minified js version) and then edit /media/com_associations/js/associations-edit.js
and replace the function with this code:

	Joomla.showAssociationMessage = function()
	{
		var controlGroup = document.querySelectorAll('#associations .control-group');

		for (var i = 0, l = controlGroup.length; i < l; i++) {
			controlGroup[i].style.display = 'none';
		}
		
		var associations = document.getElementById('associations');

		if (associations) {
			var html = document.createElement('div');
			html.classList.add('alert')
			html.classList.add('alert-info')
			html.id = 'associations-notice';
			html.innerHTML = Joomla.JText._('JGLOBAL_ASSOC_NOT_POSSIBLE');

			associations.insertAdjacentElement('afterbegin', html);
		}
	}
avatar chmst
chmst - comment - 25 May 2018

Yes, works! Great :)

avatar dgrammatiko
dgrammatiko - comment - 25 May 2018

Sorry there are no div ALERTS anymore, use joomla-alert Also we have a helper to create alerts...

avatar chmst
chmst - comment - 25 May 2018

That's another scope. Here it is a loop in the js over content languages. But thank you for the hint. @infograf768 would you make a PR?

avatar dgrammatiko
dgrammatiko - comment - 25 May 2018

@chmst NOPE. Please do not use Bootstrap classes that will not be included in J4. We already have our own components for alerts, use that!!!

avatar infograf768
infograf768 - comment - 25 May 2018

@dgrammatiko
It was not my intention to make a PR. I just checked were the error was in the js (which still uses div alerts).
As I would not know how to code <joomla-alert in a js, please do PR yourself.

avatar brianteeman brianteeman - change - 26 May 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 26 May 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 May 2018
Status New Discussion
avatar infograf768
infograf768 - comment - 25 Jul 2018

I have a patch ready using joomla-alert. Waiting for @dgrammatiko to correct a bug when compiling the js files.

avatar infograf768
infograf768 - comment - 28 Jul 2018

@chmst
Closing as we have a PR
#21281

avatar infograf768 infograf768 - close - 28 Jul 2018
avatar infograf768 infograf768 - change - 28 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-28 09:52:48
Closed_By infograf768

Add a Comment

Login with GitHub to post a comment