]> source.dussan.org Git - redmine.git/commitdiff
Merged r21115 from trunk to 4.1-stable (#34694).
authorGo MAEDA <maeda@farend.jp>
Sat, 31 Jul 2021 06:25:32 +0000 (06:25 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 31 Jul 2021 06:25:32 +0000 (06:25 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@21117 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/gantt.rb
public/javascripts/gantt.js

index 5c8be8db8a8f98b5b88a6bf7b8a27905d610ce59..dcddcca2ab0cde85481f2f48cd28336ebe37fee5 100644 (file)
@@ -341,6 +341,7 @@ module Redmine
         if options[:format] == :html
           data_options = {}
           data_options[:collapse_expand] = "issue-#{issue.id}"
+          data_options[:number_of_rows] = number_of_rows
           style = "position: absolute;top: #{options[:top]}px; font-size: 0.8em;"
           content = view.content_tag(:div, view.column_content(options[:column], issue), :style => style, :class => "issue_#{options[:column].name}", :id => "#{options[:column].name}_issue_#{issue.id}", :data => data_options)
           @columns[options[:column].name] << content if @columns.has_key?(options[:column].name)
@@ -768,6 +769,7 @@ module Redmine
               :top_increment => params[:top_increment],
               :obj_id => "#{object.class}-#{object.id}".downcase,
             },
+            :number_of_rows => number_of_rows,
           }
         end
         if has_children
@@ -823,7 +825,10 @@ module Redmine
       def html_task(params, coords, markers, label, object)
         output = +''
         data_options = {}
-        data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object
+        if object
+          data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
+          data_options[:number_of_rows] = number_of_rows
+        end
         css = "task " +
           case object
           when Project
index efda080eed1ee928c0bae4e96eb4635a92ff4938..502d7eb0ffa9a9c57558bbe1b287510d2697ec61 100644 (file)
@@ -253,13 +253,16 @@ ganttEntryClick = function(e){
   subject.nextAll('div').each(function(_, element){
     var el = $(element);
     var json = el.data('collapse-expand');
+    var number_of_rows = el.data('number-of-rows');
+    var el_task_bars = '#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
+    var el_selected_columns = 'td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
     if(out_of_hierarchy || parseInt(el.css('left')) <= subject_left){
       out_of_hierarchy = true;
       if(target_shown == null) return false;
 
       var new_top_val = parseInt(el.css('top')) + total_height * (target_shown ? -1 : 1);
       el.css('top', new_top_val);
-      $('#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"], td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"]').each(function(_, el){
+      $([el_task_bars, el_selected_columns].join()).each(function(_, el){
         $(el).css('top', new_top_val);
       });
       return true;
@@ -272,15 +275,14 @@ ganttEntryClick = function(e){
       total_height = 0;
     }
     if(is_shown == target_shown){
-      $('#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"]').each(function(_, task) {
+      $(el_task_bars).each(function(_, task) {
         var el_task = $(task);
         if(!is_shown)
           el_task.css('top', target_top + total_height);
         if(!el_task.hasClass('tooltip'))
           el_task.toggle(!is_shown);
       });
-      $('td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"]'
-          ).each(function (_, attr) {
+      $(el_selected_columns).each(function (_, attr) {
         var el_attr = $(attr);
         if (!is_shown)
           el_attr.css('top', target_top + total_height);