summaryrefslogtreecommitdiff
path: root/public/javascripts/toxcreate.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/toxcreate.js')
-rwxr-xr-xpublic/javascripts/toxcreate.js66
1 files changed, 41 insertions, 25 deletions
diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js
index 94d944d..d9946c4 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,30 +109,9 @@ $(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) {
+jQuery.fn.editModel = function(options) {
var defaults = {
method: 'get',
action: this.attr('href'),
@@ -161,7 +138,34 @@ jQuery.fn.editModel = function(type, options) {
});
};
-jQuery.fn.saveModel = function(type, options) {
+jQuery.fn.cancelEdit = function(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(options) {
var defaults = {
method: 'put',
action: 'model/' + options.id,
@@ -222,3 +226,15 @@ jQuery.fn.deleteModel = function(type, options) {
return false;
});
};
+
+$(document).ready(function() {
+ $('A[rel="external"]').each(function() {
+ $(this).attr('alt', 'Link opens in new window.');
+ $(this).attr('title', 'Link opens in new window.');
+ });
+ $('A[rel="external"]').click(function() {
+ window.open($(this).attr('href'));
+ return false;
+ });
+});
+