Projet

Général

Profil

0001-add-a-confirmation-page-before-removing-a-file-16825.patch

Frédéric Péters, 14 mars 2018 10:03

Télécharger (3,17 ko)

Voir les différences:

Subject: [PATCH] add a confirmation page before removing a file (#16825)

 fargo/fargo/models.py                                  |  3 +++
 fargo/static/fargo/css/style.css                       | 17 +++++++++--------
 fargo/templates/fargo/table.html                       |  5 +----
 fargo/templates/fargo/userdocument_confirm_delete.html | 15 +++++++++++++++
 4 files changed, 28 insertions(+), 12 deletions(-)
 create mode 100644 fargo/templates/fargo/userdocument_confirm_delete.html
fargo/fargo/models.py
82 82
    def filename_encoded(self):
83 83
        return urlquote(self.filename, safe='')
84 84

  
85
    def __unicode__(self):
86
        return self.title or self.filename
87

  
85 88
    def get_download_url(self):
86 89
        return reverse('download', kwargs={'pk': self.id, 'filename': self.filename_encoded})
87 90

  
fargo/static/fargo/css/style.css
6 6
	font-style: normal;
7 7
}
8 8

  
9
button.icon-remove-sign {
10
	border: none;
11
	background: none;
12
	box-shadow: none;
13
	padding: 2px;
14
	line-height: 100%;
15
}
16

  
17 9
td.thumbnail > img {
18 10
	height: 6em;
19 11
}
......
144 136
	text-decoration: none;
145 137
	content: "\f040"; /* pencil */
146 138
}
139

  
140
.icon-remove::before {
141
	font-family: FontAwesome;
142
	font-weight: normal;
143
	font-style: normal;
144
	display: inline-block;
145
	text-decoration: none;
146
	content: "\f057";  /* times-circle */
147
}
fargo/templates/fargo/table.html
40 40
        <a class="icon-edit" rel="popup" href="{% url 'edit' pk=row.record.pk %}"></a>
41 41
      {% endif %}
42 42
      {% if row.record.deletable_by_user %}
43
      <form method="post" action="{% url 'delete' pk=row.record.pk %}{% querystring %}">
44
        {% csrf_token %}
45
        <button class="icon-remove-sign"></button>
46
      </form>
43
        <a class="icon-remove" rel="popup" href="{% url 'delete' pk=row.record.pk %}"></a>
47 44
      {% endif %}
48 45
      {% endblock %}
49 46
   </td>
fargo/templates/fargo/userdocument_confirm_delete.html
1
{% extends "fargo/base.html" %}
2
{% load i18n %}
3

  
4
{% block content %}
5
<form method="post">
6
  {% csrf_token %}
7
  <p>
8
  {% blocktrans %}Are you sure you want to delete "{{ object }}"?{% endblocktrans %}
9
  </p>
10
  <div class="buttons">
11
    <button class="delete-button">{% trans 'Delete' %}</button>
12
    <a class="cancel" href="{% url 'home' %}">{% trans 'Cancel' %}</a>
13
  </div>
14
</form>
15
{% endblock %}
0
-