diff --git a/src/Forms.vue b/src/Forms.vue
index 66411b4a1..01d3f3efa 100644
--- a/src/Forms.vue
+++ b/src/Forms.vue
@@ -140,12 +140,11 @@
:form.sync="selectedForm"
:sidebar-opened.sync="sidebarOpened"
@open-sharing="openSharing" />
-
+ :active.sync="sidebarActive" />
@@ -177,8 +176,9 @@ import IconPlus from 'vue-material-design-icons/Plus.vue'
import ArchivedFormsModal from './components/ArchivedFormsModal.vue'
import AppNavigationForm from './components/AppNavigationForm.vue'
import FormsIcon from './components/Icons/FormsIcon.vue'
-import PermissionTypes from './mixins/PermissionTypes.js'
import OcsResponse2Data from './utils/OcsResponse2Data.js'
+import PermissionTypes from './mixins/PermissionTypes.js'
+import Sidebar from './views/Sidebar.vue'
import logger from './utils/Logger.js'
import { FormState } from './models/FormStates.ts'
@@ -199,6 +199,7 @@ export default {
NcContent,
NcEmptyContent,
NcLoadingIcon,
+ Sidebar,
},
mixins: [PermissionTypes],
diff --git a/src/components/Results/ResultsSummary.vue b/src/components/Results/ResultsSummary.vue
index 10fcbde9f..baefba14b 100644
--- a/src/components/Results/ResultsSummary.vue
+++ b/src/components/Results/ResultsSummary.vue
@@ -49,7 +49,7 @@
@@ -130,7 +130,7 @@ export default {
})
// Go through submissions to check which options have how many responses
- this.submissions.forEach((submission) => {
+ this.submissions?.forEach((submission) => {
const answers = submission.answers.filter(
(answer) => answer.questionId === this.question.id,
)
@@ -168,7 +168,7 @@ export default {
questionOptionsStats.forEach((questionOptionsStat) => {
// Fill percentage values
questionOptionsStat.percentage = Math.round(
- (100 * questionOptionsStat.count) / this.submissions.length,
+ (100 * questionOptionsStat.count) / this.submissions?.length,
)
// Mark all best results. First one is best for sure due to sorting
questionOptionsStat.best =
@@ -186,7 +186,7 @@ export default {
let noResponseCount = 0
// Go through submissions to check which options have how many responses
- this.submissions.forEach((submission) => {
+ this.submissions?.forEach((submission) => {
const answers = submission.answers.filter(
(answer) => answer.questionId === this.question.id,
)
@@ -216,7 +216,7 @@ export default {
// Calculate no response percentage
const noResponsePercentage = Math.round(
- (100 * noResponseCount) / this.submissions.length,
+ (100 * noResponseCount) / this.submissions?.length,
)
answersModels.unshift({
id: 0,
diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue
index 4055d1f13..0ffb7589f 100644
--- a/src/components/TopBar.vue
+++ b/src/components/TopBar.vue
@@ -44,18 +44,6 @@
{{ t('forms', 'Share') }}
-
-
-
-
-
@@ -221,8 +209,4 @@ export default {
margin-inline-end: 0;
}
}
-
-.icon--flipped {
- transform: scaleX(-1);
-}
diff --git a/src/mixins/ViewsMixin.js b/src/mixins/ViewsMixin.js
index 7b416a621..d956bcc2b 100644
--- a/src/mixins/ViewsMixin.js
+++ b/src/mixins/ViewsMixin.js
@@ -116,10 +116,6 @@ export default {
this.$emit('open-sharing', this.form.hash)
},
- onSidebarChange(newState) {
- this.$emit('update:sidebarOpened', newState)
- },
-
/**
* Focus title after form load
*/
diff --git a/src/router.js b/src/router.js
index 03a955117..0775c5918 100644
--- a/src/router.js
+++ b/src/router.js
@@ -28,7 +28,6 @@ import { generateUrl } from '@nextcloud/router'
import Create from './views/Create.vue'
import Results from './views/Results.vue'
-import Sidebar from './views/Sidebar.vue'
import Submit from './views/Submit.vue'
Vue.use(Router)
@@ -56,7 +55,6 @@ export default new Router({
path: '/:hash/edit',
components: {
default: Create,
- sidebar: Sidebar,
},
name: 'edit',
props: { default: true },
@@ -65,7 +63,6 @@ export default new Router({
path: '/:hash/results',
components: {
default: Results,
- sidebar: Sidebar,
},
name: 'results',
props: { default: true },
@@ -74,7 +71,6 @@ export default new Router({
path: '/:hash/submit',
components: {
default: Submit,
- sidebar: Sidebar,
},
name: 'submit',
props: { default: true },
diff --git a/src/views/Results.vue b/src/views/Results.vue
index 4ca6e47e7..4cd99f359 100644
--- a/src/views/Results.vue
+++ b/src/views/Results.vue
@@ -105,7 +105,7 @@
{{
t('forms', '{amount} responses', {
- amount: form.submissions.length,
+ amount: form.submissions?.length ?? 0,
})
}}
@@ -125,6 +125,14 @@
@blur="isDownloadActionOpened = false"
@close="isDownloadActionOpened = false">
+
+
+
+
+ {{ t('forms', 'Create spreadsheet') }}
+
{{ t('forms', 'Unlink spreadsheet') }}
-
+
-
-
-
-
- {{ t('forms', 'Create spreadsheet') }}
-
@@ -381,7 +381,6 @@ export default {
picker: null,
showConfirmDeleteDialog: false,
- showLinkedFileNotAvailableDialog: false,
linkedFileNotAvailableButtons: [
{
@@ -456,19 +455,27 @@ export default {
}
return window.location.href
},
+
+ showLinkedFileNotAvailableDialog() {
+ if (this.form.partial) {
+ return false
+ }
+ return this.canEditForm && this.form.fileId && !this.form.filePath
+ },
},
watch: {
// Reload results, when form changes
async hash() {
+ await this.fetchFullForm(this.form.id)
this.loadFormResults()
- await this.fetchLinkedFileInfo()
+ SetWindowTitle(this.formTitle)
},
},
async beforeMount() {
+ await this.fetchFullForm(this.form.id)
this.loadFormResults()
- await this.fetchLinkedFileInfo()
SetWindowTitle(this.formTitle)
},
@@ -486,11 +493,16 @@ export default {
},
)
- this.form.fileFormat = null
- this.form.fileId = null
- this.form.filePath = null
+ const updatedForm = {
+ ...this.form,
+ fileFormat: null,
+ fileId: null,
+ filePath: null,
+ }
+ this.$emit('update:form', updatedForm)
emit('forms:last-updated:set', this.form.id)
},
+
async loadFormResults() {
this.loadingResults = true
logger.debug(`Loading results for form ${this.form.hash}`)
@@ -539,7 +551,7 @@ export default {
.pick()
.then(async (path) => {
try {
- const response = await axios.patch(
+ await axios.patch(
generateOcsUrl('apps/forms/api/v3/forms/{id}', {
id: this.form.id,
}),
@@ -550,15 +562,12 @@ export default {
},
},
)
- const responseData = OcsResponse2Data(response)
-
- this.form.fileFormat = responseData.fileFormat
- this.form.fileId = responseData.fileId
- this.form.filePath = responseData.filePath
+ await this.fetchFullForm(this.form.id)
+ await this.loadFormResults()
showSuccess(
t('forms', 'File {file} successfully linked', {
- file: responseData.fileName,
+ file: this.form.filePath.split('/').pop(),
}),
)
emit('forms:last-updated:set', this.form.id)
@@ -621,20 +630,6 @@ export default {
}
},
- async fetchLinkedFileInfo() {
- const response = await axios.get(
- generateOcsUrl('apps/forms/api/v3/forms/{id}', {
- id: this.form.id,
- }),
- )
- const form = OcsResponse2Data(response)
- this.$set(this.form, 'fileFormat', form.fileFormat)
- this.$set(this.form, 'fileId', form.fileId)
- this.$set(this.form, 'filePath', form.filePath)
- this.showLinkedFileNotAvailableDialog =
- this.canEditForm && form.fileId && !form.filePath
- },
-
async onReExport() {
if (!this.form.fileId) {
// Theoretically this will never fire