Fix: disable hover event of conformanceCheckFeedback if validationErrors is empty

This commit is contained in:
Aysel Afsar 2016-02-16 12:29:52 -05:00
parent 013c003128
commit 2c65b8c9c6
3 changed files with 26 additions and 9 deletions

View File

@ -132,20 +132,16 @@ Meteor.methods({
// Check if the user actually exists, and if not, stop here
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
console.log(currentUser);
if (!currentUser) {
return;
}
console.log(currentUser);
var lastLoginDate = currentUser.lastLoginDate;
if (!lastLoginDate) {
return false;
}
console.log(lastLoginDate);
lastLoginDate.setDate(lastLoginDate.getDate() + inactivityPeriodDays);
console.log(lastLoginDate);
if (lastLoginDate <= new Date()) {
return true;

View File

@ -1,11 +1,32 @@
Template.conformanceCheckFeedback.helpers({
validationErrors: function() {
// Return validation errors sorted by last added Target
return ValidationErrors.find({}, {
var errors = ValidationErrors.find({}, {
sort: {
prefix: -1,
type: 1
}
});
Template.instance().validationErrors.set(errors.fetch());
return errors;
}
});
Template.conformanceCheckFeedback.events({
'mouseenter #conformanceCheckFeedback': function(e, template) {
if (template.validationErrors.get().length > 0) {
$(e.currentTarget).addClass("conformanceHover");
}
},
'mouseleave #conformanceCheckFeedback': function(e, template) {
var conformanceDiv = e.currentTarget;
if ($(conformanceDiv).hasClass("conformanceHover")) {
$(conformanceDiv).removeClass("conformanceHover");
}
}
});
Template.conformanceCheckFeedback.onCreated(function() {
this.validationErrors = new ReactiveVar([]);
});

View File

@ -13,7 +13,7 @@
margin: 5px
text-align: center
&:hover
overflow: auto
height: 200px
z-index: 200
.conformanceHover
overflow: auto !important
height: 200px !important
z-index: 200