{% extends "base.html" %}

{% block description %}
{{ post.excerpt }}
{% endblock %}

{% block content %}
<header class="masthead" style="background-image: url({{post.coverImage.url}})">
  <div class="overlay"></div>
  <div class="container">
    <div class="row">
      <div class="col-lg-8 col-md-10 mx-auto">
        <div class="post-heading position-relative">
          <h1>{% block title %}{{ post.title }}{% endblock %}</h1>
          <h2 class="subheading">{{ post.excerpt }}</h2>
        </div>
      </div>
    </div>
  </div>
</header>

<article>
  <div class="container">
    <div class="row">
      <div class="col-lg-8 col-md-10 mx-auto post-content">
        {{post.contentInMarkdown | markdown}}
      </div>
    </div>
  </div>
</article>

<div class="container">
  <div class="row">
    <div class="col-lg-8 col-md-10 mx-auto post-content">
      <h2>
        {{_("Leave your comment here:")}}
      </h2>
      <form class="form form-horizontal" method="post" role="form" action={{ url_for('blog.get_post', post_slug=post_slug) }} autocomplete="off">
      {{ form.hidden_tag() }}
      <p>
        {{ form.author_name(placeholder=form.author_name.label.text) }}
      </p>
      <p>
        {{ form.comment(placeholder=form.comment.label.text) }}
      </p>
      {{ form.submit }}
      </form>
    </div>

    <div class="col-lg-8 col-md-10 mx-auto post-content">
      {% if comment_sent %}
      <p>
        {{_("Your comment has been sent for moderation")}}
      </p>
      {% endif %}


      <table class="table table-striped">
        {% for comment in post.comments %}
        <tr>
          <td>
            <p>
              {{comment.author}} {{_("said")}} {{comment.time_delta}}:
            </p>
            <p>
              {{comment.comment}}
            </p>
          </td>
        </tr>
        {% endfor %}
      </table>
    </div>
  </div>
</div>
{% endblock %}
