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 => { .forEach(e => e.addEventListener("click", ev => {
if (!confirm("Do you really want to remove this sandwich ?")) if (!confirm("Do you really want to remove this sandwich ?"))
ev.preventDefault(); ev.preventDefault();

View file

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

View file

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

View file

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