From 17d660fd4b8516d6b446f7c41d7b076a29a242a1 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 12 Oct 2023 17:44:38 -0400 Subject: Added comment deleting Also I seem to have fixed the JS errors that were preventing the fancy stuff in the admin panel from working. --- app/views/admin/comments/index.html.haml | 23 +++++++++++++++++++++++ app/views/comments/_comment.html.haml | 2 +- app/views/layouts/admin.html.haml | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/comments/index.html.haml (limited to 'app/views') diff --git a/app/views/admin/comments/index.html.haml b/app/views/admin/comments/index.html.haml new file mode 100644 index 0000000..7b25c05 --- /dev/null +++ b/app/views/admin/comments/index.html.haml @@ -0,0 +1,23 @@ +- title "Comments" +%table#entries + %tr + %th Text + %th Author + %th Blog post + %th Date published + %th + - @comments.each do |comment| + %tr{ class: cycle("even", "odd") } + %td= comment.body + %td + %ul + %li= comment.username + %li= comment.email + - unless comment.website.empty? + %li= comment.website + %td= link_to comment.blog.title, comment.blog + %td= comment.published_at.strftime("%B %d, %Y, %l:%M%P") + %td + %ul.admin-actions + %li= link_to "View", blog_url(comment.blog, anchor: "comment-#{comment.id}") + %li= link_to "Delete", admin_comment_url(comment), method: :delete, data: { confirm: "Are you sure?" } diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 3e10759..3ad21e9 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -1,4 +1,4 @@ -.blog-comment +.blog-comment{ id: "comment-#{comment.id}" } %blockquote.bubble.rounded.bottom = image_tag comment.gravatar_url, class: "comment-avatar" = markdown(comment.body, { restricted: true }) diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 1c865b0..5d75ef5 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -37,5 +37,7 @@ = link_to "Games", admin_games_url, class: "major-link" %ul.minors %li.minor= link_to "New game", new_admin_game_url + %li{major_sidebar_attrs("comments")} + = link_to "Comments", admin_comments_url, class: "major-link" #main = yield -- cgit 1.4.1