aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2016-06-16 08:48:30 +0000
committerPjotr Prins2016-06-16 08:48:30 +0000
commit79e820cb5c3257eb880a6260357a45b127f15496 (patch)
treea581f6a650b2c99a1a17ee2dda58d7c39827e646
parent9cc28585801de015f24ca7b596e20893383717e9 (diff)
downloadgenenetwork2-79e820cb5c3257eb880a6260357a45b127f15496.tar.gz
Menu: removing outdated .coffee file and comments
-rwxr-xr-xwqflask/wqflask/static/new/javascript/dataset_select_menu.coffee129
-rw-r--r--wqflask/wqflask/static/new/javascript/dataset_select_menu.js14
2 files changed, 3 insertions, 140 deletions
diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee b/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee
deleted file mode 100755
index 83264da3..00000000
--- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.coffee
+++ /dev/null
@@ -1,129 +0,0 @@
-$ ->
-
- ## Handle menu changes
-
- process_json = (data) ->
- window.jdata = data
- populate_species()
- apply_default()
-
- $.ajax '/static/new/javascript/dataset_menu_structure.json',
- dataType: 'json'
- success: process_json
-
- populate_species = ->
- species_list = @jdata.species
- redo_dropdown($('#species'), species_list)
- populate_group()
- window.populate_species = populate_species
-
- populate_group = ->
- console.log("in populate group")
- species = $('#species').val()
- group_list = @jdata.groups[species]
- redo_dropdown($('#group'), group_list)
- populate_type()
- window.populate_group = populate_group
-
- populate_type = ->
- species = $('#species').val()
- group = $('#group').val()
- type_list = @jdata.types[species][group]
- redo_dropdown($('#type'), type_list)
- populate_dataset()
- window.populate_type = populate_type
-
- populate_dataset = ->
- species = $('#species').val()
- group = $('#group').val()
- type = $('#type').val()
- console.log("sgt:", species, group, type)
- dataset_list = @jdata.datasets[species][group][type]
- console.log("pop_dataset:", dataset_list)
- redo_dropdown($('#dataset'), dataset_list)
- window.populate_dataset = populate_dataset
-
- redo_dropdown = (dropdown, items) ->
- console.log("in redo:", dropdown, items)
- dropdown.empty()
- for item in items
- dropdown.append($("<option />").val(item[0]).text(item[1]))
-
- $('#species').change =>
- populate_group()
-
- $('#group').change =>
- populate_type()
-
- $('#type').change =>
- populate_dataset()
-
- ## Info buttons
-
- open_window = (url, name) ->
- options = "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"
- open(url, name, options).focus()
-
- # Link to info on selected group; use of "Cross"
- # in the url is outdated and should be changed to group
- group_info = ->
- species = $('#species').val()
- group = $('#group').val()
- url = "/" + species + "Cross.html#" + group
- open_window(url, "Group Info")
-
- $('#group_info').click(group_info)
-
- # Link to dataset info
- dataset_info = ->
- dataset = $('#dataset').val()
- url = "/webqtl/main.py?FormID=sharinginfo&InfoPageName=" + dataset
- open_window(url, "Dataset Info")
-
- $('#dataset_info').click(dataset_info)
-
-
- ## Handle setting new default drop downs
-
- make_default = ->
- holder = {}
- for item in ['species', 'group', 'type', 'dataset']
- holder[item] = $("##{item}").val()
- jholder = JSON.stringify(holder)
- $.cookie('search_defaults', jholder,
- expires: 365)
-
- apply_default = ->
- defaults = $.cookie('search_defaults')
- if defaults
- # defaults are stored as a JSON string in a cookie
- defaults = $.parseJSON(defaults)
- else
- # If user hasn't set a default we use this
- # (Most of GN's data is from BXD mice)
- defaults =
- species: "mouse"
- group: "BXD"
- type: "Hippocampus mRNA"
- dataset: "HC_M2_0606_P"
-
- for item in [['species', 'group']
- ['group', 'type']
- ['type', 'dataset'],
- ['dataset', null]]
- $("##{item[0]}").val(defaults[item[0]])
-
- if item[1]
- populate_function = "populate_" + item[1]
- console.log("Calling:", populate_function)
- window[populate_function]()
-
- check_search_term = ->
- search_term = $('#tfor').val()
- console.log("search_term:", search_term)
- if (search_term == "")
- alert("Please enter one or more search terms or search equations.")
- return false
-
- $("#make_default").click(make_default)
- $("#btsearch").click(check_search_term) \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
index dcf1ae6f..d4110e11 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
+++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
@@ -1,14 +1,9 @@
-// Generated by CoffeeScript 1.8.0
$(function() {
var gndata; // loaded once for all to use
process_json = function(data) {
populate_species();
return apply_default();
};
- // $.ajax('/static/new/javascript/dataset_menu_structure.json', {
- // dataType: 'json',
- // success: process_json
- // });
$.getJSON("http://localhost:8880/int/menu/main.json",
function(data) {
gndata = data;
@@ -21,8 +16,8 @@ $(function() {
});
var populate_species = function() {
- var species_list = Object.keys(gndata.types).map(function(species) {
- var mitem = gndata.types[species][0]
+ var species_list = Object.keys(gndata.menu).map(function(species) {
+ var mitem = gndata.menu[species].menu
// console.log("Species menu:",species,mitem)
return [species,mitem];
});
@@ -45,10 +40,7 @@ $(function() {
var populate_type = function() {
var species = $('#species').val();
var group = $('#group').val();
- // var type_list = gndata.types[species][group].map(function(item) {
- // return [item[1],item[1]];
- //})
- var type_list = gndata.types[species][1][group].map(function(item) {
+ var type_list = gndata.menu[species].types[group].map(function(item) {
return [item,item];
});