From d2fd1b4f7872d3a57bff18c1b9409231aed13b4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Sun, 30 Dec 2018 13:26:47 +0100
Subject: [PATCH] lingo/maps: move delete link to objects list (#29382)

---
 combo/apps/lingo/templates/lingo/regie_form.html   | 3 ---
 combo/apps/lingo/templates/lingo/regie_list.html   | 1 +
 combo/apps/maps/templates/maps/manager_home.html   | 1 +
 combo/apps/maps/templates/maps/map_layer_form.html | 3 ---
 tests/test_lingo_manager.py                        | 3 +--
 tests/test_maps_manager.py                         | 3 +--
 6 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/combo/apps/lingo/templates/lingo/regie_form.html b/combo/apps/lingo/templates/lingo/regie_form.html
index 0fe3f718..1788859e 100644
--- a/combo/apps/lingo/templates/lingo/regie_form.html
+++ b/combo/apps/lingo/templates/lingo/regie_form.html
@@ -17,9 +17,6 @@
   <div class="buttons">
     <button class="submit-button">{% trans "Save" %}</button>
     <a class="cancel" href="{% url 'lingo-manager-homepage' %}">{% trans 'Cancel' %}</a>
-    {% if object.id %}
-    <a class="delete" rel="popup" href="{% url 'lingo-manager-regie-delete' pk=object.id %}">{% trans 'Delete' %}</a>
-    {% endif %}
   </div>
 </form>
 {% endblock %}
diff --git a/combo/apps/lingo/templates/lingo/regie_list.html b/combo/apps/lingo/templates/lingo/regie_list.html
index d2a80314..48dac21d 100644
--- a/combo/apps/lingo/templates/lingo/regie_list.html
+++ b/combo/apps/lingo/templates/lingo/regie_list.html
@@ -23,6 +23,7 @@
    <span>({{regie.service}})</span>
    {% if regie.is_default %}<span class="extra-info">{% trans "(default regie)" %}</span>{% endif %}
  </a>
+  <a rel="popup" class="delete" href="{% url 'lingo-manager-regie-delete' pk=regie.id %}">{% trans "remove" %}</a>
  </li>
  {% endfor %}
 </ul>
diff --git a/combo/apps/maps/templates/maps/manager_home.html b/combo/apps/maps/templates/maps/manager_home.html
index 2e7c2b63..4531edf8 100644
--- a/combo/apps/maps/templates/maps/manager_home.html
+++ b/combo/apps/maps/templates/maps/manager_home.html
@@ -14,6 +14,7 @@
  {% for layer in object_list %}
  <li>
   <a class="layer-icon-{{ layer.icon }}" href="{% url 'maps-manager-layer-edit' slug=layer.slug %}">{{ layer.label }}</a>
+  <a rel="popup" class="delete" href="{% url 'maps-manager-layer-delete' slug=layer.slug %}">{% trans "remove" %}</a>
  </li>
  {% endfor %}
 </ul>
diff --git a/combo/apps/maps/templates/maps/map_layer_form.html b/combo/apps/maps/templates/maps/map_layer_form.html
index 9a97f1d6..e11a5e45 100644
--- a/combo/apps/maps/templates/maps/map_layer_form.html
+++ b/combo/apps/maps/templates/maps/map_layer_form.html
@@ -22,9 +22,6 @@
   <div class="buttons">
     <button class="submit-button">{% trans "Save" %}</button>
     <a class="cancel" href="{% url 'maps-manager-homepage' %}">{% trans 'Cancel' %}</a>
-    {% if object.id %}
-    <a class="delete" rel="popup" href="{% url 'maps-manager-layer-delete' slug=object.slug %}">{% trans 'Delete' %}</a>
-    {% endif %}
   </div>
 </form>
 {% endblock %}
diff --git a/tests/test_lingo_manager.py b/tests/test_lingo_manager.py
index b665120f..ffff1f32 100644
--- a/tests/test_lingo_manager.py
+++ b/tests/test_lingo_manager.py
@@ -63,8 +63,7 @@ def test_delete_regie(app, admin_user):
     test_add_regie(app, admin_user)
     app = login(app)
     resp = app.get('/manage/lingo/regies/', status=200)
-    resp = resp.click('Test')
-    resp = resp.click('Delete')
+    resp = resp.click('remove')
     assert 'Are you sure you want to delete this?' in resp.text
     resp = resp.forms[0].submit()
     assert resp.location.endswith('/manage/lingo/regies/')
diff --git a/tests/test_maps_manager.py b/tests/test_maps_manager.py
index 659d66cf..edb95b27 100644
--- a/tests/test_maps_manager.py
+++ b/tests/test_maps_manager.py
@@ -60,8 +60,7 @@ def test_delete_layer(app, admin_user):
     test_add_layer(app, admin_user)
     app = login(app)
     resp = app.get('/manage/maps/', status=200)
-    resp = resp.click('Test')
-    resp = resp.click('Delete')
+    resp = resp.click('remove')
     assert 'Are you sure you want to delete this?' in resp.text
     resp = resp.forms[0].submit()
     assert resp.location.endswith('/manage/maps/')
-- 
2.20.1

