Commit 0e35abba authored by maeda's avatar maeda

Add "nwday" class to non-working days in calendar (#27096).

Patch by Marius BALTEANU.


git-svn-id: https://svn.redmine.org/redmine/trunk@17798 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent cc0f22e1
...@@ -29,6 +29,7 @@ class MyController < ApplicationController ...@@ -29,6 +29,7 @@ class MyController < ApplicationController
helper :custom_fields helper :custom_fields
helper :queries helper :queries
helper :activities helper :activities
helper :calendars
def index def index
page page
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module CalendarsHelper module CalendarsHelper
include Redmine::Utils::DateCalculation
def link_to_previous_month(year, month, options={}) def link_to_previous_month(year, month, options={})
target_year, target_month = if month == 1 target_year, target_month = if month == 1
[year - 1, 12] [year - 1, 12]
...@@ -59,6 +61,7 @@ module CalendarsHelper ...@@ -59,6 +61,7 @@ module CalendarsHelper
def calendar_day_css_classes(calendar, day) def calendar_day_css_classes(calendar, day)
css = day.month==calendar.month ? 'even' : 'odd' css = day.month==calendar.month ? 'even' : 'odd'
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 css
end end
end end
...@@ -130,8 +130,24 @@ class CalendarsControllerTest < Redmine::ControllerTest ...@@ -130,8 +130,24 @@ class CalendarsControllerTest < Redmine::ControllerTest
get :show, :params => { get :show, :params => {
:query_id => 6 :query_id => 6
} }
assert_response :success assert_response :success
assert_select 'h2', :text => 'Open issues grouped by tracker' assert_select 'h2', :text => 'Open issues grouped by tracker'
end end
def test_show_calendar_day_css_classes
get :show, :params => {
:month => '12',
:year => '2016'
}
assert_response :success
assert_select 'tr:nth-child(2)' do
assert_select 'td.week-number', :text => '49'
# non working days should have "nwday" CSS class
assert_select 'td.nwday', 2
assert_select 'td.nwday', :text => '4'
assert_select 'td.nwday', :text => '10'
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment