Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-2320 Share links for board cards #3497

Merged
merged 9 commits into from
Jan 22, 2025
Prev Previous commit
Next Next commit
Merge branch 'main' into N21-2320-link-board-card
# Conflicts:
#	src/modules/feature/board/card/CardHost.unit.ts
#	src/modules/feature/board/card/CardHost.vue
#	src/modules/ui/board/index.ts
MarvinOehlerkingCap committed Jan 17, 2025

Verified

This commit was signed with the committer’s verified signature.
commit 422aa6f3e44e847feb5b2b945688a58d65812650
10 changes: 5 additions & 5 deletions src/modules/feature/board/card/CardHost.unit.ts
Original file line number Diff line number Diff line change
@@ -25,11 +25,11 @@
import { createMock, DeepMocked } from "@golevelup/ts-jest";
import { createTestingPinia } from "@pinia/testing";
import {
BoardMenuActionDelete,
BoardMenuActionEdit,
BoardMenuActionShareLink,
BoardMenuScope,
} from "@ui-board";
KebabMenuActionDelete,
KebabMenuActionEdit,
KebabMenuActionShareLink

Check failure on line 30 in src/modules/feature/board/card/CardHost.unit.ts

GitHub Actions / lint

Insert `,`
} from "@ui-kebab-menu";
import { BoardMenuScope } from "@ui-board";
import { useDeleteConfirmationDialog } from "@ui-confirmation-dialog";
import {
useBoardNotifier,
36 changes: 14 additions & 22 deletions src/modules/feature/board/card/CardHost.vue
Original file line number Diff line number Diff line change
@@ -40,20 +40,17 @@
has-background
:data-testid="boardMenuTestId"
>
<template v-if="hasDeletePermission">
<BoardMenuActionEdit
v-if="!isEditMode"
@click="onStartEditMode"
/>
</template>
<BoardMenuActionShareLink @click="onCopyShareLink" />
<template v-if="hasDeletePermission">
<BoardMenuActionDelete
data-test-id="board-menu-action-delete"
:name="card.title"
@click="onDeleteCard"
/>
</template>
<KebabMenuActionEdit
v-if="hasDeletePermission && !isEditMode"
@click="onStartEditMode"
/>
<KebabMenuActionShareLink @click="onCopyShareLink" />
<KebabMenuActionDelete
v-if="hasDeletePermission"
:name="card.title"
:scope="BoardMenuScope.CARD"
@click="onDeleteCard"
/>
</BoardMenu>
</div>

@@ -103,13 +100,8 @@
useCardStore,
} from "@data-board";
import { mdiArrowExpand } from "@icons/material";
import {
BoardMenu,
BoardMenuActionDelete,
BoardMenuActionEdit,
BoardMenuActionShareLink,
BoardMenuScope,
} from "@ui-board";
import { BoardMenu, BoardMenuScope } from "@ui-board";
import { KebabMenuActionDelete, KebabMenuActionEdit, KebabMenuActionShareLink } from "@ui-kebab-menu";

Check failure on line 104 in src/modules/feature/board/card/CardHost.vue

GitHub Actions / lint

