'use strict';

Template.feed.helpers({
  alerts: function() {
    return alertsCollection.find({status: 'new'}, {sort: {created: -1}});
  }
});

Template.hello.helpers({
  status: function() {
    if (this.status == 'yes') {
      return 'green';
    } else {
      return 'red';
    }
  }
});

var alertsRead = [];

Template.hello.events({
  'click #button .checkmark': function(e, t) {
    e.preventDefault();
    var parentClass = $(e.target).parent().attr('class');
    var reponse = 'read';

    Meteor.call('feedContentResponse', this._id, reponse, function(error, result) {
      console.log(result);
    });
  },

  'click #button .xmark': function(e, t) {
    e.preventDefault();
    var $this = $(e.target);

    $this.parent().parent().next().slideToggle('fast');
  },

  'click .report': function(e, t) {
    e.preventDefault();
    $(e.target).siblings('.details').slideToggle();
    var alertId = this._id;

    if (!!alertsRead.indexOf(alertId)) {
      Meteor.call('feedContentResponse', alertId, 'read', function(error, result) {
        console.log(result);

        alertsRead.push(alertId);
      });
    }
  }
});


@@ -212,13 +212,15 @@
 s ==
+=
  '
-yes
+read
 ') %7B
@@ -368,35 +368,32 @@
 ark': function(e
-, t
 ) %7B%0A    e.preven
@@ -416,18 +416,12 @@
 var 
-parentClas
+$thi
 s = 
@@ -435,31 +435,8 @@
 get)
-.parent().attr('class')
 ;%0A  
@@ -520,68 +520,8 @@
 onse
-, function(error, result) %7B%0A      console.log(result);%0A    %7D
 );%0A 
@@ -553,35 +553,32 @@
 ark': function(e
-, t
 ) %7B%0A    e.preven
@@ -710,19 +710,16 @@
 nction(e
-, t
 ) %7B%0A    
@@ -786,24 +786,53 @@
 deToggle();%0A
+    var $this = $(e.target);%0A
     var aler
@@ -977,38 +977,8 @@
 ) %7B%0A
-        console.log(result);%0A%0A
     

Set correct status to feed cards