From 422a5abc6c56f237d0bc84bce613e688867d0e16 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 15 Mar 2011 16:33:15 +0100 Subject: clean toxcreate.js, fix cancel edit modelname --- public/javascripts/toxcreate.js | 50 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'public/javascripts/toxcreate.js') 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', -- cgit v1.2.3 From d8d49429f3d913fea56a631ac0a5b61c80916424 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 15 Mar 2011 16:39:22 +0100 Subject: clean toxcreate.js, fix cancel edit modelname / pt2 --- public/javascripts/toxcreate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'public/javascripts/toxcreate.js') diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js index aea46f1..3f243fe 100755 --- a/public/javascripts/toxcreate.js +++ b/public/javascripts/toxcreate.js @@ -111,7 +111,7 @@ $(function() { }); -jQuery.fn.editModel = function(type, options) { +jQuery.fn.editModel = function(options) { var defaults = { method: 'get', action: this.attr('href'), @@ -138,7 +138,7 @@ jQuery.fn.editModel = function(type, options) { }); }; -jQuery.fn.cancelEdit = function(type, options) { +jQuery.fn.cancelEdit = function(options) { var defaults = { method: 'get', action: 'model/' + options.id + '/name?mode=show', @@ -165,7 +165,7 @@ jQuery.fn.cancelEdit = function(type, options) { }); }; -jQuery.fn.saveModel = function(type, options) { +jQuery.fn.saveModel = function(options) { var defaults = { method: 'put', action: 'model/' + options.id, -- cgit v1.2.3 From 592f509ec22dd3f742ee530c7b1692b1af05e528 Mon Sep 17 00:00:00 2001 From: mr Date: Thu, 24 Mar 2011 13:57:07 +0100 Subject: external links with rel='external' for w3c compliance --- public/javascripts/toxcreate.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'public/javascripts/toxcreate.js') diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js index 3f243fe..d9946c4 100755 --- a/public/javascripts/toxcreate.js +++ b/public/javascripts/toxcreate.js @@ -226,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; + }); +}); + -- cgit v1.2.3