diff --git a/models/database.py b/models/database.py index ffbedcde901c82131e52ff2edd356df805d07076..5ecf46346e3ba2347f520e6c8e422241bc874669 100644 --- a/models/database.py +++ b/models/database.py @@ -6,7 +6,7 @@ from io import StringIO, BytesIO from enum import Enum from uuid import uuid4 -from shared import db, date_filter, date_filter_short, escape_tex, DATE_KEY, START_TIME_KEY, END_TIME_KEY +from shared import db, date_filter, date_filter_short, escape_tex, DATE_KEY, START_TIME_KEY, END_TIME_KEY, current_user from utils import random_string, url_manager, get_etherpad_url, split_terms, check_ip_in_networks from models.errors import DateNotMatchingException @@ -372,6 +372,18 @@ class LocalTOP(DatabaseModel): def get_parent(self): return self.protocol + def is_expandable(self): + user = current_user() + return (self.has_private_view_right(user) + and self.description is not None + and len(self.description) > 0) + + def get_css_classes(self): + classes = ["defaulttop"] + if self.is_expandable(): + classes.append("expansion-button") + return classes + class Document(DatabaseModel): __tablename__ = "documents" __model_name__ = "document" diff --git a/static/css/style.css b/static/css/style.css index 606b8745f4b5414e3d5d9897def8460a2984ae29..447329713fd5fe17f619d8116ce2e7d871dd7a89 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -73,3 +73,7 @@ textarea { .like-sign { font-size: 16px; } + +li.defaulttop { + font-style: italic; +} diff --git a/templates/protocol-tops-include.html b/templates/protocol-tops-include.html index 7e9c43c4cba3fc657e96a731bd41342d8ee924ad..6be2c79f2fd726683af93a9e5132e2828f921ec4 100644 --- a/templates/protocol-tops-include.html +++ b/templates/protocol-tops-include.html @@ -4,7 +4,7 @@ {% for default_top in protocol.protocoltype.default_tops %} {% if not default_top.is_at_end() %} {% set localtop = default_top.get_localtop(protocol) %} - <li{% if has_private_view_right and localtop.description is not none and localtop.description|length > 0 %} class="expansion-button" id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}> + <li class="{{localtop.get_css_classes()|join(" ")}}" {% if localtop.is_expandable() %} id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}> {{default_top.name}} {% if not protocol.is_done() and has_modify_right %} <a href="{{url_for('edit_localtop', localtop_id=localtop.id)}}">Ändern</a> @@ -44,7 +44,7 @@ {% for default_top in protocol.protocoltype.default_tops %} {% if default_top.is_at_end() %} {% set localtop = default_top.get_localtop(protocol) %} - <li{% if has_private_view_right and localtop.description is not none and localtop.description|length > 0 %} class="expansion-button" id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}> + <li class="{{localtop.get_css_classes()|join(" ")}}" {% if localtop.is_expandable() %} id="localtop-{{localtop.id}}" title="{{localtop.description}}"{% endif %}> {{default_top.name}} {% if not protocol.is_done() and has_modify_right %} <a href="{{url_for('edit_localtop', localtop_id=localtop.id)}}">Ändern</a>