Redmine カレンダーで前月の月末週、来月の月初週も見たい
カレンダーは月毎に表示されますが月初が日曜日だとその前の週は先月なのでカレンダーにまったく表示されません。
そのため月初めに先週のイベントを確認したいときは先月のカレンダーを改めて表示させる必要があります。
同様に月末が土曜日だと次週のイベントを確認したいときは翌月のカレンダーを改めて表示させる必要があります。
この煩わしさをなくすため、当日が月最初の週のときは必ず前の週から表示するように、月最後の週のときは必ず次の週まで表示するパッチです。
redmine-1.3.2 で確認しましたがコードを見る限り redmine-2系にも対応していると思います。
--- app/controllers/calendars_controller.rb.org +++ app/controllers/calendars_controller.rb @@ -39,6 +39,8 @@ @month ||= Date.today.month @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month) + @calendar.startdt -= 1.week if Date.today < @calendar.startdt + 1.week + @calendar.enddt += 1.week if Date.today > @calendar.enddt - 1.week retrieve_query @query.group_by = nil if @query.valid? --- lib/redmine/helpers/calendar.rb.org +++ lib/redmine/helpers/calendar.rb @@ -21,7 +21,7 @@ # Simple class to compute the start and end dates of a calendar class Calendar include Redmine::I18n - attr_reader :startdt, :enddt + attr_accessor :startdt, :enddt def initialize(date, lang = current_language, period = :month) @date = date