From e05c01216a9423b5673402231d1c993dadcbbca0 Mon Sep 17 00:00:00 2001 From: marco <marco.nuechel@rwth-aachen.de> Date: Sun, 18 Feb 2018 02:59:35 +0100 Subject: [PATCH] UI Improvements /protocols/list Ref #156 --- templates/macros.html | 2 +- templates/protocols-list.html | 6 ++++++ views/tables.py | 35 +++++++++++++++++------------------ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/templates/macros.html b/templates/macros.html index ca9da0a..0408a6c 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -126,7 +126,7 @@ to not render a label for the CRSFTokenField --> <a href="{{table.newlink}}">{{table.newtext}}</a> {% endif %} </h3> - <table class="table table-striped"> + <table class="table table-striped table-hover"> <thead> <tr> {% for (header, class) in zip(table.headers(), classes) %} diff --git a/templates/protocols-list.html b/templates/protocols-list.html index 1b1f81f..02d3c81 100644 --- a/templates/protocols-list.html +++ b/templates/protocols-list.html @@ -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> {% endmacro %} + + {% block content %} <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_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" %} </div> {% endblock %} diff --git a/views/tables.py b/views/tables.py index 94ca58c..3352df1 100644 --- a/views/tables.py +++ b/views/tables.py @@ -71,10 +71,10 @@ class ProtocolsTable(Table): def headers(self): user = current_user() - result = ["ID", "Sitzung", "Sitzung", "Datum"] + result = ["Sitzung", "Sitzung", "Datum"] state_part = ["Status"] search_part = ["Suchergebnis"] - login_part = ["Typ", ""] + login_part = [""] if self.search_results is None: result.extend(state_part) else: @@ -85,9 +85,9 @@ class ProtocolsTable(Table): def classes(self): 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) - login_part = ["hidden-xs", "hidden-xs"] + login_part = ["hidden-xs"] if check_login(): result.extend(login_part) return result @@ -96,29 +96,28 @@ class ProtocolsTable(Table): user = current_user() protocol_link = url_for("show_protocol", protocol_id=protocol.id) result = [ - Table.link(protocol_link, str(protocol.id)), Markup("<br>").join([Table.link(protocol_link, protocol.protocoltype.name), date_filter(protocol.date)]), Table.link(protocol_link, protocol.protocoltype.name), date_filter(protocol.date), ] if self.search_results is None: - state = "Geplant" + state = "pencil" #"Geplant" if protocol.is_done(): - state = "Fertig" + state = "unchecked" #"Fertig" if protocol.public: - state = "Veröffentlicht" - result.append(state) + state = "check" #"Veröffentlicht" + result.append(Markup('<span class="glyphicon glyphicon-{state}">'.format(state=state))) elif protocol in self.search_results: result.append(Markup(self.search_results[protocol])) - if check_login(): - if user is not None and protocol.protocoltype.has_private_view_right(user): - result.append(Table.link(url_for("show_type", protocoltype_id=protocol.protocoltype.id), protocol.protocoltype.short_name)) - 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()))) - else: - result.append("") - else: - result.extend(["", ""]) + + login_part2="" + 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>' + + result.append(Markup('<div class="btn-group btn-group-xs"> {} </div>'.format(login_part2))) + + + + return result class ProtocolTypesTable(Table): -- GitLab