Skip to content
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

Allow inclusion of templates more than once. #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions login_buttons_dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@

var resetPassword = function() {
loginButtonsSession.resetMessages();
var newPassword = document.getElementById('reset-password-new-password').value;
var passwordAgain= document.getElementById('reset-password-new-password-again').value;
var newPassword = Template.instance().find('#reset-password-new-password').value;
var passwordAgain= Template.instance().find('#reset-password-new-password-again').value;
if (!Accounts._loginButtons.validatePassword(newPassword,passwordAgain)){
return;
}
Expand Down Expand Up @@ -119,8 +119,8 @@

var enrollAccount = function() {
loginButtonsSession.resetMessages();
var password = document.getElementById('enroll-account-password').value;
var passwordAgain= document.getElementById('enroll-account-password-again').value;
var password = Template.instance().find('#enroll-account-password').value;
var passwordAgain= Template.instance().find('#enroll-account-password-again').value;
if (!Accounts._loginButtons.validatePassword(password,passwordAgain)){
return;
}
Expand Down Expand Up @@ -230,7 +230,7 @@
service: serviceName
};
_.each(configurationFields(), function(field) {
configuration[field.property] = document.getElementById(
configuration[field.property] = Template.instance().find('#' +
'configure-login-service-dialog-' + field.property).value
.replace(/^\s*|\s*$/g, ""); // trim;
});
Expand Down Expand Up @@ -267,7 +267,7 @@
// Abstraction would make all of this reactive, and simpler.
var updateSaveDisabled = function() {
var anyFieldEmpty = _.any(configurationFields(), function(field) {
return document.getElementById(
return Template.instance().find('#' +
'configure-login-service-dialog-' + field.property).value === '';
});

Expand Down
32 changes: 16 additions & 16 deletions login_buttons_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@

// update new fields with appropriate defaults
if (username !== null) {
document.getElementById('login-username').value = username;
Template.instance().find('#login-username').value = username;
} else if (email !== null) {
document.getElementById('login-email').value = email;
Template.instance().find('#login-email').value = email;
} else if (usernameOrEmail !== null) {
if (usernameOrEmail.indexOf('@') === -1) {
document.getElementById('login-username').value = usernameOrEmail;
Template.instance().find('#login-username').value = usernameOrEmail;
} else {
document.getElementById('login-email').value = usernameOrEmail;
Template.instance().find('#login-email').value = usernameOrEmail;
}
}
}
Expand All @@ -157,10 +157,10 @@

// update new fields with appropriate defaults
if (email !== null){
document.getElementById('forgot-password-email').value = email;
Template.instance().find('#forgot-password-email').value = email;
} else if (usernameOrEmail !== null){
if (usernameOrEmail.indexOf('@') !== -1){
document.getElementById('forgot-password-email').value = usernameOrEmail;
Template.instance().find('#forgot-password-email').value = usernameOrEmail;
}
}
},
Expand All @@ -177,15 +177,15 @@
// force the ui to update so that we have the approprate fields to fill in
Meteor.flush();

if (document.getElementById('login-username')){
document.getElementById('login-username').value = username;
if (Template.instance().find('#login-username')){
Template.instance().find('#login-username').value = username;
}
if (document.getElementById('login-email')){
document.getElementById('login-email').value = email;
if (Template.instance().find('#login-email')){
Template.instance().find('#login-email').value = email;
}
// "login-password" is preserved thanks to the preserve-inputs package
if (document.getElementById('login-username-or-email')){
document.getElementById('login-username-or-email').value = email || username;
if (Template.instance().find('#login-username-or-email')){
Template.instance().find('#login-username-or-email').value = email || username;
}
},
'keypress #login-username, keypress #login-email, keypress #login-username-or-email, keypress #login-password, keypress #login-password-again': function(event) {
Expand Down Expand Up @@ -414,7 +414,7 @@
//

var elementValueById = function(id) {
var element = document.getElementById(id);
var element = Template.instance().find('#' + id);
if (!element){
return null;
} else {
Expand All @@ -425,7 +425,7 @@
var elementValueByIdForRadio = function(fieldIdPrefix, radioOptions) {
var value = null;
for (i in radioOptions) {
var element = document.getElementById(fieldIdPrefix + '-' + radioOptions[i].id);
var element = Template.instance().find('#' + fieldIdPrefix + '-' + radioOptions[i].id);
if (element && element.checked){
value = element.value;
}
Expand All @@ -434,12 +434,12 @@
};

var elementValueByIdForCheckbox = function(id) {
var element = document.getElementById(id);
var element = Template.instance().find('#' + id);
return element.checked;
};

var trimmedElementValueById = function(id) {
var element = document.getElementById(id);
var element = Template.instance().find('#' + id);
if (!element){
return null;
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'ian:accounts-ui-bootstrap-3',
summary: 'Bootstrap-styled accounts-ui with multi-language support.',
version: '1.2.89',
version: '1.2.90',
git: "https://github.com/ianmartorell/meteor-accounts-ui-bootstrap-3"
})

Expand Down