Replace `·KebabMenuActionDelete,·KebabMenuActionEdit,·KebabMenuActionShareLink·` with `⏎↹KebabMenuActionDelete,⏎↹KebabMenuActionEdit,⏎↹KebabMenuActionShareLink,⏎`
import { useCourseBoardEditMode, useShareBoardLink } from "@util-board";
import { useDebounceFn, useElementHover, useElementSize } from "@vueuse/core";
import { computed, defineComponent, onMounted, ref, toRef } from "vue";
@@ -129,7 +121,6 @@
},
},
components: {
BoardMenuActionShareLink,
CardSkeleton,
CardTitle,
BoardMenu,
@@ -139,6 +130,7 @@
CardHostInteractionHandler,
KebabMenuActionDelete,
CardHostDetailView,
KebabMenuActionShareLink

Check failure on line 133 in src/modules/feature/board/card/CardHost.vue

GitHub Actions / lint

Insert `,`
},
props: {
height: { type: Number, required: true },
26 changes: 0 additions & 26 deletions src/modules/ui/board/BoardMenuActionShareLink.vue

This file was deleted.

30 changes: 2 additions & 28 deletions src/modules/ui/board/index.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
import BoardMenu from "./BoardMenu.vue";
import BoardMenuAction from "./BoardMenuAction.vue";
import BoardMenuActionCopy from "./BoardMenuActionCopy.vue";
import BoardMenuActionDelete from "./BoardMenuActionDelete.vue";
import BoardMenuActionEdit from "./BoardMenuActionEdit.vue";
import BoardMenuActionMoveColumnDown from "./BoardMenuActionMoveColumnDown.vue";
import BoardMenuActionMoveColumnUp from "./BoardMenuActionMoveColumnUp.vue";
import BoardMenuActionMoveDown from "./BoardMenuActionMoveDown.vue";
import BoardMenuActionMoveLeft from "./BoardMenuActionMoveLeft.vue";
import BoardMenuActionMoveRight from "./BoardMenuActionMoveRight.vue";
import BoardMenuActionMoveUp from "./BoardMenuActionMoveUp.vue";
import BoardMenuActionPublish from "./BoardMenuActionPublish.vue";
import BoardMenuActionRevert from "./BoardMenuActionRevert.vue";
import BoardMenuActionShare from "./BoardMenuActionShare.vue";
import BoardMenuActionShareLink from "./BoardMenuActionShareLink.vue";
import { BoardMenuScope } from "./board-menu-scope";
import BoardSectionCreationHeader from "./BoardSectionCreationHeader.vue";
import ContentElementBar from "./content-element/ContentElementBar.vue";

export {
BoardMenu,
BoardMenuAction,
BoardMenuActionCopy,
BoardMenuActionEdit,
BoardMenuActionDelete,
BoardMenuActionMoveColumnDown,
BoardMenuActionMoveColumnUp,
BoardMenuActionMoveUp,
BoardMenuActionMoveDown,
BoardMenuActionMoveLeft,
BoardMenuActionMoveRight,
BoardMenuActionPublish,
BoardMenuActionRevert,
BoardMenuActionShare,
BoardMenuActionShareLink,
BoardMenuScope,
ContentElementBar,
BoardSectionCreationHeader,
};
Original file line number Diff line number Diff line change
@@ -2,19 +2,18 @@ import {
createTestingI18n,
createTestingVuetify,
} from "@@/tests/test-utils/setup";
import { BoardMenuScope } from "@ui-board";
import { mount } from "@vue/test-utils";
import { BoardMenuScope } from "./board-menu-scope";
import BoardMenuActionShareLink from "./BoardMenuActionShareLink.vue";
import { MENU_SCOPE } from "./injection-tokens";
import KebabMenuActionShareLink from "./KebabMenuActionShareLink.vue";

describe("BoardMenuActionShareLink", () => {
const setup = (scope: BoardMenuScope) => {
const wrapper = mount(BoardMenuActionShareLink, {
const wrapper = mount(KebabMenuActionShareLink, {
global: {
plugins: [createTestingVuetify(), createTestingI18n()],
provide: {
[MENU_SCOPE]: scope,
},
},
props: {
scope,
},
});

27 changes: 27 additions & 0 deletions src/modules/ui/kebab-menu/KebabMenuActionShareLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<KebabMenuAction :icon="mdiLink" data-testid="board-menu-action-share-link">
{{ $t(actionName) }}
</KebabMenuAction>
</template>

<script setup lang="ts">
import { MessageSchema } from "@/locales/schema";
import { mdiLink } from "@icons/material";
import { BoardMenuScope } from "@ui-board";
import { computed, PropType } from "vue";
import KebabMenuAction from "./KebabMenuAction.vue";

const props = defineProps({
scope: { type: String as PropType<BoardMenuScope>, required: true },
});

const actionNameTranslationKeyMap: Partial<
Record<BoardMenuScope, keyof MessageSchema>
> = {
[BoardMenuScope.CARD]: "components.board.action.shareLink.card",
};

const actionName = computed(() => {
return actionNameTranslationKeyMap[props.scope] ?? "common.actions.share";
});
</script>
4 changes: 3 additions & 1 deletion src/modules/ui/kebab-menu/index.ts
Original file line number Diff line number Diff line change
@@ -8,9 +8,10 @@ import KebabMenuActionMoveLeft from "./KebabMenuActionMoveLeft.vue";
import KebabMenuActionMoveRight from "./KebabMenuActionMoveRight.vue";
import KebabMenuActionMoveUp from "./KebabMenuActionMoveUp.vue";
import KebabMenuActionPublish from "./KebabMenuActionPublish.vue";
import KebabMenuActionRename from "./KebabMenuActionRename.vue";
import KebabMenuActionRevert from "./KebabMenuActionRevert.vue";
import KebabMenuActionShare from "./KebabMenuActionShare.vue";
import KebabMenuActionRename from "./KebabMenuActionRename.vue";
import KebabMenuActionShareLink from "./KebabMenuActionShareLink.vue";

export {
KebabMenu,
@@ -26,4 +27,5 @@ export {
KebabMenuActionRevert,
KebabMenuActionShare,
KebabMenuActionRename,
KebabMenuActionShareLink,
};

Unchanged files with check annotations Beta

const schoolExternalToolsModule: SchoolExternalToolsModule = injectStrict(
SCHOOL_EXTERNAL_TOOLS_MODULE_KEY
);
const envConfigModule: EnvConfigModule = injectStrict(ENV_CONFIG_MODULE_KEY);

Check warning on line 164 in src/components/administration/ExternalToolSection.vue

GitHub Actions / lint

'EnvConfigModule' is not defined
const notifierModule: NotifierModule = injectStrict(NOTIFIER_MODULE_KEY);
const authModule: AuthModule = injectStrict(AUTH_MODULE_KEY);
createWrapper({
type: "unsupported",
});
expect(console.error).toHaveBeenCalled();

Check warning on line 68 in src/components/base/BaseInput/BaseInput.unit.js

GitHub Actions / lint

Unexpected console statement
});
});
},
created() {
if (!componentDictionary[this.type]) {
console.error(

Check warning on line 88 in src/components/base/BaseInput/BaseInput.vue

GitHub Actions / lint

Unexpected console statement
`invalid prop type ${this.type}:\n` +
`$attrs ${JSON.stringify(this.$attrs)}`
);

Check warning on line 112 in src/components/base/BaseLink.vue

GitHub Actions / lint

Unexpected console statement

Check warning on line 119 in src/components/base/BaseLink.vue

GitHub Actions / lint

Unexpected console statement
if (handlerFunction) {
handlerFunction(responseError);
} else {
console.error(error);

Check warning on line 83 in src/components/error-handling/ErrorHandler.composable.ts

GitHub Actions / lint

Unexpected console statement
}
};
const clipboardText = "https://google.de";
const template = schoolExternalToolConfigurationTemplateFactory.build();
const clipboardMock = createMock<Clipboard>();

Check warning on line 124 in src/components/external-tools/configuration/ExternalToolConfigurator.unit.ts

GitHub Actions / lint

'Clipboard' is not defined
Object.assign(navigator, { clipboard: clipboardMock });
const { wrapper } = getWrapper({
await nextTick();
updateSearchInput(text);
} catch (err) {

Check warning on line 338 in src/components/external-tools/configuration/ExternalToolConfigurator.vue

GitHub Actions / lint

'err' is defined but never used
notifierModule.show({
text: t("pages.tool.select.clipboard.error"),
status: "error",
try {
new URL(text);
return true;
} catch (err) {

Check warning on line 8 in src/components/external-tools/configuration/external-tool-url-insertion.composable.ts

GitHub Actions / lint

'err' is defined but never used
return false;
}
};
// Clears the previous collection elements before rendering the new ones
contentModule.clearElements();
await contentModule.getElements(this.query);
} catch (error) {

Check warning on line 270 in src/components/lern-store/LernstoreCollectionDetailView.vue

GitHub Actions / lint

'error' is defined but never used
notifierModule.show({
text: this.$t("pages.content.notification.lernstoreNotAvailable"),
status: "error",
You are viewing a condensed version of this merge commit. You can view the full changes here.