Open issue by name click (#2279)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2022-09-26 15:40:13 +06:00 committed by GitHub
parent 3052f1790c
commit 5642e6823e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 3 deletions

View File

@ -13,18 +13,27 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import type { Issue } from '@hcengineering/tracker' import type { Issue, IssueParentInfo } from '@hcengineering/tracker'
import { showPanel } from '@hcengineering/ui'
import tracker from '../../plugin'
export let value: Issue | undefined export let value: Issue | undefined
export let maxWidth = '' export let maxWidth = ''
function handleIssueEditorOpened (parent: IssueParentInfo) {
if (value === undefined) return
showPanel(tracker.component.EditIssue, parent.parentId, value._class, 'content')
}
</script> </script>
{#if value} {#if value}
<div class="root" style:max-width={maxWidth}> <div class="root" style:max-width={maxWidth}>
<span class="names"> <span class="names">
{#each value.parents as parentInfo} {#each value.parents as parentInfo}
<span class="name">{parentInfo.parentTitle}</span> <span class="name cursor-pointer" on:click={() => handleIssueEditorOpened(parentInfo)}
>{parentInfo.parentTitle}</span
>
{/each} {/each}
</span> </span>
</div> </div>
@ -42,6 +51,17 @@
color: var(--content-color); color: var(--content-color);
} }
.name {
&:hover {
color: var(--caption-color);
text-decoration: underline;
}
&:active {
color: var(--accent-color);
}
}
.name::before { .name::before {
content: ''; content: '';
padding: 0 0.25rem; padding: 0 0.25rem;

View File

@ -15,14 +15,20 @@
<script lang="ts"> <script lang="ts">
import type { Issue } from '@hcengineering/tracker' import type { Issue } from '@hcengineering/tracker'
import ParentNamesPresenter from './ParentNamesPresenter.svelte' import ParentNamesPresenter from './ParentNamesPresenter.svelte'
import tracker from '../../plugin'
import { showPanel } from '@hcengineering/ui'
export let value: Issue export let value: Issue
export let shouldUseMargin: boolean = false export let shouldUseMargin: boolean = false
function handleIssueEditorOpened () {
showPanel(tracker.component.EditIssue, value._id, value._class, 'content')
}
</script> </script>
{#if value} {#if value}
<span class="root" class:with-margin={shouldUseMargin} title={value.title}> <span class="root" class:with-margin={shouldUseMargin} title={value.title}>
<span class="name">{value.title}</span> <span class="name cursor-pointer" on:click={handleIssueEditorOpened}>{value.title}</span>
<ParentNamesPresenter {value} /> <ParentNamesPresenter {value} />
</span> </span>
{/if} {/if}
@ -36,6 +42,16 @@
overflow: hidden; overflow: hidden;
flex-shrink: 10; flex-shrink: 10;
.name {
&:hover {
text-decoration: underline;
}
&:active {
color: var(--accent-color);
}
}
&.with-margin { &.with-margin {
margin-left: 0.5rem; margin-left: 0.5rem;
} }