doortts doortts 2017-08-09
usermenu: Support metakey hold click when select
@5186ccab06fbdf8de374210aa08e257f706bdba0
app/views/index/myProjectList_partial.scala.html
--- app/views/index/myProjectList_partial.scala.html
+++ app/views/index/myProjectList_partial.scala.html
@@ -7,14 +7,14 @@
 @(project:Project, favored:Boolean, isLast:Boolean = false)
 @import utils.TemplateHelper._
 
-<li class="user-li @if(isLast){favored}" onclick="window.location='@routes.ProjectApp.goConventionMenu(project.owner, project.name)';">
+<li class="user-li @if(isLast){favored}" data-location="@routes.ProjectApp.goConventionMenu(project.owner, project.name)">
     <div class="project-list project-flex-container">
         <div class="project-item project-item-container">
             <div class="flex-item site-logo">
-                <i class="project-avatar">@if(hasProjectLogo(project)){<a href="@routes.ProjectApp.goConventionMenu(project.owner, project.name)" ><img class="logo" src="@urlToProjectLogo(project)"></a>}else{<span class="dummy-25px"> </span>}</i>
+                <i class="project-avatar">@if(hasProjectLogo(project)){<img class="logo" src="@urlToProjectLogo(project)">}else{<span class="dummy-25px"> </span>}</i>
             </div>
             <div class="projectName-owner flex-item">
-                <div class="project-name flex-item"><a href="@routes.ProjectApp.goConventionMenu(project.owner, project.name)">@project.name @if(project.isPrivate){<i class="yobicon-lock yobicon-small"></i>}</a></div>
+                <div class="project-name flex-item">@project.name @if(project.isPrivate){<i class="yobicon-lock yobicon-small"></i>}</div>
                 <div class="project-owner flex-item"><a href="@routes.UserApp.userInfo(project.owner)" >@project.owner</a></div>
             </div>
         </div>
public/javascripts/common/yona.Usermenu.js
--- public/javascripts/common/yona.Usermenu.js
+++ public/javascripts/common/yona.Usermenu.js
@@ -133,6 +133,15 @@
             }
         }
 
+        $(".user-ul > .user-li").on("click", function (e) {
+            var location = $(this).data('location');
+            if(e.metaKey) {
+                window.open(location, '_blank');
+            } else {
+                window.location = location;
+            }
+        });
+
       $(".org-list > .star-org").on("click", function toggleOrgFavorite(e) {
             e.stopPropagation();
             var that = $(this);
Add a comment
List