Skip to content

お試し延長作成のボタンの位置を変更した#9179

Merged
komagata merged 2 commits intomainfrom
chore/move-campaign-create-button
Oct 1, 2025
Merged

お試し延長作成のボタンの位置を変更した#9179
komagata merged 2 commits intomainfrom
chore/move-campaign-create-button

Conversation

@yokomaru
Copy link
Copy Markdown
Contributor

@yokomaru yokomaru commented Sep 15, 2025

Issue

概要

  • 管理者のお試し延長画面を表示した際、メニュータブの上に「+お試し延長作成」ボタンが配置されていたが、タブより上の部分で変化を起こしたくないためお試し延長一覧の表示と同じ高さで右部に表示させるように変更
  • 「+お試し延長作成」ボタンを header.page-header から header.page-main-header に移動するので、ボタンのCSSのをpage-header-actionsからpage-main-header-actions に変更
    • 併せて、お試し延長新規作成の同位置に表示している「< お試し延長一覧」ボタンのCSSをpage-main-header-actions に統一(編集画面はpage-main-header-actionsが適用されているため非修正対象)

変更確認方法

確認前準備

  1. chore/move-campaign-create-buttonをローカルに取り込む
  2. foreman start -f Procfile.devでローカルサーバーを起動
  3. 管理者ユーザー(id: machida または komagata/ pass: testtest )でログインする

