Fix attachments popup (#1899)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-05-29 14:31:37 +07:00 committed by GitHub
parent badfde2dde
commit 868e349fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 6 deletions

View File

@ -129,6 +129,7 @@ export function createModel (builder: Builder): void {
},
label: attachment.string.PinAttachment,
input: 'focus',
icon: view.icon.Pin,
category: attachment.category.Attachments,
target: attachment.class.Attachment,
context: {
@ -147,6 +148,7 @@ export function createModel (builder: Builder): void {
},
label: attachment.string.UnPinAttachment,
input: 'focus',
icon: view.icon.Pin,
category: attachment.category.Attachments,
target: attachment.class.Attachment,
context: {

View File

@ -17,7 +17,8 @@
import type { Ref, Doc } from '@anticrm/core'
import { Table } from '@anticrm/view-resources'
import attachment from '@anticrm/attachment'
import attachment from '../plugin'
import view from '@anticrm/view'
export let objectId: Ref<Doc>
export let attachments: number
@ -25,8 +26,18 @@
<Table
_class={attachment.class.Attachment}
config={['', 'lastModified']}
options={{}}
config={[
'',
'description',
{
key: 'pinned',
presenter: view.component.BooleanTruePresenter,
label: attachment.string.Pinned,
sortingKey: 'pinned'
},
'lastModified'
]}
options={{ sort: { pinned: -1 } }}
query={{ attachedTo: objectId }}
loadingProps={{ length: attachments }}
/>

View File

@ -56,5 +56,8 @@
<symbol id="views" viewBox="0 0 16 16">
<path d="M12.6541 10.7952L14.7544 11.6213C14.8576 11.6618 14.9394 11.7434 14.9801 11.8466C15.0511 12.0264 14.9828 12.2268 14.827 12.3284L14.755 12.3656L8.35645 14.8924C8.15935 14.9703 7.94372 14.9831 7.74052 14.9309L7.62035 14.8918L1.25259 12.3653C1.1499 12.3246 1.06864 12.2432 1.02806 12.1404C0.957068 11.9607 1.02536 11.7603 1.1812 11.6587L1.25319 11.6215L3.34307 10.7962L7.06917 12.2751C7.65895 12.5091 8.31525 12.5097 8.9054 12.2766L12.6541 10.7952ZM12.6541 6.77688L14.7544 7.60289C14.8576 7.64346 14.9394 7.72508 14.9801 7.82824C15.0511 8.00803 14.9828 8.20839 14.827 8.31004L14.755 8.3472L10.6001 9.98825L9.619 10.375L8.35645 10.8741L8.317 10.886L8.23566 10.9132C8.20301 10.9215 8.17004 10.9282 8.13688 10.9331C8.12585 10.9346 8.11547 10.936 8.10507 10.9372C8.02541 10.9468 7.94422 10.9464 7.86397 10.9363L7.74052 10.9126L7.62035 10.8735L6.391 10.385L5.38907 9.98825L1.25259 8.34697C1.1499 8.30623 1.06864 8.22483 1.02806 8.12208C0.957068 7.94229 1.02536 7.74192 1.1812 7.64029L1.25319 7.60312L3.34307 6.77788L7.06917 8.25677C7.65895 8.49078 8.31525 8.4913 8.9054 8.25824L12.6541 6.77688ZM7.62186 1.06989C7.85734 0.976906 8.11932 0.976697 8.35494 1.06931L14.7544 3.58452C14.8576 3.62509 14.9394 3.70671 14.9801 3.80987C15.0612 4.01534 14.9605 4.24769 14.755 4.32884L10.6001 5.96988L8.35565 6.856L8.27468 6.88396C8.25405 6.8901 8.23326 6.89557 8.21236 6.90036C8.09824 6.92674 7.98013 6.93258 7.86397 6.91788L7.74052 6.89419L7.62035 6.8551L1.25259 4.3286C1.1499 4.28786 1.06864 4.20646 1.02806 4.10371C0.946925 3.89823 1.04772 3.66589 1.25319 3.58475L7.62186 1.06989Z"/>
</symbol>
<symbol id="pin" viewBox="0 0 16 16" fill="none">
<path d="M9.30308 2.90949C9.95614 2.47412 10.2827 2.25643 10.6384 2.29166C10.9942 2.32689 11.2717 2.60439 11.8267 3.15938L12.8413 4.17396C13.3963 4.72895 13.6738 5.00644 13.709 5.36221C13.7442 5.71798 13.5265 6.04451 13.0912 6.69757L12.2952 7.89148C12.2122 8.016 12.1707 8.07826 12.1307 8.14074C11.6211 8.93675 11.2566 9.81677 11.0541 10.74C11.0382 10.8125 11.0235 10.8858 10.9941 11.0326L10.8668 11.6692C10.7725 12.1406 10.2263 12.3613 9.83098 12.0877V12.0877C7.5186 10.4868 5.51386 8.48205 3.91299 6.16967V6.16967C3.63933 5.77439 3.86001 5.22813 4.33144 5.13384L4.96808 5.00651C5.11482 4.97717 5.1882 4.96249 5.26066 4.94659C6.18388 4.74408 7.0639 4.37956 7.85991 3.86995C7.92239 3.82995 7.98465 3.78844 8.10917 3.70543L9.30308 2.90949Z" stroke="white"/>
<path d="M3.33398 12.6667L6.33398 9.66669" stroke="white" stroke-linecap="round"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -28,7 +28,8 @@ loadMetadata(view.icon, {
Open: `${icons}#open`,
Setting: `${icons}#setting`,
ArrowRight: `${icons}#arrow-right`,
Views: `${icons}#views`
Views: `${icons}#views`,
Pin: `${icons}#pin`
})
addStringsLoader(viewId, async (lang: string) => await import(`../lang/${lang}.json`))

View File

@ -409,7 +409,8 @@ const view = plugin(viewId, {
Setting: '' as Asset,
Open: '' as Asset,
ArrowRight: '' as Asset,
Views: '' as Asset
Views: '' as Asset,
Pin: '' as Asset
},
category: {
General: '' as Ref<ActionCategory>,