fix: 管理画面の認証ページのbodyクラスをlayout-adminから分離#159
Conversation
ログイン・パスワードリセット画面は左メニューが存在しないため、 layout-adminではなくlayout-admin-authを使用するよう変更。 content_for(:body_class)でビュー側からbodyクラスを指定できるよう admin.html.erbを改修し、対象の3画面に設定を追加した。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough管理者認証ページテンプレート(パスワードリセット、セッション新規作成)に Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/views/admin/password_resets/show.html.erb`:
- Line 2: The page sets content_for :body_class to "layout-admin-auth" but no
corresponding CSS exists, so styles applied to body.layout-admin (color,
background-color, and admin-nav padding offset) are lost; either add a Tailwind
component that defines the .layout-admin-auth rules (mirroring the variables and
offsets used by body.layout-admin) or change the views (e.g., show.html.erb,
sessions/new.html.erb, password_resets/new.html.erb) to reuse the existing
layout-admin class; update the Tailwind components so the design-system CSS
variables (e.g., --color-text-primary, --color-admin-bg-body) and the nav
padding-left offset are applied to .layout-admin-auth if you choose the new
class.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0dc05c1a-befe-461c-99c3-1556b3a63387
📒 Files selected for processing (4)
app/views/admin/password_resets/new.html.erbapp/views/admin/password_resets/show.html.erbapp/views/admin/sessions/new.html.erbapp/views/layouts/admin.html.erb
| @@ -1,4 +1,5 @@ | |||
| <% content_for :title, "新しいパスワードの設定" %> | |||
| <% content_for :body_class, "layout-admin-auth" %> | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check if layout-admin-auth CSS styles are defined
# Search for layout-admin-auth CSS definitions
rg -n 'layout-admin-auth' --type css
# Also check for any SCSS/CSS files that might define these styles
fd -e css -e scss | xargs grep -l 'layout-admin-auth' 2>/dev/null || echo "No CSS files found with layout-admin-auth"Repository: machida/mb
Length of output: 95
🏁 Script executed:
# Check if body.layout-admin CSS exists
rg -n 'body\.layout-admin|\.layout-admin' --type css
# Search for layout-admin in CSS/SCSS files
fd -e css -e scss -e tailwind | xargs grep -l 'layout-admin' 2>/dev/null
# Check the admin layout file structure
fd -n 'application.html.erb|admin.*layout' --type f | head -10Repository: machida/mb
Length of output: 2727
🏁 Script executed:
# Read the specific file being reviewed
cat -n app/views/admin/password_resets/show.html.erb | head -20
# Check for _admin-body.css
fd -n '_admin-body' --type fRepository: machida/mb
Length of output: 1320
🏁 Script executed:
# Search for content_for :body_class usage patterns across the codebase
rg -A 3 'content_for.*:body_class' --type erb | head -30Repository: machida/mb
Length of output: 1597
🏁 Script executed:
# Read _admin-body.css to see what styles are defined for body.layout-admin
cat -n app/assets/tailwind/components/_admin-body.css
# Also check _layout.css around line 57
sed -n '50,70p' app/assets/tailwind/components/_layout.cssRepository: machida/mb
Length of output: 606
🏁 Script executed:
# Search for any layout-admin-auth definition in all file types
rg 'layout-admin-auth' -nRepository: machida/mb
Length of output: 341
layout-admin-auth クラスに対応するCSS定義がありません
body.layout-admin セレクタに定義されている以下のスタイルが適用されなくなります:
color: var(--color-text-primary)- テキスト色変数background-color: var(--color-admin-bg-body)- 背景色変数- ログイン状態時の管理画面ナビゲーションの
padding-leftオフセット
Line 4 のラッパー div に bg-sky-50 などのインライン Tailwind クラスがある場合でも、CSS 変数を使用した設計システムの意図が損なわれます。
layout-admin-auth 用の CSS を app/assets/tailwind/components/ に定義するか、既存の layout-admin クラスを再利用してください。このパターンは app/views/admin/sessions/new.html.erb と app/views/admin/password_resets/new.html.erb でも同じ問題を抱えています。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/views/admin/password_resets/show.html.erb` at line 2, The page sets
content_for :body_class to "layout-admin-auth" but no corresponding CSS exists,
so styles applied to body.layout-admin (color, background-color, and admin-nav
padding offset) are lost; either add a Tailwind component that defines the
.layout-admin-auth rules (mirroring the variables and offsets used by
body.layout-admin) or change the views (e.g., show.html.erb,
sessions/new.html.erb, password_resets/new.html.erb) to reuse the existing
layout-admin class; update the Tailwind components so the design-system CSS
variables (e.g., --color-text-primary, --color-admin-bg-body) and the nav
padding-left offset are applied to .layout-admin-auth if you choose the new
class.
layout-admin-authクラスにCSS変数・色・背景色が当たらない問題を修正。 _admin-colors.css/_admin-body.css/_utilities.cssの各セレクタに .layout-admin-authを追加し、認証ページでもadminのデザイントークンが 継承されるようにした。is--logged-inのnav padding-leftは不要なため除外。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
概要
ログイン・パスワードリセット画面は左メニューが存在しないため、
bodyタグのクラスをlayout-adminからlayout-admin-authに変更しました。変更内容
app/views/layouts/admin.html.erbcontent_for(:body_class)が指定されていればそれを使い、なければ従来のlayout-admin+ テーマカラー等を適用するように変更。対象ビュー(3画面)に
layout-admin-authを指定app/views/admin/sessions/new.html.erb(ログイン)app/views/admin/password_resets/new.html.erb(パスワードリセット申請)app/views/admin/password_resets/show.html.erb(新パスワード設定)実施済みコマンド
🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート