Add email comments to posts

This commit is contained in:
2024-03-10 13:21:06 +11:00
parent c52e7fe87f
commit 273be35a61
12 changed files with 129 additions and 32 deletions

View File

@@ -10,6 +10,7 @@ module Admin
def call(params:)
attrs_to_replace = {}
attrs_to_replace[:content] = markdown.call(content: params[:body]) if params[:body]
attrs_to_replace[:commentable] = params[:commentable]
tags = params[:tags].split(",").map(&:strip)

View File

@@ -3,6 +3,13 @@ module Admin
class WebmentionRepo < Adamantium::Repo[:webmentions]
commands update: :by_pk
def list_all_for_check
webmentions
.exclude(source_url: "email")
.order(:id)
.to_a
end
def list_all
webmentions
.order(:id)

View File

@@ -30,6 +30,9 @@ article class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 d
form action="/admin/post/#{post.id}/update" method="POST"
textarea name="body" class="text-gray-800 w-full border-blue-200 border-2 rounded p-2 mb-4" x-data="{ resize: () => { $el.style.height = '5px'; $el.style.height = $el.scrollHeight + 'px' } }" x-init="resize()" @input="resize()"
== markdown_body
fieldset class="mb-4 flex"
label for="commentable" class="mr-2" Commentable?
input class="mt-2" type="checkbox" value="true" id="commentable" name="commentable" switch="switch" checked=post.commentable
fieldset class="mb-4 flex"
label for="tags" class="mr-2" Tags:
input type="text" name="tags" id="tags" class="w-full px-1 border rounded" value="#{post.tags.map(&:label).join(", ")}"

View File

@@ -32,7 +32,10 @@ div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:
span
== webmention.content_html
td
a href="#{webmention.source_url}" Source
- if webmention.source_url == "email"
= "email"
- else
a href="#{webmention.source_url}" Source
td
a href="#{webmention.target_url}" Target
td