You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix tests
* create a popup with configurable arguments for markers
* use HTML template for popup API
* add tests
* add documentation about popups
* add changelog entry
* fix quality
* change popup's title with str(obj)
* change traduction
* improve text formatting in popup content api
* adapt tests
* adapt documentation
* add parameter to display popup or not
* add changelog entry
* change LABEL_PER_MODEL setting name
* Update mapentity/templates/mapentity/mapentity_popup_content.html
Co-authored-by: Jean-Etienne Castagnede <[email protected]>
* remove spaces in the popup
* fix tests
* add get_popup_url in the model
* fix quality
* apply suggestions
* modify magin and padding of popup
* add traduction of field name for boolean fields in popup
---------
Co-authored-by: Jean-Etienne Castagnede <[email protected]>
Copy file name to clipboardExpand all lines: docs/customization.rst
+33-1Lines changed: 33 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,38 @@ The second way overrides these templates for all your models.
197
197
you need to create a sub-directory named ``mapentity`` in ``main/templates``.
198
198
Then you can create a file named ``override_detail_pdf.html``(or ``.css``) and it will be used for all your models if a specific template is not provided.
199
199
200
+
Popups
201
+
------
202
+
203
+
MapEntity displays a popup when clicking on a map object.
204
+
By default, it shows the object's name and a button linking to its detail page.
205
+
206
+
Configure popup fields for each model using the ``POPUP_CONTENT`` setting:
207
+
208
+
.. code-block:: python
209
+
210
+
POPUP_CONTENT= {
211
+
"museum": ["name", "city", "public"],
212
+
}
213
+
214
+
The key is the model name in lowercase (e.g., ``"museum"``), and the value is a list of field names to display.
215
+
The popup title shows the object's string representation (using `__str__()`), with the configured fields displayed below.
216
+
217
+
If there is a display function for a field in the model then it will be used in priority.
218
+
219
+
.. code-block:: python
220
+
221
+
@property
222
+
defpublic_display(self):
223
+
return"Public"ifself.public else"Not public"
224
+
225
+
If no display function exists, the field’s string representation is used by default.
226
+
227
+
Non-existent fields can be used if a display function exist.
228
+
229
+
If a model isn't configured in ``POPUP_CONTENT``, the object's string representation is used as the title.
230
+
If a specified field doesn't exist on the model, it won't be displayed. The detail page button is always shown.
231
+
If the option ``displayPopup`` is setup to false, then the popup will not appear when clicking on the feature.
200
232
201
233
Settings
202
234
-----------
@@ -256,4 +288,4 @@ A help message will be added, and color of TinyMCE status bar and border will be
0 commit comments