From c30ab8f584b9e3794b63c9889b2db1e42c3d0b3c Mon Sep 17 00:00:00 2001
From: Stephan Porada <sporada@uni-bielefeld.de>
Date: Wed, 10 Jun 2020 15:10:23 +0200
Subject: [PATCH] Some cosmetic fixes

---
 web/app/admin/tables.py | 5 +++--
 web/app/admin/views.py  | 3 ++-
 web/app/jobs/tables.py  | 5 +++--
 web/app/jobs/views.py   | 5 +++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/web/app/admin/tables.py b/web/app/admin/tables.py
index f393ac89..40452278 100644
--- a/web/app/admin/tables.py
+++ b/web/app/admin/tables.py
@@ -15,7 +15,7 @@ class AdminUserTable(Table):
     role_id = Col('Role', column_html_attrs={'class': 'role'},
                   th_html_attrs={'class': 'sort',
                                  'data-sort': 'role'})
-    confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'},
+    confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'},  # noqa
                     th_html_attrs={'class': 'sort',
                                    'data-sort': 'confirmed'})
     id = Col('User Id', column_html_attrs={'class': 'id'},
@@ -23,7 +23,8 @@ class AdminUserTable(Table):
                             'data-sort': 'id'})
     url = LinkCol('Profile', 'admin.user',
                   url_kwargs=dict(user_id='id'),
-                  anchor_attrs={'class': 'waves-effect waves-light btn-small'})
+                  anchor_attrs={'class': 'waves-effect waves-light btn-floating'},  # noqa
+                  text_fallback='<i class="material-icons">edit</i>')
 
 
 class AdminUserItem(object):
diff --git a/web/app/admin/views.py b/web/app/admin/views.py
index 45b06820..f06cf098 100644
--- a/web/app/admin/views.py
+++ b/web/app/admin/views.py
@@ -7,6 +7,7 @@ from .. import db
 from ..decorators import admin_required
 from ..models import Role, User
 from ..profile import tasks as profile_tasks
+import html
 
 
 @admin.route('/')
@@ -17,7 +18,7 @@ def index():
     items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed, u.id)
              for u in users]
     # Convert table object to html string
-    table = AdminUserTable(items).__html__()
+    table = html.unescape(AdminUserTable(items).__html__())
     # Add class "list" to tbody element. Needed for "List.js"
     table = table.replace('tbody', 'tbody class="list"', 1)
     return render_template('admin/index.html.j2', table=table,
diff --git a/web/app/jobs/tables.py b/web/app/jobs/tables.py
index 15edf916..aeac3319 100644
--- a/web/app/jobs/tables.py
+++ b/web/app/jobs/tables.py
@@ -12,8 +12,9 @@ class JobInputTable(Table):
     url = LinkCol('Download', 'jobs.download_job_input',
                   url_kwargs=dict(job_id='job.id',
                                   job_input_id='input_id'),
-                  anchor_attrs={'class': 'waves-effect waves-light btn-small',
-                                'download': ''})
+                  anchor_attrs={'class': 'waves-effect waves-light btn-floating',
+                                'download': ''},
+                  text_fallback='<i class="material-icons">file_download</i>')
 
 
 class JobInputItem(object):
diff --git a/web/app/jobs/views.py b/web/app/jobs/views.py
index 394146d9..6e66b211 100644
--- a/web/app/jobs/views.py
+++ b/web/app/jobs/views.py
@@ -6,6 +6,7 @@ from . import tasks
 from . tables import JobInputItem, JobInputTable
 from ..models import Job, JobInput, JobResult
 import os
+import html
 
 
 @jobs.route('/<int:job_id>')
@@ -16,8 +17,8 @@ def job(job_id):
         abort(403)
     items = [JobInputItem(input.filename, job, input.id)
              for input in job.inputs]
-    # Convert table object to html string
-    job_input_table = JobInputTable(items).__html__()
+    # Convert table object to html string and unescape <>& for al little hack to use icons in buttons
+    job_input_table = html.unescape(JobInputTable(items).__html__())
     # Add class "list" to tbody element. Needed for "List.js"
     job_input_table = job_input_table.replace('tbody', 'tbody class="list"', 1)
     return render_template('jobs/job.html.j2',
-- 
GitLab