Commit 69841be0 authored by Robin Sonnabend's avatar Robin Sonnabend

Add visual difference betwenn default-tops and tops

/close #87
parent 80b4f2f2
......@@ -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"
......
......@@ -73,3 +73,7 @@ textarea {
.like-sign {
font-size: 16px;
}
li.defaulttop {
font-style: italic;
}
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment