Project

General

Profile

Feature #2024 » 0003-Identify-the-subject-and-taskbar-line.patch

Yuichi HARADA, 2021-02-18 02:41

View differences:

app/views/gantts/change_duration.js.erb
53 53
  subject_content = subject_content.css(css_subject).to_s.tr("\n",'').gsub(/'/, "\\\\'")
54 54
-%>
55 55
if($('<%= elm_subject %>').length){
56
  $('<%= elm_todo %>').parent().html('<%= raw(todo_content) %>');
56
  $('<%= elm_todo %>').each(function(_, task) {
57
    var el_parent = $(task).parent();
58
    el_parent.html('<%= raw(todo_content) %>');
59
    var number_of_rows = el_parent.attr('data-number-of-rows');
60
    if(number_of_rows){
61
      el_parent.find('div[data-number-of-rows]').attr('data-number-of-rows', number_of_rows);
62
    }
63
  });
57 64
  $('<%= elm_subject %>').replaceWith('<%= raw(subject_content) %>');
58 65
<%
59 66
  case obj
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(
......
781 782
              :top_increment => params[:top_increment],
782 783
              :obj_id => "#{object.class}-#{object.id}".downcase,
783 784
            },
785
            :number_of_rows => number_of_rows,
784 786
          }
785 787
        end
786 788
        if has_children
......
836 838
      def html_task(params, coords, markers, label, object)
837 839
        output = +''
838 840
        data_options = {}
839
        data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object
841
        if object
842
          data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
843
          data_options[:number_of_rows] = number_of_rows
844
        end
840 845
        css = "task " +
841 846
          case object
842 847
          when Project
public/javascripts/gantt.js
255 255
  subject.nextAll('div').each(function(_, element){
256 256
    var el = $(element);
257 257
    var json = el.data('collapse-expand');
258
    var number_of_rows = el.data('number-of-rows');
259
    var el_task_bars = '#gantt_area form > div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
260
    var el_selected_columns = 'td.gantt_selected_column div[data-collapse-expand="' + json.obj_id + '"][data-number-of-rows="' + number_of_rows + '"]';
258 261
    if(out_of_hierarchy || parseInt(el.css('left')) <= subject_left){
259 262
      out_of_hierarchy = true;
260 263
      if(target_shown == null) return false;
261 264

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