Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/components/Questions/QuestionFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
</template>
</template>

<NcNoteCard v-if="hasError" :id="errorId" type="error">
{{ errorMessage }}
</NcNoteCard>

<div class="question__content">
<ul>
<NcListItem
Expand Down Expand Up @@ -158,6 +162,7 @@ import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
import IconChevronLeft from 'vue-material-design-icons/ChevronLeft.vue'
import IconFileDocumentAlert from 'vue-material-design-icons/FileDocumentAlertOutline.vue'
import IconFile from 'vue-material-design-icons/FileOutline.vue'
Expand Down Expand Up @@ -202,6 +207,7 @@ export default {
NcButton,
NcListItem,
NcLoadingIcon,
NcNoteCard,
Question,
},

Expand All @@ -211,6 +217,7 @@ export default {
data() {
return {
fileTypes,
errorMessage: null,
fileLoading: false,
maxFileSizeUnit: Object.keys(FILE_SIZE_UNITS)[0],
maxFileSizeValue: '',
Expand Down Expand Up @@ -249,6 +256,14 @@ export default {

return t('forms', 'All file types are allowed.')
},

hasError() {
return !!this.errorMessage
},

errorId() {
return `q${this.index}_error`
},
},

mounted() {
Expand Down Expand Up @@ -404,6 +419,18 @@ export default {

this.$emit('update:values', values)
},

async validate() {
if (this.fileLoading) {
this.errorMessage = t(
'forms',
'Please wait until the file has been uploaded.',
)
return false
}
this.errorMessage = null
return true
},
},
}
</script>
Expand Down
1 change: 1 addition & 0 deletions src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ export default {
* @param {string|null} subtype the question subtype, see AnswerTypes.subtypes
*/
async addQuestion(type, subtype = null) {
this.activeQuestionType = null
const text = ''
this.isLoadingQuestions = true
Expand Down
Loading