{{define "content"}}
{{$owner := .Data.Owner}}
{{$repo := .Data.Info.Name}}
<div class="row">
  <div class="col-md-12">
    <h2>~{{$owner}}/{{$repo}}
      <span class="badge badge-secondary">{{.Data.Info.Visibility}}</span>
    </h2>
    {{if .Data.Info.Description}}<p class="text-muted">{{.Data.Info.Description}}</p>{{end}}
    {{if .Data.DefaultBranch}}
    <p>Default branch: <code>{{.Data.DefaultBranch}}</code></p>
    {{end}}
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <h3>Compare</h3>
    <form method="GET" action="/~{{$owner}}/{{$repo}}/compare/" class="form-inline">
      <div class="form-group">
        <label class="sr-only" for="base">Base</label>
        <select class="form-control" id="base" name="base">
          <optgroup label="Branches">
            {{range .Data.Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}
          </optgroup>
          <optgroup label="Tags">
            {{range .Data.Tags}}<option value="{{.Name}}">{{.Name}}</option>{{end}}
          </optgroup>
        </select>
      </div>
      <span class="mx-2">...</span>
      <div class="form-group">
        <label class="sr-only" for="head">Head</label>
        <select class="form-control" id="head" name="head">
          <optgroup label="Branches">
            {{range .Data.Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}
          </optgroup>
          <optgroup label="Tags">
            {{range .Data.Tags}}<option value="{{.Name}}">{{.Name}}</option>{{end}}
          </optgroup>
        </select>
      </div>
      <div class="form-group mx-2">
        <select class="form-control" name="mode">
          <option value="three">three-dot (merge base)</option>
          <option value="two">two-dot (direct range)</option>
        </select>
      </div>
      <button class="btn btn-primary" type="submit">Compare</button>
    </form>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <h3>Recent commits</h3>
    {{if .Data.Commits}}
    <ul class="list-unstyled">
      {{range .Data.Commits}}
      <li>
        <a href="/~{{$owner}}/{{$repo}}/commit/{{.SHA}}"><code>{{.ShortSHA}}</code></a>
        {{.Subject}}
        <span class="text-muted">— {{.AuthorName}}, {{date .Date}}</span>
      </li>
      {{end}}
    </ul>
    {{else}}
    <p class="text-muted">No commits.</p>
    {{end}}
  </div>
</div>
{{end}}
