client/js/paper-renderer.js
changeset 198 d3737b90a66b
parent 197 4e13edb46c0d
child 199 aff7eb118f7d
equal deleted inserted replaced
197:4e13edb46c0d 198:d3737b90a66b
  1849         $(window).resize(function() {
  1849         $(window).resize(function() {
  1850             _this.fixSize(false);
  1850             _this.fixSize(false);
  1851         });
  1851         });
  1852     }
  1852     }
  1853     
  1853     
  1854     if (_renkan.options.show_user_list) {
  1854     if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {
  1855         var $cpwrapper = this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),
  1855         var $cpwrapper = this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),
  1856             $cplist = this.$.find(".Rk-Users .Rk-Edit-ColorPicker");
  1856             $cplist = this.$.find(".Rk-Users .Rk-Edit-ColorPicker");
  1857         
  1857         
  1858         $cpwrapper.hover(
  1858         $cpwrapper.hover(
  1859             function(_e) {
  1859             function(_e) {
  1937 
  1937 
  1938 _(Scene.prototype).extend({
  1938 _(Scene.prototype).extend({
  1939 template: _.template(
  1939 template: _.template(
  1940     '<% if (options.show_top_bar) { %><div class="Rk-TopBar"><% if (!options.editor_mode) { %><h2 class="Rk-PadTitle"><%- project.get("title") || translate("Untitled project")%></h2>'
  1940     '<% if (options.show_top_bar) { %><div class="Rk-TopBar"><% if (!options.editor_mode) { %><h2 class="Rk-PadTitle"><%- project.get("title") || translate("Untitled project")%></h2>'
  1941     + '<% } else { %><input type="text" class="Rk-PadTitle" value="<%- project.get("title") || "" %>" placeholder="<%-translate("Untitled project")%>" /><% } %>'
  1941     + '<% } else { %><input type="text" class="Rk-PadTitle" value="<%- project.get("title") || "" %>" placeholder="<%-translate("Untitled project")%>" /><% } %>'
  1942     + '<% 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>'
  1942     + '<% 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>'
  1943     + '<%= colorPicker %></div><span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span></div><ul class="Rk-UserList"></ul></div><% } %>'
  1943     + '<% 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><% } %>'
  1944     + '<% 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">'
  1944     + '<% 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">'
  1945     + '<%- translate(options.home_button_title) %></div></div></a><% } %>'
  1945     + '<%- translate(options.home_button_title) %></div></div></a><% } %>'
  1946     + '<% 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><% } %>'
  1946     + '<% 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><% } %>'
  1947     + '<% if (options.editor_mode) { %>'
  1947     + '<% if (options.editor_mode) { %>'
  1948     + '<% if (options.show_addnode_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddNode-Button"><div class="Rk-TopBar-Tooltip">'
  1948     + '<% if (options.show_addnode_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddNode-Button"><div class="Rk-TopBar-Tooltip">'
  2216     $name.off("click").text(this.renkan.translate("<unknown user>"));
  2216     $name.off("click").text(this.renkan.translate("<unknown user>"));
  2217     $cpitems.off("mouseleave click");
  2217     $cpitems.off("mouseleave click");
  2218     allUsers.forEach(function(_user) {
  2218     allUsers.forEach(function(_user) {
  2219         if (_user.get("_id") === _this.renkan.current_user) {
  2219         if (_user.get("_id") === _this.renkan.current_user) {
  2220             $name.text(_user.get("title"));
  2220             $name.text(_user.get("title"));
       
  2221             $colorsquare.css("background", _user.get("color"));
  2221             if (_this.isEditable()) {
  2222             if (_this.isEditable()) {
  2222                 $name.click(function() {
       
  2223                     var $this = $(this),
       
  2224                         $input = $('<input>').val(_user.get("title")).blur(function() {
       
  2225                             _user.set("title", $(this).val());
       
  2226                             _this.redrawUsers();
       
  2227                             _this.redraw();
       
  2228                         });
       
  2229                     $this.empty().html($input);
       
  2230                     $input.select();
       
  2231                 });
       
  2232                 
  2223                 
  2233                 $cpitems.click(
  2224                 if (_this.renkan.options.user_name_editable) {
  2234                     function(_e) {
  2225                     $name.click(function() {
  2235                         _e.preventDefault();
  2226                         var $this = $(this),
  2236                         if (_this.isEditable()) {
  2227                             $input = $('<input>').val(_user.get("title")).blur(function() {
  2237                             _user.set("color", $(this).attr("data-color"));
  2228                                 _user.set("title", $(this).val());
       
  2229                                 _this.redrawUsers();
       
  2230                                 _this.redraw();
       
  2231                             });
       
  2232                         $this.empty().html($input);
       
  2233                         $input.select();
       
  2234                     });
       
  2235                 }
       
  2236                 
       
  2237                 if (_this.renkan.options.user_color_editable) {
       
  2238                     $cpitems.click(
       
  2239                         function(_e) {
       
  2240                             _e.preventDefault();
       
  2241                             if (_this.isEditable()) {
       
  2242                                 _user.set("color", $(this).attr("data-color"));
       
  2243                             }
       
  2244                             $(this).parent().hide();
  2238                         }
  2245                         }
  2239                         $(this).parent().hide();
  2246                     ).mouseleave(function() {
  2240                     }
  2247                         $colorsquare.css("background", _user.get("color"));
  2241                 ).mouseleave(function() {
  2248                     });
  2242                     $colorsquare.css("background", _user.get("color"));
  2249                 }
  2243                 });
       
  2244                 $colorsquare.css("background", _user.get("color"));
       
  2245             }
  2250             }
  2246             
  2251             
  2247         } else {
  2252         } else {
  2248             ulistHtml += _this.userTemplate({
  2253             ulistHtml += _this.userTemplate({
  2249                 name: _user.get("title"),
  2254                 name: _user.get("title"),