fix: activate drag-drop popup tabs for both dock and map popup modes#6751
Open
meyerlor wants to merge 4 commits into3liz:masterfrom
Open
fix: activate drag-drop popup tabs for both dock and map popup modes#6751meyerlor wants to merge 4 commits into3liz:masterfrom
meyerlor wants to merge 4 commits into3liz:masterfrom
Conversation
Fields configured with a CheckBox edit widget in QGIS previously
displayed their raw value ("Ja", "Nein", "true", "false", etc.) in the
feature popup, instead of mirroring the editing form's native checkbox.
This change covers two popup render paths:
* Auto popup (popupDefaultContent, popup_all_features_table):
new jTpl modifier popupcheckbox is used in place of featurepopup;
receives a per-layer map of CheckBox fields resolved from the QGIS
project XML by WMSRequest::getCheckBoxFieldsForLayer.
* QGIS/form popup (popupSource=form|qgis):
WMSRequest::applyCheckBoxesToFormPopup post-processes the form HTML
returned by QGIS Server, replacing the text inside each
<span id="dd_jforms_view_edition_FIELD" class="jforms-control-input">
with a disabled <input type="checkbox"> when the field is a
CheckBox widget.
Matching is lenient so the common real-world variants all render as
checkboxes: the configured CheckedState/UncheckedState, common boolean
representations (true/t/1/yes/on and false/f/0/no/off) for fields
stored as boolean, and null-like values ('', NULL, QGIS's '()') which
render as unchecked.
Fixes 3liz#6748
The tab handler used popupContainerId which is null in the map popup
branch, making the selector '#null a[data-toggle="tab"]' match nothing.
The dock popup branch had no tab handler at all.
Fix both cases by attaching click handlers after content is inserted,
using bootstrap.Tab.getOrCreateInstance() (Bootstrap 5 API) instead of
the removed jQuery .tab('show') plugin call.
Fixes 3liz#6749
ec7418b to
b7c6ebd
Compare
52b9ccb to
6cb4e5a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6749
When using drag-and-drop form layouts with multiple tabs, clicking a tab in the popup never switched the content. This affected both popup modes (dock and map overlay).
Two bugs in
displayGetFeatureInfoin map.js:popupContainerIdwhich isnullin that branch. The resulting selector#null a[data-toggle="tab"]matched nothing.$(this).tab('show')— the Bootstrap 4 jQuery plugin API, which is not available in Bootstrap 5.To fix this:
liz_layer_popup_contentDiv)popupcontent)$(this).tab('show')withbootstrap.Tab.getOrCreateInstance(el).show()(Bootstrap 5 native API)I tested it with a layer using a drag-and-drop form converted to HTML maptip layout with 3 tabs. All tabs now switch correctly in both dock and map popup modes.
A companion fix in the lizmap-plugin is also required to regenerate the maptip HTML: https://github.com/meyerlor/lizmap-plugin/tree/fix/popup-tab-switching-bootstrap5
Backport to 3.9
release_3_9 is on Bootstrap 2, so
bootstrap.Tab.getOrCreateInstance()is not available. If this fix is backported to 3.9, replace the twoTab.getOrCreateInstance(el).show()calls with$(el).tab('show')(jQuery plugin API). The structural fix — correcting the container selectors and adding the missing dock handler applies unchanged.