client/js/paper-renderer.js
changeset 198 d3737b90a66b
parent 197 4e13edb46c0d
child 199 aff7eb118f7d
--- a/client/js/paper-renderer.js	Thu Jul 04 14:46:51 2013 +0200
+++ b/client/js/paper-renderer.js	Mon Aug 19 11:47:29 2013 +0200
@@ -1851,7 +1851,7 @@
         });
     }
     
-    if (_renkan.options.show_user_list) {
+    if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {
         var $cpwrapper = this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),
             $cplist = this.$.find(".Rk-Users .Rk-Edit-ColorPicker");
         
@@ -1939,8 +1939,8 @@
 template: _.template(
     '<% if (options.show_top_bar) { %><div class="Rk-TopBar"><% if (!options.editor_mode) { %><h2 class="Rk-PadTitle"><%- project.get("title") || translate("Untitled project")%></h2>'
     + '<% } else { %><input type="text" class="Rk-PadTitle" value="<%- project.get("title") || "" %>" placeholder="<%-translate("Untitled project")%>" /><% } %>'
-    + '<% if (options.show_user_list) { %><div class="Rk-Users"><div class="Rk-CurrentUser"><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-CurrentUser-Color"><span class="Rk-Edit-ColorTip"></span></span>'
-    + '<%= colorPicker %></div><span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span></div><ul class="Rk-UserList"></ul></div><% } %>'
+    + '<% if (options.show_user_list) { %><div class="Rk-Users"><div class="Rk-CurrentUser"><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-CurrentUser-Color"><% if (options.user_color_editable) { %><span class="Rk-Edit-ColorTip"></span><% } %></span>'
+    + '<% if (options.user_color_editable) { print(colorPicker) } %></div><span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span></div><ul class="Rk-UserList"></ul></div><% } %>'
     + '<% if (options.home_button_url) {%><div class="Rk-TopBar-Separator"></div><a class="Rk-TopBar-Button Rk-Home-Button" href="<%- options.home_button_url %>"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents">'
     + '<%- translate(options.home_button_title) %></div></div></a><% } %>'
     + '<% if (options.show_fullscreen_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-FullScreen-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"><%-translate("Full Screen")%></div></div></div><% } %>'
@@ -2218,30 +2218,35 @@
     allUsers.forEach(function(_user) {
         if (_user.get("_id") === _this.renkan.current_user) {
             $name.text(_user.get("title"));
+            $colorsquare.css("background", _user.get("color"));
             if (_this.isEditable()) {
-                $name.click(function() {
-                    var $this = $(this),
-                        $input = $('<input>').val(_user.get("title")).blur(function() {
-                            _user.set("title", $(this).val());
-                            _this.redrawUsers();
-                            _this.redraw();
-                        });
-                    $this.empty().html($input);
-                    $input.select();
-                });
                 
-                $cpitems.click(
-                    function(_e) {
-                        _e.preventDefault();
-                        if (_this.isEditable()) {
-                            _user.set("color", $(this).attr("data-color"));
+                if (_this.renkan.options.user_name_editable) {
+                    $name.click(function() {
+                        var $this = $(this),
+                            $input = $('<input>').val(_user.get("title")).blur(function() {
+                                _user.set("title", $(this).val());
+                                _this.redrawUsers();
+                                _this.redraw();
+                            });
+                        $this.empty().html($input);
+                        $input.select();
+                    });
+                }
+                
+                if (_this.renkan.options.user_color_editable) {
+                    $cpitems.click(
+                        function(_e) {
+                            _e.preventDefault();
+                            if (_this.isEditable()) {
+                                _user.set("color", $(this).attr("data-color"));
+                            }
+                            $(this).parent().hide();
                         }
-                        $(this).parent().hide();
-                    }
-                ).mouseleave(function() {
-                    $colorsquare.css("background", _user.get("color"));
-                });
-                $colorsquare.css("background", _user.get("color"));
+                    ).mouseleave(function() {
+                        $colorsquare.css("background", _user.get("color"));
+                    });
+                }
             }
             
         } else {