Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import { Ref, WithLookup } from '@hcengineering/core'
import { getEmbeddedLabel } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { getPanelURI, Icon, tooltip } from '@hcengineering/ui'
import view from '@hcengineering/view'
import { Icon, tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources'

import documents from '../../../plugin'

Expand All @@ -41,19 +41,18 @@
</script>

{#if category}
<a
class={!disableClick ? 'flex-presenter' : 'category-presenter'}
href={!disableClick
? `#${getPanelURI(view.component.EditDoc, category._id, category._class, 'content')}`
: undefined}
class:inline-presenter={inline}
use:tooltip={{ label: getEmbeddedLabel(category.title) }}
>
<div class="icon category-icon">
<Icon icon={documents.icon.Document} size={'small'} />
<DocNavLink object={category} disabled={disableClick} accent {inline}>
<div
class={!disableClick ? 'flex-presenter' : 'category-presenter'}
class:inline-presenter={inline}
use:tooltip={{ label: getEmbeddedLabel(category.title) }}
>
<div class="icon category-icon">
<Icon icon={documents.icon.Document} size={'small'} />
</div>
<span class="label fs-bold whitespace-nowrap">{category.code}</span>
</div>
<span class="label whitespace-nowrap">{category.code}</span>
</a>
</DocNavLink>
{/if}

<style lang="scss">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import { Document } from '@hcengineering/controlled-documents'
import { WithLookup } from '@hcengineering/core'
import { getEmbeddedLabel } from '@hcengineering/platform'
import { getPanelURI, tooltip } from '@hcengineering/ui'
import { tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources'

import DocumentIcon from '../../icons/DocumentIcon.svelte'
import documents from '../../../plugin'
Expand All @@ -29,16 +30,17 @@
export let withIcon = false
export let withTitle = false
export let disableLink = false
export let editable = false
export let canEdit = false

$: documentCode = value !== undefined ? value.code : ''
$: noUnderline = disableLink && !editable
$: noUnderline = disableLink && !canEdit
$: disabled = disableLink && !canEdit
$: title = withTitle ? `${documentCode} ${value?.title}` : documentCode

const dispatch = createEventDispatcher()

function handleClick (event: MouseEvent): void {
if (!editable) {
if (!canEdit) {
return
}

Expand All @@ -47,23 +49,26 @@
</script>

{#if value}
<a
class="flex-presenter"
href={!disableLink ? `#${getPanelURI(documents.component.EditDoc, value._id, value._class, 'content')}` : undefined}
class:inline-presenter={inline}
class:noBold={isRegular}
class:no-underline={noUnderline}
class:cursor-inherit={noUnderline}
use:tooltip={{ label: getEmbeddedLabel(title) }}
on:click={handleClick}
<DocNavLink
object={value}
component={documents.component.EditDoc}
onClick={canEdit ? handleClick : undefined}
accent={!isRegular}
{disabled}
{noUnderline}
{inline}
>
{#if withIcon}
<div class="icon">
<DocumentIcon size="small" />
</div>
{/if}
<span class="label nowrap" class:no-underline={noUnderline} class:label-gray={isGray}>{title}</span>
</a>
<div class="flex-presenter" use:tooltip={{ label: getEmbeddedLabel(title) }}>
{#if withIcon}
<div class="icon">
<DocumentIcon size="small" />
</div>
{/if}
<span class="label nowrap" class:fs-bold={!isRegular} class:no-underline={noUnderline} class:label-gray={isGray}
>{title}</span
>
</div>
</DocNavLink>
{/if}

<style lang="scss">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
<script lang="ts">
import { Document } from '@hcengineering/controlled-documents'
import { WithLookup } from '@hcengineering/core'
import { getPanelURI } from '@hcengineering/ui'
import documents from '../../../plugin'
import { tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources'
import { getEmbeddedLabel } from '@hcengineering/platform'

export let value: WithLookup<Document>
export let inline = false
</script>

{#if value}
<a
class="flex-presenter"
href="#{getPanelURI(documents.component.EditDoc, value._id, value._class, 'content')}"
class:inline-presenter={inline}
>
<span class="label nowrap">{value.title}</span>
</a>
<DocNavLink object={value} {inline}>
<div class="flex-presenter" class:inline-presenter={inline} use:tooltip={{ label: getEmbeddedLabel(value.title) }}>
<span class="label fs-bold nowrap">{value.title}</span>
</div>
</DocNavLink>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
value={$controlledDocument}
isRegular
disableLink
editable={isInitialEditableDraft}
canEdit={isInitialEditableDraft}
on:edit={(e) => {
handleCodeEdit(e.detail)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class DocumentReasonAndImpactPage extends DocumentCommonPage {
this.textReason = page.locator('//div[contains(@class, "title") and text()="Reason"]/..')
this.textImpactAnalysis = page.locator('//div[contains(@class, "title") and text()="Impact analysis"]/..')
this.textImpactedDocuments = page.locator(
'//div[contains(@class, "title") and text()="Impacted documents"]/..//a/span'
'//div[contains(@class, "title") and text()="Impacted documents"]/..//div/span'
)
}

Expand Down
Loading