1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Generated by CoffeeScript 1.6.1
(function() {
var back_to_collections, collection_click, collection_list, process_traits;
console.log("before get_traits_from_collection");
collection_click = function() {
var this_collection_url;
console.log("Clicking on:", $(this));
this_collection_url = $(this).find('.collection_name').prop("href");
this_collection_url += "&json";
console.log("this_collection_url", this_collection_url);
return $.ajax({
dataType: "json",
url: this_collection_url,
success: process_traits
});
};
collection_list = null;
process_traits = function(trait_data, textStatus, jqXHR) {
var the_html, trait, _i, _len;
console.log('in process_traits with trait_data:', trait_data);
the_html = "<div id='collections_holder'>";
the_html += "<button id='back_to_collections' class='btn btn-inverse btn-small'>";
the_html += "<i class='icon-white icon-arrow-left'></i> Back </button>";
the_html += "<table class='table table-hover'>";
the_html += "<thead><tr><th>Record</th><th>Description</th><th>Mean</th></tr></thead>";
the_html += "<tbody>";
for (_i = 0, _len = trait_data.length; _i < _len; _i++) {
trait = trait_data[_i];
the_html += "<tr><td>" + trait.name + "</td>";
the_html += "<td>" + trait.description + "</td>";
the_html += "<td>" + (trait.mean || ' ') + "</td></tr>";
}
the_html += "</tbody>";
the_html += "</table>";
the_html += "</div>";
collection_list = $("#collections_holder").html();
$("#collections_holder").replaceWith(the_html);
return $('#collections_holder').colorbox.resize();
};
back_to_collections = function() {
console.log("collection_list:", collection_list);
$("#collections_holder").replaceWith(collection_list);
$("#trait_table").wrap("<div id='collections_holder'></div>");
$(document).on("click", ".collection_line", collection_click);
return $('#collections_holder').colorbox.resize();
};
$(function() {
console.log("inside get_traits_from_collection");
$(document).on("click", ".collection_line", collection_click);
return $(document).on("click", "#back_to_collections", back_to_collections);
});
}).call(this);
|