From b49c1cb161e4d97c4ee33ae45a48e948f1097e60 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Tue, 26 Mar 2013 09:51:39 +0900 Subject: [PATCH] Display note count on network graph. --- app/helpers/graph_helper.rb | 11 +++++++++-- app/views/graph/show.json.erb | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/helpers/graph_helper.rb b/app/helpers/graph_helper.rb index 3693301..ca7d823 100644 --- a/app/helpers/graph_helper.rb +++ b/app/helpers/graph_helper.rb @@ -1,6 +1,13 @@ module GraphHelper - def join_with_space(ary) - ary.collect{|r|r.name}.join(" ") unless ary.nil? + def get_refs(commit) + refs = "" + refs += commit.refs.collect{|r|r.name}.join(" ") if commit.refs + + # append note count + notes = @project.notes.for_commit_id(commit.id) + refs += "[#{notes.count}]" if notes.any? + + refs end def parents_zip_spaces(parents, parent_spaces) diff --git a/app/views/graph/show.json.erb b/app/views/graph/show.json.erb index d0a0709..529d584 100644 --- a/app/views/graph/show.json.erb +++ b/app/views/graph/show.json.erb @@ -13,7 +13,7 @@ }, time: c.time, space: c.spaces.first, - refs: join_with_space(c.refs), + refs: get_refs(c), id: c.sha, date: c.date, message: c.message, -- libgit2 0.21.2