mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use results endpoint for groups index, instead of switching on x-requested-with
This commit is contained in:
parent
bcdb02bb75
commit
62a5c60319
@ -5,9 +5,9 @@
|
||||
{{ block.super }}
|
||||
<script>
|
||||
window.headerSearch = {
|
||||
url: "{% url view.index_url_name %}",
|
||||
url: "{{ index_results_url }}",
|
||||
termInput: "#id_q",
|
||||
targetOutput: "#group-results"
|
||||
targetOutput: "#index-results"
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@ -17,7 +17,7 @@
|
||||
{% include "wagtailadmin/shared/header.html" with title=page_title action_url=add_link action_text=view.add_item_label icon=header_icon search_url=view.index_url_name %}
|
||||
|
||||
<div class="nice-padding">
|
||||
<div id="group-results" class="groups">
|
||||
<div id="index-results" class="groups">
|
||||
{% include "wagtailusers/groups/results.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,6 +53,8 @@ class PermissionPanelFormsMixin:
|
||||
|
||||
|
||||
class IndexView(generic.IndexView):
|
||||
template_name = "wagtailusers/groups/index.html"
|
||||
results_template_name = "wagtailusers/groups/results.html"
|
||||
page_title = _("Groups")
|
||||
add_item_label = _("Add a group")
|
||||
search_box_placeholder = _("Search groups")
|
||||
@ -71,12 +73,6 @@ class IndexView(generic.IndexView):
|
||||
),
|
||||
]
|
||||
|
||||
def get_template_names(self):
|
||||
if self.request.headers.get("x-requested-with") == "XMLHttpRequest":
|
||||
return ["wagtailusers/groups/results.html"]
|
||||
else:
|
||||
return ["wagtailusers/groups/index.html"]
|
||||
|
||||
|
||||
class CreateView(PermissionPanelFormsMixin, generic.CreateView):
|
||||
page_title = _("Add group")
|
||||
|
Loading…
Reference in New Issue
Block a user