refactor: replace new inspection modal with direct link to map and update tests accordingly
This commit is contained in:
parent
97269fb001
commit
e6166b6adb
3 changed files with 20 additions and 7 deletions
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "home/_intervention_type_modal.html" %}
|
{% include "home/_intervention_type_modal.html" %}
|
||||||
{% include "home/_new_inspection_modal.html" %}
|
|
||||||
{% if can_add_structures_repair %}
|
{% if can_add_structures_repair %}
|
||||||
{% include "home/_add_repair_intervention_modal.html" %}
|
{% include "home/_add_repair_intervention_modal.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -31,9 +30,9 @@
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_inspector %}
|
{% if is_inspector %}
|
||||||
<button class="btn btn-light main-button my-1 ms-1" type="button" data-bs-toggle="modal" data-bs-target="#newInspectionModal">
|
<a href="{% url 'inspections:quick_inspection_map' %}" class="btn btn-light main-button my-1 ms-1">
|
||||||
<i class="bi bi-search me-2"></i>{% translate "Nouvelle inspection" %}
|
<i class="bi bi-search me-2"></i>{% translate "Nouvelle inspection" %}
|
||||||
</button>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.config|has_any_role:"manager,admin,controller,external_manager,top_manager" %}
|
{% if user.config|has_any_role:"manager,admin,controller,external_manager,top_manager" %}
|
||||||
<button class="btn btn-light main-button my-1 ms-1" type="button" data-bs-toggle="modal" data-bs-target="#interventionTypeModal">
|
<button class="btn btn-light main-button my-1 ms-1" type="button" data-bs-toggle="modal" data-bs-target="#interventionTypeModal">
|
||||||
|
|
|
||||||
|
|
@ -249,3 +249,21 @@ class TeambuildingVoteViewsTests(TestCase):
|
||||||
self.assertEqual(response.context["pct_tequila"], 66.7)
|
self.assertEqual(response.context["pct_tequila"], 66.7)
|
||||||
self.assertEqual(response.context["pct_vivien"], 50.0)
|
self.assertEqual(response.context["pct_vivien"], 50.0)
|
||||||
|
|
||||||
|
|
||||||
|
class HomeIndexViewTests(TestCase):
|
||||||
|
def test_home_index_inspector_link(self):
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from common.models import Role, UserConfig
|
||||||
|
User = get_user_model()
|
||||||
|
user = User.objects.create_user('inspector_user', password='pass')
|
||||||
|
user_config = UserConfig.objects.create(user=user)
|
||||||
|
inspector_role, _ = Role.objects.get_or_create(name='inspector')
|
||||||
|
user_config.roles.add(inspector_role)
|
||||||
|
self.client.force_login(user)
|
||||||
|
|
||||||
|
response = self.client.get(reverse('home:index'))
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertContains(response, reverse('inspections:quick_inspection_map'))
|
||||||
|
self.assertNotContains(response, 'data-bs-target="#newInspectionModal"')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if is_inspector %}
|
|
||||||
{% include "home/_new_inspection_modal.html" %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue