From 7f91c87c21e32ccd36ea73607c4038016684a5e5 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 21 Jun 2016 10:50:00 +0000 Subject: Menu: re-introduce old menu --- .../new/javascript/dataset_select_menu_orig.js | 156 +++++++++++ wqflask/wqflask/templates/index_page_orig.html | 285 +++++++++++++++++++++ 2 files changed, 441 insertions(+) create mode 100644 wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js create mode 100755 wqflask/wqflask/templates/index_page_orig.html diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js new file mode 100644 index 00000000..1fe4cf75 --- /dev/null +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -0,0 +1,156 @@ +// Generated by CoffeeScript 1.8.0 +$(function() { + var apply_default, check_search_term, dataset_info, group_info, make_default, open_window, populate_dataset, populate_group, populate_species, populate_type, process_json, redo_dropdown; + process_json = function(data) { + window.jdata = data; + populate_species(); + return apply_default(); + }; + $.ajax('/static/new/javascript/dataset_menu_structure.json', { + dataType: 'json', + success: process_json + }); + populate_species = function() { + var species_list; + species_list = this.jdata.species; + redo_dropdown($('#species'), species_list); + return populate_group(); + }; + window.populate_species = populate_species; + 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(); + }; + window.populate_group = populate_group; + populate_type = function() { + var group, species, type_list; + console.log("in populate type"); + species = $('#species').val(); + group = $('#group').val(); + type_list = this.jdata.types[species][group]; + redo_dropdown($('#type'), type_list); + return populate_dataset(); + }; + window.populate_type = populate_type; + populate_dataset = function() { + var dataset_list, group, species, type; + console.log("in populate dataset"); + 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); + }; + window.populate_dataset = populate_dataset; + 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]; + if (item.length > 2){ + _results.push(dropdown.append($("