Newer
Older
GitBucket / src / main / twirl / gitbucket / core / repo / commits.scala.html
@Naoki Takezoe Naoki Takezoe on 8 Dec 2015 3 KB Fix styles
@(pathList: List[String],
  branch: String,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
  commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]],
  page: Int,
  hasNext: Boolean,
  hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
  @html.menu("code", repository){
    <div class="head">
      @if(pathList.isEmpty){
        @helper.html.branchcontrol(
          branch,
          repository,
          hasWritePermission
        ){
          @repository.branchList.map { x =>
            <li><a href="@url(repository)/commits/@encodeRefName(x)">@helper.html.checkicon(x == branch) @x</a></li>
          }
        }
      }
      @if(pathList.nonEmpty){
        <span class="muted">History for</span>
        <a class="strong" href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
        @pathList.zipWithIndex.map { case (section, i) =>
          @if(i == pathList.length - 1){
            <span class="strong">@section</span>
          } else {
            <a class="strong" href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
          }
        }
      }
    </div>
    <div class="commit-list">
      @commits.map { day =>
        <div class="muted" style="background-color: white;">
          <i class="octicon octicon-git-commit"></i> Commits on @date(day.head.commitTime)
        </div>
        <div class="list-group box-commits">
          @day.map { commit =>
            <div class="list-group-item">
              <ul class="nav nav-pills pull-right">
                <li><a href="@url(repository)/commit/@commit.id" class="link monospace" style="line-height: 16px;">@commit.id.substring(0, 7)</a></li>
                <li><a href="@url(repository)/tree/@commit.id" style="line-height: 16px;"><i class="octicon octicon-code link"></i></a></li>
              </ul>
              <div>
                <div class="commit-avatar-image">@avatar(commit, 40)</div>
                <div>
                  <a href="@url(repository)/commit/@commit.id" class="commit-message" style="font-weight: bold;">@link(commit.summary, repository)</a>
                  @if(commit.description.isDefined){
                    <a href="javascript:void(0)" onclick="$('#description-@commit.id').toggle();" class="omit">...</a>
                  }
                  <br>
                  @if(commit.description.isDefined){
                    <pre id="description-@commit.id" style="display: none;" class="commit-description">@link(commit.description.get, repository)</pre>
                  }
                  <div style="margin-top: 2px;">
                    @user(commit.authorName, commit.authorEmailAddress, "username")
                    <span class="muted">authored @helper.html.datetimeago(commit.authorTime)</span>
                    @if(commit.isDifferentFromAuthor) {
                      <span class="octicon octicon-arrow-right" style="margin-top : -2px;"></span>
                      @user(commit.committerName, commit.committerEmailAddress, "username")
                      <span class="muted">committed @helper.html.datetimeago(commit.authorTime)</span>
                    }
                  </div>
                </div>
              </div>
            </div>
          }
        </div>
      }
    </div>

    <nav style="text-align: center; margin-top: 30px">
      <ul class="pagination">
        @if(page <= 1){
          <li class="disabled"><span>Newer</span></li>
        } else {
          <li><a href="?page=@{page - 1}">Newer</a></li>
        }
        @if(!hasNext){
          <li class="disabled"><span>Older</span></li>
        } else {
          <li><a href="?page=@{page + 1}">Older</a></li>
        }
      </ul>
    </nav>
  }
}