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

Improve views/tables.py code quality

Added comments
parent 6409b034
No related branches found
No related tags found
No related merge requests found
...@@ -103,35 +103,42 @@ class ProtocolsTable(Table): ...@@ -103,35 +103,42 @@ class ProtocolsTable(Table):
def classes(self): def classes(self):
if self.search_results is None: if self.search_results is None:
result = [ result = [
"hidden-sm hidden-md hidden-lg", "hidden-sm hidden-md hidden-lg", # "Sitzung" 2 lines mobile view
"hidden-xs", "hidden-xs", "hidden-xs", # "Sitzung" 1 line standard view
"hidden-sm hidden-md hidden-lg", "hidden-xs", # "Datum" standard view
"hidden-xs", "" "hidden-sm hidden-md hidden-lg", # "Status" only icon mobile view
"hidden-xs", # "Status" icon + text standard view
"" # column for buttons all vievs
] ]
else: else:
result = [ result = [
"hidden-sm hidden-md hidden-lg", "hidden-sm hidden-md hidden-lg", # "Sitzung" 2 lines mobile view
"hidden-xs", "hidden-xs", "hidden-xs", # "Sitzung" 1 line standard view
"", "hidden-xs", "hidden-xs"] "hidden-xs", # "Datum" standard view
"", # "Suchergebnis" all vievs
"hidden-xs", # Status without header standard view
"hidden-xs" # column for buttons standard view
]
return result return result
def row(self, protocol): def row(self, protocol):
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.concat_lines([ Table.concat_lines([ # "Sitzung" 2 lines
Table.link(protocol_link, protocol.protocoltype.name), Table.link(protocol_link, protocol.protocoltype.name),
date_filter(protocol.date)]), date_filter(protocol.date)]),
Table.link(protocol_link, protocol.protocoltype.name), Table.link(protocol_link, protocol.protocoltype.name), # "Sitzung" 1 line
date_filter(protocol.date), date_filter(protocol.date) # "Datum"
] ]
if self.search_results is None: if self.search_results is None:
result.append(Table.glyphicon(protocol.get_state_glyph())) result.append(Table.glyphicon(protocol.get_state_glyph())) # "Status" only icon
result.append(Table.glyphicon( result.append(Table.glyphicon( # "Status" icon + text
protocol.get_state_glyph(), protocol.get_state_name())) protocol.get_state_glyph(), protocol.get_state_name()))
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])) # "Suchergebnis"
result.append(Table.glyphicon(protocol.get_state_glyph())) result.append(Table.glyphicon(protocol.get_state_glyph())) # "Status" only icon
buttons = [] buttons = []
if protocol.has_public_view_right(user): if protocol.has_public_view_right(user):
...@@ -150,7 +157,7 @@ class ProtocolsTable(Table): ...@@ -150,7 +157,7 @@ class ProtocolsTable(Table):
confirm="Bist du dir sicher, dass du das Protokoll {} " confirm="Bist du dir sicher, dass du das Protokoll {} "
"löschen möchtest?")) "löschen möchtest?"))
result.append(Table.button_group(buttons)) result.append(Table.button_group(buttons)) # column for buttons
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment