#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:
@@ -9,12 +9,11 @@ from django.http import HttpRequest
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils.html import format_html
|
||||
from django.utils.timezone import localtime
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from intervention.filters import InterventionTableFilter
|
||||
from intervention.models import Intervention
|
||||
from konova.sub_settings.django_settings import DEFAULT_DATE_TIME_FORMAT, DEFAULT_DATE_FORMAT
|
||||
from konova.utils.message_templates import DATA_CHECKED_ON_TEMPLATE, DATA_IS_UNCHECKED, DATA_CHECKED_PREVIOUSLY_TEMPLATE
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin
|
||||
import django_tables2 as tables
|
||||
|
||||
@@ -108,16 +107,21 @@ class InterventionTable(BaseTable, TableRenderMixin):
|
||||
"""
|
||||
html = ""
|
||||
checked = value is not None
|
||||
tooltip = _("Not checked yet")
|
||||
previously_checked = record.get_last_checked_action()
|
||||
tooltip = DATA_IS_UNCHECKED
|
||||
if checked:
|
||||
value = value.timestamp
|
||||
value = localtime(value)
|
||||
checked_on = value.strftime(DEFAULT_DATE_TIME_FORMAT)
|
||||
tooltip = _("Checked on {} by {}").format(checked_on, record.checked.user)
|
||||
checked_on = value.get_timestamp_str_formatted()
|
||||
tooltip = DATA_CHECKED_ON_TEMPLATE.format(checked_on, record.checked.user)
|
||||
html += self.render_checked_star(
|
||||
tooltip=tooltip,
|
||||
icn_filled=checked,
|
||||
)
|
||||
if previously_checked and not checked:
|
||||
checked_on = previously_checked.get_timestamp_str_formatted()
|
||||
tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(checked_on, previously_checked.user)
|
||||
html += self.render_previously_checked_star(
|
||||
tooltip=tooltip,
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record: Intervention):
|
||||
@@ -156,9 +160,7 @@ class InterventionTable(BaseTable, TableRenderMixin):
|
||||
checked = value is not None
|
||||
tooltip = _("Not recorded yet")
|
||||
if checked:
|
||||
value = value.timestamp
|
||||
value = localtime(value)
|
||||
on = value.strftime(DEFAULT_DATE_TIME_FORMAT)
|
||||
on = value.get_timestamp_str_formatted()
|
||||
tooltip = _("Recorded on {} by {}").format(on, record.recorded.user)
|
||||
html += self.render_bookmark(
|
||||
tooltip=tooltip,
|
||||
|
||||
@@ -70,6 +70,11 @@
|
||||
<span>
|
||||
{% fa5_icon 'star' 'far' %}
|
||||
</span>
|
||||
{% if last_checked %}
|
||||
<span class="rlp-gd-inv" title="{{last_checked_tooltip}}">
|
||||
{% fa5_icon 'star' 'fas' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="check-star" title="{% trans 'Checked on '%} {{obj.checked.timestamp}} {% trans 'by' %} {{obj.checked.user}}">
|
||||
{% fa5_icon 'star' %}
|
||||
|
||||
@@ -19,7 +19,7 @@ from konova.utils.generators import generate_qr_code
|
||||
from konova.utils.message_templates import INTERVENTION_INVALID, FORM_INVALID, IDENTIFIER_REPLACED, \
|
||||
CHECKED_RECORDED_RESET, DEDUCTION_REMOVED, DEDUCTION_ADDED, REVOCATION_ADDED, REVOCATION_REMOVED, \
|
||||
COMPENSATION_REMOVED_TEMPLATE, DOCUMENT_ADDED, DEDUCTION_EDITED, REVOCATION_EDITED, DOCUMENT_EDITED, \
|
||||
RECORDED_BLOCKS_EDIT
|
||||
RECORDED_BLOCKS_EDIT, DATA_CHECKED_PREVIOUSLY_TEMPLATE
|
||||
from konova.utils.user_checks import in_group
|
||||
|
||||
|
||||
@@ -265,9 +265,15 @@ def detail_view(request: HttpRequest, id: str):
|
||||
geom_form = SimpleGeomForm(
|
||||
instance=intervention,
|
||||
)
|
||||
last_checked = intervention.get_last_checked_action()
|
||||
last_checked_tooltip = ""
|
||||
if last_checked:
|
||||
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(last_checked.get_timestamp_str_formatted(), last_checked.user)
|
||||
|
||||
context = {
|
||||
"obj": intervention,
|
||||
"last_checked": last_checked,
|
||||
"last_checked_tooltip": last_checked_tooltip,
|
||||
"compensations": compensations,
|
||||
"has_access": is_data_shared,
|
||||
"geom_form": geom_form,
|
||||
|
||||
Reference in New Issue
Block a user