show.ejs 2.03 KB
<!DOCTYPE html>
<html>
  <head>
    <%- include('../partials/head') %>
  </head>
  <body>
    <%- include('../partials/nav') %>

    <div class="container mb-3">

      <nav aria-label="breadcrumb">
        <ol class="breadcrumb p-1 pl-2 pr-2">
          <li class="breadcrumb-item"><a href="/">Home</a></li>
          <li class="breadcrumb-item"><a href="/posts">Board</a></li>
          <li class="breadcrumb-item active" aria-current="page"><%= post.title %></li>
        </ol>
      </nav>

      <div class="card">
        <h5 class="card-header p-2"><%= post.address %></h5>
        <div class="row"> <!-- 1 -->

          <div class="col-md-7 col-lg-8 col-xl-9 order-sm-2 order-md-1"> <!-- 1 -->
            <div class="post-body p-2"><%= post.body %></div>
          </div>

          <div class="col-md-5 col-lg-4 col-xl-3 order-sm-1 order-md-2"> <!-- 1 -->
            <div class="post-info card m-2 p-2"> 
              <div class="border-bottom pb-1 mb-1">
                <span>Author</span> : <%= post.author ? post.author.username: "" %>
              </div>
              <div><span>Created</span> : <span data-date-time="<%= post.createdAt %>"><%= post.createdAt %></span></div>
              <% if(post.updatedAt) { %>
                <div><span>Updated</span> : <span data-date-time="<%= post.updatedAt %>"><%= post.updatedAt %></span></div>
              <% } %>
            </div>
          </div>

        </div>
      </div>

      <div class="mt-3">
        <a class="btn btn-primary" href="/posts">Back</a>
        <% if(isAuthenticated && post.author && currentUser.id == post.author.id){ %> <!-- 1 -->
          <a class="btn btn-primary" href="/posts/<%= post._id %>/edit">Edit</a>
          <form action="/posts/<%= post._id %>?_method=delete" method="post" class="d-inline">
          <a class="btn btn-primary" href="javascript:void(0)" onclick="confirm('Do you want to delete this?')?this.parentElement.submit():null;">Delete</a>
        </form>
        <% } %>
      </div>
    </div>
    <%- include('../partials/showgmap') %>

  </body>
</html>