Fix navigation placeholder and also fix further wording in loading messages etc

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
This commit is contained in:
Jan-Christoph Borchardt 2020-05-09 15:56:01 +02:00
commit 385708af80
No known key found for this signature in database
GPG key ID: CBD846FC845CBE17
5 changed files with 43 additions and 12 deletions

View file

@ -25,7 +25,7 @@
ref="navigationItem"
:exact="true"
:icon="icon"
:title="form.title"
:title="formTitle"
:to="{ name: 'edit', params: { hash: form.hash } }">
<template v-if="!loading" #actions>
<ActionLink
@ -124,6 +124,17 @@ export default {
return this.form.expires && moment().unix() > this.form.expires
},
/**
* Return form title, or placeholder if not set
* @returns {string}
*/
formTitle() {
if (this.form.title) {
return this.form.title
}
return 'New form'
},
/**
* Return the form share link
* @returns {string}
@ -148,7 +159,7 @@ export default {
methods: {
async onDeleteForm() {
if (!confirm(t('forms', 'Are you sure you want to delete the form “{title}?', { title: this.form.title }))) {
if (!confirm(t('forms', 'Are you sure you want to delete {title}?', { title: this.formTitle }))) {
return
}
@ -158,7 +169,7 @@ export default {
await axios.delete(generateUrl('/apps/forms/api/v1/form/{id}', { id: this.form.id }))
this.$emit('delete', this.form.id)
} catch (error) {
showError(t('forms', 'Error while deleting form “{title}', { title: this.form.title }))
showError(t('forms', 'Error while deleting {title}', { title: this.formTitle }))
console.error(error.response)
} finally {
this.loading = false

View file

@ -23,9 +23,7 @@
<template>
<div class="section submission">
<div class="submission-head">
<h3>
{{ t('forms', 'Response by {userDisplayName}', { userDisplayName: submission.userDisplayName }) }}
</h3>
<h3>{{ submission.userDisplayName }}</h3>
<Actions class="submission-menu" :force-menu="true">
<ActionButton icon="icon-delete" @click="onDelete">
{{ t('forms', 'Delete this response') }}