From bc8aadff7c8b10f099aaf73c1610bf60aeccefc1 Mon Sep 17 00:00:00 2001 From: Geoff Schmidt Date: Fri, 10 Aug 2012 03:38:06 -0700 Subject: [PATCH] demo: disable remove button when no selection --- examples/landmark-demo/client/landmark-demo.js | 9 ++++++++- examples/landmark-demo/landmark-demo.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/landmark-demo/client/landmark-demo.js b/examples/landmark-demo/client/landmark-demo.js index 54f5c4b058..7c8a4c7edd 100644 --- a/examples/landmark-demo/client/landmark-demo.js +++ b/examples/landmark-demo/client/landmark-demo.js @@ -180,8 +180,10 @@ Template.circles.events = { }, 'click .remove': function () { var selected = Session.get("selectedCircle:" + this.group); - if (selected) + if (selected) { Circles.remove(selected); + Session.set("selectedCircle:" + this.group, null); + } }, 'click .scram': function () { Circles.find({group: this.group}).forEach(function (r) { @@ -207,6 +209,11 @@ Template.circles.count = function () { return Circles.find({group: this.group}).count(); }; +Template.circles.disabled = function () { + return Session.get("selectedCircle:" + this.group) ? + '' : 'disabled="disabled"'; +}; + Template.circles.render = function (template) { var self = this; self.node = template.find("svg"); diff --git a/examples/landmark-demo/landmark-demo.html b/examples/landmark-demo/landmark-demo.html index f83a8977e3..2673c0f9bf 100644 --- a/examples/landmark-demo/landmark-demo.html +++ b/examples/landmark-demo/landmark-demo.html @@ -81,7 +81,7 @@
{{count}} circles
- +