From c71f69b610b270b9c25cf58e84a035078905fa46 Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 22 Aug 2011 15:28:27 +0200 Subject: remove subjectidstring for unified cookies --- application.rb | 8 +++----- public/javascripts/toxcreate.js | 14 +++++++------- views/model.haml | 18 +++++++++--------- views/models.haml | 6 +++--- views/validation.haml | 2 +- 5 files changed, 23 insertions(+), 25 deletions(-) diff --git a/application.rb b/application.rb index eb86916..9ef50f8 100644 --- a/application.rb +++ b/application.rb @@ -92,8 +92,7 @@ end get '/models/?' do @models = ToxCreateModel.all.sort(:order => "DESC") @models.each{|m| raise "internal redis error: model is nil" unless m} - subjectstring = @subjectid ? "?subjectid=#{CGI.escape(@subjectid)}" : "" - haml :models, :locals=>{:models=>@models, :subjectstring => subjectstring} + haml :models, :locals=>{:models=>@models} end get '/model/:id/status/?' do @@ -156,13 +155,12 @@ end get '/model/:id/:view/?' do response['Content-Type'] = 'text/plain' model = ToxCreateModel.get(params[:id]) - subjectstring = @subjectid ? "?subjectid=#{CGI.escape(@subjectid)}" : "" begin case params[:view] when "model" - haml :model, :locals=>{:model=>model,:subjectstring => subjectstring}, :layout => false + haml :model, :locals=>{:model=>model}, :layout => false when /validation/ - haml :validation, :locals=>{:model=>model,:subjectstring => subjectstring}, :layout => false + haml :validation, :locals=>{:model=>model}, :layout => false else return "unable to render model: id #{params[:id]}, view #{params[:view]}" end diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js index ee783ce..0e82040 100755 --- a/public/javascripts/toxcreate.js +++ b/public/javascripts/toxcreate.js @@ -18,20 +18,20 @@ $(function() { return this.replace(/^\s+|\s+$/g, ''); } - checkStati = function(stati, subjectstr) { + checkStati = function(stati) { stati = stati.split(", "); $("body") var newstati = new Array; $.each(stati, function(){ - checkProgress(this, subjectstr); - if(checkStatus(this, subjectstr) > 0) newstati.push(this); + checkProgress(this); + if(checkStatus(this) > 0) newstati.push(this); }); - if (newstati.length > 0) var statusCheck = setTimeout('checkStati("' + newstati.join(", ") + '", "' + subjectstr + '")',10000); + if (newstati.length > 0) var statusCheck = setTimeout('checkStati("' + newstati.join(", ") + '")',10000); }; - checkStatus = function(id, subjectstr) { + checkStatus = function(id) { if(id == "") return -1; - var opts = {method: 'get', action: 'model/' + id + '/status' + subjectstr, id: id}; + var opts = {method: 'get', action: 'model/' + id + '/status', id: id}; var status_changed = $.ajax({ type: opts.method, url: opts.action, @@ -62,7 +62,7 @@ $(function() { }; - checkProgress = function(id, subjectstr) { + checkProgress = function(id) { var task = $("input#model_" + id + "_task").attr('value'); var opts = {action: task + "/percentageCompleted" , id: id}; var progress_changed = $.ajax({ diff --git a/views/model.haml b/views/model.haml index e688ae9..670ba1a 100644 --- a/views/model.haml +++ b/views/model.haml @@ -65,26 +65,26 @@ %dt Training dataset: %dd - if model.training_dataset.match(/ambit/i) - %a{:href => "#{model.training_dataset}#{subjectstring}", :rel => "external"} Ambit database + %a{:href => "#{model.training_dataset}", :rel => "external"} Ambit database - else - %a{:href => "#{model.training_dataset}.xls#{subjectstring}"} Excel sheet + %a{:href => "#{model.training_dataset}.xls"} Excel sheet , -#%a{:href => "#{model.training_dataset}.rdf"} RDF/XML -#%em (experts) , - %a{:href => "#{model.training_dataset}.sdf#{subjectstring}" } SDF + %a{:href => "#{model.training_dataset}.sdf" } SDF , - %a{:href => "#{model.training_dataset}.yaml#{subjectstring}" } YAML + %a{:href => "#{model.training_dataset}.yaml" } YAML %em (experts) - if model.feature_dataset %dt Feature dataset: %dd -#%a{:href => "#{model.feature_dataset}.rdf"} RDF/XML -#, - %a{:href => "#{model.feature_dataset}.xls#{subjectstring}"} Excel sheet + %a{:href => "#{model.feature_dataset}.xls"} Excel sheet , - %a{:href => "#{model.feature_dataset}.sdf#{subjectstring}"} SDF + %a{:href => "#{model.feature_dataset}.sdf"} SDF , - %a{:href => "#{model.feature_dataset}.yaml#{subjectstring}"} YAML + %a{:href => "#{model.feature_dataset}.yaml"} YAML %em (experts) - if model.uri %dt Model: @@ -94,7 +94,7 @@ -#, - if model.validation_qmrf_uri %a{:href => File.join(model.validation_qmrf_uri,"editor")} QMRF Editor, - %a{:href => "#{model.uri}.yaml#{subjectstring}"} YAML + %a{:href => "#{model.uri}.yaml"} YAML %em (experts, models cannot be represented in Excel) - = haml :validation, :locals=>{:model=>model,:subjectstring => subjectstring}, :layout => false + = haml :validation, :locals=>{:model=>model}, :layout => false diff --git a/views/models.haml b/views/models.haml index 9ab2858..a1ef8ba 100644 --- a/views/models.haml +++ b/views/models.haml @@ -3,7 +3,7 @@ :javascript $(function() { if(#{stati != 0}) { - setTimeout('checkStati("#{stati_to_check}", "#{subjectstring}")',5000); + setTimeout('checkStati("#{stati_to_check}", "")',5000); } var reload_validation = true; }); @@ -20,6 +20,6 @@ - if @models - @models.each do |model| - = haml :model, :locals=>{:model=>model,:subjectstring=>subjectstring}, :layout => false --if @models.size == 0 + = haml :model, :locals=>{:model=>model}, :layout => false +-if @models.size == 0 .notice There are currently no models. You have to create a model first. diff --git a/views/validation.haml b/views/validation.haml index b8a6eaa..0a094d6 100644 --- a/views/validation.haml +++ b/views/validation.haml @@ -7,7 +7,7 @@ - if model.validation_report_uri %dt Detailed report: %dd - %a{:href => model.validation_report_uri + subjectstring, :target => "_blank"} show + %a{:href => model.validation_report_uri, :target => "_blank"} show %dt Number of predictions: %dd= model.nr_predictions.to_s - case model.type -- cgit v1.2.3