editor: comments wip - inserting information about author
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 27 May 2014 08:09:14 +0000 (10:09 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 28 May 2014 12:45:58 +0000 (14:45 +0200)
src/editor/modules/documentCanvas/canvas/canvas.js
src/editor/modules/documentCanvas/canvas/genericElement.js
src/editor/modules/documentCanvas/documentCanvas.js

index ab31ee1..8ca71ac 100644 (file)
@@ -60,7 +60,8 @@ $.extend(TextHandler.prototype, {
 });
 
 
-var Canvas = function(wlxmlDocument, elements) {
+var Canvas = function(wlxmlDocument, elements, metadata) {
+    this.metadata = metadata || {};
     this.elementsRegister = new ElementsRegister(documentElement.DocumentNodeElement, nullElement);
 
     elements = [
@@ -614,8 +615,8 @@ $.extend(Cursor.prototype, {
 });
 
 return {
-    fromXMLDocument: function(wlxmlDocument, elements) {
-        return new Canvas(wlxmlDocument, elements);
+    fromXMLDocument: function(wlxmlDocument, elements, metadata) {
+        return new Canvas(wlxmlDocument, elements, metadata);
     }
 };
 
index d3debb2..878e140 100644 (file)
@@ -33,7 +33,7 @@ $.extend(generic, {
             }
         }.bind(this));
 
-        this.commentsView = new CommentsView(this.wlxmlNode, {});
+        this.commentsView = new CommentsView(this.wlxmlNode, this.canvas.metadata.user);
         this.addToGutter(this.commentsView);
         this.commentTip = $('<div class="comment-tip"><i class="icon-comment"></i></div>');
         this.addWidget(this.commentTip);
index 651788e..7e70f7f 100644 (file)
@@ -20,7 +20,9 @@ return function(sandbox) {
         canvasElements = canvasElements.concat(plugin.canvasElements || []);
     });
 
-    var canvas = canvas3.fromXMLDocument(null, canvasElements);
+    var canvas = canvas3.fromXMLDocument(null, canvasElements, {
+        user: sandbox.getConfig().user
+    });
     var canvasWrapper = $(template);
     var shownAlready = false;
     var scrollbarPosition = 0,