From 4e0bb4990ca4422c0d54b4cf1707a4025989b64f Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 27 Aug 2023 06:40:59 +0000 Subject: Display calendar in vertical list layout on mobile screens (#33682). Patch by Takashi Kato. git-svn-id: https://svn.redmine.org/redmine/trunk@22283 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/helpers/calendar.rb | 17 +++++++++++++++++ lib/redmine/i18n.rb | 4 ++++ 2 files changed, 21 insertions(+) (limited to 'lib') diff --git a/lib/redmine/helpers/calendar.rb b/lib/redmine/helpers/calendar.rb index 2f5b5d097..d6730840f 100644 --- a/lib/redmine/helpers/calendar.rb +++ b/lib/redmine/helpers/calendar.rb @@ -23,6 +23,8 @@ module Redmine # Simple class to compute the start and end dates of a calendar class Calendar include Redmine::I18n + include Redmine::Utils::DateCalculation + attr_reader :startdt, :enddt def initialize(date, lang = current_language, period = :month) @@ -47,6 +49,21 @@ module Redmine end end + def format_month + (@startdt..@enddt).to_a + end + + def week_number(day) + (day + (11 - day.cwday) % 7).cweek + end + + def day_css_classes(day) + css = day.month==month ? +'even' : +'odd' + css << " today" if User.current.today == day + css << " nwday" if non_working_week_days.include?(day.cwday) + css + end + # Sets calendar events def events=(events) @events = events diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 7010437fd..5421c45d5 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -103,6 +103,10 @@ module Redmine ::I18n.t('date.day_names')[day % 7] end + def abbr_day_name(day) + ::I18n.t('date.abbr_day_names')[day % 7] + end + def day_letter(day) ::I18n.t('date.abbr_day_names')[day % 7].first end -- cgit v1.2.3