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")
form(action="/admin/sandwiches/add" method="POST") div.row
div.field form(action="/admin/sandwiches/add" method="POST")
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="name" required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
label(for="price")=__("admin.price") + ":" input#name(type="text" name="name" required)
input#price(type="number" min="0" step="any" name="price" value="0" required) div.row
div.field div.input-field.col.s12
input(type="submit" value=__("admin.add")) label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value="0" required)
div.row.center
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
form(action="/admin/sandwiches/edit" method="POST") div.row
input.hide(type="text" name="name" value=sandwich.name required) form(action="/admin/sandwiches/edit" method="POST")
div.field input.hide(type="text" name="name" value=sandwich.name required)
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="newName" value=sandwich.name required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
label(for="price")=__("admin.price") + ":" input#name(type="text" name="newName" value=sandwich.name required)
input#price(type="number" min="0" step="any" name="price" value=sandwich.price required) div.row
div.field div.input-field.col.s12
input(type="submit" value=__("save")) label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value=sandwich.price required)
div.row.center
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")