Index: docs/todo.txt
===================================================================
--- docs/todo.txt	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ docs/todo.txt	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -1,1 +1,5 @@
 description na project
+
+Brisenje na tag
+	Notifikacija za site so go koristat tagot
+	Mu izlegvit na moderatorot so go brisit negoviot tag kolku dusi go koristat tagot.
Index: src/main/java/com/db/finki/www/build_board/controller/TopicController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/TopicController.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/controller/TopicController.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -30,5 +30,5 @@
         Topic t = topicService.getByTitle(topicName);
         model.addAttribute("topic", t);
-        model.addAttribute("tags", tagService.findAll().stream().filter(tag -> !t.getTags().contains(tag)));
+        model.addAttribute("tags", tagService.findAllNotUsed(t));
         return "show-topic";
     }
@@ -52,4 +52,20 @@
         topicService.addTagToTopic(t,tagName);
         model.addAttribute("topic", t);
+        model.addAttribute("tags", tagService.findAllNotUsed(t));
+        return "redirect:/topic/" + t.getTitle();
+    }
+
+    @PostMapping("/edit/{id}")
+    public String editTopic(@PathVariable long id,@RequestParam String title, @RequestParam String content, Model model) {
+        Topic t = topicService.save(id,title,content);
+        model.addAttribute("topic", t);
+        model.addAttribute("tags", tagService.findAllNotUsed(t));
+        return "redirect:/topic/" + t.getTitle();
+    }
+    @PostMapping("/delete-tag/{topicId}/{tagName}")
+    public String deleteTag(@PathVariable long topicId, @PathVariable String tagName, Model model) {
+        Topic t = topicService.deleteTagFromTopic(topicId,tagName);
+        model.addAttribute("topic", t);
+        model.addAttribute("tags", tagService.findAllNotUsed(t));
         return "redirect:/topic/" + t.getTitle();
     }
Index: src/main/java/com/db/finki/www/build_board/entity/threads/Tag.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/threads/Tag.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/entity/threads/Tag.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -12,4 +12,5 @@
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 @Data
@@ -27,3 +28,16 @@
     @ManyToMany(mappedBy = "tags")
     private List<BBThread> threads = new ArrayList<>();
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Tag tag = (Tag) o;
+        return Objects.equals(name, tag.name);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(name);
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/service/threads/impl/TagServiceImpl.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/threads/impl/TagServiceImpl.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/service/threads/impl/TagServiceImpl.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -2,4 +2,5 @@
 
 import com.db.finki.www.build_board.entity.threads.Tag;
+import com.db.finki.www.build_board.entity.threads.Topic;
 import com.db.finki.www.build_board.repository.threads.TagRepository;
 import com.db.finki.www.build_board.service.threads.itfs.TagService;
@@ -7,4 +8,5 @@
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
@@ -28,3 +30,8 @@
         return tagRepository.save(new Tag(tagName));
     }
+
+    @Override
+    public List<Tag> findAllNotUsed(Topic t) {
+        return tagRepository.findAll().stream().filter(tag -> !t.getTags().contains(tag)).toList();
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/service/threads/impl/TopicServiceImpl.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/threads/impl/TopicServiceImpl.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/service/threads/impl/TopicServiceImpl.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -73,3 +73,21 @@
         });
     }
+
+    @Override
+    public Topic save(long id, String title, String description) {
+        Topic t = getById(id);
+        t.setTitle(title);
+        t.setContent(description);
+        return topicRepository.save(t);
+    }
+
+    @Override
+    @Transactional
+    public Topic deleteTagFromTopic(long id, String tagName) {
+        Topic t = getById(id);
+        boolean removed = t.getTags().remove(new Tag(tagName));
+        if(!removed) throw new IllegalArgumentException("Tag not found");
+        return topicRepository.save(t);
+    }
+
 }
Index: src/main/java/com/db/finki/www/build_board/service/threads/itfs/TagService.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/threads/itfs/TagService.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/service/threads/itfs/TagService.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -2,4 +2,5 @@
 
 import com.db.finki.www.build_board.entity.threads.Tag;
+import com.db.finki.www.build_board.entity.threads.Topic;
 import org.springframework.stereotype.Service;
 
@@ -9,4 +10,5 @@
     Tag findByName(String name);
     List<Tag> findAll();
