 # Helper functions ###########################
 element_exists = (pattern) ->
   $(pattern).length > 0
+
+debug_json = (json) ->
+  console.debug(JSON.stringify(json, undefined, 2))
+
 
 
 # Return the element representing the given project

      $("#project-page-#{p_id}").replaceWith(html)
      # Re-configure javascript events
      $("#project-page-#{p_id} abbr.timeago").timeago();
      add_click_action_to_test_button()
      )


do_poll = ->
  query  = $('#api-query').data('api-query')
  prefix = $('#path-prefix').data('path-prefix')

  # The page controls polling by setting or not setting
  # the api-query value.
  if query
    $.post(prefix + '/ajax/' + query)
      .done( (data) -> 
        console.debug(JSON.stringify(data, undefined, 2))
        
        # Update activity indicators
        unless $("#server-status").hasClass('fa-signal')


ready = ->
    add_click_to_project_tiles()
    add_click_to_test_buttons()

    $('.project-tile').hover ->
      $(@).toggleClass( 'project-tile-active' )
