doortts doortts 2014-04-14
usermenu: ui enhancements
@7348cd2c343eae7af63a840e37a19160c7b8dfbc
app/assets/stylesheets/less/_common.less
--- app/assets/stylesheets/less/_common.less
+++ app/assets/stylesheets/less/_common.less
@@ -135,6 +135,7 @@
 /** text style **/
 .bold { font-weight:bold; }
 .gray-txt      { color:@gray-cc !important; }
+.darkgray-txt  { color:@gray-99 !important; }
 .orange-txt    { color:@orange !important; }
 .primary-txt   { color:@primary !important; }
 .secondary-txt { color:@secondary !important; }
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -5441,5 +5441,14 @@
     height: 20px;
     .border-radius(3px);
     border: 1px solid #ececec;
+    margin-right: 3px;
   }
+  .dummy-25px {
+    width: 25px;
+    display: inline-block;
+  }
+}
+
+.dropdown-menu>li {
+  .my-list-item;
 }
(No newline at end of file)
app/assets/stylesheets/less/_yobiUI.less
--- app/assets/stylesheets/less/_yobiUI.less
+++ app/assets/stylesheets/less/_yobiUI.less
@@ -1031,7 +1031,7 @@
             > a {
                 .border-radius(3px);
                 color:#292929;
-                padding: 3px 20px 5px;
+                padding: 3px 40px 5px 15px;
                 background-color:transparent !important;
                 .transition(all 0.2s ease);
 
app/utils/TemplateHelper.scala
--- app/utils/TemplateHelper.scala
+++ app/utils/TemplateHelper.scala
@@ -139,6 +139,13 @@
     }
   }
 
