From c560c73cd321e69de2397ae2028fb57f4a997d7e Mon Sep 17 00:00:00 2001 From: nano Date: Mon, 4 May 2026 19:02:03 +0000 Subject: [PATCH] Improve BrainOrdure editorial UI --- app/views/Posts/show.asp | 254 +++++++++++++++++++++------------------ 1 file changed, 138 insertions(+), 116 deletions(-) diff --git a/app/views/Posts/show.asp b/app/views/Posts/show.asp index 81ac85d..1c88bec 100644 --- a/app/views/Posts/show.asp +++ b/app/views/Posts/show.asp @@ -1,138 +1,160 @@ -
-
- - -
Feature story
-

<%= H(post.Title) %>

+<% +Dim postHeroBackground, postHeroClass, publishedText, readTimeText +postHeroBackground = ExtractFirstImageSrc(post.Body) +postHeroClass = "masthead masthead-post" +If Len(postHeroBackground) > 0 Then + postHeroClass = postHeroClass & " masthead-has-image" +End If - <% - Dim publishedText - publishedText = "" - If IsDate(post.PublishedDate) Then - If CDate(post.PublishedDate) > #1/1/1970# Then - publishedText = FormatDateTime(post.PublishedDate, vbLongDate) - End If +publishedText = "" +If IsDate(post.PublishedDate) Then + If CDate(post.PublishedDate) > #1/1/1970# Then + publishedText = FormatDateTime(post.PublishedDate, vbLongDate) End If +End If +readTimeText = EstimateReadTime(post.Body) +%> - If Len(publishedText) > 0 Then - %> - - <% - End If +
0 Then %> style="background-image: url('<%= H(postHeroBackground) %>')"<% End If %>> +
+
+
+
+
+
Feature story
+

<%= H(post.Title) %>

+ <% If Len(publishedText) > 0 Or Len(readTimeText) > 0 Then %> + + <% End If %> +
+
+
+
+
- Dim postBody - postBody = RenderPostBody(post.Body) - %> +
+
+ -
<%= postBody %>
-
-
+
+
<%= RenderPostBody(post.Body) %>
+
- -
- <% - 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 + +
+ <% + Dim commentsCount, commentsLoadFailed commentsCount = 0 - Err.Clear - End If - On Error GoTo 0 - %> -

Comments (<%= commentsCount %>)

+ commentsLoadFailed = False - <% If commentsLoadFailed Then %> -
Comments are temporarily unavailable.
- <% ElseIf commentsCount = 0 Then %> -

No comments yet. Be the first to leave one below.

- <% Else %> - <% - Dim commentIter, commentItem - Dim commentsIterFailed - commentsIterFailed = 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 + %> +

Comments (<%= commentsCount %>)

- On Error Resume Next - Set commentIter = comments.Iterator() - If Err.Number <> 0 Then - commentsIterFailed = True - Err.Clear - End If + <% If commentsLoadFailed Then %> +
Comments are temporarily unavailable.
+ <% ElseIf commentsCount = 0 Then %> +

No comments yet. Be the first to leave one below.

+ <% Else %> + <% + Dim commentIter, commentItem + Dim commentsIterFailed + commentsIterFailed = False - Do While Not commentsIterFailed And commentIter.HasNext - Set commentItem = commentIter.GetNext() + On Error Resume Next + Set commentIter = comments.Iterator() 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 - %> -
-
-
- <%= H(commentItem.AuthorName) %> - <%= H(commentDateText) %> + 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 + %> +
+
+
+ <%= H(commentItem.AuthorName) %> + <%= H(commentDateText) %> +
+ <% + Dim commentBody + commentBody = H(commentItem.Body) + commentBody = Replace(commentBody, vbCrLf, "
") + commentBody = Replace(commentBody, vbCr, "
") + commentBody = Replace(commentBody, vbLf, "
") + %> +

<%= commentBody %>

+
<% - Dim commentBody - commentBody = H(commentItem.Body) - commentBody = Replace(commentBody, vbCrLf, "
") - commentBody = Replace(commentBody, vbCr, "
") - commentBody = Replace(commentBody, vbLf, "
") - %> -

<%= commentBody %>

-
-
- <% - Loop - If Err.Number <> 0 Then - commentsIterFailed = True - Err.Clear - End If - On Error GoTo 0 + Loop + If Err.Number <> 0 Then + commentsIterFailed = True + Err.Clear + End If + On Error GoTo 0 - If commentsIterFailed Then - %> -
Some comments could not be displayed.
- <% - End If - %> - <% End If %> + If commentsIterFailed Then + %> +
Some comments could not be displayed.
+ <% + End If + %> + <% End If %> - -
-
-

Leave a Comment

-
- - -
- - + +
+
+

Leave a Comment

+ + + +
+ + +
+
+ + +
+
+ + +
+ +

Comments are reviewed before appearing.

+
-
- - -
-
- - -
- -

Comments are reviewed before appearing.

- -
+
+
-
+