File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def index
99 # 有効な年の範囲をチェック
1010 unless year . between? ( 2012 , Date . current . year )
1111 flash [ :alert ] = "指定された年(#{ year } )は無効です。2012年から#{ Date . current . year } 年の間で指定してください。"
12- return redirect_to dojos_path
12+ return redirect_to dojos_path ( anchor : 'table' )
1313 end
1414
1515 @selected_year = year
@@ -20,7 +20,7 @@ def index
2020 @page_title = "#{ @selected_year } 年末時点のCoderDojo一覧"
2121 rescue ArgumentError
2222 flash [ :alert ] = "無効な年が指定されました"
23- return redirect_to dojos_path
23+ return redirect_to dojos_path ( anchor : 'table' )
2424 end
2525 else
2626 # yearパラメータなしの場合(既存の実装そのまま)
Original file line number Diff line number Diff line change 3333 年次データのフィルタリング
3434 </ h3 >
3535
36- <% if @selected_year %>
36+ <% if flash [ :alert ] %>
37+ < div style ="padding: 10px; background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px; margin-bottom: 15px; color: #721c24; ">
38+ <%= flash [ :alert ] %>
39+ </ div >
40+ <% elsif @selected_year %>
3741 < div style ="padding: 10px; background: #d1ecf1; border: 1px solid #bee5eb; border-radius: 4px; margin-bottom: 15px; ">
3842 < strong > <%= @selected_year %> 年末時点</ strong > のアクティブな道場を表示中
3943 </ div >
Original file line number Diff line number Diff line change 5454
5555 it "rejects years before 2012" do
5656 get dojos_path ( year : 2011 , format : :json )
57- expect ( response ) . to redirect_to ( dojos_path )
57+ expect ( response ) . to redirect_to ( dojos_path ( anchor : 'table' ) )
5858 expect ( flash [ :alert ] ) . to include ( "2012年から" )
5959 end
6060
6161 it "rejects years after current year" do
6262 future_year = Date . current . year + 1
6363 get dojos_path ( year : future_year , format : :json )
64- expect ( response ) . to redirect_to ( dojos_path )
64+ expect ( response ) . to redirect_to ( dojos_path ( anchor : 'table' ) )
6565 expect ( flash [ :alert ] ) . to include ( "無効です" )
6666 end
6767
6868 it "handles invalid year strings" do
6969 get dojos_path ( year : "invalid" , format : :json )
70- expect ( response ) . to redirect_to ( dojos_path )
70+ expect ( response ) . to redirect_to ( dojos_path ( anchor : 'table' ) )
7171 expect ( flash [ :alert ] ) . to include ( "無効" )
7272 end
7373 end
You can’t perform that action at this time.
0 commit comments