Problem/Motivation
We want to enable Chosen only in the administration theme of our project. We tried to use the selectors setting, but it doesn't work. Either chosen apply on all select or the functionality breaks when we use AJAX in views.
This issue / feature is exactly the opposite of this one: Disable chosen on admin pages
Proposed resolution
The idea is to add a checkbox in the settings to apply chosen in the admin theme only. These changes will be applied by creating a patch based on the patch #32 in the issue : https://www.drupal.org/node/2089987.
Remaining tasks
Patch will be attached.
User interface changes
A checkbox to be added in the module settings to apply chosen only in the admin theme.
Comment | File | Size | Author |
---|---|---|---|
#15 | enable_chosen_on_admin-2534756-15.patch | 4.21 KB | mr.york |
#11 | enable_chosen_on_admin-2534756-11.patch | 2.39 KB | mr.york |
#5 | chosen-toggle-admin-pages-option-2534756-5.patch | 2.36 KB | villette |
#3 | chosen-toggle-admin-pages-option-2534756-3.patch | 1.8 KB | sseguin |
Comments
Comment #1
sseguin CreditAttribution: sseguin commentedComment #2
sseguin CreditAttribution: sseguin commentedComment #3
sseguin CreditAttribution: sseguin commentedComment #4
sseguin CreditAttribution: sseguin commentedComment #5
villette CreditAttribution: villette at Floe design + technologies commentedI've updated the patch in #3 to include three options:
Comment #6
JeroenTComment #7
brockfanning CreditAttribution: brockfanning commentedThe patch works as it is intended, but unfortunately doesn't catch my use-case, which is the ctools modals that pop up when using Panels' in-place editor. This isn't surprising, since the page that the modals display on is neither administrative nor ajax.
In case it helps, the trick in using the selectors setting may be to figure out what the "context" variable is in the chosen.js. For example I wanted to get Chosen working in panels IPE modals. First I tried:
body.panels-ipe select:visible
But that didn't work. The reason is the the body element is outside the "context" variable in chosen.js. So I tried this:
.ctools-modal-content select:visible
This works because .ctools-modal-content is inside the "context" variable in chosen.js.
Comment #8
brockfanning CreditAttribution: brockfanning commentedTo be clear though, I tested the patch and it does work. I only included the info about the selectors setting on the off chance that it may help with the original problem.
Comment #9
lpeabody CreditAttribution: lpeabody at Genuine commentedReviewed and tested by brockfanning.
Comment #10
nagy.balint CreditAttribution: nagy.balint commentedGoing to review this soon.
Comment #11
mr.york CreditAttribution: mr.york at Agence Inovae commentedTested and reviewed ant reroll last patch.
Comment #13
nagy.balint CreditAttribution: nagy.balint commentedCommitted.
Comment #14
mr.york CreditAttribution: mr.york at Agence Inovae commentedComment #15
mr.york CreditAttribution: mr.york at Agence Inovae commentedAttached d8 port.
Comment #17
nagy.balint CreditAttribution: nagy.balint commentedCommitted.
Comment #19
JeroenT