Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
21d4b5e
未チェックの日報タブを削除して、べつでタブを作る
sharoa119 Jul 17, 2025
0d13a48
未チェック周りを編集
sharoa119 Jul 18, 2025
bb4bd2c
未チェックバッジはメンターと管理者のみ
sharoa119 Jul 18, 2025
c5a2d34
プラクティスで絞り込むを条件分岐する
sharoa119 Jul 18, 2025
36cfdf9
未チェックタブにタイトルを追加。また、日報作成を削除
sharoa119 Jul 22, 2025
d679b15
未チェック専用ページがなくなったので、リンク先のパスを変更
sharoa119 Jul 22, 2025
479fb77
不要になったファイルを削除
sharoa119 Jul 22, 2025
eb3806b
不要になったReports::UncheckedControllerと関連するテストを削除
sharoa119 Jul 22, 2025
bf80e78
lintでチェックが入った箇所を修正
sharoa119 Jul 22, 2025
4b05006
不要になったコントローラーに関連するテストと、routesを削除
sharoa119 Jul 22, 2025
f8f0ca8
日報・ブログのページヘッダーにデザインを適用
machida Jul 22, 2025
ab90c3a
日報・ブログのpill-navのデザインを適用
machida Jul 30, 2025
e532b60
reportsにchecksのネストされたルーティングを追加
sharoa119 Aug 8, 2025
8889ba0
テストの安定化のため、reset_avatar後にuser.reloadを追加
sharoa119 Aug 12, 2025
df52aa6
アバターのテスト用フィクスチャが正しくアタッチされていることを検証
sharoa119 Aug 12, 2025
caba069
external_entries#index で「日報作成」ボタンが表示されないことを検証
sharoa119 Aug 12, 2025
e9e41a9
external_entries#index でも日報・ブログタブをアクティブ表示
sharoa119 Aug 12, 2025
875df59
旧ヘッダーを削除し、タイトルの二重表示を解
sharoa119 Aug 22, 2025
13d68b0
form_with をブロック化して practice filter が動作するよう修正し、
sharoa119 Aug 22, 2025
a3a6886
Node を20 に更新し、テストを安定化
sharoa119 Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/controllers/reports/unchecked_controller.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ReportsController < ApplicationController # rubocop:todo Metrics/ClassLeng
def index
@reports = Report.list.page(params[:page]).per(PAGER_NUMBER)
@reports = @reports.joins(:practices).where(practices: { id: params[:practice_id] }) if params[:practice_id].present?
@reports = @reports.unchecked.not_wip if params[:unchecked].present? && admin_or_mentor_login?
end

def show
Expand Down
3 changes: 1 addition & 2 deletions app/helpers/page_tabs/reports_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module PageTabs
module ReportsHelper
def report_page_tabs(active_tab:)
tabs = []
tabs << { name: '日報', link: reports_path }
tabs << { name: '未チェックの日報', link: reports_unchecked_index_path, badge: Cache.unchecked_report_count } if staff_login?
tabs << { name: '日報', link: reports_path, badge: admin_or_mentor_login? ? Cache.unchecked_report_count.presence : nil }
tabs << { name: 'みんなのブログ', link: external_entries_path }
render PageTabsComponent.new(tabs:, active_tab:)
end
Expand Down
3 changes: 1 addition & 2 deletions app/views/application/_global_nav.slim
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ nav.global-nav
i.fa-solid.fa-book
.global-nav-links__link-label プラクティス
li.global-nav-links__item
- report_link = admin_or_mentor_login? ? reports_unchecked_index_path : reports_path
= link_to report_link, class: "global-nav-links__link #{current_link(/^reports/)}" do
= link_to reports_path, class: "global-nav-links__link #{current_link(/^(reports|external_entries)/)}" do
.global-nav-links__link-icon
i.fa-solid.fa-pen
- if admin_or_mentor_login? && Cache.unchecked_report_count.positive?
Expand Down
43 changes: 23 additions & 20 deletions app/views/external_entries/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
- title 'みんなのブログ'
- content_for :title, 'みんなのブログ'
- set_meta_tags description: 'みんなのブログ一覧ページです。'

header.page-header
.container
.page-header__inner
.page-header__start
.page-header__title
| 日報・ブログ
.page-header__end
= render 'reports/new_report'

= report_page_tabs(active_tab: 'みんなのブログ')

- if current_user.feed_url.blank?
.a-page-notice.is-danger
.container.is-lg
.a-page-notice__inner
p
| #{current_user.login_name}さんのブログは
| まだ登録されていません。
= link_to edit_current_user_path(anchor: 'form-blog-feed') do
| ブログのフィード URL の登録
| をしてください。
main.page-main
header.page-main-header
.container
.page-main-header__inner
.page-main-header__start
h1.page-main-header__title
| みんなのブログ
.page-main-header__end
.page-header-actions

hr.a-border

- if current_user.feed_url.blank?
.a-page-notice.is-danger
.container.is-lg
.a-page-notice__inner
p
| #{current_user.login_name}さんのブログは
| まだ登録されていません。
= link_to edit_current_user_path(anchor: 'form-blog-feed') do
| ブログのフィード URL の登録
| をしてください。

= render('external_entries')
46 changes: 29 additions & 17 deletions app/views/reports/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
- title '日報'
- content_for :title, '日報'
- set_meta_tags description: '日報の一覧ページです。'

