Merge pull request #367 from nextcloud/design/title-no-prefill
Do not prefill form or question title for less confusion
This commit is contained in:
commit
a662dd11ef
|
@ -148,7 +148,7 @@ class ApiController extends Controller {
|
|||
$this->logger->debug('Could not find form');
|
||||
return new Http\JSONResponse([], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
if (!$this->formsService->hasUserAccess($id)) {
|
||||
$this->logger->debug('User has no permissions to get this form');
|
||||
return new Http\JSONResponse([], Http::STATUS_FORBIDDEN);
|
||||
|
@ -171,7 +171,7 @@ class ApiController extends Controller {
|
|||
16,
|
||||
ISecureRandom::CHAR_HUMAN_READABLE
|
||||
));
|
||||
$form->setTitle('New form');
|
||||
$form->setTitle('');
|
||||
$form->setDescription('');
|
||||
$form->setAccess([
|
||||
'type' => 'public'
|
||||
|
@ -279,7 +279,7 @@ class ApiController extends Controller {
|
|||
$this->logger->debug('Invalid type');
|
||||
return new Http\JSONResponse(['message' => 'Invalid type'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$form = $this->formMapper->findById($formId);
|
||||
} catch (IMapperException $e) {
|
||||
|
@ -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 t('forms', '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
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
<!-- Header -->
|
||||
<div class="question__header">
|
||||
<input v-if="edit"
|
||||
:placeholder="t('forms', 'Enter a title for this question')"
|
||||
<input v-if="edit || !text"
|
||||
:placeholder="t('forms', 'Question title')"
|
||||
:aria-label="t('forms', 'Title of question number {index}', {index})"
|
||||
:value="text"
|
||||
class="question__header-title"
|
||||
|
|
|
@ -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') }}
|
||||
|
|
|
@ -268,7 +268,7 @@ export default {
|
|||
* @param {string} type the question type, see AnswerTypes
|
||||
*/
|
||||
async addQuestion(type) {
|
||||
const text = t('forms', 'New question')
|
||||
const text = ''
|
||||
this.isLoadingQuestions = true
|
||||
|
||||
try {
|
||||
|
|
|
@ -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" />
|
||||
|
@ -126,6 +126,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 t('forms', 'New form')
|
||||
},
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
|
@ -187,7 +198,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
|
||||
}
|
||||
|
||||
|
@ -230,7 +241,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 }}
|
||||
|
@ -114,6 +114,17 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
return this.form.title
|
||||
}
|
||||
return t('forms', 'New form')
|
||||
},
|
||||
|
||||
validQuestions() {
|
||||
return this.form.questions.filter(question => {
|
||||
// All questions must have a valid title
|
||||
|
|
Loading…
Reference in a new issue