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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
// Generated by CoffeeScript 1.3.3
(function() {
$(function() {
var apply_default, dataset_info, group_info, make_default, open_window, populate_dataset, populate_group, populate_species, populate_type, process_json, redo_dropdown,
_this = this;
process_json = function(data) {
window.jdata = data;
populate_species();
return apply_default();
};
$.ajax('/static/new/javascript/dataset_menu_structure', {
dataType: 'json',
success: process_json
});
populate_species = function() {
var species_list;
species_list = this.jdata.species;
redo_dropdown($('#species'), species_list);
return populate_group();
};
populate_group = function() {
var group_list, species;
console.log("in populate group");
species = $('#species').val();
group_list = this.jdata.groups[species];
redo_dropdown($('#group'), group_list);
return populate_type();
};
populate_type = function() {
var group, species, type_list;
species = $('#species').val();
group = $('#group').val();
type_list = this.jdata.types[species][group];
redo_dropdown($('#type'), type_list);
return populate_dataset();
};
populate_dataset = function() {
var dataset_list, group, species, type;
species = $('#species').val();
group = $('#group').val();
type = $('#type').val();
console.log("sgt:", species, group, type);
dataset_list = this.jdata.datasets[species][group][type];
console.log("pop_dataset:", dataset_list);
return redo_dropdown($('#dataset'), dataset_list);
};
redo_dropdown = function(dropdown, items) {
var item, _i, _len, _results;
console.log("in redo:", dropdown, items);
dropdown.empty();
_results = [];
for (_i = 0, _len = items.length; _i < _len; _i++) {
item = items[_i];
_results.push(dropdown.append($("<option />").val(item[0]).text(item[1])));
}
return _results;
};
$('#species').change(function() {
return populate_group();
});
$('#group').change(function() {
return populate_type();
});
$('#type').change(function() {
return populate_dataset();
});
open_window = function(url, name) {
var options;
options = "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900";
return open(url, name, options).focus();
};
group_info = function() {
var group, species, url;
species = $('#species').val();
group = $('#group').val();
url = "/" + species + "Cross.html#" + group;
return open_window(url, "Group Info");
};
$('#group_info').click(group_info);
dataset_info = function() {
var dataset, url;
dataset = $('#dataset').val();
url = "/webqtl/main.py?FormID=sharinginfo&InfoPageName=" + dataset;
return open_window(url, "Dataset Info");
};
$('#dataset_info').click(dataset_info);
make_default = function() {
var holder, item, jholder, _i, _len, _ref;
holder = {};
_ref = ['species', 'group', 'type', 'dataset'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
holder[item] = $("#" + item).val();
}
jholder = JSON.stringify(holder);
return $.cookie('search_defaults', jholder, {
expires: 365
});
};
apply_default = function() {
var defaults, item, _i, _len, _ref, _results;
defaults = $.cookie('search_defaults');
if (!defaults) {
return;
}
defaults = $.parseJSON(defaults);
_ref = [['species', 'group'], ['group', 'type'], ['type', 'dataset'], ['dataset', null]];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
$("#" + item[0]).val(defaults[item[0]]);
if (item[1]) {
_results.push(window["populate_" + item[1]]);
} else {
_results.push(void 0);
}
}
return _results;
};
return $("#make_default").click(make_default);
});
}).call(this);
|