summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-03-15 16:33:15 +0100
committermr <mr@mrautenberg.de>2011-03-15 16:33:15 +0100
commit422a5abc6c56f237d0bc84bce613e688867d0e16 (patch)
tree408cdc855d21b112808cde78da2f47c43af8db2e
parenta6ee4587bfcb565e87ab597b4e1156467ab67152 (diff)
clean toxcreate.js, fix cancel edit modelname
-rw-r--r--application.rb2
-rwxr-xr-xpublic/javascripts/toxcreate.js50
-rw-r--r--views/model_name_edit.haml7
-rw-r--r--views/models.haml5
4 files changed, 34 insertions, 30 deletions
diff --git a/application.rb b/application.rb
index 243333c..d11dad4 100644
--- a/application.rb
+++ b/application.rb
@@ -282,7 +282,7 @@ post '/models' do # create a new model
#@model.warnings += "<p>Duplicated structures (all structures/activities used for model building, please make sure, that the results were obtained from <em>independent</em> experiments):</p>" + duplicate_warnings unless duplicate_warnings.empty?
lazar.uri
end
- @model.update(:task_uri => task.uri)
+ @model.update :task_uri => task.uri
flash[:notice] = "Model creation and validation started - this may last up to several hours depending on the number and size of the training compounds."
redirect url_for('/models')
diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js
index 94d944d..aea46f1 100755
--- a/public/javascripts/toxcreate.js
+++ b/public/javascripts/toxcreate.js
@@ -86,8 +86,6 @@ $(function() {
});
return id;
};
-
-
loadModel = function(id, view) {
if(id == "") return -1;
@@ -111,27 +109,6 @@ $(function() {
return false;
};
- checkValidation = function() {
- var reload_id = "";
- $("input.model_validation_report").each(function(){
- if(!$(this).val().match(/Completed|Error/)) {
- reload_id = this.id.replace("model_validation_report_","");
- if(/^\d+$/.test(reload_id)) loadModel(reload_id, 'validation');
- };
- });
-//<<<<<<< HEAD
- //var validationCheck = setTimeout('checkValidation()',15000);
- //var validationCheck = setTimeout('checkValidation()',5000);
-//=======
- $("input.model_validation_qmrf").each(function(){
- if(!$(this).val().match(/Completed|Error/)) {
- reload_id = this.id.replace("model_validation_qmrf_","");
- if(/^\d+$/.test(reload_id)) loadModel(reload_id, 'model');
- };
- });
- var validationCheck = setTimeout('checkValidation()',15000);
-//>>>>>>> d1ad229730f6e6043fe6e7a150e05ffa41e3cec2
- }
});
jQuery.fn.editModel = function(type, options) {
@@ -161,6 +138,33 @@ jQuery.fn.editModel = function(type, options) {
});
};
+jQuery.fn.cancelEdit = function(type, options) {
+ var defaults = {
+ method: 'get',
+ action: 'model/' + options.id + '/name?mode=show',
+ trigger_on: 'click'
+ };
+ var opts = $.extend(defaults, options);
+
+ this.bind(opts.trigger_on, function() {
+ $.ajax({
+ type: opts.method,
+ url: opts.action,
+ dataType: 'html',
+ data: {
+ '_method': 'get'
+ },
+ success: function(data) {
+ $("div#model_" + opts.id + "_name").html(data);
+ },
+ error: function(data) {
+ alert("model cancel error!");
+ }
+ });
+ return false;
+ });
+};
+
jQuery.fn.saveModel = function(type, options) {
var defaults = {
method: 'put',
diff --git a/views/model_name_edit.haml b/views/model_name_edit.haml
index aec59fc..a038996 100644
--- a/views/model_name_edit.haml
+++ b/views/model_name_edit.haml
@@ -1,5 +1,5 @@
-- js = "$('#cancel_#{model.id}').editModel('GET', {id: '#{model.id}', mode: 'show'});\n "
-- js = "$('#save_#{model.id}').saveModel('POST', {id: '#{model.id}', mode: 'show'});\n "
+- js = "$('#cancel_#{model.id}').cancelEdit('GET', {id: '#{model.id}', mode: 'show'});\n "
+- js += "$('#save_#{model.id}').saveModel('POST', {id: '#{model.id}', mode: 'show'});\n "
:javascript
$(function() {
#{js}
@@ -10,5 +10,4 @@
%input{:type => 'hidden', :name => 'subjectid', :id => 'subjectid', :value => session[:subjectid]}
%input{ :type => "submit", :value => "Save", :id => "save_#{model.id}", :class => "edit_button"}
%span{:class => "edit_button"}
- %a{:href => url_for("/model/#{model.id}/name?mode=show"), :id => "cancel_#{model.id}"} Cancel
-
+ %a{:href => "#", :id => "cancel_#{model.id}"} Cancel
diff --git a/views/models.haml b/views/models.haml
index 77ea376..268cda2 100644
--- a/views/models.haml
+++ b/views/models.haml
@@ -6,16 +6,17 @@
setTimeout('checkStati("#{stati_to_check}", "#{subjectstring}")',5000);
}
var reload_validation = true;
- //if(reload_validation) setTimeout('checkValidation()',15000);
});
-# %p Get an overview about ToxCreate models. This page is refreshed every 15 seconds to update the model status.
%p Get an overview about ToxCreate models. This page is refreshed every 5 seconds to update the model status.
-# explanations
-= haml :lazar_description, :layout => false
= haml :classification, :layout => false
+= haml :lazar_description, :layout => false
= haml :regression, :layout => false
+= haml :significant_fragments, :layout => false
+= haml :similarity, :layout => false
- if @models
- @models.each do |model|