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
Tatuya Kamada
gitlab-ce
Commits
e4c517a6
Commit
e4c517a6
authored
Jul 25, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand commit message width in repo view
parent
b6dc87cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
7 deletions
+35
-7
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/pages/tree.scss
app/assets/stylesheets/pages/tree.scss
+4
-0
app/models/commit.rb
app/models/commit.rb
+8
-6
app/views/projects/tree/_tree_commit_column.html.haml
app/views/projects/tree/_tree_commit_column.html.haml
+1
-1
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+21
-0
No files found.
CHANGELOG
View file @
e4c517a6
...
@@ -8,6 +8,7 @@ v 8.11.0 (unreleased)
...
@@ -8,6 +8,7 @@ v 8.11.0 (unreleased)
- Fix CI status icon link underline (ClemMakesApps)
- Fix CI status icon link underline (ClemMakesApps)
- The Repository class is now instrumented
- The Repository class is now instrumented
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Expand commit message width in repo view (ClemMakesApps)
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
- Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable
- Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable
- Optimize maximum user access level lookup in loading of notes
- Optimize maximum user access level lookup in loading of notes
...
...
app/assets/stylesheets/pages/tree.scss
View file @
e4c517a6
...
@@ -58,6 +58,10 @@
...
@@ -58,6 +58,10 @@
.tree_commit
{
.tree_commit
{
max-width
:
320px
;
max-width
:
320px
;
.str-truncated
{
max-width
:
100%
;
}
}
}
.tree_time_ago
{
.tree_time_ago
{
...
...
app/models/commit.rb
View file @
e4c517a6
...
@@ -123,15 +123,17 @@ class Commit
...
@@ -123,15 +123,17 @@ class Commit
# In case this first line is longer than 100 characters, it is cut off
# In case this first line is longer than 100 characters, it is cut off
# after 80 characters and ellipses (`&hellp;`) are appended.
# after 80 characters and ellipses (`&hellp;`) are appended.
def
title
def
title
title
=
safe_message
full_title
.
length
>
100
?
full_title
[
0
..
79
]
<<
"…"
:
full_title
end
return
no_commit_message
if
title
.
blank?
# Returns the full commits title
def
full_title
return
@full_title
if
@full_title
title_end
=
title
.
index
(
"
\n
"
)
if
safe_message
.
blank?
if
(
!
title_end
&&
title
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
@full_title
=
no_commit_message
title
[
0
..
79
]
<<
"…"
else
else
titl
e
.
split
(
"
\n
"
,
2
).
first
@full_title
=
safe_messag
e
.
split
(
"
\n
"
,
2
).
first
end
end
end
end
...
...
app/views/projects/tree/_tree_commit_column.html.haml
View file @
e4c517a6
%span
.str-truncated
%span
.str-truncated
=
link_to_gfm
commit
.
title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"tree-commit-link"
=
link_to_gfm
commit
.
full_
title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"tree-commit-link"
spec/models/commit_spec.rb
View file @
e4c517a6
...
@@ -86,6 +86,27 @@ eos
...
@@ -86,6 +86,27 @@ eos
end
end
end
end
describe
'#full_title'
do
it
"returns no_commit_message when safe_message is blank"
do
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
''
)
expect
(
commit
.
full_title
).
to
eq
(
"--no commit message"
)
end
it
"returns entire message if there is no newline"
do
message
=
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
message
)
expect
(
commit
.
full_title
).
to
eq
(
message
)
end
it
"returns first line of message if there is a newLine"
do
message
=
commit
.
safe_message
.
split
(
" "
).
first
allow
(
commit
).
to
receive
(
:safe_message
).
and_return
(
message
+
"
\n
"
+
message
)
expect
(
commit
.
full_title
).
to
eq
(
message
)
end
end
describe
"delegation"
do
describe
"delegation"
do
subject
{
commit
}
subject
{
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