smartxml: node.setAttr tests
[fnpeditor.git] / src / editor / modules / diffViewer / diffViewer.js
1 define([
2 'libs/jquery',
3 'libs/underscore',
4 'views/tabs/tabs',
5 'libs/text!./diff.html'
6 ], function($, _, tabs, diffTemplateSrc) {
7
8 'use strict';
9
10 return function(sandbox) {
11     
12     var dom = $('<div>').addClass('rng-module-diffViewer');
13     var tabsView = (new tabs.View({position: 'right'})).render();
14     dom.append(tabsView.getAsView());
15     
16     var DiffView = function() {
17         this.dom = $(diffTemplateSrc);
18     };
19     
20     DiffView.prototype.setTable = function(table) {
21         this.dom.append(table);
22     };
23     
24
25     return {
26         start: function() {sandbox.publish('ready');},
27         getView: function() {return dom;},
28         setDiff: function(diff) {
29             var diffView = new DiffView();
30             diffView.setTable(diff.table);
31             var slug = diff.ver1 + '-' + diff.ver2;
32             tabsView.addTab(diff.ver1 + '->' + diff.ver2, slug, diffView.dom);
33             tabsView.selectTab(slug);
34         }
35     };
36 };
37
38 });