Archived
1
0
Fork 0

Sandwiches management rework

This commit is contained in:
Ethanell 2020-09-29 14:39:13 +02:00
parent 84cd60e52c
commit 1c0b810022
4 changed files with 43 additions and 33 deletions

View file

@ -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 sandwich ?"))
ev.preventDefault();

View file

@ -1,14 +1,18 @@
extends ../../layout
block content
div.card#sandwichesManagement
div.container
h1=__("admin.new")+" "+__("sandwich")
div.row
form(action="/admin/sandwiches/add" method="POST")
div.field
div.row
div.input-field.col.s12
label(for="name")=__("admin.name")+":"
input#name(type="text" name="name" required)
div.field
div.row
div.input-field.col.s12
label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value="0" required)
div.field
input(type="submit" value=__("admin.add"))
div.row.center
div.input-field.col.s12
+submit(__("admin.add"))

View file

@ -1,15 +1,19 @@
extends ../../layout
block content
div.card#sandwichesManagement
div.container
h1=__("admin.edit")+" "+sandwich.name
div.row
form(action="/admin/sandwiches/edit" method="POST")
input.hide(type="text" name="name" value=sandwich.name required)
div.field
div.row
div.input-field.col.s12
label(for="name")=__("admin.name")+":"
input#name(type="text" name="newName" value=sandwich.name required)
div.field
div.row
div.input-field.col.s12
label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value=sandwich.price required)
div.field
input(type="submit" value=__("save"))
div.row.center
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,18 +1,20 @@
extends ../../layout
block content
div.card#sandwichesManagement
div.container
h1=__("admin.sandwichManagement")
a.add(href="/admin/sandwiches/add")
button=__("admin.add")
div
ul.collection
each sandwich in sandwiches
div.sandwich
h2=sandwich.name
div.buttons
a.edit(href="/admin/sandwiches/edit?name="+sandwich.name)
button=__("admin.edit")
a.remove(href="/admin/sandwiches/delete?name="+sandwich.name)
button=__("admin.remove")
li.collection-item
div=sandwich.name
div.secondary-content
a(href="/admin/sandwiches/edit?name="+sandwich.name)
i.material-icons edit
a.delete(href="/admin/sandwiches/delete?name="+sandwich.name)
i.material-icons remove
div.fixed-action-btn
a.btn-floating.btn-large.blue(href="/admin/sandwiches/add")
i.large.material-icons add
script(src="/javascripts/admin/sandwiches.js")