mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Context menu Copy actions (#2155)
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
This commit is contained in:
parent
1e21c85379
commit
ffe2137d4a
@ -647,6 +647,70 @@ export function createModel (builder: Builder): void {
|
|||||||
group: 'edit'
|
group: 'edit'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// TODO: fix icons
|
||||||
|
createAction(
|
||||||
|
builder,
|
||||||
|
{
|
||||||
|
action: recruit.actionImpl.CopyToClipboard,
|
||||||
|
actionProps: {
|
||||||
|
type: 'id'
|
||||||
|
},
|
||||||
|
label: recruit.string.CopyId,
|
||||||
|
icon: recruit.icon.Application,
|
||||||
|
keyBinding: [],
|
||||||
|
input: 'none',
|
||||||
|
category: recruit.category.Recruit,
|
||||||
|
target: recruit.class.Applicant,
|
||||||
|
context: {
|
||||||
|
mode: ['context', 'browser'],
|
||||||
|
application: recruit.app.Recruit,
|
||||||
|
group: 'copy'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recruit.action.CopyApplicationId
|
||||||
|
)
|
||||||
|
createAction(
|
||||||
|
builder,
|
||||||
|
{
|
||||||
|
action: recruit.actionImpl.CopyToClipboard,
|
||||||
|
actionProps: {
|
||||||
|
type: 'link'
|
||||||
|
},
|
||||||
|
label: recruit.string.CopyLink,
|
||||||
|
icon: recruit.icon.Application,
|
||||||
|
keyBinding: [],
|
||||||
|
input: 'none',
|
||||||
|
category: recruit.category.Recruit,
|
||||||
|
target: recruit.class.Applicant,
|
||||||
|
context: {
|
||||||
|
mode: ['context', 'browser'],
|
||||||
|
application: recruit.app.Recruit,
|
||||||
|
group: 'copy'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recruit.action.CopyApplicationLink
|
||||||
|
)
|
||||||
|
createAction(
|
||||||
|
builder,
|
||||||
|
{
|
||||||
|
action: recruit.actionImpl.CopyToClipboard,
|
||||||
|
actionProps: {
|
||||||
|
type: 'link'
|
||||||
|
},
|
||||||
|
label: recruit.string.CopyLink,
|
||||||
|
icon: recruit.icon.Application,
|
||||||
|
keyBinding: [],
|
||||||
|
input: 'none',
|
||||||
|
category: recruit.category.Recruit,
|
||||||
|
target: contact.class.Person,
|
||||||
|
context: {
|
||||||
|
mode: ['context', 'browser'],
|
||||||
|
application: recruit.app.Recruit,
|
||||||
|
group: 'copy'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recruit.action.CopyCandidateLink
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { recruitOperation } from './migration'
|
export { recruitOperation } from './migration'
|
||||||
|
@ -26,10 +26,14 @@ import type { Action, ActionCategory, ViewAction, Viewlet } from '@anticrm/view'
|
|||||||
export default mergeIds(recruitId, recruit, {
|
export default mergeIds(recruitId, recruit, {
|
||||||
action: {
|
action: {
|
||||||
CreateOpinion: '' as Ref<Action>,
|
CreateOpinion: '' as Ref<Action>,
|
||||||
CreateGlobalApplication: '' as Ref<Action>
|
CreateGlobalApplication: '' as Ref<Action>,
|
||||||
|
CopyApplicationId: '' as Ref<Action>,
|
||||||
|
CopyApplicationLink: '' as Ref<Action>,
|
||||||
|
CopyCandidateLink: '' as Ref<Action>
|
||||||
},
|
},
|
||||||
actionImpl: {
|
actionImpl: {
|
||||||
CreateOpinion: '' as ViewAction
|
CreateOpinion: '' as ViewAction,
|
||||||
|
CopyToClipboard: '' as ViewAction
|
||||||
},
|
},
|
||||||
category: {
|
category: {
|
||||||
Recruit: '' as Ref<ActionCategory>
|
Recruit: '' as Ref<ActionCategory>
|
||||||
|
@ -87,7 +87,9 @@
|
|||||||
"GotoAssigned": "Go to my Assigned",
|
"GotoAssigned": "Go to my Assigned",
|
||||||
"GotoApplicants": "Go to Applications",
|
"GotoApplicants": "Go to Applications",
|
||||||
"GotoRecruitApplication": "Switch to Recruit Application",
|
"GotoRecruitApplication": "Switch to Recruit Application",
|
||||||
"AddDropHere": "Add or drop resume"
|
"AddDropHere": "Add or drop resume",
|
||||||
|
"CopyId": "Copy ID",
|
||||||
|
"CopyLink": "Copy link"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"TalentRequired": "Please select talent",
|
"TalentRequired": "Please select talent",
|
||||||
|
@ -89,7 +89,9 @@
|
|||||||
"GotoAssigned": "Перейти к моим назначениям",
|
"GotoAssigned": "Перейти к моим назначениям",
|
||||||
"GotoApplicants": "Перейти к кандидатам",
|
"GotoApplicants": "Перейти к кандидатам",
|
||||||
"GotoRecruitApplication": "Перейти к Приложению Рекрутинг",
|
"GotoRecruitApplication": "Перейти к Приложению Рекрутинг",
|
||||||
"AddDropHere": "Добавить или перетянуть резюме"
|
"AddDropHere": "Добавить или перетянуть резюме",
|
||||||
|
"CopyId": "Копировать ID",
|
||||||
|
"CopyLink": "Копировать ссылку"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"TalentRequired": "Пожалуйста выберите таланта",
|
"TalentRequired": "Пожалуйста выберите таланта",
|
||||||
|
@ -45,7 +45,7 @@ import VacancyCountPresenter from './components/VacancyCountPresenter.svelte'
|
|||||||
import VacancyItemPresenter from './components/VacancyItemPresenter.svelte'
|
import VacancyItemPresenter from './components/VacancyItemPresenter.svelte'
|
||||||
import VacancyModifiedPresenter from './components/VacancyModifiedPresenter.svelte'
|
import VacancyModifiedPresenter from './components/VacancyModifiedPresenter.svelte'
|
||||||
import VacancyPresenter from './components/VacancyPresenter.svelte'
|
import VacancyPresenter from './components/VacancyPresenter.svelte'
|
||||||
import { getApplicationTitle } from './utils'
|
import { getApplicationTitle, copyToClipboard } from './utils'
|
||||||
import recruit from './plugin'
|
import recruit from './plugin'
|
||||||
|
|
||||||
async function createOpinion (object: Doc): Promise<void> {
|
async function createOpinion (object: Doc): Promise<void> {
|
||||||
@ -113,7 +113,8 @@ export async function queryApplication (client: Client, search: string): Promise
|
|||||||
|
|
||||||
export default async (): Promise<Resources> => ({
|
export default async (): Promise<Resources> => ({
|
||||||
actionImpl: {
|
actionImpl: {
|
||||||
CreateOpinion: createOpinion
|
CreateOpinion: createOpinion,
|
||||||
|
CopyToClipboard: copyToClipboard
|
||||||
},
|
},
|
||||||
validator: {
|
validator: {
|
||||||
ApplicantValidator: applicantValidator
|
ApplicantValidator: applicantValidator
|
||||||
|
@ -76,6 +76,9 @@ export default mergeIds(recruitId, recruit, {
|
|||||||
Title: '' as IntlString,
|
Title: '' as IntlString,
|
||||||
Vacancies: '' as IntlString,
|
Vacancies: '' as IntlString,
|
||||||
|
|
||||||
|
CopyLink: '' as IntlString,
|
||||||
|
CopyId: '' as IntlString,
|
||||||
|
|
||||||
Review: '' as IntlString,
|
Review: '' as IntlString,
|
||||||
ReviewCreateLabel: '' as IntlString,
|
ReviewCreateLabel: '' as IntlString,
|
||||||
CreateReview: '' as IntlString,
|
CreateReview: '' as IntlString,
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import core, { Doc, Ref, TxOperations } from '@anticrm/core'
|
import core, { Doc, Ref, TxOperations } from '@anticrm/core'
|
||||||
import { translate } from '@anticrm/platform'
|
import { translate } from '@anticrm/platform'
|
||||||
import { Applicant } from '@anticrm/recruit'
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
import { Applicant, Candidate } from '@anticrm/recruit'
|
||||||
|
import { getPanelURI } from '@anticrm/ui'
|
||||||
|
import view from '@anticrm/view'
|
||||||
import recruit from './plugin'
|
import recruit from './plugin'
|
||||||
|
|
||||||
export async function getApplicationTitle (client: TxOperations, ref: Ref<Doc>): Promise<string> {
|
export async function getApplicationTitle (client: TxOperations, ref: Ref<Doc>): Promise<string> {
|
||||||
@ -15,3 +18,24 @@ export async function getApplicationTitle (client: TxOperations, ref: Ref<Doc>):
|
|||||||
const label = await translate(object.$lookup._class.shortLabel, {})
|
const label = await translate(object.$lookup._class.shortLabel, {})
|
||||||
return `${label}-${object.number}`
|
return `${label}-${object.number}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function copyToClipboard (
|
||||||
|
object: Applicant | Candidate,
|
||||||
|
ev: Event,
|
||||||
|
{ type }: { type: string }
|
||||||
|
): Promise<void> {
|
||||||
|
const client = getClient()
|
||||||
|
let text: string
|
||||||
|
switch (type) {
|
||||||
|
case 'id':
|
||||||
|
text = await getApplicationTitle(client, object._id)
|
||||||
|
break
|
||||||
|
case 'link':
|
||||||
|
// TODO: fix when short link is available
|
||||||
|
text = `${window.location.href}#${getPanelURI(view.component.EditDoc, object._id, object._class, 'content')}`
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user