From a1fdfd2f81c69e67dcbf6f6b8dd937891b5fea42 Mon Sep 17 00:00:00 2001 From: Githuba Richard <githubarj@cardiff.ac.uk> Date: Thu, 12 Dec 2024 12:28:50 +0000 Subject: [PATCH] buttons hidden and styles updated for categories --- .../static/css/headings/headings.css | 7 +++++- .../static/css/news/editNewsStyle.css | 22 ++++++++++++++----- .../resources/static/js/headings/headings.js | 4 ++++ .../templates/categories/categories.html | 6 +++-- .../templates/headings/headings.html | 8 ++++--- .../resources/templates/news/editNews.html | 8 ++++--- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/main/resources/static/css/headings/headings.css b/src/main/resources/static/css/headings/headings.css index 547d068..0a6bf08 100644 --- a/src/main/resources/static/css/headings/headings.css +++ b/src/main/resources/static/css/headings/headings.css @@ -49,7 +49,7 @@ button { .list-item{ background-color: var(--secondary-color); - padding: 20px 10px; + padding: 20px 20px; border-left: 4px solid var(--primary-color); display: flex; flex-direction: column; @@ -62,6 +62,11 @@ button { font-weight: 450; } +.list-item > p { + color: var(--secondary-text-color); + font-size: 14px; +} + .list-item:hover { border-left: 4px solid var(--tertiary-color); } diff --git a/src/main/resources/static/css/news/editNewsStyle.css b/src/main/resources/static/css/news/editNewsStyle.css index 0b575d4..cc837a0 100644 --- a/src/main/resources/static/css/news/editNewsStyle.css +++ b/src/main/resources/static/css/news/editNewsStyle.css @@ -1,3 +1,14 @@ +.edit-news-page > h1 { + text-align: center; +} + +.edit-news-page { + padding: 30px; + display: flex; + align-items: center; + flex-direction: column; +} + .form-container { display: flex; justify-content: center; @@ -10,19 +21,18 @@ form { background-color: white; border-radius: 10px; - padding: 30px; - width: 500px; - max-width: 100%; + width: 80%; box-sizing: border-box; - margin: auto; } h1 { - text-align: left; - margin-bottom: 20px; + text-align: center; + padding: 10px; + font-size: 32px; } + label { display: block; font-weight: bold; diff --git a/src/main/resources/static/js/headings/headings.js b/src/main/resources/static/js/headings/headings.js index 969fb7a..1e3cd42 100644 --- a/src/main/resources/static/js/headings/headings.js +++ b/src/main/resources/static/js/headings/headings.js @@ -46,6 +46,9 @@ function renderHeadings(headings) { const title = document.createElement('h2') title.innerHTML = `<i class="bi bi-file-earmark-text"></i> ${heading.infoTitle} ` + const shortDesc = document.createElement(`p`) + shortDesc.textContent = `${heading.shortDescription}` + const link = document.createElement('a') link.href = `/info/${heading.informationId}`; link.classList.add('heading-link'); @@ -57,6 +60,7 @@ function renderHeadings(headings) { link.appendChild(readMore); listItem.appendChild(title) + listItem.appendChild(shortDesc); listItem.appendChild(link) container.appendChild(listItem) }); diff --git a/src/main/resources/templates/categories/categories.html b/src/main/resources/templates/categories/categories.html index 8a4e591..2172142 100644 --- a/src/main/resources/templates/categories/categories.html +++ b/src/main/resources/templates/categories/categories.html @@ -1,7 +1,9 @@ <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" - layout:decorate="~{layout/layout}"> + layout:decorate="~{layout/layout}" + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" +> > <head> <title>Categories</title> @@ -11,7 +13,7 @@ <section class="info-database" layout:fragment="content" > <div class="title-section"> <h1>Community Information Database</h1> - <button id="add-new-category"> + <button id="add-new-category" sec:authorize="isAuthenticated()"> <i class="bi bi-folder-plus"></i> New Category </button> diff --git a/src/main/resources/templates/headings/headings.html b/src/main/resources/templates/headings/headings.html index 80cf562..c4b5961 100644 --- a/src/main/resources/templates/headings/headings.html +++ b/src/main/resources/templates/headings/headings.html @@ -1,6 +1,8 @@ <!DOCTYPE html> <html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" - layout:decorate="~{layout/layout}"> + layout:decorate="~{layout/layout}" + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" +> <head> <title>Category Headings</title> <link rel="stylesheet" href="/css/headings/headings.css"> @@ -15,9 +17,9 @@ <div class="buttons"> <button id="delete-button" disabled>Delete</button> - <button id="edit-mode-button">Edit</button> + <button id="edit-mode-button" sec:authorize="isAuthenticated()" >Edit</button> <a id="addInfo"> - <button id="add-new-information"> + <button id="add-new-information" sec:authorize="isAuthenticated()" > <i class="bi bi-folder-plus"></i> New Information </button> diff --git a/src/main/resources/templates/news/editNews.html b/src/main/resources/templates/news/editNews.html index 9719d75..6f19a25 100644 --- a/src/main/resources/templates/news/editNews.html +++ b/src/main/resources/templates/news/editNews.html @@ -1,5 +1,7 @@ <!DOCTYPE html> -<html lang="en"> +<html lang="en" xmlns:th="http://www.thymeleaf.org" + xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" + layout:decorate="~{layout/layout}"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @@ -8,7 +10,7 @@ <script src="/js/news/editNewsScript.js"></script> </head> -<body> +<section layout:fragment="content" class="edit-news-page"> <h1>Edit or Delete News</h1> <form th:action="@{/editNews/{id}(id=${news.news_id})}" th:object="${news}" method="post" onsubmit="return validateForm(event)"> <!-- Hidden field to hold the news ID --> @@ -66,6 +68,6 @@ </div> </form> -</body> +</section> </html> -- GitLab