Commit 94690bd2c4b30116aeee42fab5f97d5023ac750f
1 parent
6b66a766
Exists in
master
and in
4 other branches
Graph: base implementation
Showing
5 changed files
with
48 additions
and
25 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
| ... | ... | @@ -468,4 +468,13 @@ body.project-page table .commit { |
| 468 | 468 | /** UI autocomplete **/ |
| 469 | 469 | .ui-autocomplete { @include round-borders-all(5px); } |
| 470 | 470 | .ui-menu-item { cursor: pointer } |
| 471 | - | |
| 471 | + | |
| 472 | +#holder { | |
| 473 | + border: solid 1px #999; | |
| 474 | + cursor: move; | |
| 475 | + height: 70%; | |
| 476 | + overflow: scroll; | |
| 477 | + position: absolute; | |
| 478 | + width: auto; | |
| 479 | + margin: 6ex 3ex 0ex 0ex; | |
| 480 | +} | ... | ... |
app/controllers/projects_controller.rb
| ... | ... | @@ -150,11 +150,9 @@ class ProjectsController < ApplicationController |
| 150 | 150 | h[:id] = c.sha |
| 151 | 151 | h[:date] = c.date |
| 152 | 152 | h[:message] = c.message.force_encoding("UTF-8") |
| 153 | - h[:email] = c.author.email | |
| 153 | + h[:login] = c.author.email | |
| 154 | 154 | h |
| 155 | 155 | end.to_json |
| 156 | - | |
| 157 | - render :text => @commits_json | |
| 158 | 156 | end |
| 159 | 157 | |
| 160 | 158 | def blob | ... | ... |
app/views/layouts/project.html.haml
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | = link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil |
| 23 | 23 | = link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil |
| 24 | 24 | = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil |
| 25 | - = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :project_id => @project) ? "current" : nil | |
| 25 | + = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil | |
| 26 | 26 | = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do |
| 27 | 27 | Team |
| 28 | 28 | - if @project.users_projects.count > 0 | ... | ... |
lib/assets/javascripts/branch-graph.js
| 1 | -var commits = chunk1.commits, | |
| 1 | +var commits = {}, | |
| 2 | 2 | comms = {}, |
| 3 | 3 | pixelsX = [], |
| 4 | 4 | pixelsY = [], |
| 5 | 5 | mmax = Math.max, |
| 6 | 6 | mtime = 0, |
| 7 | 7 | mspace = 0, |
| 8 | - parents = {}; | |
| 9 | -for (var i = 0, ii = commits.length; i < ii; i++) { | |
| 10 | - for (var j = 0, jj = commits[i].parents.length; j < jj; j++) { | |
| 11 | - parents[commits[i].parents[j][0]] = true; | |
| 12 | - } | |
| 13 | - mtime = Math.max(mtime, commits[i].time); | |
| 14 | - mspace = Math.max(mspace, commits[i].space); | |
| 15 | -} | |
| 16 | -mtime = mtime + 4; | |
| 17 | -mspace = mspace + 10; | |
| 18 | -for (i = 0; i < ii; i++) { | |
| 19 | - if (commits[i].id in parents) { | |
| 20 | - commits[i].isParent = true; | |
| 21 | - } | |
| 22 | - comms[commits[i].id] = commits[i]; | |
| 23 | -} | |
| 24 | -var colors = ["#000"]; | |
| 25 | -for (var k = 0; k < mspace; k++) { | |
| 26 | - colors.push(Raphael.getColor()); | |
| 8 | + parents = {}, | |
| 9 | + ii = 0, | |
| 10 | + colors = ["#000"]; | |
| 11 | + | |
| 12 | +function initGraph(){ | |
| 13 | + commits = chunk1.commits; | |
| 14 | + ii = commits.length; | |
| 15 | + for (var i = 0; i < ii; i++) { | |
| 16 | + for (var j = 0, jj = commits[i].parents.length; j < jj; j++) { | |
| 17 | + parents[commits[i].parents[j][0]] = true; | |
| 18 | + } | |
| 19 | + mtime = Math.max(mtime, commits[i].time); | |
| 20 | + mspace = Math.max(mspace, commits[i].space); | |
| 21 | + } | |
| 22 | + mtime = mtime + 4; | |
| 23 | + mspace = mspace + 10; | |
| 24 | + for (i = 0; i < ii; i++) { | |
| 25 | + if (commits[i].id in parents) { | |
| 26 | + commits[i].isParent = true; | |
| 27 | + } | |
| 28 | + comms[commits[i].id] = commits[i]; | |
| 29 | + } | |
| 30 | + for (var k = 0; k < mspace; k++) { | |
| 31 | + colors.push(Raphael.getColor()); | |
| 32 | + } | |
| 27 | 33 | } |
| 34 | + | |
| 28 | 35 | function branchGraph(holder) { |
| 29 | 36 | var ch = mspace * 20 + 20, cw = mtime * 20 + 20, |
| 30 | 37 | r = Raphael("holder", cw, ch), | ... | ... |