This commit is contained in:
@@ -5,7 +5,15 @@ require 'nokogiri'
|
|||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
# GET /posts
|
# GET /posts
|
||||||
def index
|
def index
|
||||||
posts = filtered_posts
|
latest_id = params[:latest].to_i
|
||||||
|
offset = params[:offset].to_i
|
||||||
|
|
||||||
|
posts = filtered_posts.order(created_at: :desc)
|
||||||
|
posts = if posts.first&.id == latest_id
|
||||||
|
posts.limit(20).offset(offset)
|
||||||
|
else
|
||||||
|
posts.limit(offset + 20)
|
||||||
|
end
|
||||||
render json: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } })
|
render json: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
body {
|
||||||
|
@apply overflow-x-clip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|||||||
Reference in New Issue
Block a user