From 69da935c06b447af83eb02ddb1ee4ed3d35365dc Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Tue, 11 Mar 2025 00:14:29 +0500 Subject: [PATCH] Cards fixes Signed-off-by: Denis Bykhov --- models/card/src/index.ts | 8 +- models/server-card/src/index.ts | 5 +- plugins/card-assets/lang/de.json | 12 +- .../src/components/CardPresenter.svelte | 6 +- .../src/components/MasterTagAttributes.svelte | 2 +- .../components/ParentNamesPresenter.svelte | 2 +- .../components/SetParentActionPopup.svelte | 10 +- .../src/components/TagAttributes.svelte | 2 +- .../src/components/TagHierarchy.svelte | 5 +- .../components/settings/CreateRelation.svelte | 17 +++ .../settings/ManageMasterTagsContent.svelte | 2 +- .../settings/RelationSetting.svelte | 14 +++ .../settings/RelationsSection.svelte | 10 +- plugins/card-resources/src/index.ts | 4 +- plugins/card-resources/src/plugin.ts | 3 +- .../src/components/CreateRelation.svelte | 4 +- plugins/setting-resources/src/index.ts | 4 +- .../src/components/RelationEditor.svelte | 2 +- server-plugins/card-resources/src/index.ts | 113 ++++++++++++------ server-plugins/card/src/index.ts | 2 +- 20 files changed, 152 insertions(+), 75 deletions(-) create mode 100644 plugins/card-resources/src/components/settings/CreateRelation.svelte create mode 100644 plugins/card-resources/src/components/settings/RelationSetting.svelte diff --git a/models/card/src/index.ts b/models/card/src/index.ts index ceca23e1872..486d6a972aa 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -16,13 +16,12 @@ import { CardEvents, cardId, DOMAIN_CARD, - type ParentInfo, type Card, type MasterTag, + type ParentInfo, type Tag } from '@hcengineering/card' import chunter from '@hcengineering/chunter' -import contact from '@hcengineering/contact' import core, { AccountRole, DOMAIN_MODEL, @@ -368,8 +367,7 @@ export function createModel (builder: Builder): void { name: 'tagrelation', label: card.string.TagRelations, icon: setting.icon.Relations, - props: { _classes: [card.class.Card, contact.class.Contact], exclude: [] }, - component: setting.component.RelationSetting, + component: card.component.RelationSetting, group: 'settings-editor', role: AccountRole.Maintainer, order: 4501 @@ -381,7 +379,7 @@ export function createModel (builder: Builder): void { setting.class.SettingsCategory, core.space.Model, { - name: 'masterTags', + name: 'types', label: card.string.MasterTags, icon: card.icon.Card, component: card.component.ManageMasterTagsContent, diff --git a/models/server-card/src/index.ts b/models/server-card/src/index.ts index 39b643b81b2..9bfe6c71140 100644 --- a/models/server-card/src/index.ts +++ b/models/server-card/src/index.ts @@ -77,12 +77,11 @@ export function createModel (builder: Builder): void { }) builder.createDoc(serverCore.class.Trigger, core.space.Model, { - trigger: serverCard.trigger.OnCardParentChange, + trigger: serverCard.trigger.OnCardUpdate, isAsync: true, txMatch: { _class: core.class.TxUpdateDoc, - objectClass: card.class.Card, - operations: { parent: { $exists: true } } + objectClass: card.class.Card } }) diff --git a/plugins/card-assets/lang/de.json b/plugins/card-assets/lang/de.json index 409cfede287..79914743bd4 100644 --- a/plugins/card-assets/lang/de.json +++ b/plugins/card-assets/lang/de.json @@ -5,10 +5,10 @@ "Cards": "Karten", "Content": "Inhalt", "CreateCard": "Karte erstellen", - "CreateMasterTag": "Master-Tag erstellen", + "CreateMasterTag": "Typ erstellen", "CreateTag": "Tag erstellen", - "MasterTag": "Master-Tag", - "MasterTags": "Master-Tags", + "MasterTag": "Typ", + "MasterTags": "Typen", "Parent": "Eltern", "Tags": "Tags", "Tag": "Tag", @@ -18,11 +18,11 @@ "TagRelations": "Tag-Beziehungen", "DeleteTag": "Tag löschen", "DeleteTagConfirm": "Möchten Sie diesen Tag wirklich löschen? Alle zugehörigen Eigenschaften werden gelöscht", - "DeleteMasterTag": "Master-Tag löschen", - "DeleteMasterTagConfirm": "Möchten Sie diesen Master-Tag wirklich löschen? Alle mit diesem Master-Tag verbundenen Objekte werden gelöscht", + "DeleteMasterTag": "Typ löschen", + "DeleteMasterTagConfirm": "Möchten Sie diesen Typ wirklich löschen? Alle mit diesem Typ verbundenen Objekte werden gelöscht", "UnsetParent": "Elternteil entfernen", "SetParent": "Elternteil setzen", "CreateChild": "Kind erstellen", "Children": "Kinder" } -} \ No newline at end of file +} diff --git a/plugins/card-resources/src/components/CardPresenter.svelte b/plugins/card-resources/src/components/CardPresenter.svelte index c04d5ea19b8..af560ead0db 100644 --- a/plugins/card-resources/src/components/CardPresenter.svelte +++ b/plugins/card-resources/src/components/CardPresenter.svelte @@ -40,6 +40,9 @@ {:else if value} {#if type === 'link'}
+ {#if showParent} + + {/if} {value.title} - {#if showParent} - - {/if} diff --git a/plugins/card-resources/src/components/MasterTagAttributes.svelte b/plugins/card-resources/src/components/MasterTagAttributes.svelte index 8449bf208f7..34910fe02e2 100644 --- a/plugins/card-resources/src/components/MasterTagAttributes.svelte +++ b/plugins/card-resources/src/components/MasterTagAttributes.svelte @@ -74,7 +74,7 @@ ev.stopPropagation() const loc = getCurrentResolvedLocation() loc.path[2] = settingId - loc.path[3] = 'masterTags' + loc.path[3] = 'types' loc.path[4] = value._class loc.path.length = 5 loc.fragment = undefined diff --git a/plugins/card-resources/src/components/ParentNamesPresenter.svelte b/plugins/card-resources/src/components/ParentNamesPresenter.svelte index 795f812836c..fc780667187 100644 --- a/plugins/card-resources/src/components/ParentNamesPresenter.svelte +++ b/plugins/card-resources/src/components/ParentNamesPresenter.svelte @@ -72,7 +72,7 @@ &:active { color: var(--theme-content-color); } - &::before { + &::after { content: '›'; padding: 0 0.25rem; } diff --git a/plugins/card-resources/src/components/SetParentActionPopup.svelte b/plugins/card-resources/src/components/SetParentActionPopup.svelte index c81981f5ebb..0dc309be257 100644 --- a/plugins/card-resources/src/components/SetParentActionPopup.svelte +++ b/plugins/card-resources/src/components/SetParentActionPopup.svelte @@ -14,7 +14,7 @@ --> { dispatch('select', clazz._id) }} - on:contextmenu={(evt) => { - showMenu(evt, { object: clazz }) - }} /> {#if (descendants.get(clazz._id)?.length ?? 0) > 0} diff --git a/plugins/card-resources/src/components/settings/CreateRelation.svelte b/plugins/card-resources/src/components/settings/CreateRelation.svelte new file mode 100644 index 00000000000..723e74369ed --- /dev/null +++ b/plugins/card-resources/src/components/settings/CreateRelation.svelte @@ -0,0 +1,17 @@ + + + diff --git a/plugins/card-resources/src/components/settings/ManageMasterTagsContent.svelte b/plugins/card-resources/src/components/settings/ManageMasterTagsContent.svelte index 5bfae56ec55..d927bae8ae1 100644 --- a/plugins/card-resources/src/components/settings/ManageMasterTagsContent.svelte +++ b/plugins/card-resources/src/components/settings/ManageMasterTagsContent.svelte @@ -35,7 +35,7 @@ onDestroy(resolvedLocationStore.subscribe(handleLocationChanged)) function handleLocationChanged ({ path }: Location): void { - if (path[3] !== 'masterTags' || path[4] === undefined) { + if (path[3] !== 'types' || path[4] === undefined) { selectedTagId = undefined } else { selectedTagId = path[4] as Ref diff --git a/plugins/card-resources/src/components/settings/RelationSetting.svelte b/plugins/card-resources/src/components/settings/RelationSetting.svelte new file mode 100644 index 00000000000..63a4fda4919 --- /dev/null +++ b/plugins/card-resources/src/components/settings/RelationSetting.svelte @@ -0,0 +1,14 @@ + + + diff --git a/plugins/card-resources/src/components/settings/RelationsSection.svelte b/plugins/card-resources/src/components/settings/RelationsSection.svelte index a9544ddead4..c2d62e853f1 100644 --- a/plugins/card-resources/src/components/settings/RelationsSection.svelte +++ b/plugins/card-resources/src/components/settings/RelationsSection.svelte @@ -13,8 +13,7 @@ // limitations under the License. -->