-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Com_association js cleanup, fixes #21176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| })(); | ||
| links.forEach(function (item) { | ||
| item.addEventListener('click', function (event) { | ||
| if (self !== top) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of 'self' no-restricted-globals
Unexpected use of 'top' no-restricted-globals
| }); | ||
| })(); | ||
| links.forEach(function (item) { | ||
| item.addEventListener('click', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function expression prefer-arrow-callback
Unexpected unnamed function func-names
| } | ||
| }); | ||
| })(); | ||
| links.forEach(function (item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected unnamed function func-names
Unexpected function expression prefer-arrow-callback
| links = [].slice.call(document.querySelectorAll('.select-link')); | ||
| if (Joomla.getOptions('modal-associations')) { | ||
| var fnName = Joomla.getOptions('modal-associations').func; | ||
| var links = [].slice.call(document.querySelectorAll('.select-link')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
All 'var' declarations must be at the top of the function scope vars-on-top
| var fnName = Joomla.getOptions('modal-associations').func, | ||
| links = [].slice.call(document.querySelectorAll('.select-link')); | ||
| if (Joomla.getOptions('modal-associations')) { | ||
| var fnName = Joomla.getOptions('modal-associations').func; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All 'var' declarations must be at the top of the function scope vars-on-top
Unexpected var, use let or const instead no-var
| @@ -1,15 +1,20 @@ | |||
| /** | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected space or tab before '*/' in comment spaced-comment
| } | ||
| else | ||
| { | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 12 spaces but found 6 tabs indent
Unexpected tab character no-tabs
| } else { | ||
| el = document.getElementById(idFieldArr[1]).value; | ||
| } | ||
| var data_iframe = iframeTextArr[0] + el + iframeTextArr[2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 14 spaces but found 7 tabs indent
Unexpected tab character no-tabs
All 'var' declarations must be at the top of the function scope vars-on-top
Unexpected var, use let or const instead no-var
Identifier 'data_iframe' is not in camel case camelcase
| el = idFieldArr; | ||
| } else { | ||
| el = document.getElementById(idFieldArr[1]).value; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 14 spaces but found 7 tabs indent
Unexpected tab character no-tabs
| if (typeof idFieldArr === 'object') { | ||
| el = idFieldArr; | ||
| } else { | ||
| el = document.getElementById(idFieldArr[1]).value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 16 spaces but found 8 tabs indent
Unexpected tab character no-tabs
| } | ||
| }); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 1 tab indent
Unexpected tab character no-tabs
| Joomla.hideAssociation(formControl, selectedLanguage); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 tabs indent
Unexpected tab character no-tabs
| // Else show the associations fields/buttons and hide the current selected language | ||
| Joomla.hideAssociation(formControl, selectedLanguage); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 3 tabs indent
Unexpected tab character no-tabs
| } else { | ||
| // Else show the associations fields/buttons and hide the current selected language | ||
| Joomla.hideAssociation(formControl, selectedLanguage); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 tabs indent
Unexpected tab character no-tabs
| Joomla.showAssociationMessage(); | ||
| } else { | ||
| // Else show the associations fields/buttons and hide the current selected language | ||
| Joomla.hideAssociation(formControl, selectedLanguage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 10 spaces but found 5 tabs indent
Unexpected tab character no-tabs
| // If associations existed, send a warning to the user | ||
| if (existsAssociations) { | ||
| Joomla.renderMessages({warning: [Joomla.JText._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')]}); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 tabs indent
Unexpected tab character no-tabs
|
|
||
| // If associations existed, send a warning to the user | ||
| if (existsAssociations) { | ||
| Joomla.renderMessages({warning: [Joomla.JText._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')]}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 10 spaces but found 5 tabs indent
Unexpected tab character no-tabs
A space is required after '{' object-curly-spacing
A space is required before '}' object-curly-spacing
| }); | ||
|
|
||
| // If associations existed, send a warning to the user | ||
| if (existsAssociations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 tabs indent
Unexpected tab character no-tabs
| } | ||
| }); | ||
|
|
||
| // If associations existed, send a warning to the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 tabs indent
Unexpected tab character no-tabs
| } else if (clear.click) { | ||
| clear.click(); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 tabs indent
Unexpected tab character no-tabs
| } | ||
|
|
||
| // Call the modal clear button | ||
| const clear = document.getElementById(formControl + '_associations_' + languageCode + '_clear'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected string concatenation prefer-template
| element.style.display = 'block'; | ||
|
|
||
| // Check if there was an association selected for this language | ||
| if (!existsAssociations && document.getElementById(formControl + '_associations_' + languageCode + '_id').value !== '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected string concatenation prefer-template
|
|
||
| let existsAssociations = false; | ||
|
|
||
| // For each language, remove the associations, ie, empty the associations fields and reset the buttons to Select/Create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 70 exceeds the maximum line length of 100 max-len
| Joomla.showAssociationMessage(); | ||
| } else { | ||
| // Hide only the associations for the current language | ||
| if (formControlLanguage) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected if as the only statement in an else block no-lonely-if
| const formControlLanguage = document.getElementById(formControl + '_language'); | ||
|
|
||
| // Hide the associations tab if needed | ||
| if (parseInt(associationsEditOptions.hidden) === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing radix parameter radix
|
|
||
| if (Joomla.getOptions('modal-associations')) { | ||
| const fnName = Joomla.getOptions('modal-associations').func; | ||
| const links = [].slice.call(document.querySelectorAll('.select-link')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple spaces found before '=' no-multi-spaces
| 'use strict'; | ||
|
|
||
| document.addEventListener('DOMContentLoaded', () => { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed no-trailing-spaces
| ((Joomla, document) => { | ||
| 'use strict'; | ||
|
|
||
| document.addEventListener('DOMContentLoaded', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block must not be padded by blank lines padded-blocks
| */ | ||
| Joomla.submitbutton = (pressbutton) => { | ||
| if (pressbutton === 'associations.purge') { | ||
| if (confirm(Joomla.JText._('COM_ASSOCIATIONS_PURGE_CONFIRM_PROMPT'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of 'confirm' no-restricted-globals
| * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
| Joomla.submitbutton = (pressbutton) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected to return a value at the end of arrow function consistent-return
|
|
||
| links.forEach((item) => { | ||
| item.addEventListener('click', (event) => { | ||
| //eslint-disable-next-line no-restricted-globals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected exception block, space or tab after '//' in comment spaced-comment
| Joomla = window.Joomla || {}; | ||
|
|
||
| ((Joomla, document) => { | ||
| 'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected newline after "use strict" directive lines-around-directive
| */ | ||
| Joomla.submitbutton = (pressbutton) => { | ||
| if (pressbutton === 'associations.purge') { | ||
| //eslint-disable-next-line no-restricted-globals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected exception block, space or tab after '//' in comment spaced-comment
| * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
| Joomla.submitbutton = (pressbutton) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected to return a value at the end of arrow function consistent-return
|
Original Issue is #18552 Test Unsuccessful: Code comparison for menu item (debug ON) Your PR Remark in your PR the use of |
|
Also, can you integrate the changes |
|
|
||
| links.forEach((item) => { | ||
| item.addEventListener('click', (event) => { | ||
| target.src = target.getAttribute("data-editurl") + '"&task="' + target.getAttribute("data-item") + ".edit" + "&id=" + parseInt(event.target.getAttribute('data-id'), 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected string concatenation prefer-template
Strings must use singlequote quotes
Unexpected string concatenation of literals no-useless-concat
| 'use strict'; | ||
|
|
||
| document.addEventListener('DOMContentLoaded', () => { | ||
| const target = window.parent.document.getElementById("target-association"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
|
Thanks. It works fine now. Remains to add the same modifications as what has been done in #21180 to get correct contacts and newsfeeds associations fields. |
|
will test it OK when conflict fixed. |
|
@infograf768 conflict resolved |
|
I have tested this item ✅ successfully on 92a08ec This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21176. |
|
I have tested this item ✅ successfully on 911b15f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21176. |
|
Good job! |

Pull Request for Issue # .
Summary of Changes
Testing Instructions
@infograf768 you might be the only one here that knows what was broken, so please test and also provide some info for others to know how to test
Expected result
Modal opens
Actual result
Modal doesnt appear and also there was a console error
Documentation Changes Required
Hopefully not