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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
188e6a7a
Commit
188e6a7a
authored
Mar 30, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3369 from hiroponz/display-note-count
Display note count on network graph.
parents
c918000b
b49c1cb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
app/assets/javascripts/branch-graph.js.coffee
app/assets/javascripts/branch-graph.js.coffee
+9
-13
app/helpers/graph_helper.rb
app/helpers/graph_helper.rb
+9
-2
app/views/graph/show.json.erb
app/views/graph/show.json.erb
+1
-1
No files found.
app/assets/javascripts/branch-graph.js.coffee
View file @
188e6a7a
...
@@ -131,7 +131,7 @@ class BranchGraph
...
@@ -131,7 +131,7 @@ class BranchGraph
shortrefs
=
refs
shortrefs
=
refs
# Truncate if longer than 15 chars
# Truncate if longer than 15 chars
shortrefs
=
shortrefs
.
substr
(
0
,
15
)
+
"…"
if
shortrefs
.
length
>
17
shortrefs
=
shortrefs
.
substr
(
0
,
15
)
+
"…"
if
shortrefs
.
length
>
17
text
=
r
.
text
(
x
+
8
,
y
,
shortrefs
).
attr
(
text
=
r
.
text
(
x
+
4
,
y
,
shortrefs
).
attr
(
"text-anchor"
:
"start"
"text-anchor"
:
"start"
font
:
"10px Monaco, monospace"
font
:
"10px Monaco, monospace"
fill
:
"#FFF"
fill
:
"#FFF"
...
@@ -139,7 +139,7 @@ class BranchGraph
...
@@ -139,7 +139,7 @@ class BranchGraph
)
)
textbox
=
text
.
getBBox
()
textbox
=
text
.
getBBox
()
# Create rectangle based on the size of the textbox
# Create rectangle based on the size of the textbox
rect
=
r
.
rect
(
x
,
y
-
7
,
textbox
.
width
+
1
5
,
textbox
.
height
+
5
,
4
).
attr
(
rect
=
r
.
rect
(
x
,
y
-
7
,
textbox
.
width
+
5
,
textbox
.
height
+
5
,
4
).
attr
(
fill
:
"#000"
fill
:
"#000"
"fill-opacity"
:
.
5
"fill-opacity"
:
.
5
stroke
:
"none"
stroke
:
"none"
...
@@ -206,22 +206,19 @@ class BranchGraph
...
@@ -206,22 +206,19 @@ class BranchGraph
# Build line shape
# Build line shape
if
parent
[
1
]
is
commit
.
space
if
parent
[
1
]
is
commit
.
space
d1
=
[
0
,
5
]
offset
=
[
0
,
5
]
d2
=
[
0
,
10
]
arrow
=
"l-2,5,4,0,-2,-5,0,5"
arrow
=
"l-2,5,4,0,-2,-5"
else
if
parent
[
1
]
<
commit
.
space
else
if
parent
[
1
]
<
commit
.
space
d1
=
[
3
,
3
]
offset
=
[
3
,
3
]
d2
=
[
7
,
5
]
arrow
=
"l5,0,-2,4,-3,-4,4,2"
arrow
=
"l5,0,-2,4,-3,-4"
else
else
d1
=
[
-
3
,
3
]
offset
=
[
-
3
,
3
]
d2
=
[
-
7
,
5
]
arrow
=
"l-5,0,2,4,3,-4,-4,2"
arrow
=
"l-5,0,2,4,3,-4"
# Start point
# Start point
route
=
[
"M"
,
x
+
d1
[
0
],
y
+
d1
[
1
]]
route
=
[
"M"
,
x
+
offset
[
0
],
y
+
offset
[
1
]]
# Add arrow if not first parent
# Add arrow if not first parent
if
i
>
0
if
i
>
0
...
@@ -230,7 +227,6 @@ class BranchGraph
...
@@ -230,7 +227,6 @@ class BranchGraph
# Circumvent if overlap
# Circumvent if overlap
if
commit
.
space
isnt
parentCommit
.
space
or
commit
.
space
isnt
parent
[
1
]
if
commit
.
space
isnt
parentCommit
.
space
or
commit
.
space
isnt
parent
[
1
]
route
.
push
(
route
.
push
(
"L"
,
x
+
d2
[
0
],
y
+
d2
[
1
],
"L"
,
parentX2
,
y
+
10
,
"L"
,
parentX2
,
y
+
10
,
"L"
,
parentX2
,
parentY
-
5
,
"L"
,
parentX2
,
parentY
-
5
,
)
)
...
...
app/helpers/graph_helper.rb
View file @
188e6a7a
module
GraphHelper
module
GraphHelper
def
join_with_space
(
ary
)
def
get_refs
(
commit
)
ary
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
unless
ary
.
nil?
refs
=
""
refs
+=
commit
.
refs
.
collect
{
|
r
|
r
.
name
}.
join
(
" "
)
if
commit
.
refs
# append note count
notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
)
refs
+=
"[
#{
notes
.
count
}
]"
if
notes
.
any?
refs
end
end
def
parents_zip_spaces
(
parents
,
parent_spaces
)
def
parents_zip_spaces
(
parents
,
parent_spaces
)
...
...
app/views/graph/show.json.erb
View file @
188e6a7a
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
},
},
time:
c
.
time
,
time:
c
.
time
,
space:
c
.
spaces
.
first
,
space:
c
.
spaces
.
first
,
refs:
join_with_space
(
c
.
refs
),
refs:
get_refs
(
c
),
id:
c
.
sha
,
id:
c
.
sha
,
date:
c
.
date
,
date:
c
.
date
,
message:
c
.
message
,
message:
c
.
message
,
...
...
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