Skip to content

Commit

Permalink
merge v0.13.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie authored Aug 30, 2023
2 parents 6156b64 + e4acf54 commit b6e4827
Show file tree
Hide file tree
Showing 106 changed files with 2,047 additions and 1,346 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,55 @@ Changelog for the **SODAR Core** Django app package. Loosely follows the
`Keep a Changelog <http://keepachangelog.com/en/1.0.0/>`_ guidelines.


v0.13.1 (2023-08-30)
====================

Added
-----

- **General**
- ``get_chromedriver_url.sh`` utility helper (#1255)
- **Projectroles**
- ``TestSiteAppPermissionBase`` base test class (#1236)
- ``full_title`` arg in ``Project.get_log_title()`` (#1238)
- ``MultipleFileInput`` and ``MultipleFileField`` form helpers (#1226)
- ``syncmodifyapi`` project limiting option (#1263)

Changed
-------

- **General**
- Update ``django-plugins`` and ``drf-keyed-list`` dev dependencies to PyPI packages (#1241)
- Upgrade general Python dependencies (#1239)
- Update tour help (#1102)
- Template refactoring (#1102, #1249)
- **Projectroles**
- Move ``setup_ip_allowing()`` to ``IPAllowMixin`` (#1237)
- Improve ``syncmodifyapi`` project logging (#1228)
- Do not exit ``syncmodifyapi`` on failure (#1229)
- Simplify ``syncmodifyapi`` project querying (#1264)
- Update ``get_role_display_name()`` to receive ``Role`` as first argument (#1265)
- Improve member invite templates (#1246, #1247, #1248)
- **Timeline**
- Handle app plugin exceptions in ``get_object_link()`` (#1232)

Fixed
-----

- **General**
- Search in Sphinx docs build (#1245)
- All utility scripts not set as executable (#1254)
- Local Chromedriver install failure (#1255)
- **Projectroles**
- Hardcoded ``appalerts`` dependency in ``test_views`` (#1252)
- Remote sync crash in ``_add_parent_categories()`` (#1258)
- Remote sync timeline event description notation (#1260)
- Django settings not working in login view (#1250)
- Template extension not working in login view (#1250)
- **Userprofile**
- Template padding (#1244)


v0.13.0 (2023-06-01)
====================

Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ and breaking changes are possible.

.. code-block:: console
pip install django-sodar-core==0.13.0
pip install django-sodar-core==0.13.1
For installing a development version you can point your dependency to a specific
commit ID in GitHub. Note that these versions may not be stable.
Expand All @@ -135,12 +135,12 @@ Repository

The branches of the SODAR Core repository are organized as follows:

- ``main``: The latest stable release.
- ``dev``: The current development branch. Most recent features go here, but
stability is not guaranteed.
``main``
The latest stable release.
``dev``
The current development branch. Most recent features go here, but stability
is not guaranteed. Pull requests should always be based on this branch.

When including SODAR Core in your Django project, it is highly recommended to
freeze your dependency to a specific release tag or commit ID. The project is
under development and breaking changes may be introduced frequently.

Contributions should always be based on the ``dev`` branch.
212 changes: 101 additions & 111 deletions adminalerts/templates/adminalerts/alert_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,26 @@
table#sodar-aa-list-table tbody tr td:nth-child(4) {
white-space: nowrap;
}

table#sodar-aa-list-table thead tr th:nth-child(5),
table#sodar-aa-list-table tbody tr td:nth-child(5) {
width: 150px;
}

table#sodar-aa-list-table tr td:nth-child(6) {
width: 75px;
}

/* Responsive modifications */
@media screen and (max-width: 1100px) {
table#sodar-aa-list-table thead tr th:nth-child(3),
table#sodar-aa-list-table tbody tr td:nth-child(3) {
display: none;
}
}

@media screen and (max-width: 900px) {
table#sodar-aa-list-table thead tr th:nth-child(2),
table#sodar-aa-list-table tbody tr td:nth-child(2) {
display: none;
}
}

@media screen and (max-width: 750px) {
table#sodar-aa-list-table thead tr th:nth-child(4),
table#sodar-aa-list-table tbody tr td:nth-child(4) {
Expand All @@ -47,20 +42,110 @@
</style>
{% endblock css %}

{% block projectroles %}

<div class="row sodar-subtitle-container bg-white sticky-top">
<h2><i class="iconify" data-icon="mdi:alert"></i> Admin Alerts</h2>
<a role="button" class="btn btn-primary ml-auto"
href="{% url 'adminalerts:create' %}">
<i class="iconify" data-icon="mdi:plus-bold"></i> Create Alert
</a>
</div>

<div class="container-fluid sodar-page-container">
<div class="card" id="sodar-aa-alert-list">
<div class="card-body p-0">
<table class="table table-striped sodar-card-table"
id="sodar-aa-list-table">
<thead>
<tr>
<th>Message</th>
<th>User</th>
<th>Created</th>
<th>Expiry</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in object_list %}
<tr {% if not a.is_active %}class="text-muted"{% endif %}
id="sodar-aa-alert-item-{{ a.pk }}">
<td>
<a href="{% url 'adminalerts:detail' adminalert=a.sodar_uuid %}">
{{ a.message }}
</a>
</td>
<td>{% get_user_html a.user as user_html %}{{ user_html|safe }}</td>
<td>{{ a.date_created | date:'Y-m-d H:i:s' }}</td>
<td>{{ a.date_expire | date:'Y-m-d' }}</td>
<td>
<button class="btn sodar-list-btn
{% if not a.is_expired and a.active %}btn-success
{% elif not a.is_expired and not a.active %} btn-warning
{% else %} btn-danger{% endif %} js-change-alert-state-button"
type="button" data-url="{% url 'adminalerts:ajax_active_toggle' adminalert=a.sodar_uuid %}"
{% if a.is_expired %}disabled{% endif %}>
{% if a.is_expired %}
EXPIRED
{% elif a.active %}
ACTIVE
{% else %}
INACTIVE
{% endif %}
</button>
</td>
<td>
<button class="btn btn-secondary dropdown-toggle sodar-list-dropdown"
type="button" data-toggle="dropdown" aria-expanded="false">
<i class="iconify" data-icon="mdi:cog"></i>
</button>
<div class="dropdown-menu dropdown-menu-right sodar-aa-alert-dropdown">
<a class="dropdown-item"
href="{% url 'adminalerts:update' adminalert=a.sodar_uuid %}">
<i class="iconify" data-icon="mdi:lead-pencil"></i>
Update Alert
</a>
<a class="dropdown-item text-danger"
href="{% url 'adminalerts:delete' adminalert=a.sodar_uuid %}">
<i class="iconify" data-icon="mdi:close-thick"></i>
Delete Alert
</a>
</div>
</td>
</tr>
{% endfor %}
{% if not object_list %}
<tr>
<td class="bg-faded font-italic text-center" colspan="6">
No alerts found.
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
{% if is_paginated %}
{% include 'projectroles/_pagination.html' with pg_small=False %}
{% endif %}
</div>

{% endblock projectroles %}

{% block javascript %}
{{ block.super }}
<script>
function toogleBtnState(button, is_active)
{
function toogleBtnState(button, is_active) {
if (is_active) {
button.classList.add("btn-success");
button.classList.remove("btn-warning");
button.innerText = 'ACTIVE';
} else {
button.innerText = 'INACTIVE';
button.classList.remove("btn-success");
button.classList.add("btn-warning");
}
button.classList.add("btn-success");
button.classList.remove("btn-warning");
button.innerText = 'ACTIVE';
} else {
button.innerText = 'INACTIVE';
button.classList.remove("btn-success");
button.classList.add("btn-warning");
}
}

$('.js-change-alert-state-button').each(function () {
Expand All @@ -69,11 +154,9 @@
// to improve responsiveness
const is_active_guess = event.target.innerText = 'ACTIVE';
toogleBtnState(event.target, is_active_guess);

$.ajax({
type: 'POST',
url: event.target.dataset.url,

success: function (data) {
// Check if we guessed correctly
if (data.is_active === is_active_guess)
Expand All @@ -84,97 +167,4 @@
});
});
</script>
{% endblock javascript %}

{% block projectroles %}

<div class="row sodar-subtitle-container bg-white sticky-top">
<h2><i class="iconify" data-icon="mdi:alert"></i> Admin Alerts</h2>

<a role="button" class="btn btn-primary ml-auto"
href="{% url 'adminalerts:create' %}">
<i class="iconify" data-icon="mdi:plus-bold"></i> Create Alert
</a>
</div>

<div class="container-fluid sodar-page-container">

{% if object_list.count > 0 %}
<div class="card" id="sodar-aa-alert-list">
<div class="card-body p-0">
<table class="table table-striped sodar-card-table" id="sodar-aa-list-table">
<thead>
<tr>
<th>Message</th>
<th>User</th>
<th>Created</th>
<th>Expiry</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in object_list %}
<tr {% if not a.is_active %}class="text-muted"{% endif %}
id="sodar-aa-alert-item-{{ a.pk }}">
<td><a href="{% url 'adminalerts:detail' adminalert=a.sodar_uuid %}">{{ a.message }}</a></td>
<td>{% get_user_html a.user as user_html %}{{ user_html|safe }}</td>
<td>{{ a.date_created | date:'Y-m-d H:i:s' }}</td>
<td>{{ a.date_expire | date:'Y-m-d' }}</td>
<td>
<button class="btn sodar-list-btn
{% if not a.is_expired and a.active %}btn-success
{% elif not a.is_expired and not a.active %} btn-warning
{% else %} btn-danger{% endif %} js-change-alert-state-button"
type="button" data-url="{% url 'adminalerts:ajax_active_toggle' adminalert=a.sodar_uuid %}"
{% if a.is_expired %}disabled{% endif %}
>
{% if a.is_expired %}
EXPIRED
{% elif a.active %}
ACTIVE
{% else %}
INACTIVE
{% endif %}
</button>
</td>
<td>
<div class="btn-group sodar-list-btn-group" id="sodar-aa-alert-buttons-{{ a.pk }}">
<button class="btn btn-secondary dropdown-toggle sodar-list-dropdown"
type="button" data-toggle="dropdown" aria-expanded="false">
<i class="iconify" data-icon="mdi:cog"></i>
</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item"
href="{% url 'adminalerts:update' adminalert=a.sodar_uuid %}">
<i class="iconify" data-icon="mdi:lead-pencil"></i> Update Alert
</a>
<a class="dropdown-item text-danger"
href="{% url 'adminalerts:delete' adminalert=a.sodar_uuid %}">
<i class="iconify" data-icon="mdi:close-thick"></i> Delete Alert
</a>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>

{% if is_paginated %}
{% include 'projectroles/_pagination.html' with pg_small=False %}
{% endif %}

{% else %} {# if object_list.count == 0 #}
<div class="container-fluid">
<div class="alert alert-info" role="alert">
No alerts found.
</div>
</div>
{% endif %}

</div>

{% endblock projectroles %}
{% endblock javascript %}
13 changes: 3 additions & 10 deletions adminalerts/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,16 @@
from django.urls import reverse

# Projectroles dependency
from projectroles.tests.test_permissions import TestPermissionBase
from projectroles.tests.test_permissions import TestSiteAppPermissionBase

from adminalerts.tests.test_models import AdminAlertMixin


class TestAdminAlertPermissions(AdminAlertMixin, TestPermissionBase):
class TestAdminAlertPermissions(AdminAlertMixin, TestSiteAppPermissionBase):
"""Tests for AdminAlert permissions"""

def setUp(self):
# Create users
self.superuser = self.make_user('superuser')
self.superuser.is_superuser = True
self.superuser.is_staff = True
self.superuser.save()
self.regular_user = self.make_user('regular_user')
# No user
self.anonymous = None
super().setUp()
# Create alert
self.alert = self.make_alert(
message='alert',
Expand Down
Loading

0 comments on commit b6e4827

Please sign in to comment.