Skip to content

Commit

Permalink
Merge pull request #2227 from nextcloud/artonge/feat/order_collection…
Browse files Browse the repository at this point in the history
…s_files_by_taken_date

Order collections files by taken date
  • Loading branch information
artonge authored Jan 3, 2024
2 parents 45836e7 + a39cea3 commit 38610e7
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_AlbumContent_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_AlbumContent_vue.js.map

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/components/Collection/CollectionContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
:reset-selection="resetSelection" />

<!-- No content -->
<slot v-if="collectionFileIds.length === 0 && !loading" name="empty-content" />
<slot v-if="sortedCollectionFileIds.length === 0 && !loading" name="empty-content" />

<!-- Media list -->
<FilesListViewer v-if="collection !== undefined"
:container-element="appContent"
class="collection__media"
:file-ids="collectionFileIds"
:file-ids="sortedCollectionFileIds"
:base-height="isMobile ? 120 : 200"
:loading="loading">
<File slot-scope="{file, distance}"
Expand Down Expand Up @@ -125,14 +125,18 @@ export default {
files() {
return this.$store.getters.files
},
sortedCollectionFileIds() {
return this.collectionFileIds.toSorted((fileId1, fileId2) => this.files[fileId1].timestamp < this.files[fileId2].timestamp ? -1 : 1)
},
},
methods: {
openViewer(fileId) {
const file = this.files[fileId]
OCA.Viewer.open({
fileInfo: file,
list: this.collectionFileIds.map(fileId => this.files[fileId]).filter(file => !file.sectionHeader),
list: this.sortedCollectionFileIds.map(fileId => this.files[fileId]).filter(file => !file.sectionHeader),
loadMore: file.loadMore ? async () => await file.loadMore(true) : () => [],
canLoop: file.canLoop,
})
Expand Down

0 comments on commit 38610e7

Please sign in to comment.