Merge branch 'edumed' of https://github.com/fnp/redakcja into edumed
[redakcja.git] / redakcja / static / js / wiki / base.js
index 523ad96..ad2ee3a 100644 (file)
@@ -10,7 +10,7 @@
                        "perspectives": {
                                "ScanGalleryPerspective": {
                                        "show": true,
                        "perspectives": {
                                "ScanGalleryPerspective": {
                                        "show": true,
-                                       "page": 1
+                                       "page": undefined
                                },
                                "CodeMirrorPerspective": {}
                                /*
                                },
                                "CodeMirrorPerspective": {}
                                /*
@@ -69,7 +69,7 @@
                var base_id = 'id' + Math.floor(Math.random()* 5000000000);
                var id = (''+klass)+'_' + base_id;
                var $tab = $('<li id="'+id+'" data-ui-related="'+base_id+'" data-ui-jsclass="'+klass+'" >'
                var base_id = 'id' + Math.floor(Math.random()* 5000000000);
                var id = (''+klass)+'_' + base_id;
                var $tab = $('<li id="'+id+'" data-ui-related="'+base_id+'" data-ui-jsclass="'+klass+'" >'
-                               + title + '<img src="/static/icons/close.png" class="tabclose"></li>');
+                               + title + '<img src="'+STATIC_URL+'icons/close.png" class="tabclose"></li>');
                var $view = $('<div class="editor '+klass+'" id="'+base_id+'"> </div>');
 
                this.perspectives[id] = new $.wiki[klass]({
                var $view = $('<div class="editor '+klass+'" id="'+base_id+'"> </div>');
 
                this.perspectives[id] = new $.wiki[klass]({
                if($tab.length != 1)
                        $tab = $(DEFAULT_PERSPECTIVE);
 
                if($tab.length != 1)
                        $tab = $(DEFAULT_PERSPECTIVE);
 
-               var $old = $('#tabs li').filter('.active');
+               var $old = $tab.closest('.tabs').find('.active');
 
                $old.each(function(){
                        $(this).removeClass('active');
 
                $old.each(function(){
                        $(this).removeClass('active');
                        var global = $("*[data-ui-error-for='__all__']", this.$elem);
                        var unassigned = [];
 
                        var global = $("*[data-ui-error-for='__all__']", this.$elem);
                        var unassigned = [];
 
+            $("*[data-ui-error-for]", this.$elem).text('');
                        for (var field_name in errors)
                        {
                                var span = $("*[data-ui-error-for='"+field_name+"']", this.$elem);
                        for (var field_name in errors)
                        {
                                var span = $("*[data-ui-error-for='"+field_name+"']", this.$elem);