+    List<Tag> findAllNotUsed(Topic t);
     Tag create(String name);
 }
Index: src/main/java/com/db/finki/www/build_board/service/threads/itfs/TopicService.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/threads/itfs/TopicService.java	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/java/com/db/finki/www/build_board/service/threads/itfs/TopicService.java	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -13,3 +13,6 @@
     Topic getById(Long id);
     void addTagToTopic(Topic topic, String tagName);
+
+    Topic save(long id, String title, String description);
+    Topic deleteTagFromTopic(long id, String tagName);
 }
Index: src/main/resources/templates/home.html
===================================================================
--- src/main/resources/templates/home.html	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/resources/templates/home.html	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -8,4 +8,26 @@
     <title>Home Page</title>
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
+
+    <style>
+        .search-container {
+            position: relative;
+        }
+
+        .search-input {
+            height: 50px;
+            border-radius: 30px;
+            padding-left: 35px;
+            border: none;
+            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+        }
+
+        .search-icon {
+            position: absolute;
+            top: 50%;
+            left: 15px;
+            transform: translateY(-50%);
+            color: #888;
+        }
+    </style>
 </head>
 <body>
@@ -20,4 +42,16 @@
     </div>
 </nav>
+
+<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
+<div class="container">
+    <div class="row justify-content-end">
+        <div class="col-md-5 pt-5">
+            <div class="search-container">
+                <input type="text" class="form-control search-input" placeholder="Search...">
+                <i class="fas fa-search search-icon"></i>
+            </div>
+        </div>
+    </div>
+</div>
 
 <main class="container mt-4">
Index: src/main/resources/templates/show-topic.html
===================================================================
--- src/main/resources/templates/show-topic.html	(revision 6166260e61e62b7cfecf6c64042e990adee6e030)
+++ src/main/resources/templates/show-topic.html	(revision fd2ff5ed641ead466231b83d3d74e6a67ccfa049)
@@ -9,4 +9,6 @@
 <body>
 
+
+
 <main class="container mt-5">
     <!-- Topic Title and Description -->
@@ -15,5 +17,5 @@
             <h3 th:text="${topic.getTitle()}">Topic Title</h3>
             <!-- Add Tag Button -->
-            <button class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#addTagModal">Add Tag</button>
+            <button class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#addTagModal">Add Tag</button>
         </div>
         <div class="card-body">
@@ -24,15 +26,29 @@
                 <ul class="list-inline">
                     <li th:each="tag : ${topic.getTags()}" class="list-inline-item">
-                        <span class="badge bg-info text-dark" th:text="${tag.getName()}">Tag Name</span>
+            <span class="badge bg-info text-dark d-inline-flex align-items-center">
+                <span th:text="${tag.getName()}">Tag Name</span>
+                <form th:action="@{/topic/delete-tag/{topicId}/{tagName} (topicId=${topic.getId()}, tagName=${tag.getName()})}"
+                      method="post" style="margin-left: 5px;">
+                    <button type="submit" class="btn btn-sm btn-link text-danger p-0 ms-1" style="line-height: 1;">
+                        &times;
+                    </button>
+                </form>
+            </span>
                     </li>
                 </ul>
             </div>
+
+
+
         </div>
-        <!-- Delete Topic Button -->
+        <!-- Edit and Delete Buttons for Topic -->
         <div th:if="${session.user.getId() != null && session.user.getId() == topic.getUser().getId()}" class="card-footer d-flex justify-content-between">
-            <form th:action="@{/topic/delete/{id} (id=${topic.getId()})}" method="post" style="display:inline;">
-                <input type="hidden" name="id" th:value="${topic.getId()}" />
-                <button type="submit" class="btn btn-danger btn-sm">Delete Topic</button>
-            </form>
+            <div>
+                <button class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#editTopicModal">Edit Topic</button>
+                <form th:action="@{/topic/delete/{id} (id=${topic.getId()})}" method="post" style="display:inline;">
+                    <input type="hidden" name="id" th:value="${topic.getId()}" />
+                    <button type="submit" class="btn btn-danger btn-sm">Delete Topic</button>
+                </form>
+            </div>
         </div>
     </div>
@@ -53,4 +69,18 @@
         </div>
     </div>
