<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
  <meta name="description" content="Lightweight Versioned GitLab Pages">
  <meta name="author" content="brainelectronics">
  <title>Lightweight Versioned GitLab Pages</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
</head>

<body>
  {%- for item in items %}{% if item.job_id != -1 %}
  <div class="container">
    <div class="row align-items-center">
      <div class="col-4 mx-auto">
        <div class="card shadow border">
          <div class="card-body d-flex flex-column align-items-center">
            <h4 class="card-title"><a href="{{ tag_base_url }}{{ item.tag.name }}">{{ item.tag.name }}</a></h4>
            <p class="card-text">
              <table class="table table-hover">
                <thead>
                  <tr>
                    <th scope="col">Key</th>
                    <th scope="col">Value</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>Job ID</td>
                    <td>{{ item.job_id }}</td>
                  </tr>
                  <tr>
                    <td>Pipeline</td>
                    {%- set pipeline_id = item.commit.last_pipeline.web_url.split('/')[-1] %}
                    <td><a href="{{ item.commit.last_pipeline.web_url }}">{{ pipeline_id }}</a></td>
                  </tr>
                  <tr>
                    <td>Commit</td>
                    <td><a href="{{ item.commit.web_url }}">{{ item.commit.short_id }}</a></td>
                  </tr>
                  <tr>
                    <td>Tag title</td>
                    <td>{{ item.commit.title }}</td>
                  </tr>
                  <tr>
                    <td>Tag author</td>
                    <td>{{ item.commit.author_name }}</td>
                  </tr>
                  <tr>
                    <td>Created</td>
                    <td>{{ item.created_at.strftime("%Y-%m-%d %H:%M:%S") }}</td>
                  </tr>
                </tbody>
              </table>
            </p>
            <a href="{{ item.pages_url }}" class="btn btn-primary">View</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  {% endif %}{% endfor -%}

</body>
</html>