-
Notifications
You must be signed in to change notification settings - Fork 112
Inform user if the form is anonymous #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Implement #530 |
src/views/Create.vue
Outdated
| <!-- Check the form's meta information--> | ||
| <p v-if="mandatoryUsed" class="info-mandatory"> | ||
| * {{ t('forms', 'Required questions') }} | ||
| <template v-if="isAnonymous"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey!
There is a cleaner way to do that :)
Could you create a computed like infoMessage that returns those strings based on the isAnonymous/mandatoryUsed directly?
That would keep the template clean 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use v-text to keep the template clean.
b2fb779 to
929c8fc
Compare
src/views/Create.vue
Outdated
| infoMessage() { | ||
| const isMandatoryUsed = this.form.questions.reduce( | ||
| (isUsed, question) => isUsed || question.mandatory | ||
| , false) | ||
| if (isMandatoryUsed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| infoMessage() { | |
| const isMandatoryUsed = this.form.questions.reduce( | |
| (isUsed, question) => isUsed || question.mandatory | |
| , false) | |
| if (isMandatoryUsed) { | |
| isMandatoryUsed() { | |
| return this.form.questions.reduce((isUsed, question) => isUsed || question.mandatory, false) | |
| }, | |
| infoMessage() { | |
| if (this.isMandatoryUsed) { |
src/views/Create.vue
Outdated
| if (isMandatoryUsed) { | ||
| if (this.form.isAnonymous) { | ||
| return t('forms', 'Responses are connected to your Nextcloud account. An asterisk (*) indicates mandatory questions.') | ||
| } else { | ||
| return t('forms', 'Responses are anonymous. An asterisk (*) indicates mandatory questions.') | ||
| } | ||
| } else { | ||
| if (this.form.isAnonymous) { | ||
| return t('forms', 'Responses are connected to your Nextcloud account.') | ||
| } else { | ||
| return t('forms', 'Responses are anonymous.') | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use string combination to avoid making translators write 4 different translations :)
| if (isMandatoryUsed) { | |
| if (this.form.isAnonymous) { | |
| return t('forms', 'Responses are connected to your Nextcloud account. An asterisk (*) indicates mandatory questions.') | |
| } else { | |
| return t('forms', 'Responses are anonymous. An asterisk (*) indicates mandatory questions.') | |
| } | |
| } else { | |
| if (this.form.isAnonymous) { | |
| return t('forms', 'Responses are connected to your Nextcloud account.') | |
| } else { | |
| return t('forms', 'Responses are anonymous.') | |
| } | |
| } | |
| let message = '' | |
| if (this.form.isAnonymous) { | |
| message += t('forms', 'Responses are connected to your Nextcloud account.') | |
| } else { | |
| message += t('forms', 'Responses are anonymous.') | |
| } | |
| if (this.isMandatoryUsed) { | |
| message += ' ' + t('forms', 'An asterisk (*) indicates mandatory questions.') | |
| } | |
| return message |
Also, are you sure about this.form.isAnonymous ?
shouldn't we return Responses are anonymous when it's true instead? Missing a ! ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my mistake. Thanks!!
jotoeri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 💪
Just one small addition to previous comments. ;)
src/views/Create.vue
Outdated
| * {{ t('forms', 'Required questions') }} | ||
| </p> | ||
| <!-- Generate form information message--> | ||
| <p class="info-mandatory" v-text="infoMessage" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename also to info-message? Just for consistency...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good. Let's do it!
Signed-off-by: nienzu <ibqqz0602@gmail.com>
929c8fc to
0f91f85
Compare
jotoeri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 🚀
|
🚀 🎉 |
|
By the way @Nienzu we have a Nextcloud Talk instance for quicker communication among contributors, with channels for e.g. the Forms app, Deck app, Vue team etc. :) If you like we can add you there via the email from your commits? |
|
@jancborchardt |
Fix #530