+
+    <!-- Replies Section -->
+<!--    <div th:each="reply : ${replies}" class="card shadow-sm mt-4">-->
+<!--        <div class="card-header bg-light d-flex justify-content-between align-items-center">-->
+<!--            <span th:text="${reply.getUser().getName()}">Reply Author</span>-->
+<!--            &lt;!&ndash; Edit Button for Replies &ndash;&gt;-->
+<!--            <div th:if="${session.user.getId() != null && session.user.getId() == reply.getUser().getId()}">-->
+<!--                <button class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#editReplyModal" th:attr="data-reply-id=${reply.getId()}">Edit Reply</button>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--        <div class="card-body">-->
+<!--            <p th:text="${reply.getContent()}">Reply content goes here.</p>-->
+<!--        </div>-->
+<!--    </div>-->
 </main>
 
@@ -67,5 +97,4 @@
                     <div class="mb-3">
                         <label for="tagName" class="form-label">Tag Name</label>
-                        <!-- Dropdown Select -->
                         <select id="existingTags" class="form-select mb-3" name="tagName">
                             <option value="" selected disabled>Select an existing tag</option>
@@ -73,8 +102,5 @@
                             <option value="custom">Enter a custom tag...</option>
                         </select>
-
                         <input type="text" id="customTag" class="form-control d-none" placeholder="Enter custom tag name" />
-
-
                     </div>
                     <button type="submit" class="btn btn-primary w-100">Add Tag</button>
@@ -85,28 +111,49 @@
 </div>
 
-<script>
-    document.addEventListener("DOMContentLoaded", function () {
-        const existingTags = document.getElementById("existingTags");
-        const customTagInput = document.getElementById("customTag");
+<!-- Edit Topic Modal -->
+<div class="modal fade" id="editTopicModal" tabindex="-1" aria-labelledby="editTopicModalLabel" aria-hidden="true">
+    <div class="modal-dialog">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title" id="editTopicModalLabel">Edit Topic</h5>
+                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
+            </div>
+            <div class="modal-body">
+                <form th:action="@{/topic/edit/{id} (id=${topic.getId()})}" method="post">
+                    <div class="mb-3">
+                        <label for="topicTitle" class="form-label">Title</label>
+                        <input type="text" id="topicTitle" name="title" class="form-control" th:value="${topic.getTitle()}" required>
+                    </div>
+                    <div class="mb-3">
+                        <label for="topicContent" class="form-label">Content</label>
+                        <textarea id="topicContent" name="content" class="form-control" rows="5" th:text="${topic.getContent()}" required></textarea>
+                    </div>
+                    <button type="submit" class="btn btn-primary w-100">Save Changes</button>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
 
-        existingTags.addEventListener("change", function () {
-            if (this.value === "custom") {
-                customTagInput.classList.remove("d-none");
-                customTagInput.required = true;
-                customTagInput.name = "tagName";
-                existingTags.name = "";
-            } else {
-                customTagInput.classList.add("d-none");
-                customTagInput.required = false;
-                customTagInput.name = "";
-                existingTags.name = "tagName";
-                customTagInput.value = "";
-            }
-        });
-    });
-
-</script>
-
-
+<!-- Edit Reply Modal -->
+<!--<div class="modal fade" id="editReplyModal" tabindex="-1" aria-labelledby="editReplyModalLabel" aria-hidden="true">-->
+<!--    <div class="modal-dialog">-->
+<!--        <div class="modal-content">-->
+<!--            <div class="modal-header">-->
+<!--                <h5 class="modal-title" id="editReplyModalLabel">Edit Reply</h5>-->
+<!--                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>-->
+<!--            </div>-->
+<!--            <div class="modal-body">-->
+<!--                <form th:action="@{/reply/edit/{id} (id=${reply.getId()})}" method="post">-->
+<!--                    <div class="mb-3">-->
+<!--                        <label for="replyContent" class="form-label">Reply Content</label>-->
+<!--                        <textarea id="replyContent" name="content" class="form-control" rows="3" th:text="${reply.getContent()}" required></textarea>-->
+<!--                    </div>-->
+<!--                    <button type="submit" class="btn btn-primary w-100">Save Changes</button>-->
+<!--                </form>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--    </div>-->
+<!--</div>-->
 
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
