From 3c5cb22975f3ab4a6e98e0340bfa17dafb882fda Mon Sep 17 00:00:00 2001 From: flifloo Date: Tue, 29 Sep 2020 14:44:59 +0200 Subject: [PATCH] Departments management rework --- public/javascripts/admin/departments.js | 2 +- views/admin/departments/add.pug | 17 ++++++++++------- views/admin/departments/edit.pug | 19 +++++++++++-------- views/admin/departments/index.pug | 24 +++++++++++++----------- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/public/javascripts/admin/departments.js b/public/javascripts/admin/departments.js index b64f7b1..29cf219 100644 --- a/public/javascripts/admin/departments.js +++ b/public/javascripts/admin/departments.js @@ -1,4 +1,4 @@ -document.querySelectorAll("a.remove") +document.querySelectorAll(".delete") .forEach(e => e.addEventListener("click", ev => { if (!confirm("Do you really want to remove this department ?")) ev.preventDefault(); diff --git a/views/admin/departments/add.pug b/views/admin/departments/add.pug index 150c50c..769ebac 100644 --- a/views/admin/departments/add.pug +++ b/views/admin/departments/add.pug @@ -1,11 +1,14 @@ extends ../../layout block content - div.card#departmentsManagement + div.container h1=__("admin.new")+" "+__("department") - form(action="/admin/departments/add" method="POST") - div.field - label(for="name")=__("admin.name")+":" - input#name(type="text" name="name" required) - div.field - input(type="submit" value=__("admin.add")) + div.row + form(action="/admin/departments/add" method="POST") + div.row + div.input-field.col.s12 + label(for="name")=__("admin.name")+":" + input#name(type="text" name="name" required) + div.row.center + div.input-field.col.s12 + +submit(__("admin.add")) diff --git a/views/admin/departments/edit.pug b/views/admin/departments/edit.pug index ef54167..0c96f69 100644 --- a/views/admin/departments/edit.pug +++ b/views/admin/departments/edit.pug @@ -1,12 +1,15 @@ extends ../../layout block content - div.card#departmentsManagement + div.container h1=__("admin.edit")+" "+department.name - form(action="/admin/departments/edit" method="POST") - input.hide(type="text" name="name" value=department.name required) - div.field - label(for="name")=__("admin.name")+":" - input#name(type="text" name="newName" value=department.name required) - div.field - input(type="submit" value=__("save")) + div.row + form(action="/admin/departments/edit" method="POST") + input.hide(type="text" name="name" value=department.name required) + div.row + div.input-field.col.s12 + label(for="name")=__("admin.name")+":" + input#name(type="text" name="newName" value=department.name required) + div.row.center + div.input-field.col.s12 + +submit(__("save")) diff --git a/views/admin/departments/index.pug b/views/admin/departments/index.pug index fdd70b7..e2b9f62 100644 --- a/views/admin/departments/index.pug +++ b/views/admin/departments/index.pug @@ -1,18 +1,20 @@ extends ../../layout block content - div.card#departmentsManagement + div.container h1=__("admin.departmentsManagement") - a.add(href="/admin/departments/add") - button=__("admin.add") - div + ul.collection each department in departments - div.department - h2=department.name - div.buttons - a.edit(href="/admin/departments/edit?name="+department.name) - button=__("admin.edit") - a.remove(href="/admin/departments/delete?name="+department.name) - button=__("admin.remove") + li.collection-item + div=department.name + div.secondary-content + a(href="/admin/departments/edit?name="+department.name) + i.material-icons edit + a.delete(href="/admin/departments/delete?name="+department.name) + i.material-icons remove + + div.fixed-action-btn + a.btn-floating.btn-large.blue(href="/admin/departments/add") + i.large.material-icons add script(src="/javascripts/admin/departments.js")