mirror of
https://github.com/frappe/books.git
synced 2025-01-11 10:38:14 +00:00
fix: Image in listview
This commit is contained in:
parent
8f817cbbee
commit
c1acf5ee3e
@ -1,27 +1,59 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="px-5 pb-16 mt-2 text-sm flex flex-col overflow-y-hidden">
|
<div class="px-5 pb-16 mt-2 text-base flex flex-col overflow-y-hidden">
|
||||||
<div class="px-3">
|
<div class="flex px-3">
|
||||||
<Row class="text-gray-700" :columnCount="columns.length" gap="1rem">
|
<div class="py-4 mr-3 w-7" v-if="hasImage"></div>
|
||||||
|
<Row
|
||||||
|
class="flex-1 text-gray-700"
|
||||||
|
:columnCount="columns.length"
|
||||||
|
gap="1rem"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
v-for="column in columns"
|
v-for="column in columns"
|
||||||
:key="column.label"
|
:key="column.label"
|
||||||
class="py-4 truncate"
|
class="py-4 truncate"
|
||||||
:class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right' : ''"
|
:class="
|
||||||
>{{ column.label }}</div>
|
['Float', 'Currency'].includes(column.fieldtype) ? 'text-right' : ''
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ column.label }}
|
||||||
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-y-auto">
|
<div class="overflow-y-auto">
|
||||||
<div class="px-3 hover:bg-gray-100 rounded" v-for="doc in data" :key="doc.name">
|
<div
|
||||||
|
class="px-3 flex hover:bg-gray-100 rounded"
|
||||||
|
v-for="(doc, i) in data"
|
||||||
|
:key="doc.name"
|
||||||
|
>
|
||||||
|
<div class="w-7 py-4 mr-3" v-if="hasImage">
|
||||||
|
<div class="w-7 h-7 rounded-full overflow-hidden">
|
||||||
|
<img
|
||||||
|
v-if="doc.image"
|
||||||
|
:src="doc.image"
|
||||||
|
class="w-7 h-7 object-cover"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="bg-gray-500 flex h-full items-center justify-center text-white w-full text-base uppercase"
|
||||||
|
>
|
||||||
|
{{ doc.name[0] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<Row
|
<Row
|
||||||
gap="1rem"
|
gap="1rem"
|
||||||
class="cursor-pointer text-gray-900"
|
class="cursor-pointer text-gray-900 flex-1"
|
||||||
@click.native="openForm(doc.name)"
|
@click.native="openForm(doc.name)"
|
||||||
:columnCount="columns.length"
|
:columnCount="columns.length"
|
||||||
>
|
>
|
||||||
<ListCell
|
<ListCell
|
||||||
v-for="column in columns"
|
v-for="column in columns"
|
||||||
:key="column.label"
|
:key="column.label"
|
||||||
:class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right' : ''"
|
:class="
|
||||||
|
['Float', 'Currency'].includes(column.fieldtype)
|
||||||
|
? 'text-right'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
:doc="doc"
|
:doc="doc"
|
||||||
:column="column"
|
:column="column"
|
||||||
></ListCell>
|
></ListCell>
|
||||||
@ -62,6 +94,9 @@ export default {
|
|||||||
},
|
},
|
||||||
meta() {
|
meta() {
|
||||||
return frappe.getMeta(this.listConfig.doctype);
|
return frappe.getMeta(this.listConfig.doctype);
|
||||||
|
},
|
||||||
|
hasImage() {
|
||||||
|
return this.meta.hasField('image');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<PageHeader>
|
<PageHeader>
|
||||||
<h1 slot="title" class="text-xl font-bold" v-if="title">{{ title }}</h1>
|
<h1 slot="title" class="text-2xl font-bold" v-if="title">{{ title }}</h1>
|
||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<Button :icon="true" type="primary" @click="makeNewDoc">
|
<Button :icon="true" type="primary" @click="makeNewDoc">
|
||||||
<Add class="w-3 h-3 stroke-current text-white" />
|
<feather-icon name="plus" class="w-4 h-4 text-white" />
|
||||||
</Button>
|
</Button>
|
||||||
<SearchBar class="ml-2" />
|
<SearchBar class="ml-2" />
|
||||||
</template>
|
</template>
|
||||||
@ -19,7 +19,6 @@ import frappe from 'frappejs';
|
|||||||
import Observable from 'frappejs/utils/observable';
|
import Observable from 'frappejs/utils/observable';
|
||||||
import PageHeader from '@/components/PageHeader';
|
import PageHeader from '@/components/PageHeader';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import Add from '@/components/Icons/Add';
|
|
||||||
import SearchBar from '@/components/SearchBar';
|
import SearchBar from '@/components/SearchBar';
|
||||||
import List from './List';
|
import List from './List';
|
||||||
import listConfigs from './listConfig';
|
import listConfigs from './listConfig';
|
||||||
@ -31,7 +30,6 @@ export default {
|
|||||||
PageHeader,
|
PageHeader,
|
||||||
List,
|
List,
|
||||||
Button,
|
Button,
|
||||||
Add,
|
|
||||||
SearchBar
|
SearchBar
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
Loading…
Reference in New Issue
Block a user