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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c0df0cd7
Commit
c0df0cd7
authored
Apr 16, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit header improved. finalize PR 667
parent
a7ed8276
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
98 deletions
+97
-98
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+1
-1
app/assets/stylesheets/sections/commits.scss
app/assets/stylesheets/sections/commits.scss
+37
-41
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+2
-0
app/decorators/commit_decorator.rb
app/decorators/commit_decorator.rb
+26
-0
app/models/commit.rb
app/models/commit.rb
+0
-30
app/views/commits/show.html.haml
app/views/commits/show.html.haml
+31
-26
No files found.
app/assets/stylesheets/common.scss
View file @
c0df0cd7
...
@@ -745,7 +745,7 @@ p.time {
...
@@ -745,7 +745,7 @@ p.time {
.top_box_content
,
.top_box_content
,
.middle_box_content
,
.middle_box_content
,
.bottom_box_content
{
.bottom_box_content
{
padding
:
20
px
;
padding
:
15
px
;
pre
{
pre
{
background
:
none
!
important
;
background
:
none
!
important
;
...
...
app/assets/stylesheets/sections/commits.scss
View file @
c0df0cd7
.commit-
head
{
.commit-
box
{
@extend
.main_box
;
@extend
.main_box
;
padding
:
14px
;
.commit-head
{
padding-bottom
:
8px
;
@extend
.top_box_content
;
line-height
:
24px
;
.browse-button
{
.commit-title
{
@extend
.btn
;
line-height
:
26px
;
@extend
.btn-small
;
margin
:
0
;
float
:
right
;
}
}
.commit-title
{
.commit-description
{
line-height
:
26px
;
font-size
:
14px
;
}
border
:
none
;
background-color
:
white
;
padding-top
:
10px
;
}
.commit-description
{
.browse-button
{
font-size
:
14px
;
@extend
.btn
;
padding
:
0px
;
@extend
.btn-small
;
padding-bottom
:
4px
;
float
:
right
;
border
:
none
;
}
background-color
:
white
;
}
}
.commit-info
{
.commit-info
{
@extend
.middle_box_content
;
@extend
.middle_box_content
;
@extend
.clearfix
;
@extend
.clearfix
;
padding-bottom
:
8px
;
.sha-block
{
padding-top
:
8px
;
text-align
:right
;
&
:first-child
{
margin-left
:
-14px
;
padding-bottom
:
6px
;
margin-right
:
-14px
;
}
margin-bottom
:
-8px
;
.author
.name
,
.committer
.name
{
a
{
font-weight
:
bold
;
border-bottom
:
1px
solid
#aaa
;
margin-left
:
9px
;
}
}
}
}
.sha-block
{
&
.merge-commit
.sha-block
{
float
:
right
;
clear
:
right
;
margin-left
:
10px
}
}
&
.merge-commit
.sha-block
{
clear
:
right
;
}
.committer
{
.committer
{
padding-left
:
32px
;
padding-left
:
32px
;
}
}
.avatar
{
.avatar
{
margin-right
:
4px
;
margin-right
:
10px
;
}
}
}
}
}
\ No newline at end of file
app/controllers/commits_controller.rb
View file @
c0df0cd7
...
@@ -29,6 +29,8 @@ class CommitsController < ApplicationController
...
@@ -29,6 +29,8 @@ class CommitsController < ApplicationController
git_not_found!
and
return
unless
@commit
git_not_found!
and
return
unless
@commit
@commit
=
CommitDecorator
.
decorate
(
@commit
)
@note
=
@project
.
build_commit_note
(
@commit
)
@note
=
@project
.
build_commit_note
(
@commit
)
@comments_allowed
=
true
@comments_allowed
=
true
@line_notes
=
project
.
commit_line_notes
(
@commit
)
@line_notes
=
project
.
commit_line_notes
(
@commit
)
...
...
app/decorators/commit_decorator.rb
View file @
c0df0cd7
class
CommitDecorator
<
ApplicationDecorator
class
CommitDecorator
<
ApplicationDecorator
decorates
:commit
decorates
:commit
# Returns the commits title.
#
# Usually, the commit title is the first line of the commit message.
# In case this first line is longer than 80 characters, it is cut off
# after 70 characters and ellipses (`&hellp;`) are appended.
def
title
title_end
=
safe_message
.
index
(
/\n/
)
if
(
!
title_end
&&
safe_message
.
length
>
80
)
||
(
title_end
&&
title_end
>
80
)
safe_message
[
0
..
69
]
<<
"…"
.
html_safe
else
safe_message
.
split
(
/\n/
,
2
).
first
end
end
# Returns the commits description
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def
description
title_end
=
safe_message
.
index
(
/\n/
)
if
(
!
title_end
&&
safe_message
.
length
>
80
)
||
(
title_end
&&
title_end
>
80
)
"…"
.
html_safe
<<
safe_message
[
70
..-
1
]
else
safe_message
.
split
(
/\n/
,
2
)[
1
].
try
(
:chomp
)
end
end
def
breadcrumbs
def
breadcrumbs
end
end
...
...
app/models/commit.rb
View file @
c0df0cd7
...
@@ -106,36 +106,6 @@ class Commit
...
@@ -106,36 +106,6 @@ class Commit
utf8
author
.
name
utf8
author
.
name
end
end
# Returns the commits title.
#
# Usually, the commit title is the first line of the commit message.
# In case this first line is longer than 80 characters, it is cut off
# after 70 characters and ellipses (`&hellp;`) are appended.
#
# @todo This might be better placed in a view helper.
def
title
title_end
=
safe_message
.
index
(
/\n/
)
if
(
!
title_end
&&
safe_message
.
length
>
80
)
||
(
title_end
&&
title_end
>
80
)
safe_message
[
0
..
69
]
<<
"…"
.
html_safe
else
safe_message
.
split
(
/\n/
,
2
).
first
end
end
# Returns the commits description
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
#
# @todo This might be better placed in a view helper.
def
description
title_end
=
safe_message
.
index
(
/\n/
)
if
(
!
title_end
&&
safe_message
.
length
>
80
)
||
(
title_end
&&
title_end
>
80
)
"…"
.
html_safe
<<
safe_message
[
70
..-
1
]
else
safe_message
.
split
(
/\n/
,
2
)[
1
].
try
(
:chomp
)
end
end
# Was this commit committed by a different person than the original author?
# Was this commit committed by a different person than the original author?
def
different_committer?
def
different_committer?
author_name
!=
committer_name
||
author_email
!=
committer_email
author_name
!=
committer_name
||
author_email
!=
committer_email
...
...
app/views/commits/show.html.haml
View file @
c0df0cd7
.commit-head
{
class:
@commit
.
parents
.
count
>
1
?
"merge-commit"
:
""
}
.commit-box
{
class:
@commit
.
parents
.
count
>
1
?
"merge-commit"
:
""
}
=
link_to
"Browse Code »"
,
tree_project_ref_path
(
@project
,
@commit
.
id
),
:class
=>
"browse-button"
.commit-head
%h3
.commit-title
=
link_to
"Browse Code »"
,
tree_project_ref_path
(
@project
,
@commit
.
id
),
:class
=>
"browse-button"
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
title
)
%h3
.commit-title
-
if
@commit
.
description
.
present?
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
title
)
%pre
.commit-description
-
if
@commit
.
description
.
present?
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
description
)
%pre
.commit-description
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
description
)
.commit-info
.commit-info
%span
.sha-block
.row
commit
.span4
%code
=
@commit
.
id
=
image_tag
gravatar_icon
(
@commit
.
author_email
,
40
),
:class
=>
"avatar"
%span
.sha-block
.author
=
pluralize
(
@commit
.
parents
.
count
,
"parent"
)
%strong
=
@commit
.
author_name
-
@commit
.
parents
.
each
do
|
parent
|
authored
%code
=
link_to
parent
.
id
,
project_commit_path
(
@project
,
parent
)
%time
{
title:
@commit
.
authored_date
.
stamp
(
"Aug 21, 2011 9:23pm"
)}
.author
#{
time_ago_in_words
(
@commit
.
authored_date
)
}
ago
=
image_tag
gravatar_icon
(
@commit
.
author_email
,
24
),
:class
=>
"avatar"
,
:height
=>
24
,
:width
=>
24
-
if
@commit
.
different_committer?
%span
.name
=
@commit
.
author_name
.committer
authored
→
%time
{
title:
@commit
.
authored_date
.
stamp
(
"Aug 21, 2011 9:23pm"
)}
%strong
=
@commit
.
committer_name
#{
time_ago_in_words
(
@commit
.
authored_date
)
}
ago
committed
-
if
@commit
.
different_committer?
%time
{
title:
@commit
.
committed_date
.
stamp
(
"Aug 21, 2011 9:23pm"
)}
.committer
#{
time_ago_in_words
(
@commit
.
committed_date
)
}
ago
%span
.name
=
@commit
.
committer_name
.span7.right
committed
.sha-block
%time
{
title:
@commit
.
committed_date
.
stamp
(
"Aug 21, 2011 9:23pm"
)}
%span
.cgray
commit
#{
time_ago_in_words
(
@commit
.
committed_date
)
}
ago
%code
=
@commit
.
id
.sha-block
%span
.cgray
=
pluralize
(
@commit
.
parents
.
count
,
"parent"
)
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
id
[
0
...
10
],
project_commit_path
(
@project
,
parent
)
=
render
"commits/diffs"
,
:diffs
=>
@commit
.
diffs
=
render
"commits/diffs"
,
:diffs
=>
@commit
.
diffs
=
render
"notes/notes"
,
:tid
=>
@commit
.
id
,
:tt
=>
"commit"
=
render
"notes/notes"
,
:tid
=>
@commit
.
id
,
:tt
=>
"commit"
...
...
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