#163 Checked icons improvement

* adds a second star icon on currently unchecked but previously checked entries
   --> can be detected easier for another check run
* simplifies some related code parts
* moves some translation string into message_templates.py
* enables session timeout after 60 minutes
* improves comment card layout sizing
* adds/updates translations
This commit is contained in:
2022-05-30 10:26:34 +02:00
parent 528f2145a4
commit c1aa14f6ba
15 changed files with 186 additions and 120 deletions

View File

@@ -408,6 +408,20 @@ class CheckableObjectMixin(models.Model):
self.log.add(action)
return action
def get_last_checked_action(self):
""" Getter for the most recent checked action on the log
Returns:
previously_checked (UserActionLogEntry): The most recent checked action
"""
from user.models import UserAction
previously_checked = self.log.filter(
action=UserAction.CHECKED
).order_by(
"-timestamp"
).first()
return previously_checked
class ShareableObjectMixin(models.Model):
# Users having access on this object

View File

@@ -46,8 +46,8 @@ ALLOWED_HOSTS = [
LOGIN_URL = "/login/"
# Session settings
#SESSION_COOKIE_AGE = 30 * 60 # 30 minutes
#SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_AGE = 60 * 60 # 60 minutes
SESSION_SAVE_EVERY_REQUEST = True
# Application definition

View File

@@ -6,7 +6,7 @@
{% if obj.comment %}
<div class="w-100">
<div class="col-sm-12">
<div class="card mt-3">
<div class="card-header rlp-gd">
<div class="row">

View File

@@ -81,3 +81,8 @@ GEOMETRY_CONFLICT_WITH_TEMPLATE = _("Geometry conflict detected with {}")
# INTERVENTION
INTERVENTION_HAS_REVOCATIONS_TEMPLATE = _("This intervention has {} revocations")
# CHECKED
DATA_CHECKED_ON_TEMPLATE = _("Checked on {} by {}")
DATA_CHECKED_PREVIOUSLY_TEMPLATE = _("Data has changed since last check on {} by {}")
DATA_IS_UNCHECKED = _("Current data not checked yet")

View File

@@ -112,6 +112,17 @@ class BaseTable(tables.tables.Table):
icon
)
def render_previously_checked_star(self, tooltip: str = None):
"""
Returns a star icon for a check action in the past
"""
icon = "fas fa-star rlp-gd-inv"
return format_html(
"<em title='{}' class='{}'></em>",
tooltip,
icon
)
def render_bookmark(self, tooltip: str = None, icn_filled: bool = False):
"""
Returns a bookmark icon