Files
adamantium/slices/admin/templates/posts/show.html.slim
2024-09-29 17:09:23 +10:00

70 lines
3.6 KiB
Plaintext

div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200 bg-pink-100 p-4 rounded"
h3 Syndicated to
ul
- post.syndication_sources.to_a.each do |name, url|
li
a href=url
= name
= " — "
button hx-swap="afterend" hx-post="/admin/posts/#{post.id}/de_syndicate/#{name}" de-syndicate
form hx-post="/admin/posts/#{post.id}/syndicate/add_source"
span class="mr-2"
label for="syndication_source_name"
' Name:
select id="syndication_source_name" name="syndication_source_name"
option value="" (none)
option value="mastodon" Mastodon
option value="blue_sky" Blue Sky
span class="mr-2"
label for="syndication_source_url"
' URL:
input type="text" id="syndication_source_url" name="syndication_source_url"
button type="submit" Add source
button hx-post="/admin/posts/#{post.id}/syndicate/day_one" Send to Day One
// TODO: Add preview, fix sending to DayOne
article x-data="$textHighlighter, {isOpen: false, anchorX: 0, anchorY: 0, text: ''}" class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline prose-img:rounded"
- if post.post_type != "bookmark"
a href="/post/#{post.slug}"
h1= post.name || "💬"
form action="/admin/post/#{post.id}/update" method="POST"
- if post.post_type != "bookmark"
fieldset class="mb-4 flex"
label for="slug" class="mr-2" Slug:
input type="text" name="slug" id="slug" class="w-full px-1 border rounded" value="#{post.slug}"
div id="editor" data-post-text="#{markdown_body}"
textarea id="body" 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
- if post.post_type == "bookmark"
div x-ref="bookmarkText" @mouseup.capture="highlightText()"
== post.cached_content
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(", ")}"
button class="rounded bg-blue-100 hover:bg-blue-200 text-blue-600 px-2 hover:cursor-pointer" type="submit"
= "Update"
- if post.highlights.count > 0
table class="prose dark:prose-invert table-auto"
- post.highlights.each_with_index do |highlight, idx|
tr class="#{idx.even? ? 'bg-amber-50' : ''}"
td class="p-2"
= highlight.text
td class="p-2"
form method="POST" action="/admin/post/#{post.id}/highlight/#{highlight.id}"
input type="hidden" name="_method" value="delete"
button
= "Delete"
- if post.post_type == "bookmark"
div @click.outside="isOpen = false" class="p-2 bg-indigo-900 hover:bg-indigo-800 rounded text-white shadow-md shadow-indigo-500" x-show="isOpen" x-anchor.no-style="$refs.bookmarkText" :style="{ position: 'absolute', hidden: isOpen, top: isOpen ? anchorY : '0px', left: isOpen ? anchorX : '0px' }"
form method="POST" class="p-0 m-0" action="/admin/post/#{post.id}/highlight"
input type="hidden" name="post_id" value="#{post.id}"
input class="text-gray-600" type="hidden" x-model="text" name="text"
button = "Save highlight"