Added auto-removal of commas in theme edit box, if there was only 1 theme netered...
authorŁukasz Rekucki <lrekucki@gmail.com>
Mon, 8 Mar 2010 13:20:16 +0000 (14:20 +0100)
committerŁukasz Rekucki <lrekucki@gmail.com>
Mon, 8 Mar 2010 13:20:16 +0000 (14:20 +0100)
platforma/static/js/main.js

index c7e0af8..26c935e 100644 (file)
@@ -515,7 +515,7 @@ function html(element) {
                 etag.replaceWith(text);
                 xml2html({
                     xml: '<motyw id="m'+id+'"></motyw>',
                 etag.replaceWith(text);
                 xml2html({
                     xml: '<motyw id="m'+id+'"></motyw>',
-                    success: function(text) {
+                    success: function(text) {                                          
                         mtag = $('<span></span>');
                         spoint.insertNode(mtag[0]);
                         mtag.replaceWith(text);
                         mtag = $('<span></span>');
                         spoint.insertNode(mtag[0]);
                         mtag.replaceWith(text);
@@ -599,8 +599,14 @@ function html(element) {
                 
                 function save(argument) {
                     var nodeName = $box.attr('x-node') || 'pe';
                 
                 function save(argument) {
                     var nodeName = $box.attr('x-node') || 'pe';
+                                       var insertedText = $('textarea', $overlay).val();
+                                       
+                                       if ($origin.is('.motyw')) {
+                                               insertedText = insertedText.replace(/,\s*$/, '');
+                                       }
+                                       
                     xml2html({
                     xml2html({
-                        xml: '<' + nodeName + '>' + $('textarea', $overlay).val() + '</' + nodeName + '>',
+                        xml: '<' + nodeName + '>' + insertedText + '</' + nodeName + '>',
                         success: function(element) {
                             $box.html($(element).html());
                             $overlay.remove();
                         success: function(element) {
                             $box.html($(element).html());
                             $overlay.remove();