-
Notifications
You must be signed in to change notification settings - Fork 333
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
CMSMain - Fixed and enhanced BatchActionParameters #2746
CMSMain - Fixed and enhanced BatchActionParameters #2746
Conversation
+ Fixed the $batchActions variable by making it use the `registeredActions()` method + Made the loop use `FieldHolder` instead of `Field` so CMS fields display correctly + Added hidden styles to the batch action div for jQuery show/hide functionality (found in Admin module PR)
Glanced over it and it seems ok, I suspect the admin PR needs to be merged first for the display:none styles to work? I guess we don't want to hide the fields randomly without the admin changes. Do we need to add a minimum version constraint to composer.json to ensure the dependencies work together correctly? Or is there a way to make it safe without the admin PR? |
Hey Michal @michalkleiner, thanks for giving this a look over. I appreciate your time. As for your question, as far as I'm aware the If I'm correct (and didn't just miss the references somehow) then this PR should (theoretically?) be safe as is. |
That being said, I almost have the second PR complete, so we can wait until after that one's done |
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.
Just a few changes from a linting POV.
As a whole it looks good, though I haven't tried it locally yet. Will wait for the other PR but I share the same concerns as @michalkleiner
@GuySartorelli I made the changes you asked for. Unfortunately I'm not very familiar with the pull request process. I see that the changes are listed, but do I need to do anything else to incorporate them into the pull request? |
Nope, you've done it correctly. As soon as you pushed the changes to your branch, they became part of the PR. |
+ Made the linting changes requested by @GuySartorelli + Added method documentation for BatchActionParameters()
Oh okay, perfect 👍 . As for the squash, I've honestly never done one before 😅, but if you need it done I would be willing to learn. |
@mooror the only concern (from the cross-repo PRs and composer constraints perspective) is basically adding the display:none to the field. Would that have an impact if the other PR wasn't created? Could we e.g. only add it to a second and subsequent field so it won't have any impact for the current state of things? |
I think I understand where your coming from Michal, as even if there was no existing code that calls the return new LiteralField("BatchActionParameters", '<div id="BatchActionParameters" style="display:none">'.$pageHtml.'</div>'); Even without my PR, anyone who would use the method in the future would have to write some code (presumably javascript code) to remove the "display:none" and display the field. So to my mind, the addition of the second "display:none" on the inner If you guys think it will be a big issue, I can try to rewrite the javascript to automatically add "display:none" at execution time instead. I just thought this way would be more performant |
Ah, ok, that's the piece I was missing (or overlooked) that the method wasn't called from anywhere before. In that case it's probably safe(-ish) to merge this PR first. There might be folks who used it as it's a public method but since we're merging it to I'm giving it a ✅ from the code changes perspective but would defer to @GuySartorelli on the mergeability/destination branch for the PR. |
I agree, given that it's effectively dead code without this PR the risk is pretty low. I have no problems with it as an enhancement targetting |
@michalkleiner Ah okay, that makes sense, and you're right that it's possible someone may have call the method in their module. Thinking about it now, I suppose the chances of that are pretty low as it wasn't even documented, but then again if I found it someone else attempting the same thing may have used it to created a work around. Hadn't thought of that
Also, I'm not vary familiar with Silverstripe's branch structure and release cycle, so when I submitted the PR, I assumed that the 4 branch was the working branch that silverstripe 4.X branches would be created from (meaning this change would theoretically be added when 4.12 was created?). But now I'm wondering if I was mistaken in that, so to clarify, what is the 4 branch used for? |
Yeah without the changes to the
Thank you @GuySartorelli 🎩 Oh and will you be testing this PR on it's own, or in addition to the second one? |
You're correct, the
If this PR doesn't work without the second one (which it sounds like is the case), I'll test them together. |
+ Added an `action-parameters` class to the BatchActionParameters field so we can style it without using ID selectors
+ Created an extension to add the `BatchActionParameters` fields from CMSMain to the `BatchActionsForm` in LeftAndMain + Applied the extension to LeftAndMain using YAML
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.
Looks good, works locally. Without the accompanying PR there are no issues so the composer constraint doesn't need to be modified.
Good work! Happy to merge this.
If you're feeling adventurous, it would be awesome if you can write some tests (PR against this repository) and docs (PR against https://github.com/silverstripe/developer-docs) which I should have asked for earlier. :p
Glad to hear it 🚀 |
Awesome, thank you. If you need any help writing tests feel free to @ me. |
@mooror Heya, just wondering if you've been able to make time to write some documentation and tests for this? |
Hey Guy @GuySartorelli, sorry for the late reply. Things have been extra busy as of late and I haven't been on github very often To answer your question, I haven't done either. Realistically I think I'll be able to write up some documentation, but I'm not so sure about the unit tests, as I still have to learn how to write those, and at the moment I don't know if I'll have the time to invest in that (though I really need to learn those at some point) |
No worries, even the documentation would be a great help if you can make time for it. One less thing I need to worry about. |
Description
This is the first of two PRs (the second will be in the admin module) for implementing the enhancement described in issue #2744
Changes
registeredActions()
methodFieldHolder
instead ofField
so CMS fields display correctly