34694-v2.patch

Yuichi HARADA, 2021-02-15 08:53

Download (3.28 KB)

View differences:

lib/redmine/helpers/gantt.rb
347 347
        if options[:format] == :html
348 348
          data_options = {}
349 349
          data_options[:collapse_expand] = "issue-#{issue.id}"
350
          data_options[:number_of_rows] = number_of_rows
350 351
          style = "position: absolute;top: #{options[:top]}px; font-size: 0.8em;"
351 352
          content =
352 353
            view.content_tag(
......
780 781
              :top_increment => params[:top_increment],
781 782
              :obj_id => "#{object.class}-#{object.id}".downcase,
782 783
            },
784
            :number_of_rows => number_of_rows,
783 785
          }
784 786
        end
785 787
        if has_children
......
835 837
      def html_task(params, coords, markers, label, object)
836 838
        output = +''
837 839
        data_options = {}
838
        data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object
840
        if object
841
          data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
842
          data_options[:number_of_rows] = number_of_rows
843
        end
839 844
        css = "task " +
840 845
          case object
841 846
          when Project
public/javascripts/gantt.js
253 253
  subject.nextAll('div').each(function(_, element){
254 254
    var el = $(element);
255 255
    var json = el.data('collapse-expand');
256
    var number_of_rows = el.data('number-of-rows');
257
    var el_task_bars = '#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
258
    var el_selected_columns = 'td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
256 259
    if(out_of_hierarchy || parseInt(el.css('left')) <= subject_left){
257 260
      out_of_hierarchy = true;
258 261
      if(target_shown == null) return false;
259 262

  
260 263
      var new_top_val = parseInt(el.css('top')) + total_height * (target_shown ? -1 : 1);
261 264
      el.css('top', new_top_val);
262
      $('#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"], td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"]').each(function(_, el){
265
      $([el_task_bars, el_selected_columns].join()).each(function(_, el){
263 266
        $(el).css('top', new_top_val);
264 267
      });
265 268
      return true;
......
272 275
      total_height = 0;
273 276
    }
274 277
    if(is_shown == target_shown){
275
      $('#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"]').each(function(_, task) {
278
      $(el_task_bars).each(function(_, task) {
276 279
        var el_task = $(task);
277 280
        if(!is_shown)
278 281
          el_task.css('top', target_top + total_height);
279 282
        if(!el_task.hasClass('tooltip'))
280 283
          el_task.toggle(!is_shown);
281 284
      });
282
      $('td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"]'
283
          ).each(function (_, attr) {
285
      $(el_selected_columns).each(function (_, attr) {
284 286
        var el_attr = $(attr);
285 287
        if (!is_shown)
286 288
          el_attr.css('top', target_top + total_height);