diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-12-21 08:30:44 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-12-21 11:56:58 -0200 |
commit | 9d7f8143f716932c80307234ac31242838c9e9a9 (patch) | |
tree | a724a995b8aa38799647c731b0862b413e8ee370 | |
parent | 70efd6150380db9aa9edf0d556299112630ed40f (diff) | |
download | gitlab-ce-9d7f8143f716932c80307234ac31242838c9e9a9.tar.gz |
Merge branch '25681-network-graph-long-commit-msg' into 'master'
Account for newlines in commit messages on network graph
Closes #25681 and #21086
See merge request !8131
-rw-r--r-- | app/assets/javascripts/network/branch_graph.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index 64b19a54893..20a68780cd5 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -356,7 +356,7 @@ icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20); nameText = this.text(x + 25, y + 10, commit.author.name); idText = this.text(x, y + 35, commit.id); - messageText = this.text(x, y + 50, commit.message); + messageText = this.text(x, y + 50, commit.message.replace(/\r?\n/g, " \n ")); textSet = this.set(icon, nameText, idText, messageText).attr({ "text-anchor": "start", font: "12px Monaco, monospace" @@ -368,6 +368,7 @@ idText.attr({ fill: "#AAA" }); + messageText.node.style["white-space"] = "pre"; this.textWrap(messageText, boxWidth - 50); rect = this.rect(x - 10, y - 10, boxWidth, 100, 4).attr({ fill: "#FFF", @@ -404,16 +405,21 @@ s.push("\n"); x = 0; } - x += word.length * letterWidth; - s.push(word + " "); + if (word === "\n") { + s.push("\n"); + x = 0; + } else { + s.push(word + " "); + x += word.length * letterWidth; + } } t.attr({ - text: s.join("") + text: s.join("").trim() }); b = t.getBBox(); - h = Math.abs(b.y2) - Math.abs(b.y) + 1; + h = Math.abs(b.y2) + 1; return t.attr({ - y: b.y + h + y: h }); }; |