Skip to content

Commit

Permalink
Merge pull request #1921 from nextcloud/artonge/backport/stable27/1895
Browse files Browse the repository at this point in the history
[stable27] Add unselect all
  • Loading branch information
artonge authored Jul 6, 2023
2 parents 2592851 + 86c34ae commit 03f6bef
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 35 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.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/components/Collection/CollectionContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

<div v-else class="collection">
<!-- Header -->
<slot class="collection__header" name="header" :selected-file-ids="selectedFileIds" />
<slot class="collection__header"
name="header"
:selected-file-ids="selectedFileIds"
:reset-selection="resetSelection" />

<!-- No content -->
<slot v-if="collectionFileIds.length === 0 && !loading" name="empty-content" />
Expand All @@ -46,7 +49,7 @@
:loading="loading">
<File slot-scope="{file, distance}"
:file="files[file.id]"
:allow-selection="true"
:allow-selection="allowSelection"
:selected="selection[file.id] === true"
:distance="distance"
@click="openViewer"
Expand Down Expand Up @@ -99,6 +102,11 @@ export default {
default: false,
},
allowSelection: {
type: Boolean,
default: true,
},
error: {
type: [Error, Number],
default: null,
Expand Down
17 changes: 14 additions & 3 deletions src/views/AlbumContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<!-- Header -->
<HeaderNavigation key="navigation"
slot="header"
slot-scope="{selectedFileIds}"
slot-scope="{selectedFileIds, resetSelection}"
:class="{'photos-navigation--uploading': uploader.queue?.length > 0}"
:loading="loadingFiles"
:params="{ albumName }"
Expand All @@ -40,8 +40,19 @@
<div v-if="album.location !== ''" slot="subtitle" class="album__location">
<MapMarker />{{ album.location }}
</div>
<template v-if="album !== undefined"
slot="right">
<template slot="default">
<NcButton v-if="selectedFileIds.length > 0"
:aria-label="t('photos', 'Unselect all')"
@click="resetSelection">
<template #icon>
<Close />
</template>
{{ t('photos', 'Unselect all') }}
</NcButton>
</template>
<template v-if="album !== undefined" slot="right">
<UploadPicker v-if="album.nbItems !== 0"
:accept="allowedMimes"
:context="uploadContext"
Expand Down
1 change: 1 addition & 0 deletions src/views/PlaceContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<CollectionContent ref="collectionContent"
:collection="place"
:collection-file-ids="placeFileIds"
:allow-selection="false"
:loading="loadingCollection || loadingCollectionFiles"
:error="errorFetchingCollection || errorFetchingCollectionFiles">
<!-- Header -->
Expand Down
1 change: 1 addition & 0 deletions src/views/PublicAlbumContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<CollectionContent ref="collectionContent"
:collection="album"
:collection-file-ids="albumFileIds"
:allow-selection="false"
:loading="loadingAlbum || loadingFiles"
:error="errorFetchingAlbum || errorFetchingFiles">
<!-- Header -->
Expand Down
14 changes: 13 additions & 1 deletion src/views/SharedAlbumContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<!-- Header -->
<HeaderNavigation key="navigation"
slot="header"
slot-scope="{selectedFileIds}"
slot-scope="{selectedFileIds, resetSelection}"
:loading="loadingFiles"
:params="{ albumName }"
:path="'/' + albumName"
Expand All @@ -44,6 +44,18 @@
<div v-if="album.location !== ''" slot="subtitle" class="album__location">
<MapMarker />{{ album.location }} ⸱ {{ t('photos', 'Shared by') }}&nbsp;<NcUserBubble :display-name="album.collaborators[0].label" :user="album.collaborators[0].id" />
</div>

<template slot="default">
<NcButton v-if="selectedFileIds.length > 0"
:aria-label="t('photos', 'Unselect all')"
@click="resetSelection">
<template #icon>
<Close />
</template>
{{ t('photos', 'Unselect all') }}
</NcButton>
</template>

<template v-if="album !== undefined" slot="right">
<NcButton v-if="album.nbItems !== 0"
type="tertiary"
Expand Down
27 changes: 22 additions & 5 deletions src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@
<div class="timeline__header__left">
<!-- TODO: UploadPicker -->
<NcActions v-if="selectedFileIds.length === 0"
:force-title="true"
:force-menu="true"
:menu-title="t('photos', 'Add')">
<Plus slot="icon" />
<template #icon>
<Plus />
</template>
<NcActionButton :close-after-click="true"
:aria-label="t('photos', 'Create a new album')"
@click="showAlbumCreationForm = true">
{{ t('photos', 'Create new album') }}
<PlusBoxMultiple slot="icon" />
<template #icon>
<PlusBoxMultiple />
</template>
</NcActionButton>
</NcActions>

Expand All @@ -57,11 +60,20 @@
:aria-label="t('photos', 'Add selection to an album')"
@click="showAlbumPicker = true">
<template #icon>
<Plus slot="icon" />
<Plus />
</template>
{{ t('photos', 'Add to album') }}
</NcButton>

<NcButton v-if="selectedFileIds.length > 0"
:aria-label="t('photos', 'Unselect all')"
@click="resetSelection">
<template #icon>
<Close />
</template>
{{ t('photos', 'Unselect all') }}
</NcButton>

<NcActions :aria-label="t('photos', 'Open actions menu')">
<ActionDownload :selected-file-ids="selectedFileIds" :title="t('photos', 'Download selected files')">
<Download slot="icon" />
Expand All @@ -73,7 +85,9 @@
:aria-label="t('photos', 'Delete selection')"
@click="deleteSelection">
{{ t('photos', 'Delete selection') }}
<Delete slot="icon" />
<template #icon>
<Delete />
</template>
</NcActionButton>
</NcActions>
</template>
Expand Down Expand Up @@ -130,6 +144,7 @@ import Plus from 'vue-material-design-icons/Plus.vue'
import Delete from 'vue-material-design-icons/Delete.vue'
import PlusBoxMultiple from 'vue-material-design-icons/PlusBoxMultiple.vue'
import Download from 'vue-material-design-icons/Download.vue'
import Close from 'vue-material-design-icons/Close.vue'
import { NcModal, NcActions, NcActionButton, NcButton, NcEmptyContent, isMobile } from '@nextcloud/vue'
import moment from '@nextcloud/moment'
Expand All @@ -153,6 +168,7 @@ export default {
Delete,
PlusBoxMultiple,
Download,
Close,
Plus,
NcEmptyContent,
NcModal,
Expand Down Expand Up @@ -279,6 +295,7 @@ export default {
&__header {
&__left {
display: flex;
gap: 4px;
}
}
Expand Down

0 comments on commit 03f6bef

Please sign in to comment.