Merge branch 'master' into enh/dad

This commit is contained in:
Jakob
2020-03-13 11:11:18 +01:00
committed by GitHub
86 changed files with 225 additions and 11 deletions

View File

@@ -106,6 +106,9 @@ import { showError } from '@nextcloud/dialogs'
import { formatFileSize } from '@nextcloud/files'
import relativeDate from '../../mixins/relativeDate'
import { mapState } from 'vuex'
import { loadState } from '@nextcloud/initial-state'
const maxUploadSizeState = loadState('deck', 'maxUploadSize')
export default {
name: 'CardSidebarTabAttachments',
@@ -127,6 +130,7 @@ export default {
file: '',
overwriteAttachment: null,
isDraggingOver: false,
maxUploadSize: maxUploadSizeState,
}
},
computed: {
@@ -188,11 +192,19 @@ export default {
this.$refs.localAttachments.click()
},
async onLocalAttachmentSelected(file) {
if (this.maxUploadSize > 0 && file.size > this.maxUploadSize) {
showError(
t('deck', `Failed to upload {name}`, { name: file.name }) + ' - '
+ t('deck', 'Maximum file size of {size} exceeded', { size: formatFileSize(this.maxUploadSize) })
)
event.target.value = ''
return
}
const bodyFormData = new FormData()
bodyFormData.append('cardId', this.card.id)
bodyFormData.append('type', 'deck_file')
bodyFormData.append('file', file)
this.file = file
try {
await this.$store.dispatch('createAttachment', { cardId: this.card.id, formData: bodyFormData })
} catch (err) {

View File

@@ -39,7 +39,7 @@
:text="t('deck', 'Shared boards')"
:boards="sharedBoards"
icon="icon-shared" />
<AppNavigationAddBoard />
<AppNavigationAddBoard v-if="canCreate" />
</ul>
<div v-if="isAdmin"
id="app-settings"
@@ -73,6 +73,9 @@ import { Multiselect } from '@nextcloud/vue'
import AppNavigationAddBoard from './AppNavigationAddBoard'
import AppNavigationBoardCategory from './AppNavigationBoardCategory'
import { loadState } from '@nextcloud/initial-state'
const canCreateState = loadState('deck', 'canCreate')
export default {
name: 'AppNavigation',
@@ -96,6 +99,7 @@ export default {
groups: [],
groupLimit: [],
groupLimitDisabled: true,
canCreate: canCreateState,
}
},
computed: {