2019-05-19 15:52:23 +00:00
|
|
|
<template>
|
|
|
|
<v-data-table
|
|
|
|
:headers="listColumns"
|
|
|
|
:items="photos"
|
|
|
|
hide-actions
|
2019-12-03 20:25:40 +00:00
|
|
|
class="elevation-0 p-photos p-photo-list p-results"
|
2019-05-19 15:52:23 +00:00
|
|
|
disable-initial-sort
|
|
|
|
item-key="ID"
|
2019-05-20 16:38:08 +00:00
|
|
|
v-model="selected"
|
2019-12-09 17:46:24 +00:00
|
|
|
:no-data-text="this.$gettext('No photos matched your search')"
|
2019-05-19 15:52:23 +00:00
|
|
|
>
|
2020-04-08 14:16:23 +00:00
|
|
|
<template slot="items" slot-scope="props">
|
2019-05-19 15:52:23 +00:00
|
|
|
<td>
|
2020-04-08 14:52:29 +00:00
|
|
|
<v-img class="accent lighten-2" style="cursor: pointer" aspect-ratio="1"
|
|
|
|
:src="props.item.getThumbnailUrl('tile_50')"
|
2020-04-08 14:16:23 +00:00
|
|
|
@click.exact="openPhoto(props.index)"
|
|
|
|
>
|
|
|
|
<v-layout
|
|
|
|
slot="placeholder"
|
|
|
|
fill-height
|
|
|
|
align-center
|
|
|
|
justify-center
|
|
|
|
ma-0
|
|
|
|
>
|
|
|
|
<v-progress-circular indeterminate
|
|
|
|
color="accent lighten-5"></v-progress-circular>
|
|
|
|
</v-layout>
|
|
|
|
</v-img>
|
2019-05-19 15:52:23 +00:00
|
|
|
</td>
|
2020-04-08 14:16:23 +00:00
|
|
|
<td class="p-photo-desc" @click.exact="toggleSelection(props)">
|
|
|
|
<v-hover>
|
|
|
|
<button @click.stop.prevent="editPhoto(props.index)" slot-scope="{ hover }">
|
|
|
|
{{ props.item.PhotoTitle }}
|
|
|
|
<v-icon v-if="hover" size="16" title="edit">edit</v-icon>
|
|
|
|
</button>
|
|
|
|
</v-hover>
|
2020-04-07 00:04:15 +00:00
|
|
|
</td>
|
2020-04-08 14:52:29 +00:00
|
|
|
<td class="p-photo-desc hidden-xs-only" @click.exact="toggleSelection(props)">
|
2020-03-30 13:07:05 +00:00
|
|
|
<button v-if="props.item.LocationID" @click.stop.prevent="openLocation(props.index)">
|
|
|
|
{{ props.item.getLocation() }}
|
|
|
|
</button>
|
|
|
|
<span v-else>
|
|
|
|
{{ props.item.getLocation() }}
|
|
|
|
</span>
|
|
|
|
</td>
|
2020-04-08 14:52:29 +00:00
|
|
|
<td class="p-photo-desc hidden-sm-and-down" @click.exact="toggleSelection(props)">
|
2020-04-07 00:04:15 +00:00
|
|
|
<button @click.stop.prevent="editPhoto(props.index)">
|
|
|
|
{{ props.item.CameraMake }} {{ props.item.CameraModel }}
|
|
|
|
</button>
|
|
|
|
</td>
|
2020-04-08 14:52:29 +00:00
|
|
|
<td class="p-photo-desc hidden-xs-only" :title="props.item.TakenAt | luxon:format('dd/MM/yyyy HH:mm:ss')">
|
2020-04-07 00:04:15 +00:00
|
|
|
<button @click.stop.prevent="editPhoto(props.index)">
|
|
|
|
{{ props.item.TakenAt | luxon:locale }}
|
|
|
|
</button>
|
|
|
|
</td>
|
2020-04-08 14:16:23 +00:00
|
|
|
<td>
|
2020-04-08 14:52:29 +00:00
|
|
|
<v-btn class="p-photo-like" icon small flat :ripple="false"
|
2019-05-21 15:59:12 +00:00
|
|
|
@click.stop.prevent="props.item.toggleLike()">
|
2020-04-08 14:16:23 +00:00
|
|
|
<v-icon v-if="props.item.PhotoFavorite" color="pink lighten-3">favorite</v-icon>
|
|
|
|
<v-icon v-else color="accent lighten-4">favorite_border</v-icon>
|
2019-05-20 23:39:52 +00:00
|
|
|
</v-btn>
|
|
|
|
</td>
|
2019-05-19 15:52:23 +00:00
|
|
|
</template>
|
|
|
|
</v-data-table>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
2019-05-21 15:59:12 +00:00
|
|
|
name: 'p-photo-list',
|
2019-05-19 15:52:23 +00:00
|
|
|
props: {
|
|
|
|
photos: Array,
|
2019-05-20 16:38:08 +00:00
|
|
|
selection: Array,
|
2019-05-21 15:59:12 +00:00
|
|
|
openPhoto: Function,
|
2020-03-30 13:07:05 +00:00
|
|
|
editPhoto: Function,
|
2019-05-21 15:59:12 +00:00
|
|
|
openLocation: Function,
|
2019-12-08 09:21:41 +00:00
|
|
|
album: Object,
|
2019-05-19 15:52:23 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-05-20 16:38:08 +00:00
|
|
|
'selected': [],
|
2019-05-19 15:52:23 +00:00
|
|
|
'listColumns': [
|
2019-05-20 23:39:52 +00:00
|
|
|
{text: '', value: '', align: 'center', sortable: false, class: 'p-col-select'},
|
2019-12-09 17:46:24 +00:00
|
|
|
{text: this.$gettext('Title'), value: 'PhotoTitle'},
|
2020-03-30 13:30:25 +00:00
|
|
|
{text: this.$gettext('Location'), class: 'hidden-xs-only', value: 'LocLabel'},
|
|
|
|
{text: this.$gettext('Camera'), class: 'hidden-sm-and-down', value: 'CameraModel'},
|
2020-04-08 14:52:29 +00:00
|
|
|
{text: this.$gettext('Taken'), class: 'hidden-xs-only', value: 'TakenAt'},
|
2019-12-09 17:46:24 +00:00
|
|
|
{text: this.$gettext('Favorite'), value: 'PhotoFavorite', align: 'left'},
|
2019-05-19 15:52:23 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
2020-04-08 14:16:23 +00:00
|
|
|
watch: {
|
|
|
|
photos: function (photos) {
|
|
|
|
this.selected.splice(0);
|
|
|
|
|
|
|
|
for (let i = 0; i <= photos.length; i++) {
|
|
|
|
if(this.$clipboard.has(photos[i])) {
|
|
|
|
this.selected.push(photos[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection: function () {
|
|
|
|
this.selected.splice(0);
|
|
|
|
|
|
|
|
for (let i = 0; i <= this.photos.length; i++) {
|
|
|
|
if(this.$clipboard.has(this.photos[i])) {
|
|
|
|
this.selected.push(this.photos[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-05-19 15:52:23 +00:00
|
|
|
methods: {
|
2020-04-08 14:16:23 +00:00
|
|
|
toggleSelection(props) {
|
|
|
|
this.$clipboard.toggle(props.item);
|
|
|
|
props.selected = this.$clipboard.has(props.item);
|
|
|
|
}
|
2019-05-19 15:52:23 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|