extends application

block head
  script.
    forum.constants.parent = !{parent || 0};

block vars
  - var bodyClass="index posts"

block main
  if(count > 20)
    form(action='/topic/' + parent + '#' + posts[0].id)
      input(type="hidden", name="limit", value=(limit + 20 || 40))
      button(type="submit" class="atom-loadall")
        | Load earlier posts

  .posts
    if(!posts || posts.length === 0)
      | No posts. Why not contribute to the forum?
    else
      each post in posts
        include posts/post

block script
  include posts/new



  script.
    $('body').on('click', '.atom-actions-action--edit', function(event){
      event.preventDefault();
      $post = $(this).closest('.atom');
      $post.find('form.edit, .content').toggleClass('is-hidden')
    });

