summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-30 22:21:19 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-30 22:21:19 -0800
commit8c50707dd4c9c0ca21f373ebd9fea30eb1b606b4 (patch)
treea83e3fb3978f2340500eda22db7df8a0c267bc6e /vendor
parent1fdeb9e03042b1b645ed0fe6c33fb4f21dd6ddb1 (diff)
parentad33c398008d9a2ec4a900c1d54f678a47de2cdd (diff)
downloadgitlab-ce-8c50707dd4c9c0ca21f373ebd9fea30eb1b606b4.tar.gz
Merge pull request #2823 from hiroponz/switchable-branch-on-network-graph
Switchable the main branch on network graph
Diffstat (limited to 'vendor')
-rw-r--r--vendor/assets/javascripts/branch-graph.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/assets/javascripts/branch-graph.js b/vendor/assets/javascripts/branch-graph.js
index 93849c79e80..cdaa8dd8d37 100644
--- a/vendor/assets/javascripts/branch-graph.js
+++ b/vendor/assets/javascripts/branch-graph.js
@@ -73,7 +73,8 @@
, cumonth = ""
, offsetX = 20
, offsetY = 60
- , barWidth = Math.max(graphWidth, this.dayCount * 20 + 320);
+ , barWidth = Math.max(graphWidth, this.dayCount * 20 + 320)
+ , scrollLeft = cw;
this.raphael = r;
@@ -145,12 +146,18 @@
if (this.commits[i].refs) {
this.appendLabel(x, y, this.commits[i].refs);
+
+ // The main branch is displayed in the center.
+ re = new RegExp('(^| )' + this.options.ref + '( |$)');
+ if (this.commits[i].refs.match(re)) {
+ scrollLeft = x - graphWidth / 2;
+ }
}
this.appendAnchor(top, this.commits[i], x, y);
}
top.toFront();
- this.element.scrollLeft(cw);
+ this.element.scrollLeft(scrollLeft);
this.bindEvents();
};