mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 05:25:00 +02:00
Update the labels of the create button (#1138)
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
@@ -15,10 +15,11 @@
|
||||
|
||||
<script lang="ts">
|
||||
import type { Ref,Space } from '@anticrm/core'
|
||||
import core,{ WithLookup } from '@anticrm/core'
|
||||
import presentation,{ createQuery,getClient } from '@anticrm/presentation'
|
||||
import core, { WithLookup } from '@anticrm/core'
|
||||
import { IntlString } from '@anticrm/platform'
|
||||
import presentation, { createQuery, getClient } from '@anticrm/presentation'
|
||||
import type { AnyComponent } from '@anticrm/ui'
|
||||
import { Button,Icon,SearchEdit,showPopup,Tooltip } from '@anticrm/ui'
|
||||
import { Button, Icon, SearchEdit, showPopup, Tooltip, IconAdd } from '@anticrm/ui'
|
||||
import { Viewlet } from '@anticrm/view'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { classIcon } from '../utils'
|
||||
@@ -27,6 +28,7 @@
|
||||
export let spaceId: Ref<Space> | undefined
|
||||
// export let _class: Ref<Class<Doc>> | undefined
|
||||
export let createItemDialog: AnyComponent | undefined
|
||||
export let createItemLabel: IntlString = presentation.string.Create
|
||||
export let search: string
|
||||
export let viewlet: WithLookup<Viewlet> | undefined
|
||||
export let viewlets: WithLookup<Viewlet>[] = []
|
||||
@@ -51,7 +53,6 @@
|
||||
search = ''
|
||||
dispatch('search', '')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="ac-header full">
|
||||
@@ -62,7 +63,9 @@
|
||||
{#each viewlets as viewlet, i}
|
||||
<Tooltip label={viewlet.$lookup?.descriptor?.label} direction={'top'}>
|
||||
<button class="ac-header__icon-button" class:selected={selectedViewlet === i} on:click={() => { selectedViewlet = i }}>
|
||||
<Icon icon={viewlet.$lookup?.descriptor?.icon} size={'small'}/>
|
||||
{#if viewlet.$lookup?.descriptor?.icon}
|
||||
<Icon icon={viewlet.$lookup?.descriptor?.icon} size={'small'} />
|
||||
{/if}
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
@@ -72,7 +75,7 @@
|
||||
dispatch('search', search)
|
||||
}}/>
|
||||
{#if createItemDialog}
|
||||
<Button label={presentation.string.Create} primary={true} size={'small'} on:click={(ev) => showCreateDialog(ev)}/>
|
||||
<Button icon={IconAdd} label={createItemLabel} primary size={'small'} on:click={(ev) => showCreateDialog(ev)}/>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import core, { Class, Doc, Ref, Space, WithLookup } from '@anticrm/core'
|
||||
import { IntlString } from '@anticrm/platform'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import type { AnyComponent } from '@anticrm/ui'
|
||||
import view, { Viewlet } from '@anticrm/view'
|
||||
@@ -26,6 +27,7 @@
|
||||
export let currentSpace: Ref<Space> | undefined
|
||||
export let currentView: ViewConfiguration | undefined
|
||||
export let createItemDialog: AnyComponent | undefined
|
||||
export let createItemLabel: IntlString | undefined
|
||||
|
||||
let search: string = ''
|
||||
let viewlet: WithLookup<Viewlet> | undefined = undefined
|
||||
@@ -52,7 +54,7 @@
|
||||
$: update(currentView?.class, currentSpace)
|
||||
</script>
|
||||
|
||||
<SpaceHeader spaceId={space} {_class} {viewlets} {createItemDialog} bind:search={search} bind:viewlet={viewlet} />
|
||||
<SpaceHeader spaceId={space} {_class} {viewlets} {createItemDialog} {createItemLabel} bind:search={search} bind:viewlet={viewlet} />
|
||||
{#if _class && space}
|
||||
<SpaceContent {space} {_class} {search} {viewlet} />
|
||||
{/if}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import core, { Client, getCurrentAccount, Ref, Space } from '@anticrm/core'
|
||||
import notification, { NotificationStatus } from '@anticrm/notification'
|
||||
import { NotificationClientImpl } from '@anticrm/notification-resources'
|
||||
import { IntlString } from '@anticrm/platform'
|
||||
import { Avatar, createQuery, setClient } from '@anticrm/presentation'
|
||||
import {
|
||||
AnyComponent, closePopup,
|
||||
@@ -55,6 +56,7 @@
|
||||
let currentApplication: Application | undefined
|
||||
let currentView: ViewConfiguration | undefined
|
||||
let createItemDialog: AnyComponent | undefined
|
||||
let createItemLabel: IntlString | undefined
|
||||
let navigatorModel: NavigatorModel | undefined
|
||||
|
||||
onDestroy(
|
||||
@@ -96,7 +98,8 @@
|
||||
const spaceClass = client.getHierarchy().getClass(space._class) // (await client.findAll(core.class.Class, { _id: space._class }))[0]
|
||||
const view = client.getHierarchy().as(spaceClass, workbench.mixin.SpaceView)
|
||||
currentView = view.view
|
||||
createItemDialog = currentView.createItemDialog
|
||||
createItemDialog = currentView.createItemDialog ?? undefined
|
||||
createItemLabel = currentView.createItemLabel ?? undefined
|
||||
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = spaceId
|
||||
@@ -105,6 +108,7 @@
|
||||
} else {
|
||||
currentView = undefined
|
||||
createItemDialog = undefined
|
||||
createItemLabel = undefined
|
||||
}
|
||||
}
|
||||
$: updateSpace(currentSpace)
|
||||
@@ -192,6 +196,7 @@
|
||||
currentSpecial = undefined
|
||||
currentView = undefined
|
||||
createItemDialog = undefined
|
||||
createItemLabel = undefined
|
||||
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = app._id
|
||||
@@ -292,7 +297,7 @@
|
||||
{:else if specialComponent}
|
||||
<Component is={specialComponent} props={{ model: navigatorModel }} />
|
||||
{:else}
|
||||
<SpaceView {currentSpace} {currentView} {createItemDialog} />
|
||||
<SpaceView {currentSpace} {currentView} {createItemDialog} {createItemLabel} />
|
||||
{/if}
|
||||
</div>
|
||||
<!-- <div class="aside"><Chat thread/></div> -->
|
||||
|
||||
Reference in New Issue
Block a user