diff options
author | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-02-28 14:56:27 +0900 |
---|---|---|
committer | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-02-28 14:56:27 +0900 |
commit | 2a687dd5625c29e48b7b64a388a828c358d45215 (patch) | |
tree | 1e8cbcb6ff8977008720612044f4079a6a1941cf /app | |
parent | 00d0e57e859454c62084893a74fad71c26d5c50c (diff) | |
download | gitlab-ce-2a687dd5625c29e48b7b64a388a828c358d45215.tar.gz |
Show gravatar icon on tooltip.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/branch-graph.js | 7 | ||||
-rw-r--r-- | app/controllers/graph_controller.rb | 4 | ||||
-rw-r--r-- | app/models/graph/commit.rb | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/app/assets/javascripts/branch-graph.js b/app/assets/javascripts/branch-graph.js index 231b1cc6744..137e87de37f 100644 --- a/app/assets/javascripts/branch-graph.js +++ b/app/assets/javascripts/branch-graph.js @@ -320,15 +320,16 @@ }(this); Raphael.fn.commitTooltip = function(x, y, commit){ - var nameText, idText, messageText + var icon, nameText, idText, messageText , boxWidth = 300 , boxHeight = 200; - nameText = this.text(x, y + 10, commit.author.name); + icon = this.image(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); - textSet = this.set(nameText, idText, messageText).attr({ + textSet = this.set(icon, nameText, idText, messageText).attr({ "text-anchor": "start", "font": "12px Monaco, monospace" }); diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb index 8aadcfef8c2..33cb2d2dcb9 100644 --- a/app/controllers/graph_controller.rb +++ b/app/controllers/graph_controller.rb @@ -1,5 +1,6 @@ class GraphController < ProjectResourceController include ExtractsPath + include ApplicationHelper # Authorize before_filter :authorize_read_project! @@ -21,6 +22,9 @@ class GraphController < ProjectResourceController format.html format.json do graph = Graph::JsonBuilder.new(project, @ref, @commit) + graph.commits.each do |c| + c.icon = gravatar_icon(c.author.email) + end render :json => graph.to_json end end diff --git a/app/models/graph/commit.rb b/app/models/graph/commit.rb index 742a73b38b7..8ed61f4b5af 100644 --- a/app/models/graph/commit.rb +++ b/app/models/graph/commit.rb @@ -4,7 +4,7 @@ module Graph class Commit include ActionView::Helpers::TagHelper - attr_accessor :time, :spaces, :refs, :parent_spaces + attr_accessor :time, :spaces, :refs, :parent_spaces, :icon def initialize(commit) @_commit = commit @@ -23,8 +23,9 @@ module Graph [p.id,0,0] end h[:author] = { - name: author.name, - email: author.email + name: author.name, + email: author.email, + icon: icon } h[:time] = time h[:space] = spaces.first |