diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index d368a70c98..3b1580c74f 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -48,10 +48,9 @@ class CalendarsController < ApplicationController @query.issues( :include => [:tracker, :assigned_to, :priority], :conditions => [ - "((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?) OR ((start_date < ?) AND (due_date > ?)))", - @calendar.startdt, @calendar.enddt, - @calendar.startdt, @calendar.enddt, + "((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, + @calendar.startdt, @calendar.enddt ] ) events += diff --git a/app/models/issue.rb b/app/models/issue.rb index 0b30dbe3b1..8e131118c1 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1450,7 +1450,7 @@ class Issue < ActiveRecord::Base # Returns a string of css classes that apply to the issue def css_classes(user=User.current) - s = +"issue issue-#{id} tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" + s = +"issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" s << ' closed' if closed? s << ' overdue' if overdue? s << ' child' if child? diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb index d0e98e5ae7..533ed2c4de 100644 --- a/app/views/common/_calendar.html.erb +++ b/app/views/common/_calendar.html.erb @@ -6,7 +6,6 @@
  • <%= day_name((calendar.first_wday + i) % 7) %>
  • <% end %> <% calendar.format_month.each_slice(7) do |week| %> - <% weekly_events = calendar.events_on_week(week[0]) %>
  • <%= l(:label_week) %> <%= calendar.week_number week.first %>
  • @@ -15,30 +14,21 @@

    <%= day.day %> (<%= abbr_day_name(day.cwday) %>)

    -
    - <% weekly_events.each do |i| %> -
    "> - <% if i.is_a? Issue %> - <% if ((day == week[0] && (i.start_date.nil? || i.start_date < week[0])) || day == i.start_date || day == i.due_date) %> - <% duration = ((i.due_date.nil? ? week[6] : [i.due_date, week[6]].min) - day).to_i + 1 %> - <%= tag.div class: [ i.css_classes, 'tooltip hascontextmenu', day == week[0] ? 'week-0' : '', 'duration-' + duration.to_s, starting: day == i.start_date, ending: day == i.due_date ] do %> - - <%= "#{i.project} -" unless @project && @project == i.project %> - <%= link_to_issue i %> - - <%= render_issue_tooltip i %> - <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %> - <% end %> - <% end %> - <% elsif i.due_date == day %> - - <%= "#{i.project} -" unless @project && @project == i.project %> - <%= link_to_version i %> - + <% 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 %> + <%= render_issue_tooltip i %> + <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %> <% end %> -
    + <% else %> + + <%= "#{i.project} -" unless @project && @project == i.project %> + <%= link_to_version i %> + + <% end %> <% end %> -
    <% end %> <% end %> diff --git a/lib/redmine/helpers/calendar.rb b/lib/redmine/helpers/calendar.rb index f79d1d027e..d6730840f6 100644 --- a/lib/redmine/helpers/calendar.rb +++ b/lib/redmine/helpers/calendar.rb @@ -66,14 +66,7 @@ module Redmine # Sets calendar events def events=(events) - @events = events.sort_by do |e| - [ - e.is_a?(Issue) ? 0 : 1, - e.start_date || @enddt, - e.due_date || @enddt, - (e.start_date.nil? || e.start_date < @startdt) ? 0 : 1, - ] - end + @events = events @ending_events_by_days = @events.group_by {|event| event.due_date} @starting_events_by_days = @events.group_by {|event| event.start_date} end @@ -83,21 +76,6 @@ module Redmine ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq end - def events_on_week(week_start_date) - @events.filter do |e| - if e.is_a? Issue - if e.start_date.nil? || e.due_date.nil? - (!e.start_date.nil? && e.due_date.nil? && e.start_date < week_start_date+7) || - (e.start_date.nil? && !e.due_date.nil? && e.due_date >= week_start_date+7) - else - e.start_date < week_start_date+7 && e.due_date >= week_start_date - end - else - e.due_date >= week_start_date && e.due_date < week_start_date+7 - end - end - end - # Calendar current month def month @date.month diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index 57a7365fcb..d5b9c6b528 100644 --- a/public/javascripts/context_menu.js +++ b/public/javascripts/context_menu.js @@ -30,13 +30,6 @@ function contextMenuClick(event) { if (event.which == 1 || (navigator.appVersion.match(/\bMSIE\b/))) { var tr = target.closest('.hascontextmenu').first(); if (tr.length > 0) { - if (tr.closest(".cal").length > 0) { - // Select the same issue id elements in the Calendar - var issueNumberClass = tr.attr("class").split(" ").filter((i) => i.startsWith("issue-"))[0]; - if (issueNumberClass !== undefined) { - tr = tr.closest(".cal").find(".hascontextmenu" + "." + issueNumberClass); - } - } // a row was clicked if (target.is('td.checkbox')) { // the td containing the checkbox was clicked, toggle the checkbox diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 3f9f1de499..f8e11b050a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1110,7 +1110,6 @@ ul.cal { border: 1px solid #c0c0c0; border-spacing: 0; border-radius: 3px; - position: relative; } .cal .calhead { @@ -1131,12 +1130,6 @@ ul.cal { .cal .week-number .label-week { display: none; } -.cal .week-number .event-id { - visibility: hidden; -} -.cal .week-number .event-version { - height: 2rem; -} .cal .calbody { border: 1px solid #d7d7d7; @@ -1147,8 +1140,6 @@ ul.cal { line-height: 1.2; min-height: calc(1.2em * 6); padding: 2px; - display: grid; - grid-template-rows: auto 1fr; } .cal .calbody p.day-num {font-size: 1.1em; text-align:right;} @@ -1156,39 +1147,13 @@ ul.cal { .cal .calbody.odd p.day-num {color: #bbb;} .cal .calbody.today {background:#ffd;} .cal .calbody.today p.day-num {font-weight: bold;} -.cal .calbody .cal-event { - height: calc(1.2rem + 10px); -} -.cal .calbody .cal-event.event-version { - height: calc(2.2rem + 10px); -} -.cal .calbody .cal-event > .issue { - position: absolute; -} - -.cal .calbody .cal-event > .issue > .text { - display: inline-block; - width: 100%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -/* ((ul.width - week-number.width) / 7 * n - div.issue.padding - div.issue.border - li.calbody.padding - li.calbody.border) */ -.cal .calbody .cal-event > .issue.duration-1 {width: calc((100% - 2rem) / 7 * 1 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-2 {width: calc((100% - 2rem) / 7 * 2 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-3 {width: calc((100% - 2rem) / 7 * 3 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-4 {width: calc((100% - 2rem) / 7 * 4 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-5 {width: calc((100% - 2rem) / 7 * 5 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-6 {width: calc((100% - 2rem) / 7 * 6 - 12px - 2px - 2px - 2px);} -.cal .calbody .cal-event > .issue.duration-7 {width: calc((100% - 2rem) / 7 * 7 - 12px - 2px - 2px - 2px);} - -.cal .calbody .cal-event > .issue.ending:not(.week-0):not(.starting) {display:none;} .cal .calbody .icon {padding-top: 2px; padding-bottom: 3px;} .cal .calbody.nwday:not(.odd) {background-color:#f1f1f1;} +.cal .starting a.issue, p.cal.legend .starting {background: url(../images/bullet_go.png) no-repeat -1px -2px; padding-left:16px;} +.cal .ending a.issue, p.cal.legend .ending {background: url(../images/bullet_end.png) no-repeat -1px -2px; padding-left:16px;} +.cal .starting.ending a.issue, p.cal.legend .starting.ending {background: url(../images/bullet_diamond.png) no-repeat -1px -2px; padding-left:16px;} -p.cal.legend {display:none;} p.cal.legend span {display:block;} .controller-calendars p.buttons {margin-top: unset;} diff --git a/public/stylesheets/responsive.css b/public/stylesheets/responsive.css index 79901821d0..482f73cf2f 100644 --- a/public/stylesheets/responsive.css +++ b/public/stylesheets/responsive.css @@ -836,21 +836,6 @@ display: inline; } - .cal .calbody .cal-events > .cal-event { - height: auto; - } - - .cal .calbody .cal-events > .cal-event > .issue { - width: auto; - position: relative; - overflow: visible; - white-space:normal; - } - - div.tooltip:hover span.tip { - position: absolute; - } - .cal .week-number { border: 1px solid #c0c0c0; text-align: left; @@ -866,16 +851,6 @@ font-size: 1.1em; text-align: left; } - - .cal .calbody .cal-events > .cal-event > .issue.starting, - .cal .calbody .cal-events > .cal-event > .issue.ending {display: block;} - .cal .calbody .cal-events > .cal-event > .issue.week-0:not(.starting):not(.ending) {display:none;} - - .cal .starting a.issue, p.cal.legend .starting {background: url(../images/bullet_go.png) no-repeat -1px -2px; padding-left:16px;} - .cal .ending a.issue, p.cal.legend .ending {background: url(../images/bullet_end.png) no-repeat -1px -2px; padding-left:16px;} - .cal .starting.ending a.issue, p.cal.legend .starting.ending {background: url(../images/bullet_diamond.png) no-repeat -1px -2px; padding-left:16px;} - - p.cal.legend {display:block;} } @media all and (max-width: 599px) {