|
- <article class="card shadow-sm mb-4">
- <div class="card-body">
- <div class="mb-3">
- <a href="<%= PostsUrl() %>" class="small text-decoration-none">← Back to posts</a>
- </div>
-
- <div class="magazine-label mb-3">Feature story</div>
- <h1 class="display-6 mb-2"><%= H(post.Title) %></h1>
-
- <%
- Dim publishedText
- publishedText = ""
- If IsDate(post.PublishedDate) Then
- If CDate(post.PublishedDate) > #1/1/1970# Then
- publishedText = FormatDateTime(post.PublishedDate, vbLongDate)
- End If
- End If
-
- If Len(publishedText) > 0 Then
- %>
- <p class="article-meta"><%= H(publishedText) %></p>
- <%
- End If
-
- Dim postBody
- postBody = H(post.Body)
- postBody = Replace(postBody, vbCrLf, "<br>")
- postBody = Replace(postBody, vbCr, "<br>")
- postBody = Replace(postBody, vbLf, "<br>")
- %>
-
- <div class="prose fs-5 lh-lg feature-dropcap"><%= postBody %></div>
- </div>
- </article>
-
- <!-- Comments -->
- <section class="mt-2">
- <%
- Dim commentsCount, commentsLoadFailed
- commentsCount = 0
- commentsLoadFailed = False
-
- On Error Resume Next
- If IsObject(comments) Then commentsCount = comments.Count
- If Err.Number <> 0 Then
- commentsLoadFailed = True
- commentsCount = 0
- Err.Clear
- End If
- On Error GoTo 0
- %>
- <h2 class="page-title h4 mb-3">Comments (<%= commentsCount %>)</h2>
-
- <% If commentsLoadFailed Then %>
- <div class="alert alert-warning mb-4">Comments are temporarily unavailable.</div>
- <% ElseIf commentsCount = 0 Then %>
- <p class="text-muted mb-4">No comments yet. Be the first to leave one below.</p>
- <% Else %>
- <%
- Dim commentIter, commentItem
- Dim commentsIterFailed
- commentsIterFailed = False
-
- On Error Resume Next
- Set commentIter = comments.Iterator()
- If Err.Number <> 0 Then
- commentsIterFailed = True
- Err.Clear
- End If
-
- Do While Not commentsIterFailed And commentIter.HasNext
- Set commentItem = commentIter.GetNext()
- If Err.Number <> 0 Then
- commentsIterFailed = True
- Err.Clear
- Exit Do
- End If
-
- Dim commentDateText
- commentDateText = ""
- If IsDate(commentItem.CreatedDate) Then
- commentDateText = FormatDateTime(commentItem.CreatedDate, vbLongDate)
- End If
- %>
- <div class="card shadow-sm mb-3 comment-card">
- <div class="card-body">
- <div class="d-flex justify-content-between mb-2">
- <strong class="small"><%= H(commentItem.AuthorName) %></strong>
- <span class="small text-muted"><%= H(commentDateText) %></span>
- </div>
- <%
- Dim commentBody
- commentBody = H(commentItem.Body)
- commentBody = Replace(commentBody, vbCrLf, "<br>")
- commentBody = Replace(commentBody, vbCr, "<br>")
- commentBody = Replace(commentBody, vbLf, "<br>")
- %>
- <p class="mb-0"><%= commentBody %></p>
- </div>
- </div>
- <%
- Loop
- If Err.Number <> 0 Then
- commentsIterFailed = True
- Err.Clear
- End If
- On Error GoTo 0
-
- If commentsIterFailed Then
- %>
- <div class="alert alert-warning mb-4">Some comments could not be displayed.</div>
- <%
- End If
- %>
- <% End If %>
-
- <!-- Comment form -->
- <div class="card shadow-sm mt-4">
- <div class="card-body">
- <h3 class="h5 mb-3">Leave a Comment</h3>
- <form method="post" action="<%= CommentsUrl() %>">
- <input type="hidden" name="PostID" value="<%= H(post.PostID) %>">
- <input type="hidden" name="PostSlug" value="<%= H(post.Slug) %>">
- <div class="mb-3">
- <label class="form-label" for="AuthorName">Name <span class="text-danger">*</span></label>
- <input class="form-control" type="text" id="AuthorName" name="AuthorName" required>
- </div>
- <div class="mb-3">
- <label class="form-label" for="AuthorEmail">Email <span class="text-muted small">(optional, not displayed)</span></label>
- <input class="form-control" type="email" id="AuthorEmail" name="AuthorEmail">
- </div>
- <div class="mb-3">
- <label class="form-label" for="Body">Comment <span class="text-danger">*</span></label>
- <textarea class="form-control" id="Body" name="Body" rows="4" required></textarea>
- </div>
- <button class="btn btn-primary" type="submit">Submit Comment</button>
- <p class="small text-muted mt-2 mb-0">Comments are reviewed before appearing.</p>
- </form>
- </div>
- </div>
- </section>
|