Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Feb 23, 2023
1 parent 2bc1737 commit 4700185
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
55 changes: 29 additions & 26 deletions appalerts/templates/appalerts/alert_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load static %}
{% load projectroles_common_tags %}

{% block title %}{% if dismissed %}Dismissed App Alerts{% else %}Active App Alerts{% endif %}{% endblock title %}
{% block title %}{% if dismissed %}Dismissed{% else %}Active{% endif %} App Alerts{% endblock title %}

{% block css %}
{{ block.super }}
Expand All @@ -24,27 +24,32 @@
max-width: 40px;
}

.sodar-app-alert-btn {
height: 30px;
}
</style>
{% endblock css %}

{% block projectroles %}

<div class="row sodar-subtitle-container">
<h2><i class="iconify" data-icon="mdi:alert-octagram"></i> App Alerts</h2>
{% if dismissed %}
<h2><i class="iconify" data-icon="mdi:alert-octagram-outline"></i>
Dismissed App Alerts
</h2>
{% else %}
<h2><i class="iconify" data-icon="mdi:alert-octagram"></i>
Active App Alerts
</h2>
{% endif %}
{% if not dismissed %}
<div class="btn-group sodar-list-btn-group ml-auto">
<button class="btn btn-primary dropdown-toggle sodar-app-alert-btn"
<div class="btn-group ml-auto">
<button class="btn btn-primary dropdown-toggle"
id="sodar-app-alert-btn-dropdown-operations"
type="button" data-toggle="dropdown" aria-expanded="false">
<i class="iconify" data-icon="mdi:cog"></i>Alert Operations
Alert Operations
</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" id="sodar-app-alert-btn-dismissed"
href="{% url 'appalerts:list_dismissed' %}">
<i class="iconify" data-icon="mdi:alert-octagram"></i> Dismissed Alerts
<i class="iconify" data-icon="mdi:alert-octagram-outline"></i> View Dismissed
</a>
<a class="dropdown-item sodar-app-alert-btn-dismiss
{% if object_list.count == 0 %}disabled{% endif %}"
Expand All @@ -57,9 +62,9 @@ <h2><i class="iconify" data-icon="mdi:alert-octagram"></i> App Alerts</h2>
</div>
</div>
{% else %}
<a class="btn btn-primary ml-auto sodar-app-alert-btn" id="sodar-app-alert-btn-not-dismissed"
<a class="btn btn-secondary ml-auto" id="sodar-app-alert-btn-not-dismissed"
href="{% url 'appalerts:list' %}">
<i class="iconify" data-icon="mdi:alert-octagram"></i> Active Alerts
<i class="iconify" data-icon="mdi:arrow-left-circle"></i> Active Alerts
</a>
{% endif %}
</div>
Expand Down Expand Up @@ -97,17 +102,17 @@ <h2><i class="iconify" data-icon="mdi:alert-octagram"></i> App Alerts</h2>
</div>
<div>
<span class="sodar-app-alert-buttons pull-right">
{% if a.url %}
<a href="{% url 'appalerts:redirect' appalert=a.sodar_uuid %}"
class="btn btn-{{ a.level | lower }}
sodar-list-btn sodar-app-alert-btn-link"
role="button"
title="Follow link and dismiss"
data-toggle="tooltip" data-placement="top">
<i class="iconify" data-icon="mdi:arrow-right-top-bold"></i>
</a>
{% endif %}
{% if not dismissed %}
{% if a.url %}
<a href="{% url 'appalerts:redirect' appalert=a.sodar_uuid %}"
class="btn btn-{{ a.level | lower }}
sodar-list-btn sodar-app-alert-btn-link"
role="button"
title="Follow link and dismiss"
data-toggle="tooltip" data-placement="top">
<i class="iconify" data-icon="mdi:arrow-right-top-bold"></i>
</a>
{% endif %}
<a class="btn btn-{{ a.level | lower }}
sodar-list-btn sodar-app-alert-btn-dismiss sodar-app-alert-btn-dismiss-single"
role="button"
Expand All @@ -117,7 +122,7 @@ <h2><i class="iconify" data-icon="mdi:alert-octagram"></i> App Alerts</h2>
data-dismiss-url="{% url 'appalerts:ajax_dismiss' appalert=a.sodar_uuid %}">
<i class="iconify" data-icon="mdi:close-thick"></i>
</a>
{% endif %}
{% endif %}
</span>
</div>
</div>
Expand All @@ -130,10 +135,8 @@ <h2><i class="iconify" data-icon="mdi:alert-octagram"></i> App Alerts</h2>
There are currently no alerts for you.
</div>

{% if dismissed %}
{% if object_list.count > pg_number %}
{% include 'projectroles/_pagination.html' with pg_small=False %}
{% endif %}
{% if dismissed and object_list.count > 0 %}
{% include 'projectroles/_pagination.html' with pg_small=False %}
{% endif %}

</div>
Expand Down
2 changes: 1 addition & 1 deletion appalerts/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_alert_dismiss_all(self):
self.selenium.find_element(
By.ID, 'sodar-app-alert-btn-dismissed'
).text,
'Dismissed Alerts',
'View Dismissed',
)
self.selenium.find_element(
By.ID, 'sodar-app-alert-btn-dismiss-all'
Expand Down
1 change: 0 additions & 1 deletion appalerts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def get_paginate_by(self, queryset):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
status = self.kwargs.get('status', 'active')
context['pg_number'] = getattr(settings, 'DEFAULT_PAGINATION', 15)
if status == 'dismissed':
context['dismissed'] = True
else:
Expand Down

0 comments on commit 4700185

Please sign in to comment.