From 9ccd2919879fc21e9d0b0e864812793da6eabd08 Mon Sep 17 00:00:00 2001 From: First <kv9.net@gmail.com> Date: Mon, 24 Mar 2025 20:54:58 +0700 Subject: [PATCH] Add Comment to Code for Explain --- views/dashboard.ejs | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/views/dashboard.ejs b/views/dashboard.ejs index e69de29..abafe86 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -0,0 +1,56 @@ +<%- include('partials/header', { username: username }) %> + +<!-- Background color --> +<div class="container my-5" style="background-color: #a86dcff5; color: #333; border-radius: 0px; padding: 30px;"> + <!-- Header with Title --> + <div class="d-flex justify-content-between align-items-center mb-4"> + <h2 class="mb-0" style="color: #000000; font-size: 30px; font-weight: 600;">THREAD TOPIC</h2> + <a href="/thread/create" class="btn" style="background-color: #000000; color: #fff; font-weight: 600; border-radius: 20px; padding: 10px 20px;"> + Create New Thread Topic + </a> + </div> + + <!-- List Group of Topics --> + <div class="list-group"> + <% threads.forEach(thread => { %> + <!-- Topic Item --> + <div class="list-group-item mb-4" style="background-color: #FFF; color: #333; border: none; border-radius: 0px; padding: 20px;"> + <div class="d-flex justify-content-between"> + <!-- Thread Title --> + <h5 class="mb-1" style="font-size: 20px; font-weight: 700;"> + <a href="/thread/<%= thread.id %>" style="color: #000000; text-decoration: none;"> + <%= thread.thread_name %> + </a> + </h5> + <!-- Thread Owner --> + <small style="color: #999; font-size: 16px;"> + <span style="color: black; font-weight: bold;">Owner: <%= thread.ownerName %> </span> + </small> + </div> + + <!-- Short Description --> + <p class="mb-3" style="font-size: 15px; line-height: 1.5;"> + <%= thread.description.length > 100 + ? thread.description.substring(0, 100) + '...' + : thread.description + %> + </p> + + <!-- Action Buttons (View/Edit/Delete) --> + <div class="mt-3"> + <a href="/thread/<%= thread.id %>" class="btn btn-sm btn-outline-info" style="border-radius: 20px;">View</a> + <% if (thread.user_id === userId) { %> + <a href="/thread/edit/<%= thread.id %>" class="btn btn-sm btn-outline-warning" style="border-radius: 20px;">Edit</a> + <a href="/thread/delete/<%= thread.id %>" + class="btn btn-sm btn-outline-danger" style="border-radius: 20px;" + onclick="return confirm('Are you sure you want to delete this thread?');"> + Delete + </a> + <% } %> + </div> + </div> + <% }) %> + </div> +</div> + +<%- include('partials/footer') %> -- GitLab