changed how a few code snippets work and added in all projects section to view all the current projects includig <div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>the one as the main
Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
Vendored
+11
-2
@@ -225,10 +225,19 @@ $app->patch("/projectData/{id}", function (Request $request, Response $response,
|
||||
return $response->withStatus(400);
|
||||
}
|
||||
|
||||
if (!$projectData->updateProjectData($args["id"], $data["title"], $data["isMainProject"], $data["information"], $data["projectLink"], $data["gitLink"]))
|
||||
$update = $projectData->updateProjectData($args["id"], $data["title"], $data["isMainProject"], $data["information"], $data["projectLink"], $data["gitLink"]);
|
||||
|
||||
if ($update === "unset main project")
|
||||
{
|
||||
// uh oh something went wrong
|
||||
$response->getBody()->write(json_encode(array("error" => "Something went wrong", "data" => $projectData->updateProjectData($args["id"], $data["title"], $data["isMainProject"], $data["information"], $data["projectLink"], $data["gitLink"]))));
|
||||
$response->getBody()->write(json_encode(array("error" => "Can't unset project as main project, try updating another project as the main project")));
|
||||
return $response->withStatus(400);
|
||||
}
|
||||
|
||||
if (!$update)
|
||||
{
|
||||
// uh oh something went wrong
|
||||
$response->getBody()->write(json_encode(array("error" => "Something went wrong")));
|
||||
return $response->withStatus(500);
|
||||
}
|
||||
return $response;
|
||||
|
||||
Vendored
+17
-4
@@ -41,12 +41,25 @@ class projectData
|
||||
* @param string $information - Information about the project
|
||||
* @param string $projectLink - Link to the project
|
||||
* @param string $gitLink - Link to the git repository
|
||||
* @return bool - True if project was updated, false if not and there was an error
|
||||
* @return bool|string - True if project was updated, false if not and there was an error, or an error string
|
||||
*/
|
||||
function updateProjectData(string $ID, string $title, string $isMainProject, string $information, string $projectLink, string $gitLink): bool
|
||||
function updateProjectData(string $ID, string $title, string $isMainProject, string $information, string $projectLink, string $gitLink): bool | string
|
||||
{
|
||||
$conn = dbConn();
|
||||
|
||||
if ($isMainProject === "false")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("SELECT isMainProject FROM projects WHERE ID = :ID");
|
||||
$stmtMainProject->bindParam(":ID", $ID);
|
||||
$stmtMainProject->execute();
|
||||
$result = $stmtMainProject->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result["isMainProject"] === "1")
|
||||
{
|
||||
return "unset main project";
|
||||
}
|
||||
}
|
||||
|
||||
if ($isMainProject === "true")
|
||||
{
|
||||
$stmtMainProject = $conn->prepare("UPDATE projects SET isMainProject = 0;");
|
||||
@@ -55,7 +68,7 @@ class projectData
|
||||
|
||||
$stmt = $conn->prepare("UPDATE projects SET title = :title, isMainProject = :isMainProject, information = :information, projectLink = :projectLink, gitLink = :gitLink WHERE ID = :ID");
|
||||
$stmt->bindParam(":title", $title);
|
||||
$isMainProj = ($isMainProject) ? 1 : 0;
|
||||
$isMainProj = ($isMainProject === "true") ? 1 : 0;
|
||||
$stmt->bindParam(":isMainProject", $isMainProj);
|
||||
$stmt->bindParam(":information", $information);
|
||||
$stmt->bindParam(":projectLink", $projectLink);
|
||||
@@ -120,7 +133,7 @@ class projectData
|
||||
|
||||
$stmt = $conn->prepare("INSERT INTO projects (title, isMainProject, information, projectLink, gitLink) VALUES (:title, :isMainProject, :information, :projectLink, :gitLink)");
|
||||
$stmt->bindParam(":title", $title);
|
||||
$isMainProj = ($isMainProject) ? 1 : 0;
|
||||
$isMainProj = ($isMainProject === "true") ? 1 : 0;
|
||||
$stmt->bindParam(":isMainProject", $isMainProj);
|
||||
$stmt->bindParam(":information", $information);
|
||||
$stmt->bindParam(":projectLink", $projectLink);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
const scrollLimit=150;function getProjectData(){fetch("/api/projectData").then((t=>{t.json().then((n=>{t.ok&&n.forEach((t=>{if("1"===t.isMainProject)return document.querySelector("#mainProj").innerHTML=`\n\t\t\t\t\t\t<h1>${t.title}</h1>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<img src="${""===t.imgLocation?"../imgs/placeholder.png":t.imgLocation}" alt="">\n\t\t\t\t\t\t\t<div class="flexRow">\n\t\t\t\t\t\t\t\t<p>${t.information}</p>\n\t\t\t\t\t\t\t\t<div class="flexCol">\n\t\t\t\t\t\t\t\t\t<a href="${"N/A"===t.projectLink?"#":t.projectLink}" class="btn btnPrimary boxShadowIn boxShadowOut" ${"N/A"===t.projectLink?'disabled="disabled"':""}>View Project</a>\n\t\t\t\t\t\t\t\t\t<a href="${"N/A"===t.gitLink?"#":t.gitLink}" class="btn btnOutline boxShadowIn boxShadowOut" ${"N/A"===t.gitLink?'disabled="disabled"':""}>Git</a>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t`,null;document.querySelector("#otherProj").innerHTML+=`\n <div class="oProjItem">\n <img src="${""===t.imgLocation?"../imgs/placeholder.png":t.imgLocation}" alt="">\n <div class="flexCol">\n <div>\n \t<h3>${t.title}</h3>\n <p>${t.information}</p>\n </div>\n <div>\n <a href="${"N/A"===t.projectLink?"#":t.projectLink}" class="btn btnPrimary boxShadowIn boxShadowOut"${"N/A"===t.projectLink?'disabled="disabled"':""}>View Project</a>\n <a href="${"N/A"===t.githubLink?"#":t.gitubLink}" class="btn btnOutline boxShadowIn boxShadowOut">${"N/A"===t.githubLink?'disabled="disabled"':""}Git</a>\n </div>\n </div>\n </div>\n `}))}))}))}window.onscroll=()=>{document.body.scrollTop>=150||document.documentElement.scrollTop>=150?document.querySelector("nav").classList.add("scrolled"):document.querySelector("nav").classList.remove("scrolled")},document.querySelector("#goBackToTop").addEventListener("click",(()=>{window.scrollTo(0,0)})),document.addEventListener("DOMContentLoaded",(()=>{getProjectData(),document.getElementById("year").innerHTML=(new Date).getFullYear().toString()}));
|
||||
Vendored
Vendored
+1
@@ -0,0 +1 @@
|
||||
let dataText=["full stack developer","web designer","student","gamer","drummer"];function typeWriter(t,e,n){e<t.length?(document.querySelector("header div h1").innerHTML=t.substring(0,e+1)+'<span aria-hidden="true">_</span>',setTimeout((function(){typeWriter(t,e+1,n)}),100)):"function"==typeof n&&setTimeout(n,700)}function StartTextAnimation(t){void 0===dataText[t]?setTimeout((function(){StartTextAnimation(0)}),1500):t<dataText[t].length&&typeWriter(dataText[t],0,(function(){setTimeout(StartTextAnimation,1500,t+1)}))}document.addEventListener("DOMContentLoaded",(()=>{StartTextAnimation(0)}));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
let dataText=["full stack developer","web designer","student","gamer","drummer"];function typewriter(t,e,n){e<t.length?(document.querySelector("header div h1").innerHTML=t.substring(0,e+1)+'<span aria-hidden="true">_</span>',setTimeout((function(){typewriter(t,e+1,n)}),100)):"function"==typeof n&&setTimeout(n,700)}function StartTextAnimation(t){void 0===dataText[t]?setTimeout((function(){StartTextAnimation(0)}),1500):t<dataText[t].length&&typewriter(dataText[t],0,(function(){setTimeout(StartTextAnimation,1500,t+1)}))}document.addEventListener("DOMContentLoaded",(()=>{StartTextAnimation(0)}));
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+1
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Rohit Pai - All Projects</title><link rel="stylesheet" href="css/main.css"><script src="https://kit.fontawesome.com/ed3c25598e.js" crossorigin="anonymous"></script></head><body><nav><input type="checkbox" id="nav-check"> <a href="/"><h1>rohit pai</h1></a><div class="nav-btn"><label for="nav-check"><span></span> <span></span> <span></span></label></div><ul><li><a href="/#about" class="textShadow"><span><</span>about<span>></span></a></li><li><a href="/#curriculumVitae" class="textShadow"><span><</span>cv<span>></span></a></li><li><a href="#allProjects" class="textShadow active"><span><</span>projects<span>></span></a></li><li><a href="/#contact" class="textShadow"><span><</span>contact<span>></span></a></li><li><a href="#" class="textShadow"><span><</span>blog<span>></span></a></li></ul></nav><header><div><h1>full stack developer</h1><a href="/#sayHello" class="btn btnPrimary boxShadowIn boxShadowOut">Contact Me</a> <a href="#allProjects"><i class="fa-solid fa-chevron-down"></i></a></div></header><main><section id="allProjects"><div class="mainProj" id="mainProj"></div><div class="otherProj" id="otherProj"></div></section></main><footer class="flexRow"><div class="spacer"></div><p>© <span id="year"></span> Rohit Pai all rights reserved</p><div class="button"><button id="goBackToTop"><i class="fa-solid fa-chevron-up"></i></button></div></footer><script src="js/typewriter.js"></script><script src="js/projects.js"></script></body></html>
|
||||
Reference in New Issue
Block a user