Commit 1e907498a944c22db79e9cfbd26ee7f10fe1a091
1 parent
7812cb77
Exists in
master
and in
4 other branches
The commit is marked and displayed in the center.
Showing
2 changed files
with
17 additions
and
7 deletions
Show diff stats
app/views/graph/show.html.haml
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | branch_graph = new BranchGraph($("#holder"), { |
| 15 | 15 | url: '#{project_graph_path(@project, @ref, format: :json)}', |
| 16 | 16 | commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', |
| 17 | - ref: '#{@ref}' | |
| 17 | + ref: '#{@ref}', | |
| 18 | + commit_id: '#{@commit && @commit.id}' | |
| 18 | 19 | }); |
| 19 | 20 | }); | ... | ... |
vendor/assets/javascripts/branch-graph.js
| ... | ... | @@ -161,14 +161,23 @@ |
| 161 | 161 | |
| 162 | 162 | if (this.commits[i].refs) { |
| 163 | 163 | this.appendLabel(x, y, this.commits[i].refs); |
| 164 | - | |
| 165 | - // The main branch is displayed in the center. | |
| 166 | - re = new RegExp('(^| )' + this.options.ref + '( |$)'); | |
| 167 | - if (this.commits[i].refs.match(re)) { | |
| 168 | - scrollLeft = x - graphWidth / 2; | |
| 169 | - } | |
| 170 | 164 | } |
| 171 | 165 | |
| 166 | + // mark commit and displayed in the center | |
| 167 | + if (this.commits[i].id == this.options.commit_id) { | |
| 168 | + r.path([ | |
| 169 | + 'M', x, y - 5, | |
| 170 | + 'L', x + 4, y - 15, | |
| 171 | + 'L', x - 4, y - 15, | |
| 172 | + 'Z' | |
| 173 | + ]).attr({ | |
| 174 | + "fill": "#000", | |
| 175 | + "fill-opacity": .7, | |
| 176 | + "stroke": "none" | |
| 177 | + }); | |
| 178 | + scrollLeft = x - graphWidth / 2; | |
| 179 | + } | |
| 180 | + | |
| 172 | 181 | this.appendAnchor(top, this.commits[i], x, y); |
| 173 | 182 | } |
| 174 | 183 | top.toFront(); | ... | ... |