scinote-web/app/javascript/vue/global_search/groups/folders.vue

65 lines
2.9 KiB
Vue
Raw Normal View History

<template>
<div ref="content" class="bg-white rounded" :class="{ 'p-4 mb-4': total || loading }">
<template v-if="total">
<div class="flex items-center">
<h2 class="flex items-center gap-2 mt-0 mb-4">
<i class="sn-icon sn-icon-folder"></i>
{{ i18n.t('search.index.folders') }}
[{{ total }}]
</h2>
<SortFlyout v-if="selected" :sort="sort" @changeSort="changeSort"></SortFlyout>
</div>
<div class="grid grid-cols-[auto_auto_auto_auto] items-center">
<template v-for="row in preparedResults" :key="row.id" class="hover:bg-sn-super-light-grey">
<a target="_blank" :href="row.attributes.url" class="h-full py-2 px-4 overflow-hidden font-bold border-0 border-b border-solid border-sn-light-grey">
<StringWithEllipsis class="w-full" :text="row.attributes.name"></StringWithEllipsis>
</a>
<div class="h-full py-2 px-4 flex items-center gap-1 text-xs border-0 border-b border-solid border-sn-light-grey">
<b class="shrink-0">{{ i18n.t('search.index.created_at') }}:</b>
<span class="shrink-0">{{ row.attributes.created_at }}</span>
</div>
<div class="h-full py-2 px-4 grid grid-cols-[auto_1fr] items-center gap-1 text-xs border-0 border-b border-solid border-sn-light-grey">
<b class="shrink-0">{{ i18n.t('search.index.team') }}:</b>
<a :href="row.attributes.team.url" class="shrink-0 overflow-hidden" target="_blank">
<StringWithEllipsis class="w-full" :text="row.attributes.team.name"></StringWithEllipsis>
</a>
</div>
<div class="h-full py-2 px-4 border-0 border-b border-solid border-sn-light-grey">
<template v-if="row.attributes.parent_folder">
<div class="grid grid-cols-[auto_1fr] items-center gap-1 text-xs w-full">
<b class="shrink-0">{{ i18n.t('search.index.folder') }}:</b>
<a :href="row.attributes.parent_folder.url" target="_blank" class="shrink-0 overflow-hidden">
<StringWithEllipsis class="w-full" :text="row.attributes.parent_folder.name"></StringWithEllipsis>
</a>
</div>
</template>
</div>
</template>
</div>
<div v-if="viewAll" class="mt-4">
<button class="btn btn-light" @click="$emit('selectGroup', 'FoldersComponent')">View all</button>
</div>
</template>
<Loader v-if="loading" :total="total" :loaderRows="loaderRows" :loaderYPadding="loaderYPadding"
:loaderHeight="loaderHeight" :loaderGap="loaderGap" :reachedEnd="reachedEnd" />
</div>
</template>
<script>
import Loader from '../loader.vue';
import searchMixin from './search_mixin';
export default {
name: 'FoldersComponent',
mixins: [searchMixin],
components: {
Loader
},
data() {
return {
group: 'project_folders'
};
}
};
</script>