0002-Add-nwday-class-to-non-working-days-in-calendar.patch

Marius BALTEANU, 2019-01-07 05:11

Download (2.52 KB)

View differences:

app/controllers/my_controller.rb
29 29
  helper :custom_fields
30 30
  helper :queries
31 31
  helper :activities
32
  helper :calendars
32 33

  
33 34
  def index
34 35
    page
app/helpers/calendars_helper.rb
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 19

  
20 20
module CalendarsHelper
21
  include Redmine::Utils::DateCalculation
22

  
21 23
  def link_to_previous_month(year, month, options={})
22 24
    target_year, target_month = if month == 1
23 25
                                  [year - 1, 12]
......
59 61
  def calendar_day_css_classes(calendar, day)
60 62
    css = day.month==calendar.month ? 'even' : 'odd'
61 63
    css << " today" if User.current.today == day
64
    css << " nwday" if non_working_week_days.include?(day.cwday)
62 65
    css
63 66
  end
64 67
end
test/functional/calendars_controller_test.rb
129 129
    get :show, :params => {
130 130
        :query_id => 6
131 131
      }
132
      
132

  
133 133
    assert_response :success
134 134
    assert_select 'h2', :text => 'Open issues grouped by tracker'
135 135
  end
136

  
137
  def test_show_calendar_day_css_classes
138
    get :show, :params => {
139
        :month => '12',
140
        :year => '2016'
141
      }
142
    assert_response :success
143

  
144
    assert_select 'tr:nth-child(2)' do
145
      assert_select 'td.week-number', :text => '49'
146
      # non working days should have "nwday" CSS class
147
      assert_select 'td.nwday', 2
148
      assert_select 'td.nwday', :text => '4'
149
      assert_select 'td.nwday', :text => '10'
150
    end
151
  end
136 152
end
137
-