run filter on profile.js

This commit is contained in:
Yaman Qalieh 2016-10-23 15:49:43 -04:00
parent 5cf986e7e1
commit d2dbdb0cd3

View File

@ -50,7 +50,15 @@ Template.profile.helpers({
}, },
selector: (match) => { selector: (match) => {
regex = new RegExp(match, 'i'); regex = new RegExp(match, 'i');
return {$or: [{'name': regex}, {'teacher': regex}, {'hour': regex}]}; return {
$or: [{
'name': regex
}, {
'teacher': regex
}, {
'hour': regex
}]
};
} }
}] }]
}; };
@ -225,7 +233,10 @@ Template.profile.events({
'click #mainpage' () { 'click #mainpage' () {
if (!Meteor.userId() || _.contains([null, undefined, ""], Meteor.user().profile.school)) { if (!Meteor.userId() || _.contains([null, undefined, ""], Meteor.user().profile.school)) {
sAlert.closeAll(); sAlert.closeAll();
sAlert.error('Please fill in your profile!', {effect: 'stackslide', position: 'top'}); sAlert.error('Please fill in your profile!', {
effect: 'stackslide',
position: 'top'
});
} else { } else {
window.location = '/'; window.location = '/';
} }
@ -517,10 +528,12 @@ Template.profile.events({
$("#" + modifyingInput).next() $("#" + modifyingInput).next()
.css('opacity', 0) .css('opacity', 0)
.slideDown(300) .slideDown(300)
.animate( .animate({
{ opacity: 1 }, opacity: 1
{ queue: false, duration: 100 } }, {
); queue: false,
duration: 100
});
}, },
'click .optionText' (event) { // Click each preferences setting. 'click .optionText' (event) { // Click each preferences setting.
var option = event.target.childNodes[0].nodeValue; var option = event.target.childNodes[0].nodeValue;
@ -589,7 +602,9 @@ Template.profile.events({
_id: item.getAttribute("classid") _id: item.getAttribute("classid")
}); });
} }
Session.set("autocompleteDivs", divs.sort(function(a,b){return b.subscribers-a.subscribers})); Session.set("autocompleteDivs", divs.sort(function(a, b) {
return b.subscribers - a.subscribers
}));
} catch (err) {} } catch (err) {}
} }
}); });