Commit b49c1cb161e4d97c4ee33ae45a48e948f1097e60

Authored by Sato Hiroyuki
1 parent 62ef763a

Display note count on network graph.

app/helpers/graph_helper.rb
1 module GraphHelper 1 module GraphHelper
2 - def join_with_space(ary)  
3 - ary.collect{|r|r.name}.join(" ") unless ary.nil? 2 + def get_refs(commit)
  3 + refs = ""
  4 + refs += commit.refs.collect{|r|r.name}.join(" ") if commit.refs
  5 +
  6 + # append note count
  7 + notes = @project.notes.for_commit_id(commit.id)
  8 + refs += "[#{notes.count}]" if notes.any?
  9 +
  10 + refs
4 end 11 end
5 12
6 def parents_zip_spaces(parents, parent_spaces) 13 def parents_zip_spaces(parents, parent_spaces)
app/views/graph/show.json.erb
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 }, 13 },
14 time: c.time, 14 time: c.time,
15 space: c.spaces.first, 15 space: c.spaces.first,
16 - refs: join_with_space(c.refs), 16 + refs: get_refs(c),
17 id: c.sha, 17 id: c.sha,
18 date: c.date, 18 date: c.date,
19 message: c.message, 19 message: c.message,