diff options
author | mr <mr@mrautenberg.de> | 2011-03-15 16:33:15 +0100 |
---|---|---|
committer | mr <mr@mrautenberg.de> | 2011-03-15 16:33:15 +0100 |
commit | 422a5abc6c56f237d0bc84bce613e688867d0e16 (patch) | |
tree | 408cdc855d21b112808cde78da2f47c43af8db2e /public | |
parent | a6ee4587bfcb565e87ab597b4e1156467ab67152 (diff) |
clean toxcreate.js, fix cancel edit modelname
Diffstat (limited to 'public')
-rwxr-xr-x | public/javascripts/toxcreate.js | 50 |
1 files changed, 27 insertions, 23 deletions
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', |