DEV: Add computed property to Create Account modal (#10455)

Carry over the regime used in the Login modal to Create Account to
facilitate overriding of the classes set for the d-modal Component
using a new Computed Property having the same naming convention.
This commit is contained in:
Robert 2020-08-17 12:31:41 +01:00 committed by GitHub
parent 872ef82f4d
commit c164e9bbe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,14 @@ export default Controller.extend(
return false;
},
@discourseComputed("userFields", "hasAtLeastOneLoginButton")
modalBodyClasses(userFields, hasAtLeastOneLoginButton) {
const classes = [];
if (userFields) classes.push("has-user-fields");
if (hasAtLeastOneLoginButton) classes.push("has-alt-auth");
return classes.join(" ");
},
@discourseComputed("authOptions", "authOptions.can_edit_username")
usernameDisabled(authOptions, canEditUsername) {
return authOptions && !canEditUsername;

View File

@ -1,7 +1,7 @@
{{#create-account email=accountEmail disabled=submitDisabled action=(action "createAccount")}}
{{#unless complete}}
{{plugin-outlet name="create-account-before-modal-body"}}
{{#d-modal-body title="create_account.title" class=(concat (if hasAtLeastOneLoginButton "has-alt-auth") " " (if userFields "has-user-fields"))}}
{{#d-modal-body title="create_account.title" class=modalBodyClasses}}
{{#unless hasAuthOptions}}
{{login-buttons externalLogin=(action "externalLogin")}}