mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
TSK-1253 В названии вкладок браузера не различимы Таланты (#3019)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
5b6c9d0342
commit
938a630056
@ -551,6 +551,10 @@ export function createModel (builder: Builder): void {
|
||||
value: true
|
||||
})
|
||||
|
||||
builder.mixin(contact.class.Contact, core.class.Class, view.mixin.ObjectTitle, {
|
||||
titleProvider: contact.function.ContactTitleProvider
|
||||
})
|
||||
|
||||
builder.createDoc(
|
||||
presentation.class.ObjectSearchCategory,
|
||||
core.space.Model,
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import { contactId } from '@hcengineering/contact'
|
||||
import contact from '@hcengineering/contact-resources/src/plugin'
|
||||
import type { Ref } from '@hcengineering/core'
|
||||
import type { Client, Doc, Ref } from '@hcengineering/core'
|
||||
import {} from '@hcengineering/core'
|
||||
import { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/model-presentation'
|
||||
import { IntlString, mergeIds, Resource } from '@hcengineering/platform'
|
||||
@ -109,6 +109,7 @@ export default mergeIds(contactId, contact, {
|
||||
GetCurrentEmployeePosition: '' as Resource<TemplateFieldFunc>,
|
||||
GetContactName: '' as Resource<TemplateFieldFunc>,
|
||||
GetContactFirstName: '' as Resource<TemplateFieldFunc>,
|
||||
GetContactLastName: '' as Resource<TemplateFieldFunc>
|
||||
GetContactLastName: '' as Resource<TemplateFieldFunc>,
|
||||
ContactTitleProvider: '' as Resource<(client: Client, ref: Ref<Doc>) => Promise<string>>
|
||||
}
|
||||
})
|
||||
|
@ -76,6 +76,7 @@ import ActivityChannelPresenter from './components/activity/ActivityChannelPrese
|
||||
|
||||
import contact from './plugin'
|
||||
import {
|
||||
contactTitleProvider,
|
||||
employeeSort,
|
||||
filterChannelInResult,
|
||||
filterChannelNinResult,
|
||||
@ -314,7 +315,8 @@ export default async (): Promise<Resources> => ({
|
||||
GetContactName: getContactName,
|
||||
GetContactFirstName: getContactFirstName,
|
||||
GetContactLastName: getContactLastName,
|
||||
GetContactLink: getContactLink
|
||||
GetContactLink: getContactLink,
|
||||
ContactTitleProvider: contactTitleProvider
|
||||
},
|
||||
resolver: {
|
||||
Location: resolveLocation
|
||||
|
@ -27,7 +27,7 @@ import {
|
||||
getLastName,
|
||||
getName
|
||||
} from '@hcengineering/contact'
|
||||
import { Doc, getCurrentAccount, IdMap, ObjQueryType, Ref, Timestamp, toIdMap } from '@hcengineering/core'
|
||||
import { Client, Doc, getCurrentAccount, IdMap, ObjQueryType, Ref, Timestamp, toIdMap } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { TemplateDataProvider } from '@hcengineering/templates'
|
||||
import { DropdownIntlItem, getCurrentLocation, getPanelURI, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
@ -300,3 +300,9 @@ export function getAvatarProviderId (avatar?: string | null): Ref<AvatarProvider
|
||||
}
|
||||
return contact.avatarProvider.Image
|
||||
}
|
||||
|
||||
export async function contactTitleProvider (client: Client, ref: Ref<Contact>): Promise<string> {
|
||||
const object = await client.findOne(contact.class.Contact, { _id: ref })
|
||||
if (object === undefined) return ''
|
||||
return getName(object)
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import { getClient } from '@hcengineering/presentation'
|
||||
import { Applicant, Candidate, recruitId, Review, Vacancy, VacancyList } from '@hcengineering/recruit'
|
||||
import { getCurrentLocation, getPanelURI, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
import contact, { getName } from '@hcengineering/contact'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import recruit from './plugin'
|
||||
|
||||
@ -174,7 +175,11 @@ export async function getVacTitle (client: Client, ref: Ref<Vacancy>): Promise<s
|
||||
}
|
||||
|
||||
export async function getAppTitle (client: Client, ref: Ref<Applicant>): Promise<string> {
|
||||
return await getTitle(client, ref, recruit.class.Applicant)
|
||||
const applicant = await client.findOne(recruit.class.Applicant, { _id: ref })
|
||||
if (applicant === undefined) return ''
|
||||
const candidate = await client.findOne(contact.class.Contact, { _id: applicant.attachedTo })
|
||||
if (candidate === undefined) return ''
|
||||
return getName(candidate)
|
||||
}
|
||||
|
||||
export async function getRevTitle (client: Client, ref: Ref<Review>): Promise<string> {
|
||||
|
@ -185,9 +185,14 @@
|
||||
)
|
||||
|
||||
async function updateWindowTitle (loc: Location) {
|
||||
const title = (await getWindowTitle(loc)) ?? getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform'
|
||||
const ws = loc.path[1]
|
||||
document.title = ws == null ? title : `${ws} - ${title}`
|
||||
const docTitle = await getWindowTitle(loc)
|
||||
if (docTitle !== undefined && docTitle !== '') {
|
||||
document.title = ws == null ? docTitle : `${docTitle} - ${ws}`
|
||||
} else {
|
||||
const title = getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform'
|
||||
document.title = ws == null ? title : `${ws} - ${title}`
|
||||
}
|
||||
}
|
||||
async function getWindowTitle (loc: Location) {
|
||||
if (loc.fragment == null) return
|
||||
@ -195,10 +200,8 @@
|
||||
const [, _id, _class] = decodeURIComponent(loc.fragment).split('|')
|
||||
if (_class == null) return
|
||||
|
||||
const clazz = hierarchy.getClass(_class as Ref<Class<Doc>>)
|
||||
if (!hierarchy.hasMixin(clazz, view.mixin.ObjectTitle)) return
|
||||
|
||||
const mixin = hierarchy.as(clazz, view.mixin.ObjectTitle)
|
||||
const mixin = hierarchy.classHierarchyMixin(_class as Ref<Class<Doc>>, view.mixin.ObjectTitle)
|
||||
if (mixin === undefined) return
|
||||
const titleProvider = await getResource(mixin.titleProvider)
|
||||
try {
|
||||
return await titleProvider(client, _id as Ref<Doc>)
|
||||
|
Loading…
Reference in New Issue
Block a user