summaryrefslogtreecommitdiff
path: root/app/controllers
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/controllers
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/controllers')
-rw-r--r--app/controllers/graph_controller.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb
index 33cb2d2dcb9..d27fd039478 100644
--- a/app/controllers/graph_controller.rb
+++ b/app/controllers/graph_controller.rb
@@ -8,24 +8,21 @@ class GraphController < ProjectResourceController
before_filter :require_non_empty_project
def show
- if params.has_key?(:q) && params[:q].blank?
- redirect_to project_graph_path(@project, params[:id])
- return
- end
-
if params.has_key?(:q)
+ if params[:q].blank?
+ redirect_to project_graph_path(@project, params[:id])
+ return
+ end
+
@q = params[:q]
@commit = @project.repository.commit(@q) || @commit
end
respond_to do |format|
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
+ @graph = Graph::JsonBuilder.new(project, @ref, @commit)
end
end
end