Commit 4b2ecbc4 authored by Koen Punt's avatar Koen Punt

Updated branch-graph, abstracted some code in seperate functions

Removed unused Raphael.fn.popup
parent e1282d50
...@@ -83,19 +83,13 @@ class ProjectsController < ProjectResourceController ...@@ -83,19 +83,13 @@ class ProjectsController < ProjectResourceController
end end
def graph def graph
respond_to do |format| respond_to do |format|
format.html format.html
format.json do format.json do
graph = Gitlab::Graph::JsonBuilder.new(project) graph = Gitlab::Graph::JsonBuilder.new(project)
#@days_json, @commits_json = graph.days_json, graph.commits_json render :json => graph.to_json
render :text => graph.to_json
end end
end end
end end
def destroy def destroy
......
...@@ -9,5 +9,8 @@ ...@@ -9,5 +9,8 @@
:javascript :javascript
var branch_graph; var branch_graph;
$(function(){ $(function(){
branch_graph = new BranchGraph($("#holder"), '#{url_for :controller => 'projects', :action => 'graph'}'); branch_graph = new BranchGraph($("#holder"), {
url: '#{url_for controller: 'projects', action: 'graph', format: :json}',
commit_url: '#{url_for controller: 'projects', action: 'show'}/commits/%s'
});
}); });
...@@ -18,11 +18,11 @@ module Gitlab ...@@ -18,11 +18,11 @@ module Gitlab
@days = index_commits @days = index_commits
end end
def to_json def to_json(*args)
{ {
days: @days.compact.map { |d| [d.day, d.strftime("%b")] }, days: @days.compact.map { |d| [d.day, d.strftime("%b")] },
commits: @commits.map(&:to_graph_hash) commits: @commits.map(&:to_graph_hash)
}.to_json }.to_json(*args)
end end
protected protected
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment