diff options
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 5 | ||||
-rw-r--r-- | public/javascripts/gantt.js | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 3238de8cf..a760a3466 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -749,7 +749,10 @@ module Redmine :class => "#{options[:css]} task_todo", :id => html_id} if options[:issue] - content_opt[:data] = {"rels" => issue_relations(options[:issue]).to_json} + rels = issue_relations(options[:issue]) + if rels.present? + content_opt[:data] = {"rels" => rels.to_json} + end end output << view.content_tag(:div, ' '.html_safe, content_opt) if coords[:bar_late_end] diff --git a/public/javascripts/gantt.js b/public/javascripts/gantt.js index 51e2257e0..066a15884 100644 --- a/public/javascripts/gantt.js +++ b/public/javascripts/gantt.js @@ -13,18 +13,16 @@ function setDrawArea() { function getRelationsArray() { var arr = new Array(); - $.each($('div.task_todo'), function(index_div, element) { + $.each($('div.task_todo[data-rels]'), function(index_div, element) { var element_id = $(element).attr("id"); if (element_id != null) { var issue_id = element_id.replace("task-todo-issue-", ""); var data_rels = $(element).data("rels"); - if (data_rels != null) { - for (rel_type_key in data_rels) { - $.each(data_rels[rel_type_key], function(index_issue, element_issue) { - arr.push({issue_from: issue_id, issue_to: element_issue, - rel_type: rel_type_key}); - }); - } + for (rel_type_key in data_rels) { + $.each(data_rels[rel_type_key], function(index_issue, element_issue) { + arr.push({issue_from: issue_id, issue_to: element_issue, + rel_type: rel_type_key}); + }); } } }); |