doortts doortts 2017-03-08
user-profile: Polishing view pages
Notice
----
User profile page will be more simplified
in the future.

It's easy to slow down, but it's not used very well.

See: Yona Github issue #170
@335d0cc82ee1e9e97b36df29fe828754ff28e0a6
app/controllers/UserApp.java
--- app/controllers/UserApp.java
+++ app/controllers/UserApp.java
@@ -631,6 +631,12 @@
 
                 sortByLastPushedDateAndName(projects);
             }
+        } else {
+            projects = collectProjects(loginId, user, groupNames);
+            collectDatum(projects, postings, issues, pullRequests, milestones, daysAgo);
+            sortDatum(postings, issues, pullRequests, milestones);
+
+            sortByLastPushedDateAndName(projects);
         }
         if (user.isAnonymous()) {
             return notFound(ErrorViews.NotFound.render("user.notExists.name"));
app/views/user/partial_milestones.scala.html
--- app/views/user/partial_milestones.scala.html
+++ app/views/user/partial_milestones.scala.html
@@ -60,8 +60,5 @@
             </div>
         </div>
     </div>
-    <div class="completion-rate"><!--
-             -->@milestone.getCompletionRate<!--
-             --><i>%</i>
-    </div>
+    <div class="completion-rate">@milestone.getCompletionRate %</div>
 </li>
app/views/user/partial_projectlist.scala.html
--- app/views/user/partial_projectlist.scala.html
+++ app/views/user/partial_projectlist.scala.html
@@ -1,22 +1,8 @@
 @**
-* Yobi, Project Hosting SW
+* Yona, 21st Century Project Hosting SW
 *
-* Copyright 2013 NAVER Corp.
-* http://yobi.io
-*
-* @author Suwon Chae
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
+* Copyright Yona & Yobi Authors & NAVER Corp.
+* https://yona.io
 **@
 @(project:Project, user:User)
 @import utils.JodaDateUtil._
@@ -25,49 +11,38 @@
 <li class="project">
     <div class="info-wrap">
         <div class="pull-left">
-            <a href="@routes.ProjectApp.project(project.owner, project.name)" class="avatar-wrap large">
+            <a href="@routes.ProjectApp.project(project.owner, project.name)" class="avatar-wrap small">
                 <img src="@urlToProjectLogo(project)">
             </a>
         </div>
         <div class="pull-left" style="margin-left: 10px;">
             <div class="header">
-                <a href="@routes.UserApp.userInfo(project.owner)" class="owner-name-small">@project.owner</a> / <a href="@routes.ProjectApp.project(project.owner, project.name)" class="project-name">@project.name</a>
+                <a href="@routes.ProjectApp.project(project.owner, project.name)" class="project-name">@project.name</a>
                 @if(project.isPrivate){ <i class="yobicon-lock yobicon-small"></i> }
-            </div>
-            @if(project.isForkedFromOrigin){
-            <div class="forked label">
-                <i class="yobicon-split yobicon-white vmiddle"></i>
-                @Messages("fork.original")
-                <span>/ <a href="@routes.UserApp.userInfo(project.originalProject.owner)">@project.originalProject.owner</a> / </span>
-                <a href="@routes.ProjectApp.project(project.originalProject.owner, project.originalProject.name)">@project.originalProject.name</a>
-            </div>
-            }
-            <div class="desc tag">
-                @for(label <- project.labels) {
-                <span class="project-label @label.category.toLowerCase">@label.name</span>
+                @if(project.isForkedFromOrigin){
+                    <i class="yobicon-split yobicon-white vmiddle"></i>
+                    <span> <a href="@routes.ProjectApp.project(project.originalProject.owner, project.originalProject.name)">@project.originalProject.owner/@project.originalProject.name</a></span>
                 }
             </div>
             <div class="desc">@project.overview</div>
             <div class="name-tag">
-                @Messages("project.create") <strong title="@getDateString(project.createdDate)">@agoOrDateString(project.createdDate)</strong>
-                @if(project.lastPushedDateAgo() != null) {, @Messages("project.codeUpdate") <strong title="@getDateString(project.lastPushedDate)">@agoOrDateString(project.lastPushedDate)}</strong>
+                @Html(Messages("project.onmember", User.findUsersByProject(project.id).size)) <a href="@routes.UserApp.userInfo(project.owner)" class="owner-name-small">@project.owner</a> <span title="@getDateString(project.createdDate)">@agoOrDateString(project.createdDate)</span>
+                @if(project.lastPushedDateAgo() != null) {, @Messages("project.codeUpdate") <span title="@getDateString(project.lastPushedDate)">@agoOrDateString(project.lastPushedDate)}</span>
             </div>
         </div>
     </div>
     <div class="stats-wrap pull-right">
         <div class="stats">
-            @Html(Messages("project.onmember", User.findUsersByProject(project.id).size))<br/>
-
             @if(UserApp.currentUser.loginId != project.owner ){
                 @if(User.isWatching(project)){
-                    <a href="@routes.WatchProjectApp.unwatch(project.owner, project.name)" class="nbtn blue medium watchBtn">
+                    <a href="@routes.WatchProjectApp.unwatch(project.owner, project.name)" class="ybtn watchBtn">
                         <i class="yobicon-eye-open yobicon-middle yobicon-white"></i>
-                        @Messages("notification.watch")
+                        @Messages("notification.unwatch")
                         <span class="num-badge">@project.getWatchingCount</span>
                     </a>
                 }
                 @if(!User.isWatching(project) && project.isPublic) {
-                    <a href="@routes.WatchProjectApp.watch(project.owner, project.name)" class="nbtn  medium watchBtn">
+                    <a href="@routes.WatchProjectApp.watch(project.owner, project.name)" class="ybtn watchBtn">
                         <i class="yobicon-eye-close yobicon-middle yobicon-white"></i>
                         @Messages("notification.watch")
                         <span class="num-badge">@project.getWatchingCount</span>
app/views/user/view.scala.html
--- app/views/user/view.scala.html
+++ app/views/user/view.scala.html
@@ -91,26 +91,28 @@
                             @Messages("project.projects") @showBadgeNumberIfExist(projects.size)
                         </a>
                     </li>
-                    <li class="@isActiveTab("postings")">
-                        <a href="#postings" data-toggle="tab">
-                            @Messages("menu.board") @showBadgeNumberIfExist(postings.size)
-                        </a>
-                    </li>
-                    <li class="@isActiveTab("pullRequests")">
-                        <a href="#pullRequests" data-toggle="tab">
-                            @Messages("menu.pullRequest") @showBadgeNumberIfExist(pullRequests.size)
-                        </a>
-                    </li>
-                    <li class="@isActiveTab("issues")">
-                        <a href="#issues" data-toggle="tab">
-                            @Messages("menu.issue") @showBadgeNumberIfExist(issues.size)
-                        </a>
-                    </li>
-                    <li class="@isActiveTab("milestones")">
-                        <a href="#milestones" data-toggle="tab">
-                            @Messages("milestone") @showBadgeNumberIfExist(milestones.size)
-                        </a>
-                    </li>
+                    @if(user.loginId.equals(UserApp.currentUser().loginId)) {
+                        <li class="@isActiveTab("postings")">
+                            <a href="#postings" data-toggle="tab">
+                                @Messages("menu.board") @showBadgeNumberIfExist(postings.size)
+                            </a>
+                        </li>
+                        <li class="@isActiveTab("pullRequests")">
+                            <a href="#pullRequests" data-toggle="tab">
+                                @Messages("menu.pullRequest") @showBadgeNumberIfExist(pullRequests.size)
+                            </a>
+                        </li>
+                        <li class="@isActiveTab("issues")">
+                            <a href="#issues" data-toggle="tab">
+                                @Messages("menu.issue") @showBadgeNumberIfExist(issues.size)
+                            </a>
+                        </li>
+                        <li class="@isActiveTab("milestones")">
+                            <a href="#milestones" data-toggle="tab">
+                                @Messages("milestone") @showBadgeNumberIfExist(milestones.size)
+                            </a>
+                        </li>
+                    }
                 </ul>
 
                 <div class="tab-content">
@@ -126,54 +128,56 @@
                             }
                         </ul>
                     </div>
-                    <div id="postings" class="tab-pane @isActiveTab("postings")">
-                        @if(postings.size==0){
-                            <div class="error-wrap">
-                                <p>@Messages("userinfo.daysAgo.prefix") @Messages("post.is.empty")</p>
-                            </div>
-                        }
-                        <ul class="post-list-wrap">
-                            @for(post <- postings){
+                    @if(user.loginId.equals(UserApp.currentUser().loginId)) {
+                        <div id="postings" class="tab-pane @isActiveTab("postings")">
+                            @if(postings.size == 0) {
+                                <div class="error-wrap">
+                                    <p>@Messages("userinfo.daysAgo.prefix") @Messages("post.is.empty")</p>
+                                </div>
+                            }
+                            <ul class="post-list-wrap">
+                            @for(post <- postings) {
                                 @partial_postings(post, post.project)
                             }
-                        </ul>
-                    </div>
-                    <div id="issues" class="tab-pane @isActiveTab("issues")">
-                        @if(issues.size==0){
-                            <div class="error-wrap">
-                                <p>@Messages("userinfo.daysAgo.prefix") @Messages("issue.is.empty")</p>
-                            </div>
-                        }
-                        <ul class="post-list-wrap row-fluid">
-                        @for(issue <- issues){
-                            @partial_issues(issue, issue.project)
-                        }
-                        </ul>
-                    </div>
-                    <div id="pullRequests" class="tab-pane @isActiveTab("pullRequests")">
-                        @if(pullRequests.size==0){
-                            <div class="error-wrap">
-                                <p>@Messages("userinfo.daysAgo.prefix") @Messages("pullRequest.is.empty")</p>
-                            </div>
-                        }
-                        <ul class="post-list-wrap  row-fluid">
-                        @for(pull <- pullRequests){
-                            @partial_pullRequests(pull, pull.toProject)
-                        }
-                        </ul>
-                    </div>
-                    <div id="milestones" class="tab-pane @isActiveTab("milestones")">
-                        @if(milestones.size==0){
-                            <div class="error-wrap">
-                                <p>@Messages("milestone.is.empty")</p>
-                            </div>
-                        }
-                        <ul class="milestones">
-                        @for(milestone <- milestones){
-                            @partial_milestones(milestone, milestone.project)
-                        }
-                        </ul>
-                    </div>
+                            </ul>
+                        </div>
+                        <div id="issues" class="tab-pane @isActiveTab("issues")">
+                            @if(issues.size == 0) {
+                                <div class="error-wrap">
+                                    <p>@Messages("userinfo.daysAgo.prefix") @Messages("issue.is.empty")</p>
+                                </div>
+                            }
+                            <ul class="post-list-wrap row-fluid">
+                            @for(issue <- issues) {
+                                @partial_issues(issue, issue.project)
+                            }
+                            </ul>
+                        </div>
+                        <div id="pullRequests" class="tab-pane @isActiveTab("pullRequests")">
+                            @if(pullRequests.size == 0) {
+                                <div class="error-wrap">
+                                    <p>@Messages("userinfo.daysAgo.prefix") @Messages("pullRequest.is.empty")</p>
+                                </div>
+                            }
+                            <ul class="post-list-wrap  row-fluid">
+                            @for(pull <- pullRequests) {
+                                @partial_pullRequests(pull, pull.toProject)
+                            }
+                            </ul>
+                        </div>
+                        <div id="milestones" class="tab-pane @isActiveTab("milestones")">
+                            @if(milestones.size == 0) {
+                                <div class="error-wrap">
+                                    <p>@Messages("milestone.is.empty")</p>
+                                </div>
+                            }
+                            <ul class="milestones">
+                            @for(milestone <- milestones) {
+                                @partial_milestones(milestone, milestone.project)
+                            }
+                            </ul>
+                        </div>
+                    }
                </div>
             </div>
         </section>
Add a comment
List