header.page-header
.container
.page-header__inner
.page-header__start
.page-header__title
| 日報・ブログ
.page-header__end
= render 'reports/new_report'

= report_page_tabs(active_tab: '日報')

.page-main
nav.page-filter.form
.container.is-md
= form_with url: reports_path, local: true, method: 'get'
.form-item.is-inline-md-up
= label_tag :practice_id, 'プラクティスで絞り込む', class: 'a-form-label'
= select_tag :practice_id, options_from_collection_for_select(@current_user_practice.sorted_practices, :id, :title, selected: params[:practice_id]), include_blank: '全ての日報を表示', onchange: 'this.form.submit()', id: 'js-choices-single-select'
main.page-main
header.page-main-header
.container
.page-main-header__inner
.page-main-header__start
h1.page-main-header__title
| 日報
.page-main-header__end
.page-header-actions
ul.page-header-actions__items
li.page-header-actions__item
= render 'reports/new_report'

hr.a-border

- if admin_or_mentor_login?
nav.pill-nav
ul.pill-nav__items
li.pill-nav__item
= link_to '全て', reports_path, class: "pill-nav__item-link#{' is-active' unless params[:unchecked]}"
li.pill-nav__item
= link_to '未チェック', reports_path(unchecked: true), class: "pill-nav__item-link#{' is-active' if params[:unchecked]}"
- if params[:unchecked].blank?
nav.page-filter.form.pb-0
.container.is-md
= form_with url: reports_path, local: true, method: :get do
.form-item.is-inline-md-up
= label_tag :practice_id, 'プラクティスで絞り込む', class: 'a-form-label'
= select_tag :practice_id, options_from_collection_for_select(@current_user_practice.sorted_practices, :id, :title, selected: params[:practice_id]), include_blank: '全ての日報を表示', onchange: 'this.form.submit()', id: 'js-choices-single-select'
.page-body
- if @reports.empty?
.o-empty-message
Expand Down
30 changes: 0 additions & 30 deletions app/views/reports/unchecked/index.html.slim

This file was deleted.

6 changes: 1 addition & 5 deletions config/routes/reports.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# frozen_string_literal: true

Rails.application.routes.draw do
namespace :reports do
resources :unchecked, only: %i(index)
end
Comment on lines -4 to -6
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

未チェックの日報のページ自体なくなってしまって良かったんでしたっけ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

コメントありがとうございます。
確認します!!


resources :reports do
resources :checks, only: %i[create destroy]
resources :checks, only: [:create, :destroy]
end
end
12 changes: 12 additions & 0 deletions test/system/external_entries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ class ExternalEntriesTest < ApplicationSystemTestCase
end
end
end

test 'does not show "New Report" button on External Entries page' do
visit_with_auth external_entries_url, 'komagata'
assert_no_link '日報作成'
assert_no_selector 'a.btn', text: '日報作成'
end

test 'does not show "New Report" button on External Entries page for general user' do
visit_with_auth external_entries_url, 'muryou'
assert_no_link '日報作成'
assert_no_selector 'a.btn', text: '日報作成'
end
end
32 changes: 0 additions & 32 deletions test/system/report/unchecked_test.rb

This file was deleted.

42 changes: 42 additions & 0 deletions test/system/reports_practice_filter_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

require 'application_system_test_case'

class ReportsPracticeFilterTest < ApplicationSystemTestCase
setup do
@user = users(:kimura)
@practice1 = practices(:practice1)
@practice2 = practices(:practice2)
@report1 = Report.create!(
user: @user,
title: 'レポート1',
description: 'テスト用レポート1',
reported_on: Time.zone.today
)
@report1.practices << @practice1

@report2 = Report.create!(
user: @user,
title: 'レポート2',
description: 'テスト用レポート2',
reported_on: Time.zone.today - 1.day
)
@report2.practices << @practice2

visit login_path
fill_in 'メールアドレス', with: @user.email
fill_in 'パスワード', with: 'testtest'
click_button 'ログイン'
end

test 'GET filter by practice works' do
visit reports_path(practice_id: @practice1.id)
assert_text 'レポート1', wait: 5
assert_no_text 'レポート2', wait: 5
end

test 'practice filter is hidden when unchecked parameter is present' do
visit reports_path(unchecked: true)
assert_no_selector 'select#js-choices-single-select', wait: 5
end
end
6 changes: 0 additions & 6 deletions test/system/reports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -657,12 +657,6 @@ def wait_for_watch_change
end
end

test 'mentors can see reports page if products published_at is nil' do
visit_with_auth '/reports/unchecked', 'mentormentaro'
click_link 'テストのnippou'
assert_text '今日は1時間学習しました。'
end

test 'open new report with a past date' do
visit_with_auth '/reports/new?reported_on=2022-1-1', 'komagata'
assert_equal '2022-01-01', find('#report_reported_on').value
Expand Down
5 changes: 4 additions & 1 deletion test/system/searchables_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ class SearchablesTest < ApplicationSystemTestCase
end

test 'show icon and go profile page when click icon' do
reset_avatar(users(:komagata))
user = users(:komagata)
reset_avatar(user)
user.reload
assert user.avatar.attached?, 'アバターのテスト用フィクスチャがアタッチできませんでした(komagata)'
visit_with_auth '/', 'hatsuno'
find('.js-modal-search-shown-trigger').click
within('form[name=search]') do
Expand Down