Basic list items extracting
[fnpeditor.git] / modules / diffViewer / diffViewer.js
index 254a19a..be0e431 100644 (file)
@@ -1,35 +1,38 @@
-define([\r
-'libs/jquery-1.9.1.min',\r
-'libs/underscore-min',\r
-'views/tabs/tabs',\r
-'libs/text!./diff.html'\r
-], function($, _, tabs, diffTemplateSrc) {\r
-\r
-'use strict';\r
-\r
-return function(sandbox) {\r
-    \r
-    var dom = $('<div>').addClass('rng-module-diffViewer');\r
-    var tabsView = (new tabs.View({position: 'right'})).render();\r
-    dom.append(tabsView.getAsView());\r
-    \r
-    var DiffView = function() {\r
-        this.dom = $(diffTemplateSrc)\r
-    }\r
-    DiffView.prototype.setTable = function(table) {\r
-        this.dom.append(table);\r
-    }\r
-    \r
-\r
-    return {\r
-        start: function() {sandbox.publish('ready');},\r
-        getView: function() {return dom;},\r
-        setDiff: function(diff) {\r
-            var diffView = new DiffView();\r
-            diffView.setTable(diff.table);\r
-            tabsView.addTab(diff.ver1 + '->' + diff.ver2, diff.ver1 + '-' + diff.ver2, diffView.dom);\r
-        }\r
-    };\r
-};\r
-\r
+define([
+'libs/jquery-1.9.1.min',
+'libs/underscore-min',
+'views/tabs/tabs',
+'libs/text!./diff.html'
+], function($, _, tabs, diffTemplateSrc) {
+
+'use strict';
+
+return function(sandbox) {
+    
+    var dom = $('<div>').addClass('rng-module-diffViewer');
+    var tabsView = (new tabs.View({position: 'right'})).render();
+    dom.append(tabsView.getAsView());
+    
+    var DiffView = function() {
+        this.dom = $(diffTemplateSrc);
+    };
+    
+    DiffView.prototype.setTable = function(table) {
+        this.dom.append(table);
+    };
+    
+
+    return {
+        start: function() {sandbox.publish('ready');},
+        getView: function() {return dom;},
+        setDiff: function(diff) {
+            var diffView = new DiffView();
+            diffView.setTable(diff.table);
+            var slug = diff.ver1 + '-' + diff.ver2;
+            tabsView.addTab(diff.ver1 + '->' + diff.ver2, slug, diffView.dom);
+            tabsView.selectTab(slug);
+        }
+    };
+};
+
 });
\ No newline at end of file
 });
\ No newline at end of file