From: Ɓukasz Rekucki <lrekucki@gmail.com>
Date: Mon, 8 Mar 2010 13:20:16 +0000 (+0100)
Subject: Added auto-removal of commas in theme edit box, if there was only 1 theme netered... 
X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/af0452ad29bec28c7095f144e11337e0972b7670?ds=inline

Added auto-removal of commas in theme edit box, if there was only 1 theme netered. Fixes #270
---

diff --git a/platforma/static/js/main.js b/platforma/static/js/main.js
index c7e0af86..26c935e0 100644
--- a/platforma/static/js/main.js
+++ b/platforma/static/js/main.js
@@ -515,7 +515,7 @@ function html(element) {
                 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);
@@ -599,8 +599,14 @@ function html(element) {
                 
                 function save(argument) {
                     var nodeName = $box.attr('x-node') || 'pe';
+					var insertedText = $('textarea', $overlay).val();
+					
+					if ($origin.is('.motyw')) {
+						insertedText = insertedText.replace(/,\s*$/, '');
+					}
+					
                     xml2html({
-                        xml: '<' + nodeName + '>' + $('textarea', $overlay).val() + '</' + nodeName + '>',
+                        xml: '<' + nodeName + '>' + insertedText + '</' + nodeName + '>',
                         success: function(element) {
                             $box.html($(element).html());
                             $overlay.remove();