Commit c4315d71 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

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

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