summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-08-27 06:40:59 +0000
committerGo MAEDA <maeda@farend.jp>2023-08-27 06:40:59 +0000
commit4e0bb4990ca4422c0d54b4cf1707a4025989b64f (patch)
treecbef1701962cdbb60dded88ff1bc80eb69646dc8 /app
parent6653f60d7454aa927840eced55b20bde77adbc16 (diff)
downloadredmine-4e0bb4990ca4422c0d54b4cf1707a4025989b64f.tar.gz
redmine-4e0bb4990ca4422c0d54b4cf1707a4025989b64f.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/controllers/my_controller.rb1
-rw-r--r--app/helpers/calendars_helper.rb29
-rw-r--r--app/views/common/_calendar.html.erb73
3 files changed, 31 insertions, 72 deletions
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 48a68b626..9eaaa90e7 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -33,7 +33,6 @@ class MyController < ApplicationController
helper :custom_fields
helper :queries
helper :activities
- helper :calendars
def index
page
diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb
deleted file mode 100644
index e207bc391..000000000
--- a/app/helpers/calendars_helper.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-# Redmine - project management software
-# Copyright (C) 2006-2023 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-module CalendarsHelper
- include Redmine::Utils::DateCalculation
-
- def calendar_day_css_classes(calendar, day)
- css = day.month==calendar.month ? +'even' : +'odd'
- css << " today" if User.current.today == day
- css << " nwday" if non_working_week_days.include?(day.cwday)
- css
- end
-end
diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb
index 63cb43c97..533ed2c4d 100644
--- a/app/views/common/_calendar.html.erb
+++ b/app/views/common/_calendar.html.erb
@@ -1,48 +1,37 @@
<%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do -%>
<%= hidden_field_tag 'back_url', url_for(:params => request.query_parameters), :id => nil %>
-<table class="cal">
-<thead>
- <tr>
- <th scope="col" title="<%= l(:label_week) %>" class="week-number"></th>
- <% 7.times do |i| %>
- <th scope="col"><%= day_name((calendar.first_wday + i) % 7) %></th>
- <% end %>
- </tr>
-</thead>
-<tbody>
-<tr>
-<% day = calendar.startdt %>
-<% while day <= calendar.enddt %>
- <% if day.cwday == calendar.first_wday %>
- <td class='week-number' title='<%= l(:label_week) %>'>
- <%= (day + (11 - day.cwday) % 7).cweek %>
- </td>
+<ul class="cal">
+ <li scope="col" title="<%= l(:label_week) %>" class="calhead week-number"></li>
+ <% 7.times do |i| %>
+ <li scope="col" class="calhead"><%= day_name((calendar.first_wday + i) % 7) %></li>
<% end %>
-<td class="<%= calendar_day_css_classes(calendar, day) %>">
-<p class="day-num"><%= day.day %></p>
-<% calendar.events_on(day).each do |i| %>
- <% if i.is_a? Issue %>
- <div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip hascontextmenu">
- <%= "#{i.project} -" unless @project && @project == i.project %>
- <%= link_to_issue i, :truncate => 30 %>
- <span class="tip"><%= render_issue_tooltip i %></span>
- <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
- </div>
- <% else %>
- <span class="icon icon-package">
- <%= "#{i.project} -" unless @project && @project == i.project %>
- <%= link_to_version i %>
- </span>
+ <% calendar.format_month.each_slice(7) do |week| %>
+ <li class='week-number'>
+ <span class="label-week"><%= l(:label_week) %></span> <%= calendar.week_number week.first %>
+ </li>
+ <% week.each do |day| %>
+ <li class="<%= calendar.day_css_classes day %> calbody">
+ <p class="day-num"><%= day.day %>
+ <span class="abbr-day">(<%= abbr_day_name(day.cwday) %>)</span>
+ </p>
+ <% calendar.events_on(day).each do |i| %>
+ <% if i.is_a? Issue %>
+ <%= tag.div class: [ i.css_classes, 'tooltip hascontextmenu', starting: day == i.start_date, ending: day == i.due_date] do %>
+ <%= "#{i.project} -" unless @project && @project == i.project %>
+ <%= link_to_issue i, :truncate => 30 %>
+ <span class="tip"><%= render_issue_tooltip i %></span>
+ <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
+ <% end %>
+ <% else %>
+ <span class="icon icon-package">
+ <%= "#{i.project} -" unless @project && @project == i.project %>
+ <%= link_to_version i %>
+ </span>
+ <% end %>
+ <% end %>
+ </li>
+ <% end %>
<% end %>
-<% end %>
-</td>
-<% if day.cwday==calendar.last_wday and day!=calendar.enddt %>
- </tr><tr>
-<% end %>
-<% day = day + 1 %>
-<% end %>
-</tr>
-</tbody>
-</table>
+</ul>
<% end %>
<%= context_menu %>