Skip to content

Instantly share code, notes, and snippets.

@CvanRijen
Created April 17, 2015 07:54
Show Gist options
  • Select an option

  • Save CvanRijen/c089a5e41142f46a4355 to your computer and use it in GitHub Desktop.

Select an option

Save CvanRijen/c089a5e41142f46a4355 to your computer and use it in GitHub Desktop.
Template.categorySelected.onCreated(function () {
var instance = this;
instance.autorun(function () {
instance.subscribe('packages', Router.current().params.category_slug)
});
instance.packages = function () {
return Packages.find({}, {sort: {"GitHub.subscribers_count": -1, "GitHub.stargazers_count": -1}})
};
});
Template.categorySelected.onRendered(function () {
var instance = this;
var $container = $('#container2').isotope({
itemSelector: '.item2',
getSortData: {
watchers: '.watchers parseInt',
stars: '.stars parseInt',
forks: '.forks parseInt'
}
});
instance.autorun(function () {
if (instance.subscriptionsReady()) {
Meteor.setTimeout(function () {
$container.isotope('reloadItems');
$container.isotope({
sortBy: [ 'watchers', 'stars', 'forks' ],
sortAscending: false
});
Meteor.setTimeout(function () {
$('.item2').css('opacity', 1);
}, 50);
}, 100);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment