Jihan Kim 2014-04-07
Branches: simplify branch list
@381a77b3ee9e41c0e30ea811d705626c0399c9f3
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -5299,9 +5299,10 @@
     }
 
     .branchName {
+        min-width:200px;
         padding-top:13px;
 
-        a { color:@blue; }
+        a { color:@blue;font-family:@fixed-font-family; }
 
         .headBranch {
             color: #0088cc;
@@ -5313,22 +5314,10 @@
         }
     }
 
-    .commitMessage {
-        padding-top:13px;
-
-        .usf-group       { float:left; }
-        .avatar-wrap     { margin-top:0px; margin-right:10px; }
-        .commitMsg.short {
-            display:inline;
-            overflow:visible;
-            white-space: normal;
-            padding:0;
-        }
-        .commitMsg.desc  { margin-top:5px; }
-    }
-
-    .commitDate {
+    .commit {
         width:115px; padding-top:13px;
+        .commitId { font-family:@fixed-font-family; }
+        .date { font-size:11px; color:#777; margin-left:10px; }
     }
 
     .pullRequest {
app/views/code/branches.scala.html
--- app/views/code/branches.scala.html
+++ app/views/code/branches.scala.html
@@ -46,8 +46,7 @@
                     <thead class="thead">
                         <tr>
                             <th>@Messages("title.branches")</th>
-                            <th>@Messages("code.branches.commitMsg")</th>
-                            <th>@Messages("code.branches.commitDate")</th>
+                            <th>@Messages("code.branches.commit")</th>
                             <th>@Messages("code.branches.pullRequest")</th>
                             @if(isAllowed(UserApp.currentUser(), project.asResource(), Operation.DELETE) ||
                                 isAllowed(UserApp.currentUser(), project.asResource(), Operation.UPDATE)) {
app/views/code/partial_branchrow.scala.html
--- app/views/code/partial_branchrow.scala.html
+++ app/views/code/partial_branchrow.scala.html
@@ -24,46 +24,20 @@
 @import utils.AccessControl._
 @import java.net.URLEncoder
 
-@getShowCommitURL(gitBranch:playRepository.GitBranch) = @{
-    var queryString = "?branch=" + URLEncoder.encode(gitBranch.getName, "UTF-8")
-    routes.CodeHistoryApp.show(project.owner, project.name, gitBranch.getHeadCommit.getId) + queryString
-}
-
-@deleteBranchURL(branch:String) =@{
-    var branchName = URLEncoder.encode(branch, "UTF-8")
-    routes.BranchApp.deleteBranch(project.owner, project.name, branchName)
-}
-
-@goToBranchURL(branch:String) =@{
-    var branchName = URLEncoder.encode(branch, "UTF-8")
-    routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, branchName, "")
-}
-
-@getCommiterAvatar(gitBranch:playRepository.GitBranch) = {
-    @if(branch.getUser != null){
-        <a href="@routes.UserApp.userInfo(branch.getUser.loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@branch.getUser.name">
-            <img src="@branch.getUser.avatarUrl" class="avatar-wrap smaller">
-        </a>
-    } else {
-        <a class="usf-group" data-toggle="tooltip" data-placement="top" title="@branch.getHeadCommit.getCommitterName">
-            <img src="@utils.GravatarUtil.getAvatar(branch.getHeadCommit.getCommitterEmail, 25)" class="avatar-wrap smaller">
-        </a>
-    }
-}
-
 <tr @if(isHead){class="head"}>
     <td class="branchName">
-        <a href="@goToBranchURL(branch.getName)">@branch.getShortName</a>
+        <a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch.getName, "UTF-8"), "")">@branch.getShortName</a>
         @if(isHead){<span class="headBranch ml10">@Messages("code.branches.defaultBranch")</span>}
     </td>
-    <td class="commitMessage">
-        @getCommiterAvatar(branch)
-        @common.commitMsg(branch.getHeadCommit.getShortMessage,
-                          branch.getHeadCommit.getMessage,
-                          getShowCommitURL(branch))
-    </td>
-    <td class="commitDate">
-        @momentFromNow(branch.getHeadCommit.getCommitterDate, lang.language)
+    <td class="commit">
+        <a href="@routes.CodeHistoryApp.history(project.owner, project.name, URLEncoder.encode(branch.getName, "UTF-8"), "")"
+            class="commitId" title="@branch.getHeadCommit.getId">@branch.getHeadCommit.getShortId</a>
+
+        @defining(branch.getHeadCommit.getCommitterDate) { commitDate =>
+        <span class="date" data-toggle="tooltip" data-placement="top" title="@getDateString(commitDate)">
+            @momentFromNow(commitDate, lang.language)
+        </span>
+        }
     </td>
     <td class="pullRequest">
     @if(branch.getPullRequest != null) {
@@ -82,7 +56,7 @@
         @if(isAllowed(UserApp.currentUser(), project.asResource(), Operation.UPDATE)){
             @if(branch.getName != project.defaultBranch()){
                 <button type="button"
-                        class="ybtn ybtn-default"
+                        class="ybtn ybtn-default ybtn-small"
                         data-request-method="post"
                         data-request-uri="@routes.BranchApp.setAsDefault(project.owner, project.name, URLEncoder.encode(branch.getName, "UTF-8"))">
                     @Messages("code.branches.setAsDefault")
@@ -91,7 +65,8 @@
         }
 
         @if(isAllowed(UserApp.currentUser(), project.asResource(), Operation.DELETE) && !isHead){
-            <a href="@deleteBranchURL(branch.getName)" class="ybtn ybtn-danger" data-request-method="delete">
+            <a href="@routes.BranchApp.deleteBranch(project.owner, project.name, URLEncoder.encode(branch.getName, "UTF-8"))"
+                class="ybtn ybtn-danger ybtn-small" data-request-method="delete">
                 @Messages("button.delete")
             </a>
         }
conf/messages
--- conf/messages
+++ conf/messages
File mode has changed
@@ -66,8 +66,7 @@
 button.yes = Yes
 code.addedPath = {0} (Added)
 code.author = Author
-code.branches.commitDate = Latest commit date
-code.branches.commitMsg = Latest commit message
+code.branches.commit = Latest commit
 code.branches.defaultBranch = Default branch
 code.branches.noPullRequest = No pull request sent
 code.branches.pullRequest = Latest pull request
conf/messages.ja
--- conf/messages.ja
+++ conf/messages.ja
File mode has changed
@@ -62,8 +62,7 @@
 button.yes = はい
 code.addedPath = {0} (追加)
 code.author = 作成者
-code.branches.commitDate = Latest commit date
-code.branches.commitMsg = Latest commit message
+code.branches.commit = Latest commit
 code.branches.defaultBranch = Default branch
 code.branches.noPullRequest = No pull request sent
 code.branches.pullRequest = Latest pull request
conf/messages.ko
--- conf/messages.ko
+++ conf/messages.ko
File mode has changed
@@ -66,8 +66,7 @@
 button.yes = 예
 code.addedPath = {0} (추가됨)
 code.author = 작성자
-code.branches.commitDate = 최근 커밋한 날짜
-code.branches.commitMsg = 최근 커밋 메시지
+code.branches.commit = 최근 커밋
 code.branches.defaultBranch = 기본 브랜치
 code.branches.noPullRequest = 주고받은 코드가 없습니다
 code.branches.pullRequest = 최근 코드 주고받기
Add a comment
List