From a7b2f3d5adf044e5834f59465744c89e6615b423 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev <haiodo@users.noreply.github.com> Date: Sun, 29 May 2022 14:55:17 +0700 Subject: [PATCH] Fix Vacancy Archive item presenting (#1901) Signed-off-by: Andrey Sobolev <haiodo@gmail.com> --- models/recruit/src/index.ts | 4 ++++ .../components/VacancyItemPresenter.svelte | 22 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 37d32a9c49..36b6bec3d5 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -134,6 +134,10 @@ export function createModel (builder: Builder): void { } }) + builder.mixin(core.class.Space, core.class.Class, view.mixin.AttributePresenter, { + presenter: recruit.component.VacancyItemPresenter + }) + builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.CollectionEditor, { editor: recruit.component.Applications }) diff --git a/plugins/recruit-resources/src/components/VacancyItemPresenter.svelte b/plugins/recruit-resources/src/components/VacancyItemPresenter.svelte index 8ad89459d9..d4cb17c335 100644 --- a/plugins/recruit-resources/src/components/VacancyItemPresenter.svelte +++ b/plugins/recruit-resources/src/components/VacancyItemPresenter.svelte @@ -20,7 +20,7 @@ export let value: Vacancy export let inline: boolean = false - export let action: (item: Ref<Vacancy>) => void + export let action: ((item: Ref<Vacancy>) => void) | undefined = undefined function editVacancy (): void { showPanel(recruit.component.EditVacancy, value._id, value._class, 'content') @@ -28,13 +28,25 @@ </script> {#if value} - <div class="flex-presenter" class:inline-presenter={inline} on:click={() => action(value._id)}> + <div + class="flex-presenter" + class:inline-presenter={inline} + on:click={() => { + if (action !== undefined) { + action(value._id) + } else { + editVacancy() + } + }} + > <div class="icon"> <Icon icon={recruit.icon.Vacancy} size={'small'} /> </div> <span class="label">{value.name}</span> - <div class="action"> - <ActionIcon label={recruit.string.Edit} size={'small'} icon={IconEdit} action={editVacancy} /> - </div> + {#if action !== undefined} + <div class="action"> + <ActionIcon label={recruit.string.Edit} size={'small'} icon={IconEdit} action={editVacancy} /> + </div> + {/if} </div> {/if}