Skip to content
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

Fix errors exposed by strict and also improve js #20221

Conversation

okonomiyaki3000
Copy link
Contributor

Pull Request for Issue # .

Summary of Changes

This is just #12544 plus some additional improvements.
While that older PR was aimed only at fixing the "strict" errors, this one fixes other problems.
In particular, button groups (radio buttons) will now work properly when used inside of subforms.
Same for Chosen selectors that use coloring based on state.
Also, delegation is used to handle various events. This has several benefits.

This is only a rewrite of the first part of this file. There is likely much more that can be improved.

Testing Instructions

This file only affects the administrator when using the Isis template so use that.
First of all, nothing should be broken. This mainly affects Chosen, radio button groups, and tooltips. So check any pages that have those things.

The main improvements apply to subforms. Subforms with radio buttons set up as btn-group should be tested. There are probably none of these in Joomla because they didn't really work before this patch. So make one and test it. Same goes for Chosens used in subforms with the chzn-color-state class.

Expected result

When you dynamically add a subform row that contains radio buttons, Chosen, or tooltips, these things should be initialized properly in the new row. Before this patch they were not.

Actual result

Oh, it works.

Documentation Changes Required

Probably not. Unless there were previously some documented warnings about using radio buttons or Chosens in subforms. If so, those warnings may be deleted as they will no longer apply.

@okonomiyaki3000
Copy link
Contributor Author

If you want to test subforms, there's one here: plugins/system/redirect/form/excludes.xml
This creates a repeatable subform in the Redirect plugin config. If you add some fields this file, you can easily test that they are working properly.

@okonomiyaki3000
Copy link
Contributor Author

This 'drone' failure seems to have nothing at all to do with these changes.

@Quy
Copy link
Contributor

Quy commented Apr 24, 2018

Can you confirm that this addresses the same things as #19722?

@okonomiyaki3000
Copy link
Contributor Author

@Quy This PR addresses the Isis template only, #19722 addresses beez3 and protostar as well. Since this one is on top of #12544, it also includes the "strict" fixes which really should have been merged by now. Other than that, it's really an issue of which adds more overhead and complexity to the code and which one reduces it. I'll recuse myself from sharing any opinion on that matter.

@okonomiyaki3000
Copy link
Contributor Author

I've created #20224 and #20225 to fix the same issues in Beez3 and Protostar. These three together are an alternative to #19722

@Sophist-UK
Copy link
Contributor

As the author of #19722 I am happy to close my PR, and for this PR and #20224 / #20225 to replace them - though I hope @okonomiyaki3000 will consider and include my recent comments in #19722.

@dgrammatiko
Copy link
Contributor

Just few comments here:

  • First of all thanks for this PR
  • The js functionality for the group buttons does not belong to the template, it must be triggered in the layout of the checkboxes (or whatever the layout name is that renders those buttons). These are joomla fields and the js should be there!
  • Unfortunately this cannot be done in J3 without risking breaking a lot of components/plugins/modules
  • For J4 these buttons (as all the rest of the fields) will be done using custom elements (one of the good things with this approach is that we don't need and coupling [events or callback] for the subform)
  • It would be greatly appreciated if you can do a PR against 4.0-dev to remove the jQuery dependency and make this a custom element and also couple it to the actual layout. That is already in our todo list: [4.0] Move interactive fields to custom Elements #19427

@Quy
Copy link
Contributor

Quy commented Apr 24, 2018

Is is also possible to include/fix "modal" type as reported in #11805?

@okonomiyaki3000
Copy link
Contributor Author

@Quy It's not appropriate to include it in this PR but yes, I can fix that.

@okonomiyaki3000
Copy link
Contributor Author

LOL, wait.... This is going to take more than most of these. I better jump in over there but please don't think of it as related to this PR and don't expect the fix very soon.

@okonomiyaki3000
Copy link
Contributor Author

What are we gonna do about this drone failure? Is this for real? I don't buy it.

@okonomiyaki3000
Copy link
Contributor Author

Just make it run again. I bet it works this time.

@Quy
Copy link
Contributor

Quy commented Apr 28, 2018

OK to close #12544 ?

@Quy Quy mentioned this pull request May 14, 2018
@infograf768
Copy link
Member

Drone restarted

@okonomiyaki3000
Copy link
Contributor Author

I don't know why this would fail. This PR has nothing to do with jquery.ui.sortable or whatever.

@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 5e66f87


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

@roland-d
Copy link
Contributor

@okonomiyaki3000 I only noticed this PR after merging #12544 and I think because of that merge we have a conflict now. Could you update this PR please?

@okonomiyaki3000 okonomiyaki3000 force-pushed the fix-errors-exposed-by-strict-and-also-improve-js branch from 5e66f87 to 1a09ee9 Compare July 25, 2018 01:01
@okonomiyaki3000
Copy link
Contributor Author

Rebased with latest staging. Should be correct.

@roland-d
Copy link
Contributor

@kneisel @FPerisa Can you please test this one also? Thank you.

@okonomiyaki3000
Copy link
Contributor Author

Don't believe appveyor, it just timed out.

@fancyFranci
Copy link
Contributor

I have tested this item ✅ successfully on 1a09ee9

Subforms are working with this patch, even when I click on the plus.

For testing I added this to excludes.xml:

<field name="myradiovalue"
       type="radio"
       default="0"
       label="Select an option"
       class="btn-group">
   <option value="0">1</option>
   <option value="1">2</option>
</field>
<field name="myselectvalue"
       type="list"
       default="0"
       label="Select an option"
       class="chzn-color-state">
   <option value="0">nimm</option>
   <option value="1">mich</option>
   <option value="2">nicht</option>
</field>
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/20221">issues.joomla.org/tracker/joomla-cms/20221</a>.</sub>

@ghost
Copy link

ghost commented Aug 8, 2018

@viocassel can you please retest?

@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 1a09ee9

It works 😃


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

@Quy
Copy link
Contributor

Quy commented Aug 8, 2018

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 8, 2018
@mbabker mbabker added this to the Joomla 3.8.12 milestone Aug 9, 2018
@mbabker mbabker merged commit c83103e into joomla:staging Aug 9, 2018
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 9, 2018
@okonomiyaki3000 okonomiyaki3000 deleted the fix-errors-exposed-by-strict-and-also-improve-js branch August 10, 2018 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants