Created
April 17, 2015 07:54
-
-
Save CvanRijen/c089a5e41142f46a4355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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