From 8b051b345c5b627cf2edea35e9b4b12059d867b9 Mon Sep 17 00:00:00 2001 From: "nico.fathi" <nico.fathi@ui.ac.id> Date: Mon, 25 Apr 2022 21:05:05 +0700 Subject: [PATCH] Fix templates and controller --- .../controller/ProjectsController.java | 19 +++- .../templates/projects/new_project_form.html | 46 +++++++-- .../templates/projects/projects.html | 94 ++++++++++++++++++- 3 files changed, 147 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/id/ui/cs/deadliners/Projects/controller/ProjectsController.java b/src/main/java/com/id/ui/cs/deadliners/Projects/controller/ProjectsController.java index 4517e04..18645ac 100644 --- a/src/main/java/com/id/ui/cs/deadliners/Projects/controller/ProjectsController.java +++ b/src/main/java/com/id/ui/cs/deadliners/Projects/controller/ProjectsController.java @@ -1,2 +1,19 @@ -package com.id.ui.cs.deadliners.Projects.controller;public class ProjectsController { +package com.id.ui.cs.deadliners.Projects.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class ProjectsController { + @GetMapping(path = "/projects") + public String projectList(){ + return "projects/projects"; + } + + @GetMapping(path = "/projects/new-projects") + public String newProjectForm(){ + return "projects/new_project_form"; + } + + } diff --git a/src/main/resources/templates/projects/new_project_form.html b/src/main/resources/templates/projects/new_project_form.html index 4bdcfcb..37de354 100644 --- a/src/main/resources/templates/projects/new_project_form.html +++ b/src/main/resources/templates/projects/new_project_form.html @@ -1,10 +1,44 @@ <!DOCTYPE html> -<html lang="en"> +<html xmlns:th="http://www.thymeleaf.org"> <head> - <meta charset="UTF-8"> - <title>$Title$</title> + <meta charset="UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Deadlines</title> + + <!-- CSS only --> + <link rel="stylesheet" href="mainpage.css"> + <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> + <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'> </head> <body> -$END$ -</body> -</html> \ No newline at end of file +<div style ="padding: 40px 40px"> + <div class="card "> + <div class="card-body"> + <h3 class="card-title">New Project</h3> + <form action="" method="POST"> + + <label style="font-family: poppins; ">Project Name</label><br> + <input class="form-control" type="text" placeholder="Enter your project name" aria-label="default input example"> + <br> + + <label style="font-family: poppins;">Description</label><br> + <textarea class="form-control" placeholder="Write a description of your project" id="exampleFormControlTextarea1" rows="3"></textarea> + + + <br> + + + <input type="submit" value="Submit" class="btn btn-primary " style=" float: right; font-family: poppins; " > + + <!-- <input type="submit" value="Cancel" class="btn btn-primary" style=" font-family: poppins; background: #FE5D5D; border-color: #FE5D5D;" href="project_page.html"> --> + <br> + </form> + + </div> + + </div> +</div> + +</body> \ No newline at end of file diff --git a/src/main/resources/templates/projects/projects.html b/src/main/resources/templates/projects/projects.html index 4bdcfcb..5eefa32 100644 --- a/src/main/resources/templates/projects/projects.html +++ b/src/main/resources/templates/projects/projects.html @@ -1,10 +1,94 @@ -<!DOCTYPE html> -<html lang="en"> +!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> - <title>$Title$</title> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Deadlines</title> + + <!-- CSS only --> + <link rel="stylesheet" href="mainpage.css"> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css"> + <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'> + <style> + .pojok-kanan{ + position: static; + top: 0px; + right: 0px; + + } + /* unvisited link */ + a:link { + color: black; + text-decoration: none; + } + + /* visited link */ + a:visited { + color: black; + text-decoration: none; + } + + /* mouse over link */ + a:hover { + color: black; + text-decoration: none; + } + + /* selected link */ + a:active { + color: black; + text-decoration: none; + } + + .card:hover{ + color:blue; + } + </style> </head> <body> -$END$ +<header> + <div th:replace="fragment/navbar :: navbar"> + + </div> +</header> + +<div class="container" > + <div class="main-page"> + <div class="title-section"> + <button style="margin-top: 80px;" type="button" class="btn btn-primary">New Project</button> + </div> + <div class="card"> + <div class="card-body"> + <div class="row"> + <div class="col"> + <a href="www.youtube.com"><h5 class="card-title">Project 1</h5></a> + <h6 class="card-subtitle">by Nico Fathi Rizqi</h6> + <p class="card-text">Description of Project</p> + </div> + <div class="col"> + <button type="button" onclick="confirDelete()" class="btn btn-primary">Delete</button> + </div> + </div> + </div> + </div> + <div class="card"> + <div class="card-body"> + <a href="www.youtube.com"><h5 class="card-title">Project 1</h5></a> + <h6 class="card-subtitle">by Nico Fathi Rizqi</h6> + <p class="card-text">Description of Project</p> + </div> + </div> + </div> +</div> </body> -</html> \ No newline at end of file +<script> + function confirmDelete() { + let text = "Are you sure you want to delete project?\n(if you are not leader of the project you will leave instead)"; + if (confirm(text) == true) { + text = "Project Deleted"; + document.getElementById("demo").innerHTML = text; + } + } +</script> \ No newline at end of file -- GitLab