Showing previous versions of a publication
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 17 Jun 2013 09:05:51 +0000 (11:05 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 17 Jun 2013 09:05:51 +0000 (11:05 +0200)
modules/data/data.js
modules/documentHistory/documentHistory.js
modules/documentHistory/templates/main.html
modules/rng/rng.js

index 8c35436..e2cdbb1 100644 (file)
@@ -118,6 +118,9 @@ return function(sandbox) {
                     },\r
                 }); \r
             }\r
+        },\r
+        getDocumentId: function() {\r
+            return document_id;\r
         }\r
     }\r
 };\r
index 9a01f16..d435617 100644 (file)
@@ -30,6 +30,10 @@ return function(sandbox) {
         });\r
         dialog.show();\r
     });\r
+    \r
+    dom.find('.btn.display').click(function(e) {\r
+        sandbox.publish('displayVersion', {version: historyItems.getSelected()[0]});\r
+    });\r
         \r
     var addHistoryItem = function(item, options) {\r
         historyItems.add(item);\r
@@ -80,18 +84,18 @@ return function(sandbox) {
             var len = this._selected.length;\r
             if(len === 0) {\r
                 toggleButton('compare', false);\r
-                toggleButton('show2', false);\r
+                toggleButton('display', false);\r
                 toggleButton('restore', false);\r
             }\r
             if(len === 1) {\r
                 toggleButton('compare', false);\r
-                toggleButton('show2', true);\r
+                toggleButton('display', true);\r
                 toggleButton('restore', true);\r
             }\r
             if(len === 2) {\r
                 toggleItemViews(false);\r
                 toggleButton('compare', true);\r
-                toggleButton('show2', false);\r
+                toggleButton('display', false);\r
                 toggleButton('restore', false);\r
             } else {\r
                 toggleItemViews(true);\r
index ff4ea79..0e581f6 100644 (file)
@@ -3,7 +3,7 @@
         <div class="group">\r
             <button class="btn btn-mini compare">Porównaj</button>\r
             <button class="btn btn-mini restore">Przywróć</button>\r
-            <button class="btn btn-mini show2">Zobacz</button>\r
+            <button class="btn btn-mini display">Zobacz</button>\r
         </div>\r
     </div>\r
     <div style="clear:both;"></div>\r
index cd7122c..3b41394 100644 (file)
@@ -285,6 +285,9 @@ return function(sandbox) {
         },\r
         restoreVersion: function(event) {\r
             sandbox.getModule('data').restoreVersion(event);\r
+        },\r
+        displayVersion: function(event) {\r
+            window.open('/' + gettext('editor') + '/' + sandbox.getModule('data').getDocumentId() + '?version=' + event.version, _.uniqueId());\r
         }\r
     }\r
     \r