diff --git a/backend/handlers/tags.go b/backend/handlers/tags.go
index 4da3805..1d06c04 100644
--- a/backend/handlers/tags.go
+++ b/backend/handlers/tags.go
@@ -102,7 +102,7 @@ func UpdateTag(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusNotFound)
}
- return c.SendStatus(fiber.StatusOK)
+ return c.SendStatus(fiber.StatusNoContent)
}
func CreateTagOption(c *fiber.Ctx) error {
diff --git a/frontend/src/components/project/card/modal_card.svelte b/frontend/src/components/project/card/modal_card.svelte
index b9080cf..ca59930 100644
--- a/frontend/src/components/project/card/modal_card.svelte
+++ b/frontend/src/components/project/card/modal_card.svelte
@@ -65,9 +65,6 @@
{/if}
diff --git a/frontend/src/components/project/card/modal_tags.svelte b/frontend/src/components/project/card/modal_tags.svelte
index 40330e6..a0ee2bb 100644
--- a/frontend/src/components/project/card/modal_tags.svelte
+++ b/frontend/src/components/project/card/modal_tags.svelte
@@ -2,6 +2,7 @@
import type { Card } from '../../../stores/interfaces';
import api, { processError } from '../../../utils/api';
import status from '../../../utils/status';
+ import AddIcon from '../../icons/addIcon.svelte';
import ModalTag from './modal_tag.svelte';
export let card: Card;
@@ -50,19 +51,7 @@
>
|
diff --git a/frontend/src/components/project/groupMenu.svelte b/frontend/src/components/project/groupMenu.svelte
index 5fbbd98..f49e57a 100644
--- a/frontend/src/components/project/groupMenu.svelte
+++ b/frontend/src/components/project/groupMenu.svelte
@@ -1,56 +1,47 @@
-{#if isOpen}
-
-{/if}
+
diff --git a/frontend/src/components/sidebar.svelte b/frontend/src/components/sidebar.svelte
index da03d7d..0de2b1e 100644
--- a/frontend/src/components/sidebar.svelte
+++ b/frontend/src/components/sidebar.svelte
@@ -166,6 +166,7 @@
}
input {
+ cursor: pointer;
padding: 10px;
border-radius: 5px;
background-color: transparent;
diff --git a/frontend/src/components/tuils/menu.svelte b/frontend/src/components/tuils/menu.svelte
new file mode 100644
index 0000000..5739cdc
--- /dev/null
+++ b/frontend/src/components/tuils/menu.svelte
@@ -0,0 +1,39 @@
+
+
+{#if isOpen}
+
+{/if}
+
+
diff --git a/frontend/src/stores/projectTags.ts b/frontend/src/stores/projectTags.ts
index b86f522..f1e76d3 100644
--- a/frontend/src/stores/projectTags.ts
+++ b/frontend/src/stores/projectTags.ts
@@ -1,34 +1,34 @@
-import { get, writable } from "svelte/store";
-import type { MeTag, TagOption } from "./interfaces";
-import api, { processError } from "../utils/api";
-import status from "../utils/status";
+import { get, writable } from 'svelte/store';
+import type { MeTag, TagOption } from './interfaces';
+import api, { processError } from '../utils/api';
+import status from '../utils/status';
const { subscribe, set, update } = writable({} as { [key: number]: MeTag });
export default {
- subscribe,
- init: async (projectID: number) : Promise => {
- const response = await api.get(`/v1/projects/${projectID}/tags`);
+ subscribe,
+ init: async (projectID: number): Promise => {
+ const response = await api.get(`/v1/projects/${projectID}/tags`);
- if (response.status !== 200) {
- processError(response);
- return false;
- }
+ if (response.status !== 200) {
+ processError(response);
+ return false;
+ }
- const metags: MeTag[] = response.data;
+ const metags: MeTag[] = response.data;
- const tags: { [key: number]: MeTag } = {};
+ const tags: { [key: number]: MeTag } = {};
- metags.forEach((tag: MeTag) => {
- if(tag.options === null) tag.options = [];
- tags[tag.id] = tag;
- });
+ metags.forEach((tag: MeTag) => {
+ if (tag.options === null) tag.options = [];
+ tags[tag.id] = tag;
+ });
- set(tags);
+ set(tags);
- return true;
- },
- add: async (tag_id: number, value: string) => {
+ return true;
+ },
+ addOption: async (tag_id: number, value: string) => {
const response = await api.post(`/v1/tags/${tag_id}/options`, {
value
});
@@ -38,15 +38,66 @@ export default {
return;
}
- const option: TagOption = {
- id: response.data.id,
- tag_id,
- value,
- };
+ const option: TagOption = {
+ id: response.data.id,
+ tag_id,
+ value
+ };
- update(tags => {
- tags[tag_id].options.push(option);
- return tags;
- });
- },
-}
\ No newline at end of file
+ update((tags) => {
+ tags[tag_id].options.push(option);
+ return tags;
+ });
+ },
+ delete: async (tag_id: number) => {
+ const response = await api.delete(`/v1/tags/${tag_id}`);
+
+ if (response.status !== status.NoContent) {
+ processError(response, 'Failed to delete tag');
+ return;
+ }
+
+ update((tags) => {
+ delete tags[tag_id];
+ return tags;
+ });
+ },
+ update: async (tag: MeTag) => {
+ const response = await api.put(`/v1/tags/${tag.id}`, tag);
+
+ if (response.status !== status.NoContent) {
+ processError(response, 'Failed to update tag');
+ return;
+ }
+
+ update((tags) => {
+ tags[tag.id] = tag;
+ return tags;
+ });
+ },
+ add: async (ProjectId: number, title: string, type: number) => {
+ const response = await api.post(`/v1/tags`, {
+ project_id: ProjectId,
+ title,
+ type
+ });
+
+ if (response.status !== status.Created) {
+ processError(response, 'Failed to create tag');
+ return;
+ }
+
+ const tag: MeTag = {
+ id: response.data.id,
+ project_id: ProjectId,
+ title,
+ type,
+ options: []
+ };
+
+ update((tags) => {
+ tags[tag.id] = tag;
+ return tags;
+ });
+ }
+};
diff --git a/frontend/static/css/global.css b/frontend/static/css/global.css
index 2d62897..e51ede2 100644
--- a/frontend/static/css/global.css
+++ b/frontend/static/css/global.css
@@ -16,4 +16,17 @@ a {
ul {
list-style: none;
+}
+
+button:not(.real) {
+ border: none;
+ background-color: inherit;
+ color: inherit;
+ font-size: inherit;
+ cursor: pointer;
+ border-radius: 3px;
+}
+
+button:not(.real):hover {
+ background-color: #fff2;
}
\ No newline at end of file