KAnanev/Page-analyzer

View on GitHub
page_analyzer/templates/url.html

Summary

Maintainability
Test Coverage
{% extends 'base.html' %}
{% block title %}Сайт: {{ item.url }}{% endblock %}

{% block content %}
<div class="table-responsive">
  <table class="table table-bordered table-hover text-nowrap" data-test="url">
    <tbody>
    <tr>
      <td>ID</td>
      <td>{{ item.id }}</td>
    </tr>
    <tr>
      <td>Имя</td>
      <td>{{ item.name }}</td>
    </tr>
    <tr>
      <td>Дата создания</td>
      <td>{{ item.created_at.strftime('%Y-%m-%d')}}</td>
    </tr>
    </tbody>
  </table>
</div>

<h2 class="mt-5 mb-3">Проверки</h2>

<form method="post" action="{{ url_for('page_analyzer.post_url_check', url_id=item.id) }}">
  <input type="submit" class="btn btn-primary" value="Запустить проверку">
</form>

<div>
    <table class="table table-bordered table-hover mt-2" data-test="checks">
    <thead>
      <tr>
        <th>ID</th>
        <th>Код ответа</th>
        <th>h1</th>
        <th>title</th>
        <th>description</th>
        <th>Дата создания</th>
      </tr>
    </thead>
      <tbody>
    {% if item.url_checks %}
    {% for check in item.url_checks %}
    <tr>
        <td>{{ check.id }}</td>
        <td>{{ check.status_code|default('', true) }}</td>
        <td>{{ check.h1|default('', true) }}</td>
        <td>{{ check.title|default('', true) }}</td>
        <td>{{ check.description|default('', true) }}</td>
        <td>{{ check.created_at.strftime('%Y-%m-%d') }}</td>
    </tr>
    {% endfor %}
    {% endif %}
    </tbody>
    </table>
  </div>

{% endblock %}