+  def hasProjectLogo(project: Project) = {
+    models.Attachment.findByContainer(project.asResource) match {
+      case files if files.size > 0 => true
+      case _ => false
+    }
+  }
+
   /**
    * get branch item name
    * @param branch
@@ -227,6 +234,13 @@
     }
   }
 
+  def hasOrganizationLogo(organization: Organization) = {
+    models.Attachment.findByContainer(organization.asResource) match {
+      case files if files.size > 0 => true
+      case _ => false
+    }
+  }
+
   object DiffRenderer {
 
     def removedWord(word: String) = "<span class='remove'>" + word + "</span>"
app/views/common/usermenu.scala.html
--- app/views/common/usermenu.scala.html
+++ app/views/common/usermenu.scala.html
@@ -1,4 +1,5 @@
 @(project:Project)
+@import utils.TemplateHelper._
 @orderString = @{"createdDate DESC"}
 <ul class="gnb-usermenu">
     <li>
@@ -65,8 +66,8 @@
                     <span class="numberic">@groups.size</span>
                 </li>
                 @if(groups.length > 0) {
-                    @for(g <- groups){
-                        <li><a href="@routes.OrganizationApp.organization(g.name)"><span class="bold">@g.name</span></a></li>
+                    @for(organization <- groups){
+                        <li><a href="@routes.OrganizationApp.organization(organization.name)">@if(hasOrganizationLogo(organization)){<img src="@urlToOrganizationLogo(organization)">}else{<span class="dummy-25px"> </span>} <span class="bold">@organization.name</span></a></li>
                     }
                 } else {
                     <li class="empty">@Messages("organization.is.empty")</li>
@@ -78,14 +79,14 @@
                     <span class="numberic">@visitedProjects.size</span>
                 </li>
                 @if(visitedProjects.length > 0) {
-                    @for(pv <- visitedProjects){
-                        <li><a href="@routes.ProjectApp.project(pv.project.owner, pv.project.name)"><span class="gray">@pv.project.owner / </span><span class="bold">@pv.project.name</span></a></li>
+                    @for(visited <- visitedProjects){
+                        <li><a href="@routes.ProjectApp.project(visited.project.owner, visited.project.name)">@if(hasProjectLogo(visited.project)){<img src="@urlToProjectLogo(visited.project)">} else{<span class="dummy-25px"> </span>} <span class="bold">@visited.project.name</span> <span class="darkgray-txt small-font">of @visited.project.owner</span></a></li>
                     }
                 } else {
                     @defining(Project.findProjectsCreatedByUser(UserApp.currentUser.loginId, orderString)) { myProjects =>
                         @if(myProjects.length > 0) {
                             @for(project <- myProjects){
-                                <li><a href="@routes.ProjectApp.project(project.owner, project.name)"><span class="gray">@project.owner / </span><span class="bold">@project.name</span></a></li>
+                                <li>@if(hasProjectLogo(project)){<img src="@urlToProjectLogo(project)">} <a href="@routes.ProjectApp.project(project.owner, project.name)"><span class="bold">@project.name</span> <span class="darkgray-txt small-font">of @project.owner</span></a></li>
                             }
                         } else {
                             <li class="empty">@Messages("project.is.empty")</li>
app/views/index/myOrganizationList.scala.html
--- app/views/index/myOrganizationList.scala.html
+++ app/views/index/myOrganizationList.scala.html
@@ -5,7 +5,7 @@
 @defining(Organization.findOrganizationsByUserLoginId(UserApp.currentUser.loginId)) { organizations =>
     @for(organization <- organizations){
         <li class="my-list-item" data-value="@organization.name">
-            <img src="@urlToOrganizationLogo(organization)"><a href="@routes.OrganizationApp.organization(organization.name)">
+            @if(hasOrganizationLogo(organization)){<img src="@urlToOrganizationLogo(organization)">}else{<span class="dummy-25px"> </span>}<a href="@routes.OrganizationApp.organization(organization.name)">
                 <span class="bold">@organization.name</span>
             </a>
         </li>
app/views/index/myProjectList.scala.html
--- app/views/index/myProjectList.scala.html
+++ app/views/index/myProjectList.scala.html
@@ -5,9 +5,11 @@
 <ul class="tab-pane unstyled my-project-item" id="@title">
 @for(project <- projects){
     <li class="my-list-item" data-value="@if(project.owner != currentUser.loginId) {@project.owner / }@project.name">
+    @if(hasProjectLogo(project)){<img src="@urlToProjectLogo(project)" alt="@project.name"/>} else{<span class="dummy-25px"> </span>}
         <a href="@routes.ProjectApp.project(project.owner, project.name)" class="project-name">
-            <img src="@urlToProjectLogo(project)" alt="@project.name"/> <strong>@project.name @if(project.isPrivate){ <i class="yobicon-lock yobicon-small"></i> }</strong>
+            <strong>@project.name @if(project.isPrivate){ <i class="yobicon-lock yobicon-small"></i> }</strong>
         </a>
+        <span class="gray-txt small-font">of <a href="@routes.UserApp.userInfo(project.owner)" >@project.owner</a></span>
     </li>
 }
 </ul>
@@ -16,9 +18,10 @@
 <ul class="tab-pane unstyled my-project-item active" id="recentlyVisited">
 @for(visited <- visitedProjects){
     <li class="my-list-item" data-value="@if(visited.project.owner != currentUser.loginId) {@visited.project.owner / }@visited.project.name">
-        <img src="@urlToProjectLogo(visited.project)" alt="@visited.project.name"/><a href="@routes.ProjectApp.project(visited.project.owner, visited.project.name)" class="project-name">
+        @if(hasProjectLogo(visited.project)){<img src="@urlToProjectLogo(visited.project)" alt="@visited.project.name"/>} else{<span class="dummy-25px"> </span>}<a href="@routes.ProjectApp.project(visited.project.owner, visited.project.name)" class="project-name">
             <strong>@visited.project.name @if(visited.project.isPrivate){ <i class="yobicon-lock yobicon-small"></i> }</strong>
         </a>
+        <span class="gray-txt small-font">of <a href="@routes.UserApp.userInfo(visited.project.owner)" >@visited.project.owner</a></span>
     </li>
 }
 </ul>    
Add a comment
List