mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 08:48:01 +00:00
Fix recruit activity labels (#962)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
1ccccf5162
commit
16686010b0
@ -3,6 +3,8 @@
|
|||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
"Edit": "Edit",
|
"Edit": "Edit",
|
||||||
"Options": "Options",
|
"Options": "Options",
|
||||||
"Edited": "edited"
|
"Edited": "edited",
|
||||||
|
"DocCreated": "created {_class}",
|
||||||
|
"DocDeleted": "deleted {_class}"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -141,7 +141,7 @@
|
|||||||
{#if viewlet && viewlet?.editable}
|
{#if viewlet && viewlet?.editable}
|
||||||
<div class="edited">
|
<div class="edited">
|
||||||
{#if viewlet.label}
|
{#if viewlet.label}
|
||||||
<Label label={viewlet.label} />
|
<Label label={viewlet.label} params={viewlet.labelParams ?? {}} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if tx.updated}
|
{#if tx.updated}
|
||||||
<Label label={activity.string.Edited} />
|
<Label label={activity.string.Edited} />
|
||||||
@ -152,7 +152,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else if viewlet && viewlet.label}
|
{:else if viewlet && viewlet.label}
|
||||||
<div class='flex-center'>
|
<div class='flex-center'>
|
||||||
<Label label={viewlet.label} />
|
<Label label={viewlet.label} params={viewlet.labelParams ?? {}} />
|
||||||
{#if viewlet.labelComponent}
|
{#if viewlet.labelComponent}
|
||||||
<Component is={viewlet.labelComponent} {props} />
|
<Component is={viewlet.labelComponent} {props} />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import type { TxViewlet } from '@anticrm/activity'
|
import type { TxViewlet } from '@anticrm/activity'
|
||||||
import activity from '@anticrm/activity'
|
import activity from '../plugin'
|
||||||
import core, { Class, Doc, Ref, TxCUD, TxOperations } from '@anticrm/core'
|
import core, { Class, Doc, Ref, TxCUD, TxOperations } from '@anticrm/core'
|
||||||
import { Asset, IntlString } from '@anticrm/platform'
|
import { Asset, IntlString, translate } from '@anticrm/platform'
|
||||||
import { AnyComponent, AnySvelteComponent } from '@anticrm/ui'
|
import { AnyComponent, AnySvelteComponent } from '@anticrm/ui'
|
||||||
import { AttributeModel } from '@anticrm/view'
|
import { AttributeModel } from '@anticrm/view'
|
||||||
import { buildModel, getObjectPresenter } from '@anticrm/view-resources'
|
import { buildModel, getObjectPresenter } from '@anticrm/view-resources'
|
||||||
import { ActivityKey, activityKey, DisplayTx } from '../activity'
|
import { ActivityKey, activityKey, DisplayTx } from '../activity'
|
||||||
|
|
||||||
export type TxDisplayViewlet =
|
export type TxDisplayViewlet =
|
||||||
| (Pick<TxViewlet, 'icon' | 'label' | 'display' | 'editable' | 'hideOnRemove' | 'labelComponent'> & {
|
| (Pick<TxViewlet, 'icon' | 'label' | 'display' | 'editable' | 'hideOnRemove' | 'labelComponent' | 'labelParams'> & {
|
||||||
component?: AnyComponent | AnySvelteComponent
|
component?: AnyComponent | AnySvelteComponent
|
||||||
})
|
})
|
||||||
| undefined
|
| undefined
|
||||||
@ -16,7 +16,7 @@ export type TxDisplayViewlet =
|
|||||||
async function createPseudoViewlet (
|
async function createPseudoViewlet (
|
||||||
client: TxOperations,
|
client: TxOperations,
|
||||||
dtx: DisplayTx,
|
dtx: DisplayTx,
|
||||||
label: string
|
label: IntlString
|
||||||
): Promise<TxDisplayViewlet> {
|
): Promise<TxDisplayViewlet> {
|
||||||
const doc = dtx.doc
|
const doc = dtx.doc
|
||||||
if (doc === undefined) {
|
if (doc === undefined) {
|
||||||
@ -24,12 +24,14 @@ async function createPseudoViewlet (
|
|||||||
}
|
}
|
||||||
const docClass: Class<Doc> = client.getModel().getObject(doc._class)
|
const docClass: Class<Doc> = client.getModel().getObject(doc._class)
|
||||||
|
|
||||||
|
const trLabel = await translate(docClass.label, {})
|
||||||
const presenter = await getObjectPresenter(client, doc._class, { key: 'doc-presenter' })
|
const presenter = await getObjectPresenter(client, doc._class, { key: 'doc-presenter' })
|
||||||
if (presenter !== undefined) {
|
if (presenter !== undefined) {
|
||||||
return {
|
return {
|
||||||
display: 'inline',
|
display: 'inline',
|
||||||
icon: docClass.icon ?? activity.icon.Activity,
|
icon: docClass.icon ?? activity.icon.Activity,
|
||||||
label: (`${label} ` + docClass.label) as IntlString,
|
label: label,
|
||||||
|
labelParams: { _class: trLabel },
|
||||||
component: presenter.presenter
|
component: presenter.presenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,10 +78,10 @@ async function checkInlineViewlets (
|
|||||||
): Promise<{ viewlet: TxDisplayViewlet, model: AttributeModel[] }> {
|
): Promise<{ viewlet: TxDisplayViewlet, model: AttributeModel[] }> {
|
||||||
if (dtx.tx._class === core.class.TxCreateDoc) {
|
if (dtx.tx._class === core.class.TxCreateDoc) {
|
||||||
// Check if we have a class presenter we could have a pseudo viewlet based on class presenter.
|
// Check if we have a class presenter we could have a pseudo viewlet based on class presenter.
|
||||||
viewlet = await createPseudoViewlet(client, dtx, 'created')
|
viewlet = await createPseudoViewlet(client, dtx, activity.string.DocCreated)
|
||||||
}
|
}
|
||||||
if (dtx.tx._class === core.class.TxRemoveDoc) {
|
if (dtx.tx._class === core.class.TxRemoveDoc) {
|
||||||
viewlet = await createPseudoViewlet(client, dtx, 'deleted')
|
viewlet = await createPseudoViewlet(client, dtx, activity.string.DocDeleted)
|
||||||
}
|
}
|
||||||
if (dtx.tx._class === core.class.TxUpdateDoc) {
|
if (dtx.tx._class === core.class.TxUpdateDoc) {
|
||||||
model = await createUpdateModel(dtx, client, model)
|
model = await createUpdateModel(dtx, client, model)
|
||||||
|
@ -13,12 +13,14 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import chunter, { chunterId } from '@anticrm/chunter'
|
import activity, { activityId } from '@anticrm/activity'
|
||||||
import type { IntlString } from '@anticrm/platform'
|
import type { IntlString } from '@anticrm/platform'
|
||||||
import { mergeIds } from '@anticrm/platform'
|
import { mergeIds } from '@anticrm/platform'
|
||||||
|
|
||||||
export default mergeIds(chunterId, chunter, {
|
export default mergeIds(activityId, activity, {
|
||||||
string: {
|
string: {
|
||||||
Activity: '' as IntlString
|
Activity: '' as IntlString,
|
||||||
|
DocCreated: '' as IntlString,
|
||||||
|
DocDeleted: '' as IntlString
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -37,6 +37,7 @@ export interface TxViewlet extends Doc {
|
|||||||
|
|
||||||
// Label will be displayed right after author
|
// Label will be displayed right after author
|
||||||
label?: IntlString
|
label?: IntlString
|
||||||
|
labelParams?: any
|
||||||
// Do component need to be emphasized or not.
|
// Do component need to be emphasized or not.
|
||||||
display: 'inline' | 'content' | 'emphasized'
|
display: 'inline' | 'content' | 'emphasized'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user