Skip to content

Conversation

@Nienzu
Copy link
Member

@Nienzu Nienzu commented Oct 12, 2020

Fix #530

@Nienzu
Copy link
Member Author

Nienzu commented Oct 12, 2020

Implement #530

<!-- Check the form's meta information-->
<p v-if="mandatoryUsed" class="info-mandatory">
* {{ t('forms', 'Required questions') }}
<template v-if="isAnonymous">
Copy link
Member

@skjnldsv skjnldsv Oct 12, 2020

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 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion!

Copy link
Member Author

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.

@skjnldsv skjnldsv added 2. developing Work in progress enhancement New feature or request labels Oct 12, 2020
@skjnldsv skjnldsv added this to the 2.1 milestone Oct 12, 2020
@Nienzu Nienzu force-pushed the inform_user_anonymous branch from b2fb779 to 929c8fc Compare October 12, 2020 10:14
Comment on lines 198 to 202
infoMessage() {
const isMandatoryUsed = this.form.questions.reduce(
(isUsed, question) => isUsed || question.mandatory
, false)
if (isMandatoryUsed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {

Comment on lines 202 to 211
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.')
}
}
Copy link
Member

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 :)

Suggested change
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 ! ?

Copy link
Member Author

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!!

Copy link
Member

@jotoeri jotoeri left a 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. ;)

* {{ t('forms', 'Required questions') }}
</p>
<!-- Generate form information message-->
<p class="info-mandatory" v-text="infoMessage" />
Copy link
Member

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...

Copy link
Member Author

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>
@Nienzu Nienzu force-pushed the inform_user_anonymous branch from 929c8fc to 0f91f85 Compare October 13, 2020 02:15
@Nienzu Nienzu requested review from jotoeri and skjnldsv October 13, 2020 02:51
Copy link
Member

@jotoeri jotoeri left a 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 👍 🚀

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 2. developing Work in progress labels Oct 13, 2020
@skjnldsv skjnldsv merged commit 8efb024 into nextcloud:master Oct 13, 2020
@skjnldsv
Copy link
Member

🚀 🎉

@jancborchardt
Copy link
Member

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?

@Nienzu
Copy link
Member Author

Nienzu commented Oct 14, 2020

@jancborchardt
Yes, it sounds cool~Thanks for your invitation : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inform user: Is it anonymous?

4 participants