Skip to content

Commit

Permalink
Fixed gene_set from the main form
Browse files Browse the repository at this point in the history
  • Loading branch information
homonecloco committed Jul 12, 2018
1 parent 7e221d6 commit 2ccd501
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 36 deletions.
36 changes: 5 additions & 31 deletions app/assets/javascripts/application.js
Expand Up @@ -54,38 +54,12 @@ ready = (function() {
$('#example2').html(response.compare.gene );
$('#example3').html(response.search.name);
$('#example4').html(response.compare.name );
// This part breaks after a while, unfortunatly at this time for time limitations I'll leave for later
//Setup all the selectors
console.log("Changing examples")
$("select[name*='gene_set_selector']").val(geneID)

$("select[name*='gene_set_selector']").val(geneID)
},
error: function(){
alert ("There was a problem with selecting the gene set");
}
});

//var newGeneID = $(this).val();
//TODO: Move this function to the previous selector.
/*
$.ajax({
type: 'get',
url: '/',
dataType: 'JSON',
data: {
gene_set_selector:newGeneID
},
success: function (response) {
$('#example1').html(response.search.gene);
$('#example2').html(response.compare.gene );
$('#example3').html(response.search.name);
$('#example4').html(response.compare.name );
},
error: function(){
alert ("There was a problem with selecting the gene set");
}
});*/

});

$(".alert-error").on("click", function(event) {
Expand Down Expand Up @@ -260,8 +234,9 @@ ready = (function() {

// Adding a new column to the results table (with a time delay to let the content to be generated first and then changed)
$(document).ready(function($) {
console.log("Searching for results")
setTimeout(function(){

console.log("inside timeout")
// Adding the header of the column
$('#sequenceserver').contents().find('thead').eq(0).find('th').eq(1).after('<th class="text-left">Expression search</th>')

Expand All @@ -280,10 +255,9 @@ ready = (function() {
$('#sequenceserver').contents().find('tbody').eq(0).find('tr').each(function(index, el) {
// ***Constructing the link(adding the gene name)
var geneName = $(this).find('td').eq(1).children().text();
var link = "genes/forward?submit=Search&gene=" + geneName + "&gene_set=" + geneSet;

var link = "genes/forward?submit=Search&gene=" + geneName + "&gene_set=" + geneSet + "&search_by=";
var secondColResTable = $(this).find('td').eq(1);
secondColResTable.after("<td> <a href=" + link + " target=\"_top\">Expression</a> </td>");
secondColResTable.after("<td> <a href='" + link + "transcript' target=\"_top\">Expression</a> </td>");
});
}, 3000);
});
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/genes_controller.rb
Expand Up @@ -43,6 +43,7 @@ def forwardCommon
gene_name = params[:gene]
gene_name = params[:query] if params[:query]
@gene_set = GeneSet.find(params[:gene_set_selector]) if params[:gene_set_selector]
@gene_set = GeneSet.find(params[:gene_set_selector_main]) if params[:gene_set_selector_main]
@gene_set = GeneSet.find_by(:name => params[:gene_set]) if params[:gene_set]
session[:heatmap] = false
@gene, @search_by = GenesHelper.findGeneName gene_name, @gene_set
Expand Down Expand Up @@ -87,6 +88,8 @@ def forward
end
rescue Exception => e
flash[:error] = e.to_s
#puts "ERROR: #{e.inspect}"
#puts e.backtrace
redirect_back fallback_location: request.base_url.to_s
return
end
Expand All @@ -111,12 +114,8 @@ def heatmap
genes = session[:genes] if session[:genes]
genes = params[:genes] if params[:genes]
session[:genes] = params[:genes] if params[:genes]
#puts "____"
#puts genes
#This acts as a flag for share action
session[:heatmap] = true
# If parameters passed cnotain settings (it's a shared link)

# If parameters passed contain settings (it's a shared link)
if params[:settings]
@client = MongodbHelper.getConnection unless @client
data = @client[:share].find({'hash' => params[:settings]}).first
Expand Down

0 comments on commit 2ccd501

Please sign in to comment.