Skip to content
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

maps/react: fix react map namespaces #1766

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion adhocracy4/maps_react/templatetags/react_maps_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def react_choose_point(polygon, point, name):
}

return format_html(
'<div data-a4-widget="choose-point" ' 'data-attributes="{attributes}"></div>',
'<div data-a4-widget="react-choose-point" '
'data-attributes="{attributes}"></div>',
attributes=json.dumps(attributes),
)
8 changes: 4 additions & 4 deletions adhocracy4/maps_react/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def __init__(self, polygon, attrs=None):
super().__init__(attrs)

class Media:
js = ("a4maps_choose_point.js",)
js = ("a4maps_react_choose_point.js",)

css = {"all": ["a4maps_choose_point.css"]}
css = {"all": ["a4maps_react_choose_point.css"]}

def render(self, name, value, attrs, renderer=None):
if not finders.find("a4maps_choose_point.js"):
if not finders.find("a4maps_react_choose_point.js"):
raise ImproperlyConfigured(
"Configure your frontend build tool to generate a4maps_choose_point.js."
"Configure your frontend build tool to generate a4maps_react_choose_point.js."
)

context = {
Expand Down
4 changes: 2 additions & 2 deletions tests/maps_react/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_react_maps_without_point(rf, area_settings):
}
}
expected = format_html(
'<div data-a4-widget="choose-point" data-attributes="{attributes}"></div>',
'<div data-a4-widget="react-choose-point" data-attributes="{attributes}"></div>',
attributes=json.dumps(attrs),
)

Expand Down Expand Up @@ -50,7 +50,7 @@ def test_react_maps_with_point(rf, area_settings):
}
}
expected = format_html(
'<div data-a4-widget="choose-point" data-attributes="{attributes}"></div>',
'<div data-a4-widget="react-choose-point" data-attributes="{attributes}"></div>',
attributes=json.dumps(attrs),
)

Expand Down
2 changes: 1 addition & 1 deletion tests/maps_react/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_choose_point_widget(area_settings):
expected = format_html(
"""

<div data-a4-widget="choose-point" data-attributes="{attributes}"></div>
<div data-a4-widget="react-choose-point" data-attributes="{attributes}"></div>
<input id="id_test_filter" type="hidden" name="test_filter" value="test_val1">
""",
attributes=json.dumps(attrs),
Expand Down