コミットを比較

..

2 コミット

作成者 SHA1 メッセージ 日付
みてるぞ f0065af00a #279 2026-03-23 12:19:16 +09:00
みてるぞ ee93ff8ea0 タグ一覧ページの作成(#61) (#298)
#61

#61

Merge remote-tracking branch 'origin/main' into feature/061

#61

#61

#61

#61

#61

#61

#61

#61

#61

#61

日づけ不詳の表示修正

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #298
2026-03-21 19:58:02 +09:00
4個のファイルの変更25行の追加20行の削除
+8 -5
ファイルの表示
@@ -2,8 +2,8 @@ class TagsController < ApplicationController
def index def index
post_id = params[:post] post_id = params[:post]
name = params[:name].presence name = params[:name].to_s.strip.presence
category = params[:category].presence category = params[:category].to_s.strip.presence
post_count_between = (params[:post_count_gte].presence || -1).to_i, post_count_between = (params[:post_count_gte].presence || -1).to_i,
(params[:post_count_lte].presence || -1).to_i (params[:post_count_lte].presence || -1).to_i
post_count_between[0] = nil if post_count_between[0] < 0 post_count_between[0] = nil if post_count_between[0] < 0
@@ -36,7 +36,9 @@ class TagsController < ApplicationController
.includes(:tag_name, tag_name: :wiki_page) .includes(:tag_name, tag_name: :wiki_page)
q = q.where(posts: { id: post_id }) if post_id.present? q = q.where(posts: { id: post_id }) if post_id.present?
q = q.where('tag_names.name LIKE ?', "%#{ name }%") if name if name
q = q.where('tag_names.name LIKE ?', "%#{ ActiveRecord::Base.sanitize_sql_like(name) }%")
end
q = q.where(category: category) if category q = q.where(category: category) if category
q = q.where('tags.post_count >= ?', post_count_between[0]) if post_count_between[0] q = q.where('tags.post_count >= ?', post_count_between[0]) if post_count_between[0]
q = q.where('tags.post_count <= ?', post_count_between[1]) if post_count_between[1] q = q.where('tags.post_count <= ?', post_count_between[1]) if post_count_between[1]
@@ -77,7 +79,7 @@ class TagsController < ApplicationController
alias_rows = alias_rows =
TagName TagName
.where('name LIKE ?', "#{ q }%") .where('name LIKE ?', "#{ ActiveRecord::Base.sanitize_sql_like(q) }%")
.where.not(canonical_id: nil) .where.not(canonical_id: nil)
.pluck(:canonical_id, :name) .pluck(:canonical_id, :name)
@@ -97,7 +99,8 @@ class TagsController < ApplicationController
base base
.where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') + .where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') +
'tag_names.name LIKE ?'), 'tag_names.name LIKE ?'),
*(with_nico ? ['nico', "nico:#{ q }%"] : []), "#{ q }%") *(with_nico ? ['nico', "nico:#{ ActiveRecord::Base.sanitise_sql_like(q) }%"] : []),
"#{ ActiveRecord::Base.sanitise_sql_like(q) }%")
tags = tags =
if canonical_ids.present? if canonical_ids.present?
+6
ファイルの表示
@@ -6,6 +6,7 @@ import { DndContext,
useSensor, useSensor,
useSensors } from '@dnd-kit/core' useSensors } from '@dnd-kit/core'
import { restrictToWindowEdges } from '@dnd-kit/modifiers' import { restrictToWindowEdges } from '@dnd-kit/modifiers'
import { useQueryClient } from '@tanstack/react-query'
import { motion } from 'framer-motion' import { motion } from 'framer-motion'
import { useEffect, useMemo, useRef, useState } from 'react' import { useEffect, useMemo, useRef, useState } from 'react'
@@ -19,6 +20,7 @@ import SidebarComponent from '@/components/layout/SidebarComponent'
import { toast } from '@/components/ui/use-toast' import { toast } from '@/components/ui/use-toast'
import { CATEGORIES, CATEGORY_NAMES } from '@/consts' import { CATEGORIES, CATEGORY_NAMES } from '@/consts'
import { apiDelete, apiGet, apiPatch, apiPost } from '@/lib/api' import { apiDelete, apiGet, apiPatch, apiPost } from '@/lib/api'
import { postsKeys, tagsKeys } from '@/lib/queryKeys'
import { dateString, originalCreatedAtString } from '@/lib/utils' import { dateString, originalCreatedAtString } from '@/lib/utils'
import type { DragEndEvent } from '@dnd-kit/core' import type { DragEndEvent } from '@dnd-kit/core'
@@ -152,6 +154,8 @@ type Props = { post: Post; sp?: boolean }
export default (({ post, sp }: Props) => { export default (({ post, sp }: Props) => {
sp = Boolean (sp) sp = Boolean (sp)
const qc = useQueryClient ()
const baseTags = useMemo<TagByCategory> (() => { const baseTags = useMemo<TagByCategory> (() => {
const tagsTmp = { } as TagByCategory const tagsTmp = { } as TagByCategory
@@ -181,6 +185,8 @@ export default (({ post, sp }: Props) => {
const reloadTags = async (): Promise<void> => { const reloadTags = async (): Promise<void> => {
setTags (buildTagByCategory (await apiGet<Post> (`/posts/${ post.id }`))) setTags (buildTagByCategory (await apiGet<Post> (`/posts/${ post.id }`)))
qc.invalidateQueries ({ queryKey: postsKeys.root })
qc.invalidateQueries ({ queryKey: tagsKeys.root })
} }
const onDragEnd = async (e: DragEndEvent) => { const onDragEnd = async (e: DragEndEvent) => {
+4 -8
ファイルの表示
@@ -104,14 +104,10 @@ export default (({ posts, onClick }: Props) => {
{tagsVsbl && ( {tagsVsbl && (
<motion.div <motion.div
key="sptags" key="sptags"
className="md:hidden mt-4" className="md:hidden overflow-hidden"
variants={{ hidden: { clipPath: 'inset(0 0 100% 0)', initial={{ height: 0 }}
height: 0 }, animate={{ height: 'auto' }}
visible: { clipPath: 'inset(0 0 0% 0)', exit={{ height: 0 }}
height: 'auto'} }}
initial="hidden"
animate="visible"
exit="hidden"
transition={{ duration: .2, ease: 'easeOut' }}> transition={{ duration: .2, ease: 'easeOut' }}>
{posts.length > 0 && TagBlock} {posts.length > 0 && TagBlock}
</motion.div>)} </motion.div>)}