Remove jQuery from accounts-ui-unstyled & fix typos

This commit is contained in:
StorytellerCZ
2018-05-14 10:39:06 +02:00
parent fa3a7e1629
commit 415e21f445
5 changed files with 25 additions and 27 deletions

View File

@@ -75,7 +75,7 @@ Template._resetPasswordDialog.helpers({
//
Template._justResetPasswordDialog.events({
'click #just-verified-dismiss-button': () =>
'click #just-verified-dismiss-button': () =>
loginButtonsSession.set('justResetPassword', false),
});
@@ -133,7 +133,7 @@ Template._enrollAccountDialog.helpers({
//
Template._justVerifiedEmailDialog.events({
'click #just-verified-dismiss-button': () =>
'click #just-verified-dismiss-button': () =>
loginButtonsSession.set('justVerifiedEmail', false),
});
@@ -148,7 +148,7 @@ Template._justVerifiedEmailDialog.helpers({
//
Template._loginButtonsMessagesDialog.events({
'click #messages-dialog-dismiss-button': () =>
'click #messages-dialog-dismiss-button': () =>
loginButtonsSession.resetMessages(),
});
@@ -192,8 +192,7 @@ Template._configureLoginServiceDialog.events({
);
configuration.loginStyle =
$('#configure-login-service-dialog input[name="loginStyle"]:checked')
.val();
document.querySelector('#configure-login-service-dialog input[name="loginStyle"]:checked').value;
// Configure this login service
Accounts.connection.call(
@@ -253,7 +252,7 @@ Template._configureLoginServiceDialog.helpers({
configurationFields,
visible: () => loginButtonsSession.get('configureLoginServiceDialogVisible'),
// renders the appropriate template
configurationSteps: () =>
configurationSteps: () =>
Template._configureLoginServiceDialog.templateForService(),
saveDisabled: () =>
loginButtonsSession.get('configureLoginServiceDialogSaveDisabled'),

View File

@@ -147,7 +147,7 @@ const changePassword = () => {
if (!matchPasswordAgainIfPresent())
return;
Accounts.changePassword(oldPassword, password, error => {
if (error) {
loginButtonsSession.errorMessage(error.reason || "Unknown error");
@@ -185,12 +185,12 @@ const isInPasswordSignupFields = (fieldOrFields) => {
}
return signupFields.includes(fieldOrFields);
}
};
// events shared between loginButtonsLoggedOutDropdown and
// loginButtonsLoggedInDropdown
Template.loginButtons.events({
'click #login-name-link, click #login-sign-in-link': () =>
'click #login-name-link, click #login-sign-in-link': () =>
loginButtonsSession.set('dropdownVisible', true),
'click .login-close-text': loginButtonsSession.closeDropdown,
});
@@ -377,7 +377,7 @@ Template._loginButtonsLoggedOutPasswordService.helpers({
const loginFields = [
{fieldName: 'username-or-email', fieldLabel: 'Username or Email',
autocomplete: 'username email',
visible: () => isInPasswordSignupFields(
visible: () => isInPasswordSignupFields(
["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL"]
),
},
@@ -402,7 +402,7 @@ Template._loginButtonsLoggedOutPasswordService.helpers({
"USERNAME_ONLY",
]),
},
{fieldName: 'email', fieldLabel: 'Email', inputType: 'email',
{fieldName: 'email', fieldLabel: 'Email', inputType: 'email',
autocomplete: 'email',
visible: () => isInPasswordSignupFields(
["USERNAME_AND_EMAIL", "EMAIL_ONLY"]
@@ -432,8 +432,8 @@ Template._loginButtonsLoggedOutPasswordService.helpers({
inForgotPasswordFlow: () => loginButtonsSession.get('inForgotPasswordFlow'),
inLoginFlow: () =>
!loginButtonsSession.get('inSignupFlow') &&
inLoginFlow: () =>
!loginButtonsSession.get('inSignupFlow') &&
!loginButtonsSession.get('inForgotPasswordFlow'),
inSignupFlow: () => loginButtonsSession.get('inSignupFlow'),
@@ -473,10 +473,10 @@ Template._loginButtonsChangePassword.helpers({
}
return [
// The username and email fields are included here to address an
// accessibility warning in Chrome, but the fields don't actually display.
// The warning states that there should be an optionally hidden
// username/email field on password forms.
// XXX I think we should not use a CSS class here because this is the
// accessibility warning in Chrome, but the fields don't actually display.
// The warning states that there should be an optionally hidden
// username/email field on password forms.
// XXX I think we should not use a CSS class here because this is the
// `unstyled` package. So instead we apply an inline style.
{fieldName: 'username', fieldLabel: 'Username', autocomplete: 'username',
fieldStyle: 'display: none;', fieldValue: username,
@@ -486,7 +486,7 @@ Template._loginButtonsChangePassword.helpers({
"USERNAME_ONLY",
]),
},
{fieldName: 'email', fieldLabel: 'Email', inputType: 'email',
{fieldName: 'email', fieldLabel: 'Email', inputType: 'email',
autocomplete: 'email', fieldStyle: 'display: none;', fieldValue: email,
visible: () => isInPasswordSignupFields(
["USERNAME_AND_EMAIL", "EMAIL_ONLY"]

View File

@@ -55,26 +55,26 @@ const closeDropdown = () => {
set('inMessageOnlyFlow', false);
set('dropdownVisible', false);
resetMessages();
}
};
const infoMessage = message => {
_set("errorMessage", null);
_set("infoMessage", message);
ensureMessageVisible();
}
};
const errorMessage = message => {
_set("errorMessage", message);
_set("infoMessage", null);
ensureMessageVisible();
}
};
// is there a visible dialog that shows messages (info and error)
const isMessageDialogVisible = () => {
return get('resetPasswordToken') ||
get('enrollAccountToken') ||
get('justVerifiedEmail');
}
};
// ensure that somethings displaying a message (info or error) is
// visible. If a dialog with messages is open, do nothing;
@@ -87,12 +87,12 @@ const isMessageDialogVisible = () => {
const ensureMessageVisible = () => {
if (!isMessageDialogVisible())
set("dropdownVisible", true);
}
};
const resetMessages = () => {
_set("errorMessage", null);
_set("infoMessage", null);
}
};
const configureService = name => {
if (Meteor.isCordova) {
@@ -102,7 +102,7 @@ const configureService = name => {
set('configureLoginServiceDialogServiceName', name);
set('configureLoginServiceDialogSaveDisabled', true);
}
}
};
Accounts._loginButtonsSession = {
set,

View File

@@ -11,7 +11,6 @@ Package.onUse(function (api) {
'ecmascript',
'templating@1.2.13',
'session',
'jquery',
], 'client');
// Export Accounts (etc) to packages using this one.

View File

@@ -79,7 +79,7 @@ OAuth._stateFromQuery = query => {
}
};
OAuth._loginStyleFromQuery = quer => {
OAuth._loginStyleFromQuery = query => {
let style;
// For backwards-compatibility for older clients, catch any errors
// that result from parsing the state parameter. If we can't parse it,