mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-09 22:09:14 +00:00
fix user picture delete confirmation page
This commit is contained in:
@@ -4,15 +4,11 @@
|
|||||||
{% trans %}Delete confirmation{% endtrans %}
|
{% trans %}Delete confirmation{% endtrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% if is_fragment %}
|
{# Don't display tabs and errors #}
|
||||||
|
{% block tabs %}
|
||||||
{# Don't display tabs and errors #}
|
{% endblock %}
|
||||||
{% block tabs %}
|
{% block errors %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block errors %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block file %}
|
{% block file %}
|
||||||
<h2>{% trans %}Delete confirmation{% endtrans %}</h2>
|
<h2>{% trans %}Delete confirmation{% endtrans %}</h2>
|
||||||
@@ -23,30 +19,32 @@
|
|||||||
{% set action = current %}
|
{% set action = current %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form action="{{ action }}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
|
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
|
||||||
<button
|
<form
|
||||||
|
method="post"
|
||||||
{% if is_fragment %}
|
{% if is_fragment %}
|
||||||
hx-post="{{ action }}"
|
hx-action="{{ action }}"
|
||||||
hx-target="#content"
|
|
||||||
hx-swap="innerHTML"
|
|
||||||
{% endif %}
|
|
||||||
>{% trans %}Confirm{% endtrans %}</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
{% if is_fragment %}
|
|
||||||
hx-get="{{ previous }}"
|
|
||||||
hx-target="#content"
|
hx-target="#content"
|
||||||
hx-swap="innerHTML"
|
hx-swap="innerHTML"
|
||||||
{% else %}
|
{% else %}
|
||||||
action="window.history.back()"
|
action="{{ action }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
>{% trans %}Cancel{% endtrans %}</button>
|
>
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="submit" value="{% trans %}Confirm{% endtrans %}" />
|
||||||
|
</form>
|
||||||
|
<form
|
||||||
|
method="get"
|
||||||
|
{% if is_fragment %}
|
||||||
|
hx-action="{{ previous }}"
|
||||||
|
hx-target="#content"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
{% else %}
|
||||||
|
action="javascript:history.back();"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<input type="submit" name="cancel" value="{% trans %}Cancel{% endtrans %}" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-22
@@ -21,7 +21,7 @@
|
|||||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
from django.urls import path, re_path, register_converter
|
from django.urls import path, register_converter
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
|
|
||||||
from com.views import NewsListView
|
from com.views import NewsListView
|
||||||
@@ -193,27 +193,11 @@ urlpatterns = [
|
|||||||
name="user_gift_delete",
|
name="user_gift_delete",
|
||||||
),
|
),
|
||||||
# File views
|
# File views
|
||||||
re_path(r"^file/$", FileListView.as_view(), name="file_list"),
|
path("file/", FileListView.as_view(), name="file_list"),
|
||||||
re_path(
|
path("file/<int:file_id>/", FileView.as_view(), name="file_detail"),
|
||||||
r"^file/(?P<file_id>[0-9]+)/$",
|
path("file/<int:file_id>/edit/", FileEditView.as_view(), name="file_edit"),
|
||||||
FileView.as_view(),
|
path("file/<int:file_id>/prop/", FileEditPropView.as_view(), name="file_prop"),
|
||||||
name="file_detail",
|
path("file/<int:file_id>/delete/", FileDeleteView.as_view(), name="file_delete"),
|
||||||
),
|
|
||||||
re_path(
|
|
||||||
r"^file/(?P<file_id>[0-9]+)/edit/$",
|
|
||||||
FileEditView.as_view(),
|
|
||||||
name="file_edit",
|
|
||||||
),
|
|
||||||
re_path(
|
|
||||||
r"^file/(?P<file_id>[0-9]+)/prop/$",
|
|
||||||
FileEditPropView.as_view(),
|
|
||||||
name="file_prop",
|
|
||||||
),
|
|
||||||
re_path(
|
|
||||||
r"^file/(?P<file_id>[0-9]+)/delete/$",
|
|
||||||
FileDeleteView.as_view(),
|
|
||||||
name="file_delete",
|
|
||||||
),
|
|
||||||
path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
|
path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
|
||||||
path(
|
path(
|
||||||
"file/<int:file_id>/moderate/", FileModerateView.as_view(), name="file_moderate"
|
"file/<int:file_id>/moderate/", FileModerateView.as_view(), name="file_moderate"
|
||||||
|
|||||||
+2
-9
@@ -356,15 +356,8 @@ class FileDeleteView(AllowFragment, CanEditPropMixin, DeleteView):
|
|||||||
if "next" in self.request.GET:
|
if "next" in self.request.GET:
|
||||||
return self.request.GET["next"]
|
return self.request.GET["next"]
|
||||||
if self.object.parent is None:
|
if self.object.parent is None:
|
||||||
return reverse(
|
return reverse("core:file_list")
|
||||||
"core:file_list",
|
return reverse("core:file_detail", kwargs={"file_id": self.object.parent.id})
|
||||||
)
|
|
||||||
return reverse(
|
|
||||||
"core:file_detail",
|
|
||||||
kwargs={
|
|
||||||
"file_id": self.object.parent.id,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super().get_context_data(**kwargs)
|
kwargs = super().get_context_data(**kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user