mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
Fix document labels (#5904)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
a251f39b42
commit
b46c3eb1b1
@ -900,12 +900,16 @@ export function createModel (builder: Builder): void {
|
||||
titleProvider: recruit.function.RevTitleProvider
|
||||
})
|
||||
|
||||
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.ObjectIdentifier, {
|
||||
provider: recruit.function.ReviewIdentifierProvider
|
||||
})
|
||||
|
||||
builder.mixin(recruit.class.Vacancy, core.class.Class, view.mixin.ObjectTitle, {
|
||||
titleProvider: recruit.function.VacTitleProvider
|
||||
})
|
||||
|
||||
builder.mixin(recruit.class.Vacancy, core.class.Class, view.mixin.ObjectIdentifier, {
|
||||
provider: recruit.function.VacTitleProvider
|
||||
provider: recruit.function.VacancyIdentifierProvider
|
||||
})
|
||||
|
||||
builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.LinkProvider, {
|
||||
|
@ -15,7 +15,9 @@
|
||||
<script lang="ts">
|
||||
import type { Asset, IntlString } from '@hcengineering/platform'
|
||||
import { translate } from '@hcengineering/platform'
|
||||
import { themeStore } from '@hcengineering/theme'
|
||||
import { createEventDispatcher, ComponentType } from 'svelte'
|
||||
|
||||
import plugin from '../plugin'
|
||||
import type { AnySvelteComponent } from '../types'
|
||||
import Icon from './Icon.svelte'
|
||||
@ -42,7 +44,7 @@
|
||||
autoFocus = false
|
||||
}
|
||||
|
||||
$: void translate(placeholder, placeholderParam ?? {}).then((res) => {
|
||||
$: void translate(placeholder, placeholderParam ?? {}, $themeStore.language).then((res) => {
|
||||
phTranslate = res
|
||||
})
|
||||
$: if (textHTML !== undefined) {
|
||||
|
@ -80,11 +80,14 @@
|
||||
icon = await getResource(iconMixin.component)
|
||||
}
|
||||
|
||||
const hasId = hierarchy.classHierarchyMixin(object._class, view.mixin.ObjectIdentifier) !== undefined
|
||||
const showDescription = hasId && isDocChat && !isPerson
|
||||
|
||||
items.push({
|
||||
id: object._id,
|
||||
object,
|
||||
title: (await getChannelName(object._id, object._class, object)) ?? (await translate(titleIntl, {})),
|
||||
description: isDocChat && !isPerson ? await getDocTitle(client, object._id, object._class, object) : undefined,
|
||||
description: showDescription ? await getDocTitle(client, object._id, object._class, object) : undefined,
|
||||
icon: icon ?? getObjectIcon(_class),
|
||||
iconProps: { showStatus: true },
|
||||
iconSize,
|
||||
|
@ -193,8 +193,8 @@
|
||||
if (hierarchy.isDerived(_class, activity.class.ActivityMessage)) {
|
||||
if (messagesTab === undefined) {
|
||||
messagesTab = {
|
||||
id: activity.class.ActivityMessage as string,
|
||||
label: await translate(activity.string.Messages, {})
|
||||
id: activity.class.ActivityMessage,
|
||||
labelIntl: activity.string.Messages
|
||||
}
|
||||
}
|
||||
continue
|
||||
@ -204,7 +204,7 @@
|
||||
const intlLabel = clazz.pluralLabel ?? clazz.label ?? _class
|
||||
tabs.push({
|
||||
id: _class,
|
||||
label: await translate(intlLabel, {})
|
||||
labelIntl: intlLabel
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -70,10 +70,12 @@ import {
|
||||
getAppIdentifier,
|
||||
getAppTitle,
|
||||
getObjectLink,
|
||||
getReviewIdentifier,
|
||||
getRevTitle,
|
||||
getSequenceId,
|
||||
getSequenceLink,
|
||||
getTalentId,
|
||||
getVacancyIdentifier,
|
||||
getVacTitle,
|
||||
objectLinkProvider,
|
||||
parseLinkId,
|
||||
@ -400,6 +402,8 @@ export default async (): Promise<Resources> => ({
|
||||
function: {
|
||||
AppTitleProvider: getAppTitle,
|
||||
AppIdentifierProvider: getAppIdentifier,
|
||||
VacancyIdentifierProvider: getVacancyIdentifier,
|
||||
ReviewIdentifierProvider: getReviewIdentifier,
|
||||
VacTitleProvider: getVacTitle,
|
||||
RevTitleProvider: getRevTitle,
|
||||
IdProvider: getSequenceId,
|
||||
|
@ -152,6 +152,8 @@ export default mergeIds(recruitId, recruit, {
|
||||
IdProvider: '' as Resource<(doc: Doc) => Promise<string>>,
|
||||
AppTitleProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
AppIdentifierProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
VacancyIdentifierProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
ReviewIdentifierProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
VacTitleProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
RevTitleProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
HasActiveApplicant: '' as FilterFunction,
|
||||
|
@ -207,15 +207,6 @@ export async function getObjectLink (doc: Candidate | VacancyList): Promise<Loca
|
||||
return loc
|
||||
}
|
||||
|
||||
async function getTitle<T extends RecruitDocument> (
|
||||
client: Client,
|
||||
ref: Ref<T>,
|
||||
_class: Ref<Class<T>>
|
||||
): Promise<string> {
|
||||
const object = await client.findOne<RecruitDocument>(_class, { _id: ref as Ref<any> })
|
||||
return object != null ? await getSequenceId(object) : ''
|
||||
}
|
||||
|
||||
export async function getVacTitle (client: Client, ref: Ref<Vacancy>, doc?: Vacancy): Promise<string> {
|
||||
const object = doc ?? (await client.findOne(recruit.class.Vacancy, { _id: ref }))
|
||||
return object != null ? object.name : ''
|
||||
@ -239,8 +230,9 @@ export async function getAppIdentifier (client: Client, ref: Ref<Applicant>, doc
|
||||
return applicant.identifier
|
||||
}
|
||||
|
||||
export async function getRevTitle (client: Client, ref: Ref<Review>): Promise<string> {
|
||||
return await getTitle(client, ref, recruit.class.Review)
|
||||
export async function getRevTitle (client: Client, ref: Ref<Review>, doc?: Review): Promise<string> {
|
||||
const object = doc ?? (await client.findOne(recruit.class.Review, { _id: ref }))
|
||||
return object != null ? object.title : ''
|
||||
}
|
||||
|
||||
export async function getSequenceId (doc: RecruitDocument): Promise<string> {
|
||||
@ -262,3 +254,23 @@ export async function getSequenceId (doc: RecruitDocument): Promise<string> {
|
||||
export async function getTalentId (doc: Candidate): Promise<string> {
|
||||
return doc._id
|
||||
}
|
||||
|
||||
export async function getVacancyIdentifier (client: Client, ref: Ref<Vacancy>, doc?: Vacancy): Promise<string> {
|
||||
const vacancy = doc ?? (await client.findOne(recruit.class.Vacancy, { _id: ref }))
|
||||
|
||||
if (vacancy === undefined) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return await getSequenceId(vacancy)
|
||||
}
|
||||
|
||||
export async function getReviewIdentifier (client: Client, ref: Ref<Review>, doc?: Review): Promise<string> {
|
||||
const review = doc ?? (await client.findOne(recruit.class.Review, { _id: ref }))
|
||||
|
||||
if (review === undefined) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return await getSequenceId(review)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user