Application Presenter and labels for custom presenters

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-11 11:32:01 +02:00
parent 127e9bff23
commit 9d24dc384e
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
10 changed files with 687 additions and 654 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -108,7 +108,7 @@ export function createModel (builder: Builder): void {
resume: chunter.class.Attachment
}
} as FindOptions<Doc>, // TODO: fix
config: ['', '#' + recruit.component.CreateApplicationPresenter, 'city', '$lookup.resume', 'channels']
config: ['', '#' + recruit.component.CreateApplicationPresenter + '/Action', 'city', '$lookup.resume', 'channels']
})
builder.createDoc(view.class.Viewlet, core.space.Model, {
@ -122,7 +122,7 @@ export function createModel (builder: Builder): void {
state: core.class.State
}
} as FindOptions<Doc>, // TODO: fix
config: ['$lookup.candidate', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
config: ['$lookup.candidate', '#' + recruit.component.ApplicationPresenter + '/Application', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
})
builder.createDoc(view.class.Viewlet, core.space.Model, {

View File

@ -34,7 +34,8 @@ export default mergeIds(recruitId, recruit, {
CreateApplication: '' as AnyComponent,
EditCandidate: '' as AnyComponent,
KanbanCard: '' as AnyComponent,
CreateApplicationPresenter: '' as AnyComponent
CreateApplicationPresenter: '' as AnyComponent,
ApplicationPresenter: '' as AnyComponent
},
space: {
CandidatesPublic: '' as Ref<Space>

View File

@ -0,0 +1,26 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import type { Applicant } from '@anticrm/recruit'
import { IconFile } from '@anticrm/ui'
export let object: Applicant
</script>
<IconFile size={'small'}/>

View File

@ -20,14 +20,14 @@
import { Label, showPopup } from '@anticrm/ui'
import CreateApplication from './CreateApplication.svelte'
export let object: Doc
export let value: Doc
let button: HTMLElement
</script>
<div class="flex-center presenter-container" bind:this={button}
on:click={() => { showPopup(CreateApplication, { candidate: object._id, preserveCandidate: true }, button) }}
on:click={() => { showPopup(CreateApplication, { candidate: value._id, preserveCandidate: true }, button) }}
>
<Label label="Create Application" />
</div>

View File

@ -22,6 +22,7 @@ import CandidateGeneral from './components/CandidateGeneral.svelte'
import Attachments from './components/Attachments.svelte'
import KanbanCard from './components/KanbanCard.svelte'
import CreateApplicationPresenter from './components/CreateApplicationPresenter.svelte'
import ApplicationPresenter from './components/ApplicationPresenter.svelte'
export default async () => ({
component: {
@ -33,6 +34,7 @@ export default async () => ({
CandidateGeneral,
Attachments,
KanbanCard,
CreateApplicationPresenter
CreateApplicationPresenter,
ApplicationPresenter
},
})

View File

@ -67,7 +67,7 @@
{#each objects as object (object._id)}
<tr class="tr-body">
{#each model as attribute}
<td><svelte:component this={attribute.presenter} {object} value={getValue(object, attribute.key)}/></td>
<td><svelte:component this={attribute.presenter} value={getValue(object, attribute.key)}/></td>
{/each}
</tr>
{/each}

View File

@ -65,10 +65,11 @@ async function getPresenter(client: Client, _class: Ref<Class<Obj>>, key: string
return getObjectPresenter(client, _class, preserveKey)
} else {
if (key.startsWith('#')) {
const [presenter, label] = key.substring(1).split('/')
return {
key: '',
label: '' as IntlString,
presenter: await getResource(key.substring(1) as AnyComponent)
label: label as IntlString,
presenter: await getResource(presenter as AnyComponent)
}
}
const split = key.split('.')

File diff suppressed because it is too large Load Diff