       $('.details-title').text event.name
       $('.details-entry').text event.description
       selected_cell.addClass 'selected'
+
+    # hide details if the event's details are already open
     else
       selected_cell.removeClass 'selected'
       $('.details').slideUp 'slow', ->

$ ->
  getEventById = (eventId) ->
    gon.events.find (el) ->
      el.id is eventId

  $('a.link-latest').click ->
    if $('.col-latest').hasClass 'hidden'
      $('.col-latest').removeClass 'hidden'

      $('.col-details').removeClass 'hidden'
      $('.details').slideDown 'slow'

    # update details if details column already is visible
    else if +$('.details').attr('data-event-id') isnt event_id
      $('.city-entry.selected').removeClass 'selected'

