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

View File

@ -1,11 +1,32 @@
Template.conformanceCheckFeedback.helpers({ Template.conformanceCheckFeedback.helpers({
validationErrors: function() { validationErrors: function() {
// Return validation errors sorted by last added Target // Return validation errors sorted by last added Target
return ValidationErrors.find({}, { var errors = ValidationErrors.find({}, {
sort: { sort: {
prefix: -1, prefix: -1,
type: 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 margin: 5px
text-align: center text-align: center
&:hover .conformanceHover
overflow: auto overflow: auto !important
height: 200px height: 200px !important
z-index: 200 z-index: 200