Replace "even" and "odd" CSS classes with "this-month" and "other-month" for calendar days (#41509).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23151 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-10-20 07:02:22 +00:00
parent 1d46be8b0f
commit 309e6a27f3
3 changed files with 13 additions and 11 deletions

View File

@@ -1245,12 +1245,14 @@ ul.cal {
.cal .calbody p.day-num {font-size: 1.1em; text-align:right;} .cal .calbody p.day-num {font-size: 1.1em; text-align:right;}
.cal .calbody .abbr-day {display:none} .cal .calbody .abbr-day {display:none}
.cal .calbody.odd p.day-num {color: #bbb;} .cal .calbody.this-month {background-color:#fff;}
.cal .calbody.other-month {background-color:#f6f7f8;}
.cal .calbody.other-month p.day-num {color: #bbb;}
.cal .calbody.today {background:#ffd;} .cal .calbody.today {background:#ffd;}
.cal .calbody.today p.day-num {font-weight: bold;} .cal .calbody.today p.day-num {font-weight: bold;}
.cal .calbody .icon {padding-top: 2px; padding-bottom: 3px;} .cal .calbody .icon {padding-top: 2px; padding-bottom: 3px;}
.cal .calbody.nwday:not(.odd) {background-color:#f1f1f1;} .cal .calbody.nwday:not(.other-month) {background-color:#f1f1f1;}
p.cal.legend span {display:flex;} p.cal.legend span {display:flex;}
.controller-calendars p.buttons {margin-top: unset;} .controller-calendars p.buttons {margin-top: unset;}

View File

@@ -57,7 +57,7 @@ module Redmine
end end
def day_css_classes(day) def day_css_classes(day)
css = day.month==month ? +'even' : +'odd' css = day.month==month ? +'this-month' : +'other-month'
css << " today" if User.current.today == day css << " today" if User.current.today == day
css << " nwday" if non_working_week_days.include?(day.cwday) css << " nwday" if non_working_week_days.include?(day.cwday)
css css

View File

@@ -219,14 +219,14 @@ class CalendarsControllerTest < Redmine::ControllerTest
assert_select 'ul' do assert_select 'ul' do
assert_select 'li.week-number:nth-of-type(2)', :text => /53$/ assert_select 'li.week-number:nth-of-type(2)', :text => /53$/
assert_select 'li.odd', :text => /^27/ assert_select 'li.other-month', :text => /^27/
assert_select 'li.even', :text => /^2/ assert_select 'li.this-month', :text => /^2/
end end
assert_select 'ul' do assert_select 'ul' do
assert_select 'li.week-number', :text => /1$/ assert_select 'li.week-number', :text => /1$/
assert_select 'li.odd', :text => /^3/ assert_select 'li.other-month', :text => /^3/
assert_select 'li.even', :text => /^9/ assert_select 'li.this-month', :text => /^9/
end end
with_settings :start_of_week => 1 do with_settings :start_of_week => 1 do
@@ -242,14 +242,14 @@ class CalendarsControllerTest < Redmine::ControllerTest
assert_select 'ul' do assert_select 'ul' do
assert_select 'li.week-number:nth-of-type(2)', :text => /53$/ assert_select 'li.week-number:nth-of-type(2)', :text => /53$/
assert_select 'li.even', :text => /^28/ assert_select 'li.this-month', :text => /^28/
assert_select 'li.even', :text => /^3/ assert_select 'li.this-month', :text => /^3/
end end
assert_select 'ul' do assert_select 'ul' do
assert_select 'li.week-number', :text => /1$/ assert_select 'li.week-number', :text => /1$/
assert_select 'li.even', :text => /^4/ assert_select 'li.this-month', :text => /^4/
assert_select 'li.even', :text => /^10/ assert_select 'li.this-month', :text => /^10/
end end
end end