diff options
author | Artem Tarasov | 2015-07-02 16:24:02 +0300 |
---|---|---|
committer | Artem Tarasov | 2015-07-02 16:24:02 +0300 |
commit | 31b793033e9d2065b6ccfa47484ce1237b641dfb (patch) | |
tree | d06b664342fdb44df34272cd01aac7d27478c6f6 /wqflask | |
parent | f54165c5979d2e8cb10948abd027574c815a3e1c (diff) | |
download | genenetwork2-31b793033e9d2065b6ccfa47484ce1237b641dfb.tar.gz |
fix #80
Diffstat (limited to 'wqflask')
4 files changed, 56 insertions, 73 deletions
diff --git a/wqflask/wqflask/static/new/javascript/create_lodchart.coffee b/wqflask/wqflask/static/new/javascript/create_lodchart.coffee index df176f52..472ec12d 100644 --- a/wqflask/wqflask/static/new/javascript/create_lodchart.coffee +++ b/wqflask/wqflask/static/new/javascript/create_lodchart.coffee @@ -52,41 +52,3 @@ $ -> #window.setTimeout(create_lod_chart(), 1000) root.create_lod_chart = create_lod_chart -$("#export").click => - #Get d3 SVG element - svg = $("#topchart").find("svg")[0] - - #Extract SVG text string - svg_xml = (new XMLSerializer).serializeToString(svg) - console.log("svg_xml:", svg_xml) - - #Set filename - filename = "manhattan_plot_" + js_data.this_trait - - #Make a form with the SVG data - form = $("#exportform") - form.find("#data").val(svg_xml) - form.find("#filename").val(filename) - form.submit() - -$("#export_pdf").click => - - #$('#topchart').remove() - #$('#chart_container').append('<div class="qtlcharts" id="topchart"></div>') - #create_interval_map() - - #Get d3 SVG element - svg = $("#topchart").find("svg")[0] - - #Extract SVG text string - svg_xml = (new XMLSerializer).serializeToString(svg) - console.log("svg_xml:", svg_xml) - - #Set filename - filename = "manhattan_plot_" + js_data.this_trait - - #Make a form with the SVG data - form = $("#exportpdfform") - form.find("#data").val(svg_xml) - form.find("#filename").val(filename) - form.submit() diff --git a/wqflask/wqflask/static/new/javascript/create_lodchart.js b/wqflask/wqflask/static/new/javascript/create_lodchart.js index a7cea8a5..2537e9e2 100644 --- a/wqflask/wqflask/static/new/javascript/create_lodchart.js +++ b/wqflask/wqflask/static/new/javascript/create_lodchart.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.2 (function() { var create_lod_chart; @@ -43,34 +43,8 @@ }); }; - root.create_lod_chart = create_lod_chart; - - $("#export").click((function(_this) { - return function() { - var filename, form, svg, svg_xml; - svg = $("#topchart").find("svg")[0]; - svg_xml = (new XMLSerializer).serializeToString(svg); - console.log("svg_xml:", svg_xml); - filename = "manhattan_plot_" + js_data.this_trait; - form = $("#exportform"); - form.find("#data").val(svg_xml); - form.find("#filename").val(filename); - return form.submit(); - }; - })(this)); - - $("#export_pdf").click((function(_this) { - return function() { - var filename, form, svg, svg_xml; - svg = $("#topchart").find("svg")[0]; - svg_xml = (new XMLSerializer).serializeToString(svg); - console.log("svg_xml:", svg_xml); - filename = "manhattan_plot_" + js_data.this_trait; - form = $("#exportpdfform"); - form.find("#data").val(svg_xml); - form.find("#filename").val(filename); - return form.submit(); - }; - })(this)); + $(function() { + return root.create_lod_chart = create_lod_chart; + }); }).call(this); diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee index 211fedae..16ca1886 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee @@ -87,8 +87,30 @@ open_mapping_results = (data) -> href: "#mapping_results_holder" height: "90%" width: "90%" - onComplete: => root.create_lod_chart() - ) + onComplete: => + root.create_lod_chart() + + #Set filename + filename = "lod_chart_" + js_data.this_trait + + getSvgXml = -> + svg = $("#topchart").find("svg")[0] + (new XMLSerializer).serializeToString(svg) + + $("#exportform > #export").click => + svg_xml = getSvgXml() + form = $("#exportform") + form.find("#data").val(svg_xml) + form.find("#filename").val(filename) + form.submit() + + $("#exportpdfform > #export_pdf").click => + svg_xml = getSvgXml() + form = $("#exportpdfform") + form.find("#data").val(svg_xml) + form.find("#filename").val(filename) + form.submit() + ) showalert = (message,alerttype) -> $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>') diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index 259e4685..d6f4ba89 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -79,6 +79,7 @@ do_ajax_post = function(url, form_data) { console.log(xhr); clearInterval(_this.my_timer); $('#progress_bar_container').modal('hide'); + $('#static_progress_bar_container').modal('hide'); return $("body").html("We got an error."); }; })(this), @@ -86,6 +87,7 @@ do_ajax_post = function(url, form_data) { return function(data) { clearInterval(_this.my_timer); $('#progress_bar_container').modal('hide'); + $('#static_progress_bar_container').modal('hide'); return open_mapping_results(data); }; })(this) @@ -103,14 +105,37 @@ open_mapping_results = function(data) { width: "90%", onComplete: (function(_this) { return function() { - return root.create_lod_chart(); + var filename, getSvgXml; + root.create_lod_chart(); + filename = "lod_chart_" + js_data.this_trait; + getSvgXml = function() { + var svg; + svg = $("#topchart").find("svg")[0]; + return (new XMLSerializer).serializeToString(svg); + }; + $("#exportform > #export").click(function() { + var form, svg_xml; + svg_xml = getSvgXml(); + form = $("#exportform"); + form.find("#data").val(svg_xml); + form.find("#filename").val(filename); + return form.submit(); + }); + return $("#exportpdfform > #export_pdf").click(function() { + var form, svg_xml; + svg_xml = getSvgXml(); + form = $("#exportpdfform"); + form.find("#data").val(svg_xml); + form.find("#filename").val(filename); + return form.submit(); + }); }; })(this) }); }; showalert = function(message, alerttype) { - return $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">×</a><span>' + message + '</span></div>'); + return $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">�</a><span>' + message + '</span></div>'); }; $('#suggestive').hide(); @@ -221,4 +246,4 @@ $("#choose_closet_control").change(function() { $("#display_all_lrs").change(function() { return toggle_enable_disable("#suggestive_lrs"); -});
\ No newline at end of file +}); |