   #--------------------------------------------
 
   $scope.read_entry = (entry)->
-    alert 'test'
+    if $rootScope.open_entry == entry
+      # User is closing the open entry, do nothing
+      alert "closing #{entry.title}"
+      unset_open_entry()
+    else
+      set_open_entry entry
+      if !entry.read
+        # User is opening an unread entry
+        alert "reading #{entry.title}"
+      else
+        # User is opening a read entry
+        alert "opening read #{entry.title}"
+
+    alert $rootScope.open_entry.id
 
   #--------------------------------------------
   # Load a feed's entries

  #--------------------------------------------

  set_current_feed = (feed)->
    $rootScope.current_feed = feed

  #--------------------------------------------

  #--------------------------------------------

  $scope.refresh_feed = ->
    unset_open_entry()
    $scope.loading_entries = true

    $http.put("/feeds/#{$rootScope.current_feed.id}.json")
