Points = new Meteor.Collection("points");

if (Meteor.isClient) {

  Template.points.pointsAll = function() {
    return Points.find({});
  };

  Template.actuators.actuatorsAll = function() {
    // only returns points that have ActuatorPath
    return Points.find({"ActuatorUUID": {"$exists": true} })
  };

  Template.actuator_display.rendered = function() {
    var uuid = this.data.ActuatorUUID;
    Meteor.call('tags', uuid, function(err, res) {
      if (err) {
        console.log(err);
      }
      Session.set(res[0].uuid, res[0].Actuate.Model);
    });
  };

  Template.actuator_display.type = function() {
    return Session.get(this.ActuatorUUID) || "none";
  };

  // functions to help determine type of actuator based on Actuate.Model from sMAP metadata
  Template.actuator_display.helpers({
    isDiscrete: function(template) {
      return Session.get(this.ActuatorUUID) === "discrete";
    },
    isBinary: function(template) {
      return Session.get(this.ActuatorUUID) === "binary";
    },
    isContinuous: function(template) {
      return Session.get(this.ActuatorUUID) === "continuous";
    }
  });

  Template.actuator_continuous.rendered = function() {
    if (Meteor.isClient) {
      //TODO: write methods to get min/max from the sMAP metadata and use that o create the slider
      console.log(this.data.ActuatorUUID);
      $("#"+this.data.ActuatorUUID).slider({
      });
    }
  };


  Template.navbar.helpers({
    activeIf: function (template) {
      var currentRoute = Router.current();
      return currentRoute &&
        template === currentRoute.lookupTemplate() ? 'active' : '';
    }
  });

  Template.home.greeting = function () {
    return "Welcome to openbas.";
  };

  Template.home.events({
    'click input': function () {
      // template data, if any, is available in 'this'
      if (typeof console !== 'undefined')
        console.log("You pressed the button");
    }
  });
}

if (Meteor.isServer) {
}

@@ -60,16 +60,355 @@
 ent) %7B%0A%0A
+  var actuators = %7B%7D;%0A  var actuatorsDep = new Deps.Dependency;%0A%0A  var getActuators = function(act_uuid) %7B%0A    actuatorsDep.depend();%0A    return actuators%5Bact_uuid%5D %7C%7C %7B%22Actuate%22: %7B%22Model%22: %7B%7D, %22States%22: %5B0,1000%5D%7D%7D;%0A  %7D;%0A%0A  var updateActuators = function(act_uuid, data) %7B%0A    actuators%5Bact_uuid%5D = data;%0A    actuatorsDep.changed();%0A  %7D;%0A%0A
   Templa
@@ -845,19 +845,23 @@
     
-Session.set
+updateActuators
 (res
@@ -880,22 +880,8 @@
 s%5B0%5D
-.Actuate.Model
 );%0A 
@@ -948,35 +948,36 @@
 %0A    return 
-Session.get
+getActuators
 (this.Actuat
@@ -983,16 +983,30 @@
 torUUID)
+.Actuate.Model
  %7C%7C %22non
@@ -1191,35 +1191,36 @@
      return 
-Session.get
+getActuators
 (this.Actuat
@@ -1222,24 +1222,38 @@
 ctuatorUUID)
+.Actuate.Model
  === %22discre
@@ -1308,35 +1308,36 @@
      return 
-Session.get
+getActuators
 (this.Actuat
@@ -1339,24 +1339,38 @@
 ctuatorUUID)
+.Actuate.Model
  === %22binary
@@ -1435,19 +1435,20 @@
 urn 
-Session.get
+getActuators
 (thi
@@ -1462,16 +1462,30 @@
 torUUID)
+.Actuate.Model
  === %22co

use deps to handle retrieving data from backend