diff options
author | Sam Rose <sam@gitlab.com> | 2016-12-15 19:32:03 -0500 |
---|---|---|
committer | Sam Rose <sam@gitlab.com> | 2016-12-16 16:46:17 -0500 |
commit | 178f9ebb67bddbd2719cbd140967103b57f2c0c7 (patch) | |
tree | f70db361edd639d3474c90e403f78ff3e014f712 /app/assets/javascripts/network | |
parent | 77bfad1f4e397b012b19dda51e55a35af6935c38 (diff) | |
download | gitlab-ce-178f9ebb67bddbd2719cbd140967103b57f2c0c7.tar.gz |
Respect newlines in commit messages on network graph25681-network-graph-long-commit-msg
Diffstat (limited to 'app/assets/javascripts/network')
-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 }); }; |