From 4ae5e95280c5bcfa5125e649bc678e7bf1a5a119 Mon Sep 17 00:00:00 2001 From: Alex <41288429+Dvinyanin@users.noreply.github.com> Date: Fri, 20 May 2022 14:19:45 +0700 Subject: [PATCH] Fix board preference (#1807) Signed-off-by: Dvinyanin Alexandr --- models/board/src/index.ts | 16 +++++++++------- models/board/src/plugin.ts | 2 +- .../src/components/editor/CardLabels.svelte | 19 ++++++------------- .../board-resources/src/utils/BoardUtils.ts | 15 ++++++++++++++- plugins/board/src/index.ts | 6 +++--- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/models/board/src/index.ts b/models/board/src/index.ts index 4fdb018e3f..79bd24fcd2 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -14,7 +14,7 @@ // // To help typescript locate view plugin properly -import type { Board, Card, CardDate, CardLabel, MenuPage, LabelsCompactMode } from '@anticrm/board' +import type { Board, Card, CardDate, CardLabel, MenuPage, CommonBoardPreference } from '@anticrm/board' import type { Employee } from '@anticrm/contact' import { DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp, Type } from '@anticrm/core' import { @@ -36,7 +36,7 @@ import contact from '@anticrm/model-contact' import core, { TAttachedDoc, TDoc, TObj } from '@anticrm/model-core' import task, { TSpaceWithStates, TTask } from '@anticrm/model-task' import view, { actionTemplates, createAction } from '@anticrm/model-view' -import workbench from '@anticrm/model-workbench' +import workbench, { Application } from '@anticrm/model-workbench' import { IntlString } from '@anticrm/platform' import type { AnyComponent } from '@anticrm/ui' import preference, { TPreference } from '@anticrm/model-preference' @@ -72,10 +72,12 @@ export class TCardLabel extends TAttachedDoc implements CardLabel { isHidden?: boolean } -@Model(board.class.LabelsCompactMode, preference.class.Preference) -export class TLabelsCompactMode extends TPreference implements LabelsCompactMode { - @Prop(TypeRef(board.class.Board), board.string.LabelsCompactMode) - attachedTo!: Ref +@Model(board.class.CommonBoardPreference, preference.class.Preference) +export class TCommonBoardPreference extends TPreference implements CommonBoardPreference { + @Prop(TypeRef(workbench.class.Application), board.string.CommonBoardPreference) + attachedTo!: Ref + + cardLabelsCompactMode!: boolean } @Model(board.class.Card, task.class.Task) @@ -123,7 +125,7 @@ export class TMenuPage extends TDoc implements MenuPage { } export function createModel (builder: Builder): void { - builder.createModel(TBoard, TCard, TCardLabel, TCardDate, TMenuPage, TLabelsCompactMode) + builder.createModel(TBoard, TCard, TCardLabel, TCardDate, TMenuPage, TCommonBoardPreference) builder.createDoc(board.class.MenuPage, core.space.Model, { component: board.component.Archive, diff --git a/models/board/src/plugin.ts b/models/board/src/plugin.ts index 68a1fc5ef3..b2e1d43d8b 100644 --- a/models/board/src/plugin.ts +++ b/models/board/src/plugin.ts @@ -55,6 +55,6 @@ export default mergeIds(boardId, board, { Table: '' as Ref }, string: { - LabelsCompactMode: '' as IntlString + CommonBoardPreference: '' as IntlString } }) diff --git a/plugins/board-resources/src/components/editor/CardLabels.svelte b/plugins/board-resources/src/components/editor/CardLabels.svelte index 7b8bc3cec8..4b1edb8bc2 100644 --- a/plugins/board-resources/src/components/editor/CardLabels.svelte +++ b/plugins/board-resources/src/components/editor/CardLabels.svelte @@ -13,14 +13,13 @@ // limitations under the License. -->