mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
some tweaks
This commit is contained in:
parent
35fd7ca908
commit
8c444e1bb9
4 changed files with 13 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
highlightNewEntry();
|
||||||
$("input[type=checkbox]").change(checkItem);
|
$("input[type=checkbox]").change(checkItem);
|
||||||
$("#remove").click(deleteCheckeditems);
|
$("#remove").click(deleteCheckeditems);
|
||||||
$("#nameField").focus();
|
$("#nameField").focus();
|
||||||
|
@ -6,6 +7,13 @@ $(document).ready(function () {
|
||||||
$("#nameField").on("focus", function () { $(this).select(); });
|
$("#nameField").on("focus", function () { $(this).select(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function highlightNewEntry(){
|
||||||
|
var cookies = document.cookie;
|
||||||
|
var cookieRegExp = new RegExp(/newItem(\d+)/ig);
|
||||||
|
console.log(cookies.match(cookieRegExp));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function deleteCheckeditems() {
|
function deleteCheckeditems() {
|
||||||
$.post({
|
$.post({
|
||||||
url: "api/list/del",
|
url: "api/list/del",
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$CONFIG = array (
|
$CONFIG = array (
|
||||||
'installed' => true,
|
'installed' => false,
|
||||||
'host' => 'localhost',
|
|
||||||
'username' => 'shoppinglist',
|
|
||||||
'passwd' => 'Erfolg100%',
|
|
||||||
'database' => 'shoppinglist',
|
|
||||||
'theme' => 'default',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -41,7 +41,9 @@
|
||||||
$insertQuery = $mysqli->prepare("INSERT INTO `Einkauf` (`Anzahl`, `Einheit`, `Name`, `Erledigt`) VALUES (?, ?, ?, 0);");
|
$insertQuery = $mysqli->prepare("INSERT INTO `Einkauf` (`Anzahl`, `Einheit`, `Name`, `Erledigt`) VALUES (?, ?, ?, 0);");
|
||||||
$insertQuery->bind_param("sss", $anzahl, $einheit, $name);
|
$insertQuery->bind_param("sss", $anzahl, $einheit, $name);
|
||||||
$result = $insertQuery->execute();
|
$result = $insertQuery->execute();
|
||||||
|
$insertID = $mysqli->insert_id;
|
||||||
$mysqli->close();
|
$mysqli->close();
|
||||||
|
return $insertID;
|
||||||
}
|
}
|
||||||
|
|
||||||
function newItems($itemList){
|
function newItems($itemList){
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
switch ($_GET["function"]) {
|
switch ($_GET["function"]) {
|
||||||
case 'new':
|
case 'new':
|
||||||
$shopping->newItem($_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
|
$newID = $shopping->newItem($_POST["anzahl"], $_POST["einheit"], $_POST["name"]);
|
||||||
|
setcookie("newItem", "$newID", 0, "/", "");
|
||||||
header("Location: /list");
|
header("Location: /list");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue