Fix Feedback Comments + Fixed Nav Anchor Workaround
* Admin Feedback page: fix the visit button to go to a reported comment. * CSS: with the fixed top nav bar, anchor links (like to the FAQ or specific comments on a thread) were scrolling so the anchor was below the nav bar. Add a scroll-padding-top to work around this.
This commit is contained in:
parent
39398a1f78
commit
90b7eea0dc
|
@ -137,19 +137,9 @@ func Feedback() http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
case "comments":
|
||||
// Get this comment.
|
||||
comment, err := models.GetComment(fb.TableID)
|
||||
if err != nil {
|
||||
session.FlashError(w, r, "Couldn't get comment ID %d: %s", fb.TableID, err)
|
||||
} else {
|
||||
// What was the comment on?
|
||||
switch comment.TableName {
|
||||
case "threads":
|
||||
// Visit the thread.
|
||||
templates.Redirect(w, fmt.Sprintf("/forum/thread/%d", comment.TableID))
|
||||
return
|
||||
}
|
||||
}
|
||||
// Redirect to the comment redirector.
|
||||
templates.Redirect(w, fmt.Sprintf("/go/comment?id=%d", fb.TableID))
|
||||
return
|
||||
case "forums":
|
||||
// Get this forum.
|
||||
forum, err := models.GetForum(fb.TableID)
|
||||
|
|
|
@ -105,6 +105,16 @@ From: <a href="/u/%s">@%s</a>
|
|||
if comment, err := models.GetComment(uint64(tableID)); err == nil {
|
||||
tableLabel = fmt.Sprintf(`A comment written by "%s"`, comment.User.Username)
|
||||
aboutUser = &comment.User
|
||||
footer = fmt.Sprintf(`
|
||||
|
||||
---
|
||||
|
||||
From: <a href="/u/%s">@%s</a>
|
||||
|
||||
%s`,
|
||||
comment.User.Username, comment.User.Username,
|
||||
markdown.Quotify(comment.Message),
|
||||
)
|
||||
} else {
|
||||
log.Error("/contact: couldn't produce table label for comment %d: %s", tableID, err)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
/* Custom CSS styles */
|
||||
|
||||
html {
|
||||
/* With the fixed top nav bar, this works around anchor-links to make them appear
|
||||
correctly BELOW the nav bar instead of overlapped underneath it. */
|
||||
scroll-padding-top: 52px;
|
||||
}
|
||||
|
||||
abbr {
|
||||
cursor: help;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user