Skip to content

Commit

Permalink
Mark current branch tag
Browse files Browse the repository at this point in the history
  • Loading branch information
EmteZogaf committed Aug 25, 2017
1 parent f29b993 commit 1631f8d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions css/explaingit.css
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ g.branch-tag > rect {
stroke-width: 2;
}

g.branch-tag.current-branch > rect {
fill: #FFCC66;
stroke: #339900;
stroke-width: 2;
}

g.branch-tag.git-tag > rect {
fill: #7FC9FF;
stroke: #0026FF;
Expand Down
19 changes: 18 additions & 1 deletion js/historyview.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ define(['d3'], function () {
renderTags: function () {
var view = this,
tagData = this._parseTagData(),
existingTags, newTags;
existingTags, newTags,
currentBranch = this.currentBranch;

existingTags = this.tagBox.selectAll('g.branch-tag')
.data(tagData, function (d) { return d.name; });
Expand Down Expand Up @@ -707,6 +708,9 @@ define(['d3'], function () {
} else if (d.name.toUpperCase() === 'HEAD') {
classes += ' head-tag';
}
if (d.name == currentBranch) {
classes += " current-branch"
}
return classes;
});

Expand Down Expand Up @@ -737,6 +741,19 @@ define(['d3'], function () {
return commit.cx;
});

this.tagBox.selectAll('g.branch-tag').attr('class', function(d) {
var cls = d3.select(this).attr('class').split(" "),
currentBranchIndex = cls.indexOf('current-branch');
if (d.name == currentBranch) {
if (currentBranchIndex < 0) {
cls.push('current-branch');
}
} else if (currentBranchIndex >= 0) {
cls.splice(currentBranchIndex, 1);
}
return cls.join(' ');
});

this._markBranchlessCommits();
},

Expand Down

0 comments on commit 1631f8d

Please sign in to comment.