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
[4.0] spinner as web component #22491
Conversation
if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} | ||
});" | ||
); | ||
*/ |
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.
Needs to get removed or?
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.
Yup this inline script cannot be overridden unless you create a plugin (which might not even possible to do in j4 due to name spacing). Asset loading should happen only in layouts
// Preload spindle-wheel when we need to submit form due to category selector changed | ||
\Joomla\CMS\Factory::getDocument()->addScriptDeclaration( | ||
<<<JS | ||
document.addEventListener('DOMContentLoaded', function() { |
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.
This part should be added only when custom fields are involved
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.
It needs a wrapper similar to the one one top
@@ -113,7 +110,7 @@ jQuery(document).ready(function($) { | |||
target.setAttribute('data-language', selected.split(':')[0]); | |||
|
|||
// Iframe load start, show Joomla loading layer. | |||
Joomla.loadingLayer('show'); | |||
document.body.appendChild(document.createElement('joomla-core-loader')); |
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.
indent
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.
Actually this file needs to be converted to es6 and vanilla js. The indentation won’t solve the real problems here
@@ -168,7 +165,8 @@ jQuery(document).ready(function($) { | |||
}); | |||
|
|||
// Iframe load finished, hide Joomla loading layer. | |||
Joomla.loadingLayer('hide'); | |||
var spinner = document.querySelector('joomla-core-loader'); |
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.
indent
|
||
const template = document.createElement('template'); | ||
template.innerHTML = `<style>{{CSS_CONTENTS_PLACEHOLDER}}</style> | ||
<div><span class="yellow"></span><span class="red"></span><span class="blue"></span><span class="green"></span><p>®</p></div>`; |
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.
indent
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.
This is correctly indented, the contents are part of the template therefore they don’t obey the the cs of the js, something like `<<<JS
` in php world
installation/template/js/setup.js
Outdated
@@ -12,7 +12,7 @@ | |||
Joomla.setlanguage = function(form) { | |||
var data = Joomla.serialiseForm(form); | |||
|
|||
Joomla.loadingLayer("show"); | |||
document.body.appendChild(document.createElement('joomla-core-loader')); |
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.
indent
} else { | ||
Joomla.loadingLayer("hide"); | ||
var el = document.querySelector('joomla-core-loader') |
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.
indent
There are multiple issues being addressed in this one pr and it really should be one issue per pr. It makes testing much more reliable and avoids parts of the pr not being tested etc |
It’s a take it or leave it... |
Thats a shame as its not the right thing to do (as you well know) and its the reason why whe in the past pr's with multiple issues were merged we are wasting time undoing all the mistakes. |
maybe can you please skip the category field for now? it will have a huge conflict with #22263 |
@Fedik unfortuanatelly this is a really poor implementation with so many anti patterns so at some point it needs to be done.
I know it’s a pain but at some point these needs to be done correctly... |
As I am currently wasting a lot of time redoing a lot of work that was committed in error because it was not tested properly because it was buried in a big pr with other things we must stop accepting any pr that addresses multiple issues at the same time. It is a waste of people's limited time to have to redo things that were not able to be tested! |
Ok good luck |
Pull Request for Issue # .
Summary of Changes
Testing Instructions
Install Joomla, spinner is ok
Make sure that you have custom fields assigned to one category. Edit an article and change its cat to the one that custom fields are attached. spinner is ok
Try a multilingual and check if the spinner works ok
Expected result
Actual result
Documentation Changes Required
In 4.0 in each page that a spinner is needed the following steps will need to be done:
if you want to use the same codebase for different versions (j3 and j4) here is a quick code: