コミットを比較
3 コミット
cbade1cd83
...
7d2cd85754
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 7d2cd85754 | |||
| f3bd9bea77 | |||
| ede46fda82 |
@@ -19,8 +19,16 @@ class PostsController < ApplicationController
|
|||||||
posts = posts.first(limit)
|
posts = posts.first(limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: { posts: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }),
|
render json: { posts: posts.map { |post|
|
||||||
next_cursor: }
|
post.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }).tap { |json|
|
||||||
|
json['thumbnail'] =
|
||||||
|
if post.thumbnail.attached?
|
||||||
|
rails_storage_proxy_url(post.thumbnail, only_path: false)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}, next_cursor: }
|
||||||
end
|
end
|
||||||
|
|
||||||
def random
|
def random
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
<IfModule mod_headers.c>
|
||||||
|
<FilesMatch "\.(css|js|jpg|png|webp|woff2?)$">
|
||||||
|
Header set Cache-Control "max-age=31536000, public"
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteBase /
|
RewriteBase /
|
||||||
|
|||||||
@@ -94,13 +94,16 @@ export default () => {
|
|||||||
{posts.length
|
{posts.length
|
||||||
? (
|
? (
|
||||||
<div className="flex flex-wrap gap-4 gap-y-8 p-4 justify-between">
|
<div className="flex flex-wrap gap-4 gap-y-8 p-4 justify-between">
|
||||||
{posts.map (post => (
|
{posts.map ((post, i) => (
|
||||||
<Link to={`/posts/${ post.id }`}
|
<Link to={`/posts/${ post.id }`}
|
||||||
key={post.id}
|
key={post.id}
|
||||||
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg">
|
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg">
|
||||||
<img src={post.thumbnail || post.thumbnailBase || undefined}
|
<img src={post.thumbnail || post.thumbnailBase || undefined}
|
||||||
alt={post.title || post.url}
|
alt={post.title || post.url}
|
||||||
title={post.title || post.url || undefined}
|
title={post.title || post.url || undefined}
|
||||||
|
loading="eager"
|
||||||
|
fetchPriority="high"
|
||||||
|
decoding="async"
|
||||||
className="object-none w-full h-full" />
|
className="object-none w-full h-full" />
|
||||||
</Link>))}
|
</Link>))}
|
||||||
</div>)
|
</div>)
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする