summaryrefslogtreecommitdiff
path: root/app/models/graph/commit.rb
diff options
context:
space:
mode:
authorSato Hiroyuki <sathiroyuki@gmail.com>2013-03-06 20:31:28 +0900
committerSato Hiroyuki <sathiroyuki@gmail.com>2013-03-07 15:19:32 +0900
commit2f7f46b25655aa6f2c2a7756663c97ddb4491100 (patch)
tree550b87737e9a45147c980f3d795c9a419722bfda /app/models/graph/commit.rb
parent9dc46eee8ed31f3955f5a94731ab72e97797523a (diff)
downloadgitlab-ce-2f7f46b25655aa6f2c2a7756663c97ddb4491100.tar.gz
Refactor: replace "render :json = graph.to_json" to view template(show.json.erb).
Because model shouldn't know about view logic.
Diffstat (limited to 'app/models/graph/commit.rb')
-rw-r--r--app/models/graph/commit.rb22
1 files changed, 1 insertions, 21 deletions
diff --git a/app/models/graph/commit.rb b/app/models/graph/commit.rb
index 8ed61f4b5af..e47a543daa9 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, :icon
+ attr_accessor :time, :spaces, :refs, :parent_spaces
def initialize(commit)
@_commit = commit
@@ -17,26 +17,6 @@ module Graph
@_commit.send(m, *args, &block)
end
- def to_graph_hash
- h = {}
- h[:parents] = self.parents.collect do |p|
- [p.id,0,0]
- end
- h[:author] = {
- name: author.name,
- email: author.email,
- icon: icon
- }
- h[:time] = time
- h[:space] = spaces.first
- h[:parent_spaces] = parent_spaces
- h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
- h[:id] = sha
- h[:date] = date
- h[:message] = message
- h
- end
-
def add_refs(ref_cache, repo)
if ref_cache.empty?
repo.refs.each do |ref|