Commit c4315d71 authored by Robin Sonnabend's avatar Robin Sonnabend

Merge branch 'master' of git.fsmpi.rwth-aachen.de:protokollsystem/proto3

parents 1536cb16 399debab
......@@ -17,7 +17,7 @@ import os
from sqlalchemy import event
from sqlalchemy.orm import relationship, backref
from todostates import make_states
from todostates import make_states, make_state_glyphes
class DatabaseModel(db.Model):
......@@ -602,6 +602,10 @@ class TodoState(Enum):
STATE_TO_NAME, NAME_TO_STATE = make_states(TodoState)
return STATE_TO_NAME[self]
def get_glyph(self):
STATE_TO_GLYPH = make_state_glyphes(TodoState)
return STATE_TO_GLYPH[self]
@staticmethod
def get_name_to_state():
STATE_TO_NAME, NAME_TO_STATE = make_states(TodoState)
......@@ -711,6 +715,9 @@ class Todo(DatabaseModel):
def get_state(self):
return "[{}]".format(self.get_state_plain())
def get_state_glyph(self):
return self.state.get_glyph()
def get_state_plain(self):
result = self.state.get_name()
if self.state.needs_date():
......
......@@ -112,35 +112,43 @@
<thead>
<tr>
<th class="hidden-sm hidden-md hidden-lg">Todo</th>
<th class="hidden-xs">ID</th>
<th class="hidden-xs">Status</th>
<th class="hidden-xs">Sitzung</th>
<th class="hidden-xs">Name</th>
<th>Aufgabe</th>
<th class="hidden-xs">Sitzung</th>
<th class="hidden-xs"></th>
</tr>
</thead>
<tbody>
<tr>
<td class="hidden-sm hidden-md hidden-lg"><a href="#">[offen]</a><br><a href="#">Sitzung</a><br>mmustermann</td>
<td class="hidden-xs"><a href="#">2</a></td>
<td class="hidden-xs">[offen]</td>
<td class="hidden-xs"><a href="#">Sitzung-18-03-01</a></td>
<td class="hidden-sm hidden-md hidden-lg"><span class="glyphicon glyphicon-unchecked"></span><br>mmustermann<br><a href="#">Sitzung</a></td>
<td class="hidden-xs"><span class="glyphicon glyphicon-unchecked"></span> offen</td>
<td class="hidden-xs">mmustermann</td>
<td>Mit der Fakultät treffen</td>
<td class="hidden-xs"><a href="#">Ändern</a>, <a href="#">Löschen</a></td>
<td><a href="#">Mit der Fakultät treffen</a></td>
<td class="hidden-xs"><a href="#">Sitzung-18-03-01</a></td>
<td class="hidden-xs"><div class="btn-group btn-group-xs"><a href="#" class="btn btn-success"><span class="glyphicon glyphicon-pencil"></span></a><a href="#" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a></div></td>
</tr>
<tr>
<td class="hidden-sm hidden-md hidden-lg"><a href="#">[in Bearbeitung]</a><br><a href="#">Arbeitsgruppe</a><br>kmusterfrau</td>
<td class="hidden-xs"><a href="#">1</a></td>
<td class="hidden-xs">[in Bearbeitung]</td>
<td class="hidden-xs"><a href="#">Arbeitsgruppe-18-02-15</a></td>
<td class="hidden-sm hidden-md hidden-lg"><span class="glyphicon glyphicon-edit"></span><br>kmusterfrau<br><a href="#">Arbeitsgruppe</a></td>
<td class="hidden-xs"><span class="glyphicon glyphicon-edit"></span> in Bearbeitung</td>
<td class="hidden-xs">kmusterfrau</td>
<td>Organisiation des nächsten Events</td>
<td class="hidden-xs"><a href="#">Ändern</a>, <a href="#">Löschen</a></td>
<td><a href="#">Organisiation des nächsten Events</a></td>
<td class="hidden-xs"><a href="#">Arbeitsgruppe-18-02-15</a></td>
<td class="hidden-xs"><div class="btn-group btn-group-xs"><a href="#" class="btn btn-success"><span class="glyphicon glyphicon-pencil"></span></a><a href="#" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a></div></td>
</tr>
</tbody>
</table>
<div align="center">
<span class="glyphicon glyphicon-unchecked"></span> offen,
<span class="glyphicon glyphicon-share"></span> wartet auf Rückmeldung,
<span class="glyphicon glyphicon-edit"></span> in Bearbeitung,
<span class="glyphicon glyphicon-log-out"></span> ab,
<span class="glyphicon glyphicon-log-in"></span> vor,
<span class="glyphicon glyphicon-modal-window"></span> verwaist,
<span class="glyphicon glyphicon-check"></span> erledigt,
<span class="glyphicon glyphicon-remove-circle"></span> abgewiesen,
<span class="glyphicon glyphicon-ban-circle"></span> obsolet
</div>
</div>
</div>
<p>
......@@ -202,39 +210,39 @@
</thead>
<tbody>
<tr>
<td>offen</td>
<td><span class="glyphicon glyphicon-unchecked"></span> offen</td>
<td>Das Todo muss noch erledigt werden</td>
</tr>
<tr>
<td>wartet auf Rückmeldung</td>
<td><span class="glyphicon glyphicon-share"></span> wartet auf Rückmeldung</td>
<td>Jemand kümmert sich um das Todo, wartet allerdings gerade darauf, dass jemand anderes (intern oder extern) sich zurückmeldet.</td>
</tr>
<tr>
<td>in Bearbeitung</td>
<td><span class="glyphicon glyphicon-edit"></span> in Bearbeitung</td>
<td>Jemand kümmert sich gerade um das Todo.</td>
</tr>
<tr>
<td>ab</td>
<td><span class="glyphicon glyphicon-log-out"></span> ab</td>
<td>Das Todo wird erst ab dem Datum relevant.</td>
</tr>
<tr>
<td>vor</td>
<td><span class="glyphicon glyphicon-log-in"></span> vor</td>
<td>Das Todo muss vor dem Datum erledigt werden.</td>
</tr>
<tr>
<td>verwaist</td>
<td><span class="glyphicon glyphicon-modal-window"></span> verwaist</td>
<td>Das Todo hat niemanden, der es erledigen wird.</td>
</tr>
<tr>
<td>erledigt</td>
<td><span class="glyphicon glyphicon-check"></span> erledigt</td>
<td>Das Todo ist erledigt.</td>
</tr>
<tr>
<td>abgewiesen</td>
<td><span class="glyphicon glyphicon-remove-circle"></span> abgewiesen</td>
<td>Das Todo ist nicht und wird nicht mehr erledigt.</td>
</tr>
<tr>
<td>obsolet</td>
<td><span class="glyphicon glyphicon-ban-circle"></span> obsolet</td>
<td>Das Todo wurde nicht erledigt und nun ist es zu spät, das noch zu tun.</td>
</tr>
</tbody>
......
......@@ -6,6 +6,16 @@
<div class="container">
{{render_form(search_form, class_="form-inline", action_url=url_for("list_todos"), action_text="Suchen", labels_visible=False, method="GET")}}
{{render_table(todos_table)}}
<div align="center"><span class="glyphicon glyphicon-unchecked"></span> offen,
<span class="glyphicon glyphicon-share"></span> wartet auf Rückmeldung,
<span class="glyphicon glyphicon-edit"></span> in Bearbeitung,
<span class="glyphicon glyphicon-log-out"></span> ab,
<span class="glyphicon glyphicon-log-in"></span> vor,
<span class="glyphicon glyphicon-modal-window"></span> verwaist,
<span class="glyphicon glyphicon-check"></span> erledigt,
<span class="glyphicon glyphicon-remove-circle"></span> abgewiesen,
<span class="glyphicon glyphicon-ban-circle"></span> obsolet
</div>
{% include "pagination-footer.html" %}
</div>
{% endblock %}
......@@ -56,3 +56,17 @@ def make_states(TodoState):
"obsolete": TodoState.obsolete
}
return STATE_TO_NAME, NAME_TO_STATE
def make_state_glyphes(TodoState):
STATE_TO_GLYPH = {
TodoState.open: "unchecked",
TodoState.waiting: "share",
TodoState.in_progress: "edit",
TodoState.after: "log-out",
TodoState.before: "log-in",
TodoState.orphan: "modal-window",
TodoState.done: "check",
TodoState.rejected: "remove-circle",
TodoState.obsolete: "ban-circle"
}
return STATE_TO_GLYPH
......@@ -481,29 +481,28 @@ class TodosTable(Table):
super().__init__("Todos", todos, newlink=url_for("new_todo"))
def headers(self):
return ["Todo", "ID", "Status", "Sitzung", "Name", "Aufgabe", ""]
return ["Todo", "Status", "Name", "Aufgabe", "Sitzung", ""]
def classes(self):
return [
"hidden-sm hidden-md hidden-lg",
"hidden-xs", "hidden-xs", "hidden-xs", "hidden-xs",
None, "hidden-xs"]
"hidden-xs", "hidden-xs", None,
"hidden-xs", "hidden-xs"]
def row(self, todo):
user = current_user()
protocol = todo.get_first_protocol()
mobile_parts = [Table.link(
url_for("show_todo", todo_id=todo.id),
todo.get_state())]
mobile_parts = [Table.glyphicon(todo.get_state_glyph())]
mobile_parts.append(todo.who)
if protocol is not None:
mobile_parts.append(Table.link(
url_for("show_protocol", protocol_id=protocol.id),
todo.protocoltype.short_name))
mobile_parts.append(todo.who)
row = [
Markup("<br>").join(mobile_parts),
Table.link(url_for("show_todo", todo_id=todo.id), todo.get_id()),
todo.get_state(),
Table.glyphicon(todo.get_state_glyph(),todo.get_state_plain()),
todo.who,
Table.link(url_for("show_todo", todo_id=todo.id), todo.description),
Table.link(
url_for("show_protocol", protocol_id=protocol.id),
protocol.get_short_identifier())
......@@ -512,15 +511,22 @@ class TodosTable(Table):
url_for(
"list_protocols", protocoltype_id=todo.protocoltype.id),
todo.protocoltype.short_name),
todo.who,
todo.description,
]
if todo.protocoltype.has_modify_right(user):
row.append(Table.concat([
Table.link(url_for("edit_todo", todo_id=todo.id), "Ändern"),
Table.link(url_for("delete_todo", todo_id=todo.id,
csrf_token=get_csrf_token()), "Löschen")
]))
buttons = []
buttons.append(Table.button(
url_for(
"edit_todo", todo_id=todo.id,
csrf_token=get_csrf_token()),
icon="pencil",
style="success"))
buttons.append(Table.button(
url_for(
"delete_todo", todo_id=todo.id,
csrf_token=get_csrf_token()),
icon="trash",
style="danger"))
row.append(Table.button_group(buttons))
else:
row.append("")
return row
......
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