Name: madewith
Owner: Meteor
Description: null
Created: 2012-04-17 02:17:46.0
Updated: 2016-02-07 15:40:19.0
Pushed: 2013-08-03 01:27:27.0
Size: 176
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
or.startup(function() {
each(['madewith_apps', 'madewith_comments'], function(collection) {
_.each(['insert', 'update', 'remove'], function(method) {
Meteor.default_server.method_handlers['/' + collection + '/' + method] = function() {};
});
;
or.methods({
...
te: function(hostname) {
// if the app doesn't already have a vote in this minute,
// increment vote_count and mark this minute in the votes array.
// minutes since epoch
var vote_ts = Math.floor((new Date()).getTime() / 1000 / 60);
if (Meteor.isClient) {
Apps.update({name: hostname},
{$inc: {vote_count: 1}, $addToSet: {votes: vote_ts}});
} else {
Apps.update({name: hostname, votes: {$ne: vote_ts}},
{$inc: {vote_count: 1}, $addToSet: {votes: vote_ts}});
}
...
Meteor.isServer) {
teor.publish("allApps", function() {
return Apps.find({}, {fields: {pw_sha: 0, votes: 0}});
;
...
late.madewith.events({
lick .madewith_upvote': function(event) {
var app = apps.findOne();
if (app) {
server.call('vote', hostname);
// ...
}