Table improvements
* enhances visualization of editable column on tables
* simplifies code
* enhances visualization of parcel_group column on tables
* WIP: Ordering on intervention table is odd. Same results are being displayed on page 2. Needs further analysis and fixing!
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
{% load i18n l10n %}
|
||||
{% load i18n l10n fontawesome_5 %}
|
||||
<div class="table-container w-100 scroll-300">
|
||||
{% if parcels|length == 0 %}
|
||||
<article class="alert alert-info">
|
||||
{% fa5_icon 'search-location' %}
|
||||
{% trans 'Parcels can not be calculated, since no geometry is given.' %}
|
||||
</article>
|
||||
{% else %}
|
||||
|
||||
@@ -12,8 +12,9 @@ from django.http import HttpRequest
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import format_html
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from konova.models import BaseObject, GeoReferencedMixin
|
||||
from konova.models import BaseObject, GeoReferencedMixin, ShareableObjectMixin
|
||||
from konova.settings import PAGE_SIZE_DEFAULT, PAGE_PARAM, RESULTS_PER_PAGE_PARAM, PAGE_SIZE_OPTIONS
|
||||
|
||||
|
||||
@@ -200,6 +201,25 @@ class TableRenderMixin:
|
||||
)
|
||||
return html
|
||||
|
||||
def render_e(self, value, record: ShareableObjectMixin):
|
||||
""" Renders the editable column
|
||||
|
||||
Args:
|
||||
value (str): The identifier value
|
||||
record (ShareableObjectMixin): The record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
html = ""
|
||||
has_access = record.is_shared_with(self.user)
|
||||
|
||||
html += self.render_icn(
|
||||
tooltip=_("Full access granted") if has_access else _("Access not granted"),
|
||||
icn_class="fas fa-share-alt rlp-r-inv" if has_access else "",
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
|
||||
class TableOrderMixin:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user