Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4398bdf2
Commit
4398bdf2
authored
Dec 21, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'koenpunt-gh-issue-1509'
parents
a567d596
a47032bc
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
274 additions
and
199 deletions
+274
-199
app/assets/images/ajax_loader_gray.gif
app/assets/images/ajax_loader_gray.gif
+0
-0
app/assets/javascripts/projects.js.coffee
app/assets/javascripts/projects.js.coffee
+0
-7
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+3
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+13
-9
app/views/projects/graph.html.haml
app/views/projects/graph.html.haml
+8
-6
lib/gitlab/graph/commit.rb
lib/gitlab/graph/commit.rb
+1
-1
lib/gitlab/graph/json_builder.rb
lib/gitlab/graph/json_builder.rb
+8
-9
vendor/assets/javascripts/branch-graph.js
vendor/assets/javascripts/branch-graph.js
+241
-167
No files found.
app/assets/images/ajax_loader_gray.gif
0 → 100644
View file @
4398bdf2
8.17 KB
app/assets/javascripts/projects.js.coffee
View file @
4398bdf2
...
...
@@ -18,10 +18,3 @@ $ ->
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
submit
()
class
@
GraphNav
@
init
:
->
$
(
'.graph svg'
).
css
'position'
,
'relative'
$
(
'body'
).
bind
'keyup'
,
(
e
)
->
$
(
'.graph svg'
).
animate
(
left
:
'+=400'
)
if
e
.
keyCode
is
37
# left
$
(
'.graph svg'
).
animate
(
left
:
'-=400'
)
if
e
.
keyCode
is
39
# right
app/assets/stylesheets/common.scss
View file @
4398bdf2
...
...
@@ -57,6 +57,9 @@ table a code {
background
:
url(ajax_loader.gif)
no-repeat
center
center
;
width
:
40px
;
height
:
40px
;
&
.loading-gray
{
background
:
url(ajax_loader_gray.gif)
no-repeat
center
center
;
}
}
/** FLASH message **/
...
...
app/controllers/projects_controller.rb
View file @
4398bdf2
...
...
@@ -87,9 +87,13 @@ class ProjectsController < ProjectResourceController
end
def
graph
respond_to
do
|
format
|
format
.
html
format
.
json
do
graph
=
Gitlab
::
Graph
::
JsonBuilder
.
new
(
project
)
@days_json
,
@commits_json
=
graph
.
days_json
,
graph
.
commits_json
render
:json
=>
graph
.
to_json
end
end
end
def
destroy
...
...
app/views/projects/graph.html.haml
View file @
4398bdf2
...
...
@@ -2,13 +2,15 @@
%br
.graph_holder
%h4
%small
You can move around the graph by using arrow keys.
%small
You can move around the graph by using
the
arrow keys.
#holder
.graph
.loading.loading-gray
:javascript
var
chunk1
=
{
commits
:
#{
@commits_json
}
};
var
days
=
#{
@days_json
}
;
initGraph
();
var
branch_graph
;
$
(
function
(){
branchGraph
(
$
(
"
#holder
"
)[
0
]);
GraphNav
.
init
();
branch_graph
=
new
BranchGraph
(
$
(
"
#holder
"
),
{
url
:
'
#{
url_for
controller:
'projects'
,
action:
'graph'
,
format: :json
}
'
,
commit_url
:
'
#{
url_for
controller:
'projects'
,
action:
'show'
}
/commits/%s
'
});
});
lib/gitlab/graph/commit.rb
View file @
4398bdf2
...
...
@@ -28,7 +28,7 @@ module Gitlab
h
[
:refs
]
=
refs
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
unless
refs
.
nil?
h
[
:id
]
=
sha
h
[
:date
]
=
date
h
[
:message
]
=
escape_once
(
message
)
h
[
:message
]
=
message
h
[
:login
]
=
author
.
email
h
end
...
...
lib/gitlab/graph/json_builder.rb
View file @
4398bdf2
...
...
@@ -18,12 +18,11 @@ module Gitlab
@days
=
index_commits
end
def
days_json
@days_json
=
@days
.
compact
.
map
{
|
d
|
[
d
.
day
,
d
.
strftime
(
"%b"
)]
}.
to_json
end
def
commits_json
@commits_json
=
@commits
.
map
(
&
:to_graph_hash
).
to_json
def
to_json
(
*
args
)
{
days:
@days
.
compact
.
map
{
|
d
|
[
d
.
day
,
d
.
strftime
(
"%b"
)]
},
commits:
@commits
.
map
(
&
:to_graph_hash
)
}.
to_json
(
*
args
)
end
protected
...
...
vendor/assets/javascripts/branch-graph.js
View file @
4398bdf2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment