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:
parent
a09c44476c
commit
385708af80
|
@ -633,7 +633,7 @@ class ApiController extends Controller {
|
|||
// Append Display Name
|
||||
if (substr($submission['userId'], 0, 10) === 'anon-user-') {
|
||||
// Anonymous User
|
||||
$submission['userDisplayName'] = $this->l10n->t('anonymous user');
|
||||
$submission['userDisplayName'] = $this->l10n->t('Anonymous response');
|
||||
} else {
|
||||
$userEntity = $this->userManager->get($submission['userId']);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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') }}
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
<TopBar>
|
||||
<button @click="showEdit">
|
||||
<span class="icon-forms" role="img" />
|
||||
{{ t('forms', 'Back to form') }}
|
||||
{{ t('forms', 'Back to questions') }}
|
||||
</button>
|
||||
</TopBar>
|
||||
|
||||
<header v-if="!noSubmissions">
|
||||
<h2>{{ t('forms', 'Responses for {title}', { title: form.title }) }}</h2>
|
||||
<h2>{{ t('forms', 'Responses for {title}', { title: formTitle }) }}</h2>
|
||||
<div class="response_actions">
|
||||
<button class="response_actions__export" @click="download">
|
||||
<span class="icon-download" role="img" />
|
||||
|
@ -125,6 +125,17 @@ export default {
|
|||
noSubmissions() {
|
||||
return this.submissions && this.submissions.length === 0
|
||||
},
|
||||
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
return this.form.title
|
||||
}
|
||||
return 'New form'
|
||||
},
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
|
@ -185,7 +196,7 @@ export default {
|
|||
},
|
||||
|
||||
async deleteAllSubmissions() {
|
||||
if (!confirm(t('forms', 'Are you sure you want to delete all responses of this form?'))) {
|
||||
if (!confirm(t('forms', 'Are you sure you want to delete all responses of {title}?', { title: this.formTitle }))) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -228,7 +239,7 @@ export default {
|
|||
|
||||
const element = document.createElement('a')
|
||||
element.setAttribute('href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(parser.parse(formattedSubmissions)))
|
||||
element.setAttribute('download', this.form.title + '.csv')
|
||||
element.setAttribute('download', this.formTitle + '.csv')
|
||||
element.style.display = 'none'
|
||||
document.body.appendChild(element)
|
||||
element.click()
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<!-- Forms title & description-->
|
||||
<header>
|
||||
<h2 id="form-title">
|
||||
{{ form.title }}
|
||||
{{ formTitle }}
|
||||
</h2>
|
||||
<p v-if="!loading && !success" class="form-desc">
|
||||
{{ form.description }}
|
||||
|
@ -111,6 +111,17 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
return this.form.title
|
||||
}
|
||||
return 'New form'
|
||||
},
|
||||
|
||||
validQuestions() {
|
||||
return this.form.questions.filter(question => {
|
||||
// All questions must have a valid title
|
||||
|
|
Loading…
Reference in a new issue