お試し延長作成 ボタン

  1. 管理者用メニューのお試し延長一覧画面(http://localhost:3000/admin/campaigns) へ移動
  2. 「+お試し延長作成」ボタンが、お試し延長一覧の表示と同じ高さで右部に表示されていることを確認
  3. 「+お試し延長作成」ボタンをクリックするとお試し延長作成画面(http://localhost:3000/admin/campaigns/new) が表示されることを確認

お試し延長一覧 ボタン

  1. 管理者用メニューのお試し延長作成画面(http://localhost:3000/admin/campaigns/new) へ移動
  2. 「< お試し延長一覧」ボタンが、お試し延長作成の表示と同じ高さで右部に表示されていることを確認
  3. 「< お試し延長一覧」ボタンをクリックするとお試し延長一覧画面(http://localhost:3000/admin/campaigns) が表示されることを確認

Screenshot

お試し延長作成 ボタン

  • ボタンの位置が変更されていることを確認
変更前 変更後
ブラウザ
表示
レスポンシブ
表示(念の為)

お試し延長一覧 ボタン

  • 見た目や位置が変わっていないことを確認
変更前 変更後
ブラウザ
表示
レスポンシブ
表示(念の為)

Summary by CodeRabbit

  • スタイル
    • 管理画面のキャンペーン一覧で、作成ボタンをヘッダー右上からページ本文のヘッダー右側(.page-main-header__end 等)へ移動し、視認性と配置を改善しました。
    • ボタンの文言は引き続き「お試し延長作成」、アイコン・見た目・遷移先は従来どおり保持しています。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 15, 2025

Walkthrough

管理画面のキャンペーン関連ビューで、新規作成ボタンのDOM構造と配置を変更。new_admin_campaign_pathへのリンク・ボタン本体(クラス、アイコン、ラベル)は維持し、indexではヘッダーからmain.page-main配下(.page-main-header__end)へ移動、newではアクションコンテナのクラス階層をpage-header-actions系からpage-main-header-actions系へ置換。

Changes

Cohort / File(s) Summary
Index: アクション配置移動
app/views/admin/campaigns/index.html.slim
ヘッダー(header.page-header)内の新規作成リンクを削除し、同じlink_to new_admin_campaign_patha-button is-md is-secondary is-blocki.fa-regular.fa-plus、ラベル「お試し延長作成」)をmain.page-main配下の.page-main-header__endへ追加。
New: アクションコンテナのクラス名変更
app/views/admin/campaigns/new.html.slim
ページ内のアクションコンテナ階層をpage-header-actions/...からpage-main-header-actions/...へ置換(リンクや表示内容は変更なし)。

Sequence Diagram(s)

(この変更はビュー上のDOM構造・クラス調整であり、コントロールフローや新しい機能は含まれないため、シーケンス図は省略します。)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • komagata

Poem

ぽん、とボタンが席替えしたよ
見出し越えてメインへぴょんと移動
同じ道、同じアイコンで待つ
押せば伸びるはお試しの時
うさぎが跳ねて喜ぶよ 🐇✧

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed タイトルはプルリクの主要な変更点(「お試し延長作成」ボタンの位置移動)を簡潔かつ明確に表しており、差分の内容(header から page-main-header への移動とクラス名変更)と一致しています。レビュー履歴を眺める際に主旨が伝わる短い表現になっています。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed PR説明はリポジトリのテンプレートに概ね準拠しており、Issue番号(#9091)、概要、変更確認方法(ブランチ名を含む手順)および変更前後のスクリーンショットが含まれていて再現手順も具体的です。手順は管理者ログインや画面遷移まで明記されておりレビュアーが検証しやすい構成になっています。番号付けの重複など軽微な体裁の不統一は見られますが、重要な情報の欠落はなくテンプレート要件を満たしていると判断します。
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/move-campaign-create-button

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yokomaru yokomaru changed the title お試し延長作成のボタンの位置を変更した [WIP]お試し延長作成のボタンの位置を変更した Sep 15, 2025
@yokomaru yokomaru changed the title [WIP]お試し延長作成のボタンの位置を変更した お試し延長作成のボタンの位置を変更した Sep 15, 2025
@yokomaru yokomaru marked this pull request as ready for review September 15, 2025 13:02
@github-actions github-actions bot requested a review from komagata September 15, 2025 13:02
@yokomaru
Copy link
Copy Markdown
Contributor Author

yokomaru commented Sep 15, 2025

@machida
お疲れ様です!
管理画面の各メニューにおける作成/一覧ボタンのスタイルについてご相談させてください🙋


相談したいこと

  • このPRでの修正範囲についてどちらが適切か
    • このPRでは index のみに対応し、new/edit などの統一は別途 issue を立てる
    • このPRの中でキャンペーン系(index/new/edit)のみ header.page-main-header に統一する
  • faq や companies などキャンペーン以外の画面については別issueを立てて整理する方向でよいか

詳細

お試し延長一覧画面 (http://localhost:3000/admin/campaigns) の「+ お試し延長作成」ボタンを
header.page-header から header.page-main-header に移動し、CSSクラスも .page-header-actions.page-main-header-actions に変更しました

一方で、同じ位置に配置されている「< お試し延長一覧」ボタンについては、
ページごとに適用クラスが異なっていました(見た目や配置は同じように表示されています)

また、faq や companies などキャンペーン以外の画面でも .page-header-actions.page-main-header-actions が混在している状況を確認しました


考え

見た目や配置は現状どちらのクラスでも問題なさそうなのですが、配置箇所が header.page-main-header であることを踏まえると .page-main-header-actions を適用する方が適切かな、と思っています。
上記で統一しておいた方が今後の修正時に迷いづらくなるのではないかと思います🤔

このPRでキャンペーン系(index/new/edit)まで統一してしまうのがよいか、それとも index のみで区切って別issueを立てて整理した方がよいかご意見いただけると助かります🙇‍♀️

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
app/views/admin/campaigns/index.html.slim (3)

23-26: アイコンのa11yとFAスタイルを微調整しませんか

  • アイコンは装飾用途なので aria-hidden を付与推奨。
  • Font Awesome の plus は通常 solid系です。現状の fa-regular で描画できるかご確認ください(テーマ依存)。

適用案(FAのスタイルはご利用環境に合わせて調整):

-                  i.fa-regular.fa-plus
+                  i.fa-solid.fa-plus(aria-hidden="true")

23-26: is-block によりヘッダ内で横幅を取りすぎる可能性を確認

ヘッダのアクション領域では横並びが前提のことが多く、is-block がフル幅になってしまうレイアウト崩れの原因になる場合があります。スクリーンショット上問題なければ維持でOKですが、もし気になるようなら is-block の除去も検討ください。

適用例:

-                = link_to new_admin_campaign_path, class: 'a-button is-md is-secondary is-block' do
+                = link_to new_admin_campaign_path, class: 'a-button is-md is-secondary' do

20-22: 確認結果:.page-main-header-actions は定義済みで、該当ビューは旧クラスを参照していません。

  • 定義: app/javascript/stylesheets/application/blocks/page/_page-main-header-actions.sass(app/javascript/stylesheets/application.sass で @import されています)。
  • 対象ビュー: app/views/admin/campaigns/index.html.slim は .page-main-header-actions を使用しており、.page-header-actions は含まれていません。
  • 注意: リポジトリ内に旧クラス .page-header-actions を参照するテンプレートが多数残っています(例: app/views/notifications/index.html.slim、app/javascript/stylesheets/application/blocks/page/_page-header-actions.sass)。統一が必要なら横断的な置換/古いスタイルの削除を検討してください。
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7665c5 and e36e16d.

📒 Files selected for processing (1)
  • app/views/admin/campaigns/index.html.slim (1 hunks)
🔇 Additional comments (1)
app/views/admin/campaigns/index.html.slim (1)

19-26: 配置変更は目的どおりでOK

ボタンを .page-main-header__end 側へ移動しており、PR目的に合致。リンク先・クラスも維持されています。

@yokomaru yokomaru self-assigned this Sep 15, 2025
@yokomaru
Copy link
Copy Markdown
Contributor Author

yokomaru commented Sep 20, 2025

#9179 (comment)

上記の件は9/17のMTGで町田さんに確認し、このPRではお試し延長ページのコンテンツタブ内のボタンのスタイルをpage-main-header-actionsに統一する(edit/new/index)ことに決定。
それ以外の管理画面のページは別途Issueを立てて対応する。

- 管理ページヘッダーにあったボタンをお試し期間ページ内のヘッダー(`header.page-main-header`)に移動した
- 移動先のクラスに合わせてボタンのCSSを`page-main-header`に変更した
- 他のお試し延長画面(edit/index)に合わせて、`header.page-main-header`内に配置されているボタンに適用するCSSは`page-main-header-actions`に統一する
@yokomaru yokomaru force-pushed the chore/move-campaign-create-button branch from e36e16d to ca87ad9 Compare September 20, 2025 11:32
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
app/views/admin/campaigns/new.html.slim (3)

20-24: 軽いリファクタ: アクション群の共通ラッパをパーシャル化

同一BEM構造を new/index/edit で繰り返すなら、レイアウトパーシャルでラップすると保守が楽です。

該当箇所を以下のように置換(本ファイル内差分):

-          .page-main-header-actions
-            .page-main-header-actions__items
-              .page-main-header-actions__item
-                = link_to admin_campaigns_path, class: 'a-button is-md is-secondary is-block is-back' do
-                  | お試し延長一覧
+          = render layout: 'admin/shared/page_main_header_actions' do
+            .page-main-header-actions__item
+              = link_to admin_campaigns_path, class: 'a-button is-md is-secondary is-block is-back' do
+                | お試し延長一覧

新規パーシャル(ファイル追加):

/ app/views/admin/shared/_page_main_header_actions.html.slim
.page-main-header-actions
  .page-main-header-actions__items
    = yield

23-24: i18n化(任意)

文言を翻訳キーに寄せると将来の文言統一が容易です。

差分例:

-                  | お試し延長一覧
+                  = t('admin.campaigns.index.back_to_list', default: 'お試し延長一覧')

ロケール例:

# config/locales/ja.yml
ja:
  admin:
    campaigns:
      index:
        back_to_list: お試し延長一覧

20-24: UI確認ポイント(レスポンシブ)

.is-block は狭幅での全幅化を誘発します。ヘッダー右寄せのボタン群で崩れがないか、主要ブレークポイント(<=480px, 768px, 1024px)での折返しと余白を目視確認してください。問題があれば .is-block の条件付与やコンテナ側のフレックス設定で調整を。

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e36e16d and ca87ad9.

📒 Files selected for processing (2)
  • app/views/admin/campaigns/index.html.slim (1 hunks)
  • app/views/admin/campaigns/new.html.slim (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/views/admin/campaigns/index.html.slim
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (2)
app/views/admin/campaigns/new.html.slim (2)

20-22: DOMの移設とBEMブロックの統一は妥当(page-main-header-actions へ集約)

.page-main-header__end 配下にアクションを置く方針と合致しており、命名も既存パターンと整合しています。


20-24: 確認結果 — CSS定義あり、ビューは統一済み、テスト参照要確認

  • CSS: app/javascript/stylesheets/application/blocks/page/_page-main-header-actions.sass に .page-main-header-actions__items と .page-main-header-actions__item の定義あり。
  • ビュー: app/views/admin/campaigns/{new.html.slim, edit.html.slim, index.html.slim, _form.html.slim} に .page-main-header-actions / __items / __item が出現(new/edit/index は 20–22 行で確認)。
  • 旧クラス残存: app/views/admin/campaigns 配下に 'page-header-actions' の残存は無し。
  • テスト: spec ディレクトリが存在しないため、テスト内で旧クラス参照の有無を確認できていない。テストが別ディレクトリ(例: test/)にある場合は同様に検索するか、CI/ローカルでテストを実行して旧セレクタ参照を確認すること。

@yokomaru
Copy link
Copy Markdown
Contributor Author

@smallmonkeykey

リサさん、お疲れ様です!
ご都合のよいタイミングでこちらのレビューをしていただけますでしょうか?
急ぎではありませんので、お時間のある際で大丈夫ですっ🙌
よろしくお願いいたします 🙏

@smallmonkeykey
Copy link
Copy Markdown
Contributor

@yokomaru
レビュー依頼ありがとうございます!
承知しました!

@smallmonkeykey smallmonkeykey self-requested a review September 25, 2025 05:26
@smallmonkeykey
Copy link
Copy Markdown
Contributor

@yokomaru
確認しました!Approveさせていただきます〜🙆
レスポンシブ表示などもあってわかりやすかったです!
また、今後の保守性まで見据えられてて勉強になりました👀

@yokomaru
Copy link
Copy Markdown
Contributor Author

@smallmonkeykey
リサさん、Reviewer登録こちらでできておらずすみません🙏💦

丁寧な確認をありがとうございますっ!
(Descriptionなどを書くときリサさんのやつをかなり参考にさせていただいてますっ☺️笑)

レビュー&Approveありがとうございましたー!

@yokomaru
Copy link
Copy Markdown
Contributor Author

@komagata
メンバーレビューが終わりました!
お手隙でレビューをお願いします🙏

Copy link
Copy Markdown
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確認させていただきました。OKです〜!

@komagata komagata merged commit 5216319 into main Oct 1, 2025
20 checks passed
@komagata komagata deleted the chore/move-campaign-create-button branch October 1, 2025 05:14
@github-actions github-actions bot mentioned this pull request Oct 1, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants