mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 13:21:57 +00: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
|
value: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(contact.class.Contact, core.class.Class, view.mixin.ObjectTitle, {
|
||||||
|
titleProvider: contact.function.ContactTitleProvider
|
||||||
|
})
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
presentation.class.ObjectSearchCategory,
|
presentation.class.ObjectSearchCategory,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import { contactId } from '@hcengineering/contact'
|
import { contactId } from '@hcengineering/contact'
|
||||||
import contact from '@hcengineering/contact-resources/src/plugin'
|
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 {} from '@hcengineering/core'
|
||||||
import { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/model-presentation'
|
import { ObjectSearchCategory, ObjectSearchFactory } from '@hcengineering/model-presentation'
|
||||||
import { IntlString, mergeIds, Resource } from '@hcengineering/platform'
|
import { IntlString, mergeIds, Resource } from '@hcengineering/platform'
|
||||||
@ -109,6 +109,7 @@ export default mergeIds(contactId, contact, {
|
|||||||
GetCurrentEmployeePosition: '' as Resource<TemplateFieldFunc>,
|
GetCurrentEmployeePosition: '' as Resource<TemplateFieldFunc>,
|
||||||
GetContactName: '' as Resource<TemplateFieldFunc>,
|
GetContactName: '' as Resource<TemplateFieldFunc>,
|
||||||
GetContactFirstName: '' 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 contact from './plugin'
|
||||||
import {
|
import {
|
||||||
|
contactTitleProvider,
|
||||||
employeeSort,
|
employeeSort,
|
||||||
filterChannelInResult,
|
filterChannelInResult,
|
||||||
filterChannelNinResult,
|
filterChannelNinResult,
|
||||||
@ -314,7 +315,8 @@ export default async (): Promise<Resources> => ({
|
|||||||
GetContactName: getContactName,
|
GetContactName: getContactName,
|
||||||
GetContactFirstName: getContactFirstName,
|
GetContactFirstName: getContactFirstName,
|
||||||
GetContactLastName: getContactLastName,
|
GetContactLastName: getContactLastName,
|
||||||
GetContactLink: getContactLink
|
GetContactLink: getContactLink,
|
||||||
|
ContactTitleProvider: contactTitleProvider
|
||||||
},
|
},
|
||||||
resolver: {
|
resolver: {
|
||||||
Location: resolveLocation
|
Location: resolveLocation
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
getLastName,
|
getLastName,
|
||||||
getName
|
getName
|
||||||
} from '@hcengineering/contact'
|
} 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 { createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import { TemplateDataProvider } from '@hcengineering/templates'
|
import { TemplateDataProvider } from '@hcengineering/templates'
|
||||||
import { DropdownIntlItem, getCurrentLocation, getPanelURI, Location, ResolvedLocation } from '@hcengineering/ui'
|
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
|
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 { Applicant, Candidate, recruitId, Review, Vacancy, VacancyList } from '@hcengineering/recruit'
|
||||||
import { getCurrentLocation, getPanelURI, Location, ResolvedLocation } from '@hcengineering/ui'
|
import { getCurrentLocation, getPanelURI, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
|
import contact, { getName } from '@hcengineering/contact'
|
||||||
import { workbenchId } from '@hcengineering/workbench'
|
import { workbenchId } from '@hcengineering/workbench'
|
||||||
import recruit from './plugin'
|
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> {
|
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> {
|
export async function getRevTitle (client: Client, ref: Ref<Review>): Promise<string> {
|
||||||
|
@ -185,20 +185,23 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
async function updateWindowTitle (loc: Location) {
|
async function updateWindowTitle (loc: Location) {
|
||||||
const title = (await getWindowTitle(loc)) ?? getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform'
|
|
||||||
const ws = loc.path[1]
|
const ws = loc.path[1]
|
||||||
|
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}`
|
document.title = ws == null ? title : `${ws} - ${title}`
|
||||||
}
|
}
|
||||||
|
}
|
||||||
async function getWindowTitle (loc: Location) {
|
async function getWindowTitle (loc: Location) {
|
||||||
if (loc.fragment == null) return
|
if (loc.fragment == null) return
|
||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
const [, _id, _class] = decodeURIComponent(loc.fragment).split('|')
|
const [, _id, _class] = decodeURIComponent(loc.fragment).split('|')
|
||||||
if (_class == null) return
|
if (_class == null) return
|
||||||
|
|
||||||
const clazz = hierarchy.getClass(_class as Ref<Class<Doc>>)
|
const mixin = hierarchy.classHierarchyMixin(_class as Ref<Class<Doc>>, view.mixin.ObjectTitle)
|
||||||
if (!hierarchy.hasMixin(clazz, view.mixin.ObjectTitle)) return
|
if (mixin === undefined) return
|
||||||
|
|
||||||
const mixin = hierarchy.as(clazz, view.mixin.ObjectTitle)
|
|
||||||
const titleProvider = await getResource(mixin.titleProvider)
|
const titleProvider = await getResource(mixin.titleProvider)
|
||||||
try {
|
try {
|
||||||
return await titleProvider(client, _id as Ref<Doc>)
|
return await titleProvider(client, _id as Ref<Doc>)
|
||||||
|
Loading…
Reference in New Issue
Block a user