 $ ->
+
+  # Adds to each compute button a callback event
+  initializeButtons = () ->
+    for metric in gon.metrics
+      repository = gon.repository.name
+      $(".compute-metric.#{metric}").click createRequestCallback(repository, metric)
 
   # Create the callback used for the metric button click handler
   createRequestCallback = (repository, metric) ->

          return true
    return false

  initializeButtons = () ->
    for metric in gon.metrics
      repository = gon.repository.name
      $(".compute-metric.#{metric}").click createRequestCallback(repository, metric)

  if gon? and gon.repository? and gon.metrics?

    # activate repository selector
    $('.dropdown-toggle').dropdown()
    initializeButtons()

      type = job.state
    return type

  # Fills a defined progress bar up to the given percent
  fillProgressBar = (repository, metric, type, percent) ->
    progressClass = '.admin.control.progress'
    repositoryId = repository.split('.').join('-')
    barDiv = $("#{progressClass} .#{repositoryId}.#{metric}.#{type}.bar")
    barDiv.css('width', "#{percent}%")

  # Determines whether the request for the job progress should
  # be repeated
  repeatRequest = (response) ->
    for repository, metrics of response
      for metric, job of metrics
