-
Notifications
You must be signed in to change notification settings - Fork 38
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
Show post ID in postselect dropdown option labels #660
Comments
@danieliser Just to clarify: Which dropdown is this referring to? The selected page/post conditions in the "Targeting" section of the popup editor? |
@fpcorso Yea, plenty of sites with multiple pages using same name, hard to differentiate them in those dropdowns. |
@danieliser The conditions system is a web of files and scripts. After A LOT of hunting, narrowed down to somewhere within pumselect2. We really need to add some sort of documentation/wiki for these systems as I still am not sure how this all works even after spending an hour going through all these files. First, the _selected conditions are defined here as postselect type: https://github.com/PopupMaker/Popup-Maker/blob/master/classes/Conditions.php#L235 Which gets called to render in conditions.js: https://github.com/PopupMaker/Popup-Maker/blob/master/assets/js/src/admin/popup-editor/plugins/conditions.js#L124 Which calls field in templates.js: https://github.com/PopupMaker/Popup-Maker/blob/master/assets/js/src/admin/general/plugins/templates.js#L384 After a lot of debugging, I found that, upon clicking, it calls the AJAX and processResults in select2.js: https://github.com/PopupMaker/Popup-Maker/blob/master/assets/js/src/admin/general/plugins/select2.js#L30 Which queries the DB in object_search method in Ajax.php: https://github.com/PopupMaker/Popup-Maker/blob/master/classes/Admin/Ajax.php#L19 This eventually fires of a prototype.option of the pumselect2 in the vendor folder: https://github.com/PopupMaker/Popup-Maker/blob/master/assets/js/src/admin/general/vendor/select2.full.custom.js#L3148 I am unsure where we would want to modify the option labels for the dropdown. Should we modify in select2.js in the processResults to foreach over all items and change text to include the ID? Should we modify the Ajax object_search to include the ID in the |
@fpcorso My first and current thought is modifying the AJAX object search method to simply change the labels returned to include a prefix/suffix of the post ID.
While we are at it, might as well support it for taxonomies and users as well here:
|
@danieliser Then we don't re-use the select2 pinging that AJAX endpoint anywhere else besides in the conditions, right? Okay, I'll make those changes and get them committed. |
@danieliser Done. I originally did just the number |
@fpcorso that is perfect, was exactly what I had envisioned. That solves at least 5-10 tickets a year if not a lot more as that is only what I see. Also just more polished now. |
(1): Hello World
Or
Hello World <small>(1)</small>
So that if you have 2 pages with the same name/slug you can tell the difference.
The text was updated successfully, but these errors were encountered: