function cookbook_versions_show_more() {
  var cookbook = $(this).attr("data");
  var version_list = $("#" + cookbook + "_versions");
  if (version_list.children().length == 1) {
    return;
  }
  version_list.children('.other_version').show();
  $("#" + cookbook + "_show_all").show();
  $(this).unbind("click");
  $(this).html("&#8211;").attr("title", "hide other versions of " + cookbook);
  $(this).click(cookbook_versions_show_less);
}

function cookbook_versions_show_less() {
  console.log($(this));
  var cookbook = $(this).attr("data");
  var version_list = $("#" + cookbook + "_versions");
  version_list.children('.other_version').hide();
  version_list.children('.all_version').hide();
  $("#" + cookbook + "_show_all").hide();
  $(this).unbind("click");
  $(this).text("+").attr("title", "show other versions of " + cookbook);
  $(this).click(cookbook_versions_show_more);
}

function cookbook_versions_show_all() {
  var self = $(this);
  var cookbook = self.attr("data");
  var version_list = $("#" + cookbook + "_versions");
  var all_versions = version_list.children('.all_version');
  if (all_versions.length > 0) {
    all_versions.show();
    self.hide();
    return;
  }
  var callback = function(data, textStatus, jqXHR) {
    var all_versions = $('<ol/>');
    console.log("got " + data[cookbook].length + " items for " + cookbook);
    for (var i in data[cookbook]) {
      var v = data[cookbook][i];
      klass = "all_version";
      if (i == 0) {
        klass = "latest_version";
      }
      else if (i < 5) {
        klass = "other_version";
      }
      var link = $('<a/>').attr("href", v.url).text(v.version);
      var item = $('<li/>').addClass(klass).append(link);
      all_versions.append(item);
    }
    version_list.html(all_versions.html());
    self.hide();
  }
  $.ajax({
    url : "/cookbooks/" + cookbook + "?num_versions=all",
    dataType: "json",
    success : callback,
    error : function(jqXHR, textStatus, errorThrown) {
      // FIXME
      console.log(textStatus);
    }
  })
}

function fetch_all_versions0(cookbook) {
  $.ajax({
    url : "/cookbooks/" + cookbook,
    dataType: "json",
    success : function(data, textStatus, jqXHR) {
      console.log(data);
    },
    error : function(jqXHR, textStatus, errorThrown) {
      console.log(textStatus);
    }

  })
}

$(document).ready(function() {
  $('td.show_more a').click(cookbook_versions_show_more);
  $('td.show_more a').each(cookbook_versions_show_less);
  $('a.show_all').click(cookbook_versions_show_all);
})


@@ -299,32 +299,56 @@
 nbind(%22click%22);%0A
+  // en-dash == &#8211;%0A
   $(this).html(%22
@@ -402,32 +402,32 @@
  %22 + cookbook);%0A
-
   $(this).click(
@@ -1209,16 +1209,170 @@
 rn;%0A  %7D%0A
+  var spinner = $('%3Cimg/%3E')%0A    .attr(%22src%22, %22/images/indicator.gif%22)%0A    .attr(%22id%22, %22show_all_versions_spinner%22);%0A  self.after(spinner);%0A  self.hide();%0A
   var ca
@@ -1455,84 +1455,8 @@
 ');%0A
-    console.log(%22got %22 + data%5Bcookbook%5D.length + %22 items for %22 + cookbook);%0A
     
@@ -1882,31 +1882,36 @@
 ml());%0A    s
-elf.hid
+pinner.remov
 e();%0A  %7D%0A  $
@@ -2087,337 +2087,42 @@
     
-// FIXME%0A      console.log(textStatus);%0A    %7D%0A  %7D)%0A%7D%0A%0Afunction fetch_all_versions0(cookbook) %7B%0A  $.ajax(%7B%0A    url : %22/cookbooks/%22 + cookbook,%0A    dataType: %22json%22,%0A    success : function(data, textStatus, jqXHR) %7B%0A      console.log(data);%0A    %7D,%0A    error : function(jqXHR, textStatus, errorThrown) %7B%0A      console.log(textStatus
+spinner.remove();%0A      self.show(
 );%0A 
@@ -2126,17 +2126,16 @@
 ;%0A    %7D%0A
-%0A
   %7D)%0A%7D%0A%0A

Add spinner for show all versions and fix error handling