{{ template "header" . }}

<style>
  td {
    padding: 16px 0;
  }
</style>

<main>
  <div class="user-profile">
    <h1>
      <a href="/{{.username}}">{{.username}}</a>
      /
      <a href="/{{.username}}/{{.reponame}}">{{.reponame}}</a>
    </h1>
    <h2>
    {{if ne "" .branch}}
      {{.branch}}で
    {{else}}
      {{.author}}さん
    {{end}}のコミット
    </h2>
    {{if .commits}}
    {{range $key, $value := .commits}}
    <h3>{{$value.Date}}</h3>
    <table class="user-readme-text file-table">
      <tbody>
        {{range $k, $v := $value.Commit}}
        <tr class="file-u-list">
          <td>
            <a href="/{{$.username}}/{{$.reponame}}/commit/{{$v.Id}}">{{$v.Mess}}</a><br />
            <a href="/{{$.username}}/{{$.reponame}}/commits?author={{$v.User}}">{{$v.User}}</a>さんは{{$value.Date}}でコミットしました
          </td>
          <td width="70" style="vertical-align: top;">
            {{if $v.Issue}}
            <a href="/{{$.username}}/{{$.reponame}}/pull/{{$v.Issue}}">#{{$v.Issue}}</a>
            {{end}}
          </td>
          <td width="80" style="vertical-align: top;">
            <a href="/{{$.username}}/{{$.reponame}}/commit/{{$v.Id}}">{{.IdShort}}</a>
          </td>
        </tr>
        {{end}}
      </tbody>
    </table>
    {{end}}
    {{end}}
  </div>
  {{if .commits}}
  {{if or (ne "" .prev) (ne "" .next)}}
  <div class="button-parent">
    {{if ne "" .next}}<a class="button" href="{{.next}}">次</a>{{end}}
    {{if ne "" .prev}}<a class="button" href="{{.prev}}">戻る</a>{{end}}
  </div>
  {{end}}
  {{end}}
</main>

{{ template "footer" . }}
