Skip to content
Snippets Groups Projects
Commit e05c0121 authored by marco's avatar marco
Browse files

UI Improvements /protocols/list

Ref #156
parent beb64bb1
No related branches found
No related tags found
1 merge request!10Resolve "Protokolle Übersichtseite umbauen"
...@@ -126,7 +126,7 @@ to not render a label for the CRSFTokenField --> ...@@ -126,7 +126,7 @@ to not render a label for the CRSFTokenField -->
<a href="{{table.newlink}}">{{table.newtext}}</a> <a href="{{table.newlink}}">{{table.newtext}}</a>
{% endif %} {% endif %}
</h3> </h3>
<table class="table table-striped"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
{% for (header, class) in zip(table.headers(), classes) %} {% for (header, class) in zip(table.headers(), classes) %}
......
...@@ -12,10 +12,16 @@ ...@@ -12,10 +12,16 @@
<a href="{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}">{{text}}</a> <a href="{{url_for(request.endpoint, page=_page, protocoltype_id=protocoltype_id, search=search_term, state_open=state_open, page_length=_page_length)}}">{{text}}</a>
{% endmacro %} {% endmacro %}
{% block content %} {% block content %}
<div class="container"> <div class="container">
{{render_form(search_form, class_="form-inline", action_url=url_for("list_protocols"), action_text="Suchen", labels_visible=False, method="GET")}} {{render_form(search_form, class_="form-inline", action_url=url_for("list_protocols"), action_text="Suchen", labels_visible=False, method="GET")}}
{{render_table(protocols_table)}} {{render_table(protocols_table)}}
<div align="center"> <span class="glyphicon glyphicon-pencil"></span> Geplant,
<span class="glyphicon glyphicon-unchecked"></span> Fertig,
<span class="glyphicon glyphicon-check"></span> Veröffentlicht
</div>
{% include "pagination-footer.html" %} {% include "pagination-footer.html" %}
</div> </div>
{% endblock %} {% endblock %}
...@@ -71,10 +71,10 @@ class ProtocolsTable(Table): ...@@ -71,10 +71,10 @@ class ProtocolsTable(Table):
def headers(self): def headers(self):
user = current_user() user = current_user()
result = ["ID", "Sitzung", "Sitzung", "Datum"] result = ["Sitzung", "Sitzung", "Datum"]
state_part = ["Status"] state_part = ["Status"]
search_part = ["Suchergebnis"] search_part = ["Suchergebnis"]
login_part = ["Typ", ""] login_part = [""]
if self.search_results is None: if self.search_results is None:
result.extend(state_part) result.extend(state_part)
else: else:
...@@ -85,9 +85,9 @@ class ProtocolsTable(Table): ...@@ -85,9 +85,9 @@ class ProtocolsTable(Table):
def classes(self): def classes(self):
state_or_search_class = "hidden-xs" if self.search_results is None else None state_or_search_class = "hidden-xs" if self.search_results is None else None
result = ["hidden-xs", "hidden-sm hidden-md hidden-lg", "hidden-xs", "hidden-xs", None] result = ["hidden-sm hidden-md hidden-lg", "hidden-xs", "hidden-xs", None]
#result.append(state_or_search_class) #result.append(state_or_search_class)
login_part = ["hidden-xs", "hidden-xs"] login_part = ["hidden-xs"]
if check_login(): if check_login():
result.extend(login_part) result.extend(login_part)
return result return result
...@@ -96,29 +96,28 @@ class ProtocolsTable(Table): ...@@ -96,29 +96,28 @@ class ProtocolsTable(Table):
user = current_user() user = current_user()
protocol_link = url_for("show_protocol", protocol_id=protocol.id) protocol_link = url_for("show_protocol", protocol_id=protocol.id)
result = [ result = [
Table.link(protocol_link, str(protocol.id)),
Markup("<br>").join([Table.link(protocol_link, protocol.protocoltype.name), date_filter(protocol.date)]), Markup("<br>").join([Table.link(protocol_link, protocol.protocoltype.name), date_filter(protocol.date)]),
Table.link(protocol_link, protocol.protocoltype.name), Table.link(protocol_link, protocol.protocoltype.name),
date_filter(protocol.date), date_filter(protocol.date),
] ]
if self.search_results is None: if self.search_results is None:
state = "Geplant" state = "pencil" #"Geplant"
if protocol.is_done(): if protocol.is_done():
state = "Fertig" state = "unchecked" #"Fertig"
if protocol.public: if protocol.public:
state = "Veröffentlicht" state = "check" #"Veröffentlicht"
result.append(state) result.append(Markup('<span class="glyphicon glyphicon-{state}">'.format(state=state)))
elif protocol in self.search_results: elif protocol in self.search_results:
result.append(Markup(self.search_results[protocol])) result.append(Markup(self.search_results[protocol]))
if check_login():
if user is not None and protocol.protocoltype.has_private_view_right(user): login_part2=""
result.append(Table.link(url_for("show_type", protocoltype_id=protocol.protocoltype.id), protocol.protocoltype.short_name)) login_part2 = '<a href=url_for("delete_protocol", protocol_id=protocol.id)" class="btn btn-danger" confirm="Bist du dir sicher, dass du das Protokoll {} löschen möchtest?"> <span class="glyphicon glyphicon-trash"></span> </a>'
if protocol.protocoltype.has_admin_right(user):
result.append(Table.link(url_for("delete_protocol", protocol_id=protocol.id), "Löschen", confirm="Bist du dir sicher, dass du das Protokoll {} löschen möchtest?".format(protocol.get_short_identifier()))) result.append(Markup('<div class="btn-group btn-group-xs"> {} </div>'.format(login_part2)))
else:
result.append("")
else:
result.extend(["", ""])
return result return result
class ProtocolTypesTable(Table): class ProtocolTypesTable(Table):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment