From ae6838dce4be4be8a1447da7bccbc063687d9cf5 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Sat, 13 Oct 2012 23:02:07 -0700 Subject: [PATCH] parties: can create private parties --- examples/parties/client/client.js | 6 +++++- examples/parties/model.js | 2 +- examples/parties/parties.html | 1 + examples/parties/server/server.js | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/parties/client/client.js b/examples/parties/client/client.js index 0d769eda72..976eeadb44 100644 --- a/examples/parties/client/client.js +++ b/examples/parties/client/client.js @@ -209,6 +209,7 @@ Template.createDialog.events = { 'click .save': function (event, template) { var title = template.find(".title").value; var description = template.find(".description").value; + var public = !template.find(".private").checked; if (title.length && description.length) { var coords = Session.get("createCoords"); @@ -217,7 +218,10 @@ Template.createDialog.events = { description: description, x: coords.x, y: coords.y, - public: true // XXX + public: public + }, function(error, party) { + if (!error) + Session.set("selected", party); }); Session.set("showCreateDialog", false); } else { diff --git a/examples/parties/model.js b/examples/parties/model.js index 8201683855..de1de30fbd 100644 --- a/examples/parties/model.js +++ b/examples/parties/model.js @@ -57,7 +57,7 @@ Meteor.methods({ if (! this.userId) throw new Meteor.Error(403, "You must be logged in"); - Parties.insert({ + return Parties.insert({ owner: this.userId, x: options.x, y: options.y, diff --git a/examples/parties/parties.html b/examples/parties/parties.html index 4504d733ca..fdf16ac70c 100644 --- a/examples/parties/parties.html +++ b/examples/parties/parties.html @@ -35,6 +35,7 @@ Title:
Description

+ Private party?
diff --git a/examples/parties/server/server.js b/examples/parties/server/server.js index 1696593e56..f63019f80d 100644 --- a/examples/parties/server/server.js +++ b/examples/parties/server/server.js @@ -7,5 +7,5 @@ Meteor.publish("directory", function () { Meteor.publish("parties", function () { return Parties.find( - {$or: [{"public": true}, {canSee: this.userId}]}); + {$or: [{"public": true}, {canSee: this.userId}, {owner: this.userId}]}); });