Skip to content

Commit 18a9d53

Browse files
committed
feat: Ease opening photos picker in album content view
1 parent 4d46dd8 commit 18a9d53

1 file changed

Lines changed: 10 additions & 78 deletions

File tree

src/views/AlbumContent.vue

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
:path="'/' + albumName"
3939
:title="albumName"
4040
@refresh="fetchAlbumContent">
41-
<div v-if="album.location !== ''" slot="subtitle" class="album__location">
41+
<div v-if="album.location !== ''"
42+
slot="subtitle"
43+
class="album__location">
4244
<MapMarker />{{ album.location }}
4345
</div>
4446

@@ -54,13 +56,12 @@
5456
</template>
5557

5658
<template v-if="album !== undefined" slot="right">
57-
<UploadPicker v-if="album.nbItems !== 0"
58-
:accept="allowedMimes"
59-
:context="uploadContext"
60-
:destination="album.basename"
61-
:root="uploadContext.root"
62-
:multiple="true"
63-
@uploaded="onUpload" />
59+
<NcButton @click="showAddPhotosModal = true">
60+
<template #icon>
61+
<Plus :size="20" />
62+
</template>
63+
{{ t('photos', 'Add photos to this album' ) }}
64+
</NcButton>
6465

6566
<NcButton v-if="sharingEnabled"
6667
type="tertiary"
@@ -166,11 +167,10 @@
166167
</template>
167168

168169
<script>
169-
import { addNewFileMenuEntry, removeNewFileMenuEntry } from '@nextcloud/files'
170170
import { getCurrentUser } from '@nextcloud/auth'
171171
import { mapActions, mapGetters } from 'vuex'
172172
import { NcActions, NcActionButton, NcButton, NcModal, NcEmptyContent, NcActionSeparator, NcLoadingIcon, isMobile } from '@nextcloud/vue'
173-
import { UploadPicker, getUploader } from '@nextcloud/upload'
173+
import { getUploader } from '@nextcloud/upload'
174174
import debounce from 'debounce'
175175
176176
import Close from 'vue-material-design-icons/Close.vue'
@@ -181,7 +181,6 @@ import ImagePlus from 'vue-material-design-icons/ImagePlus.vue'
181181
import MapMarker from 'vue-material-design-icons/MapMarker.vue'
182182
import Pencil from 'vue-material-design-icons/Pencil.vue'
183183
import Plus from 'vue-material-design-icons/Plus.vue'
184-
import PlusSvg from '@mdi/svg/svg/plus.svg'
185184
import ShareVariant from 'vue-material-design-icons/ShareVariant.vue'
186185
187186
import AbortControllerMixin from '../mixins/AbortControllerMixin.js'
@@ -198,7 +197,6 @@ import FilesPicker from '../components/FilesPicker.vue'
198197
import HeaderNavigation from '../components/HeaderNavigation.vue'
199198
200199
import { genFileInfo } from '../utils/fileUtils.js'
201-
import allowedMimes from '../services/AllowedMimes.js'
202200
import client from '../services/DavClient.js'
203201
import DavRequest from '../services/DavRequest.js'
204202
import logger from '../services/logger.js'
@@ -229,7 +227,6 @@ export default {
229227
Pencil,
230228
Plus,
231229
ShareVariant,
232-
UploadPicker,
233230
},
234231
235232
mixins: [
@@ -249,26 +246,11 @@ export default {
249246
250247
data() {
251248
return {
252-
allowedMimes,
253-
254249
showAddPhotosModal: false,
255250
showManageCollaboratorView: false,
256251
showEditAlbumForm: false,
257252
258253
loadingAddCollaborators: false,
259-
260-
uploader: getUploader(),
261-
262-
newFileMenuEntry: {
263-
id: 'album-add',
264-
displayName: t('photos', 'Add photos to this album'),
265-
templateName: '',
266-
if: (context) => context.route === this.$route.name,
267-
/** Existing icon css class */
268-
iconSvgInline: PlusSvg,
269-
/** Function to be run after creation */
270-
handler: () => { this.showAddPhotosModal = true },
271-
},
272254
}
273255
},
274256
@@ -297,20 +279,6 @@ export default {
297279
sharingEnabled() {
298280
return OC.Share !== undefined
299281
},
300-
301-
/**
302-
* The upload picker context
303-
* We're uploading to the album folder, and the backend handle
304-
* the writing to the default location as well as the album update.
305-
* The context is also used for the NewFileMenu.
306-
*/
307-
uploadContext() {
308-
return {
309-
...this.album,
310-
route: this.$route.name,
311-
root: `dav/photos/${getCurrentUser()?.uid}/albums`,
312-
}
313-
},
314282
},
315283
316284
watch: {
@@ -323,11 +291,6 @@ export default {
323291
324292
mounted() {
325293
this.fetchAlbumContent()
326-
addNewFileMenuEntry(this.newFileMenuEntry)
327-
},
328-
329-
destroyed() {
330-
removeNewFileMenuEntry(this.newFileMenuEntry)
331294
},
332295
333296
methods: {
@@ -431,15 +394,6 @@ export default {
431394
this.loadingAddCollaborators = false
432395
}
433396
},
434-
435-
/**
436-
* A new File has been uploaded, let's add it
437-
*
438-
* @param {Upload[]} uploads
439-
*/
440-
onUpload: debounce(function() {
441-
this.fetchAlbumContent()
442-
}, 500),
443397
},
444398
}
445399
</script>
@@ -461,26 +415,4 @@ export default {
461415
color: var(--color-text-lighter);
462416
}
463417
}
464-
465-
.photos-navigation {
466-
position: relative;
467-
// Add space at the bottom for the progress bar.
468-
&--uploading {
469-
margin-bottom: 30px;
470-
}
471-
}
472-
473-
:deep(.upload-picker) {
474-
.upload-picker__progress {
475-
position: absolute;
476-
bottom: -30px;
477-
left: 64px;
478-
margin: 0;
479-
}
480-
.upload-picker__cancel {
481-
position: absolute;
482-
bottom: -24px;
483-
right: 50px;
484-
}
485-
}
486418
</style>

0 commit comments

Comments
 (0)