project-data-fix #35
6
dist/api/project/projectData.php
vendored
6
dist/api/project/projectData.php
vendored
@ -64,7 +64,7 @@ class projectData
|
||||
|
||||
if ($isMainProject === "true")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0;");
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0 WHERE isMainProject = 1;");
|
||||
$stmtMainProject->execute();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ class projectData
|
||||
$conn = dbConn();
|
||||
if ($isMainProject === "true")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0;");
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0 WHERE isMainProject = 1;");
|
||||
$stmtMainProject->execute();
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class projectData
|
||||
// update the database with the new image location
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("UPDATE projects SET imgLocation = :imgLocation WHERE ID = :ID");
|
||||
$stmt->bindParam(":imgLocation", $targetFile);
|
||||
$stmt->bindParam(":imgLocation", $targetFile["imgLocation"]);
|
||||
$stmt->bindParam(":ID", $ID);
|
||||
$stmt->execute();
|
||||
|
||||
|
2
dist/editor/editor.html
vendored
2
dist/editor/editor.html
vendored
File diff suppressed because one or more lines are too long
2
dist/editor/js/editor.js
vendored
2
dist/editor/js/editor.js
vendored
File diff suppressed because one or more lines are too long
@ -64,7 +64,7 @@ class projectData
|
||||
|
||||
if ($isMainProject === "true")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0;");
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0 WHERE isMainProject = 1;");
|
||||
$stmtMainProject->execute();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ class projectData
|
||||
$conn = dbConn();
|
||||
if ($isMainProject === "true")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0;");
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0 WHERE isMainProject = 1;");
|
||||
$stmtMainProject->execute();
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class projectData
|
||||
// update the database with the new image location
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("UPDATE projects SET imgLocation = :imgLocation WHERE ID = :ID");
|
||||
$stmt->bindParam(":imgLocation", $targetFile);
|
||||
$stmt->bindParam(":imgLocation", $targetFile["imgLocation"]);
|
||||
$stmt->bindParam(":ID", $ID);
|
||||
$stmt->execute();
|
||||
|
||||
|
@ -18,9 +18,10 @@
|
||||
class="fa fa-caret-right"></i></a></li>
|
||||
<li class="dropdown">
|
||||
<ul>
|
||||
<li><a href="#" id="goToAddPost" class="active"><span><</span>Add Blog Post<span>></span></a>
|
||||
<li><a href="#" id="goToAddPost"><span><</span>Add Blog Post<span>></span></a>
|
||||
</li>
|
||||
<li><a href="#" id="goToEditPost"><span><</span>Edit Blog Post<span>></span></a></li>
|
||||
<li><a href="#" id="goToEditPost" class="active"><span><</span>Edit Blog
|
||||
Post<span>></span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#" id="logout"><span><</span>Logout<span>></span></a></li>
|
||||
@ -205,6 +206,8 @@
|
||||
<input type="submit" value="Add new blog post" class="btn btnPrimary boxShadowIn boxShadowOut">
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
<script src="js/editor.js"></script>
|
||||
|
@ -56,7 +56,7 @@ document.addEventListener('DOMContentLoaded', () =>
|
||||
{
|
||||
json.forEach(item =>
|
||||
{
|
||||
addProject(item["ID"], (item["isMainProject"] === "1" ? "true" : "false"), (item["imgLocation"] === "") ? "../imgs/placeholder.png" : item["imgLocation"], item["title"], item["information"], item["projectLink"], item["gitLink"]);
|
||||
addProject(item["ID"], (item["isMainProject"] === 1 ? "true" : "false"), (item["imgLocation"] === "") ? "../imgs/placeholder.png" : item["imgLocation"], item["title"], item["information"], item["projectLink"], item["gitLink"]);
|
||||
})
|
||||
return;
|
||||
}
|
||||
@ -353,7 +353,6 @@ document.querySelector("#projError .close").addEventListener("click", () =>
|
||||
document.querySelector("#addPostError .close").addEventListener("click", () =>
|
||||
document.querySelector("#addPostError").classList.toggle("hidden"));
|
||||
|
||||
|
||||
document.querySelector("#addPostSuccess .close").addEventListener("click", () =>
|
||||
document.querySelector("#addPostSuccess").classList.toggle("hidden"));
|
||||
|
||||
@ -777,7 +776,7 @@ function updateProjectItem(id, e)
|
||||
{
|
||||
window.location.href = "./";
|
||||
return;
|
||||
}ujh
|
||||
}
|
||||
|
||||
document.querySelector(`#projError${id}`).classList.remove("hidden");
|
||||
document.querySelector(`#projError${id} div`).innerHTML = updatedProjectImage.error;
|
||||
@ -856,7 +855,7 @@ function addProject(id , isMainProject, imgLocation, title, information, project
|
||||
</div>
|
||||
<div class="formControl isMainProject">
|
||||
<label class="checkContainer" for="isMainProject${id}">Is It The Main Project
|
||||
<input type="checkbox" id="isMainProject${id}" name="isMainProject${id}" ${(isMainProject === "true" ? "checked" : "")}>
|
||||
<input type="checkbox" id="isMainProject${id}" name="isMainProject${id}" ${(isMainProject === "true" ? "checked=''" : "")}>
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user