fix: fix description is required for communities

This commit is contained in:
Jonathan Rainville 2021-03-03 13:50:56 -05:00 committed by Iuri Matias
parent d1c6c0f9a9
commit a09dd25506
1 changed files with 9 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import "../../../../shared/status"
ModalPopup {
readonly property int maxDescChars: 140
property string nameValidationError: ""
property string descriptionValidationError: ""
property string colorValidationError: ""
property string selectedImageValidationError: ""
property string selectedImage: ""
@ -39,6 +40,7 @@ ModalPopup {
nameValidationError = ""
colorValidationError = ""
selectedImageValidationError = ""
descriptionValidationError = ""
if (nameInput.text === "") {
//% "You need to enter a name"
@ -51,6 +53,10 @@ ModalPopup {
nameValidationError = qsTrId("your-name-needs-to-be-100-characters-or-shorter")
}
if (descriptionTextArea.text === "") {
descriptionValidationError = qsTr("You need to enter a description")
}
if (selectedImage === "") {
//% "You need to select an image"
selectedImageValidationError = qsTrId("you-need-to-select-an-image")
@ -62,7 +68,7 @@ ModalPopup {
colorValidationError = qsTr("This field needs to be an hexadecimal color (eg: #4360DF)")
}
return !nameValidationError && !descriptionTextArea.validationError && !colorValidationError
return !nameValidationError && !descriptionTextArea.validationError && !colorValidationError && !descriptionValidationError
}
title: isEdit ?
@ -110,7 +116,8 @@ ModalPopup {
//% "What your community is about"
placeholderText: qsTrId("what-your-community-is-about")
//% "The description cannot exceed 140 characters"
validationError: descriptionTextArea.text.length > maxDescChars ? qsTrId("the-description-cannot-exceed-140-characters") : ""
validationError: descriptionTextArea.text.length > maxDescChars ? qsTrId("the-description-cannot-exceed-140-characters") :
popup.descriptionValidationError || ""
anchors.top: nameInput.bottom
anchors.topMargin: Style.current.bigPadding
customHeight: 88