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
cd9f135a
Commit
cd9f135a
authored
Oct 21, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1717 from riyad/add-author-to-tree-listing
Update author info in tree listing
parents
0189ee97
4fd73683
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
16 deletions
+48
-16
app/assets/stylesheets/sections/tree.scss
app/assets/stylesheets/sections/tree.scss
+18
-6
app/decorators/commit_decorator.rb
app/decorators/commit_decorator.rb
+22
-0
app/roles/team.rb
app/roles/team.rb
+3
-3
app/views/refs/logs_tree.js.haml
app/views/refs/logs_tree.js.haml
+3
-4
app/views/tree/_tree_commit.html.haml
app/views/tree/_tree_commit.html.haml
+0
-3
app/views/tree/_tree_commit_column.html.haml
app/views/tree/_tree_commit_column.html.haml
+2
-0
No files found.
app/assets/stylesheets/sections/tree.scss
View file @
cd9f135a
...
...
@@ -52,14 +52,26 @@
}
}
.tree-commit-link
{
color
:
#333
;
.tree_author
{
padding-right
:
8px
;
img
.avatar
{
border
:
0
none
;
float
:
none
;
margin-right
:
0
;
padding
:
0
;
width
:
16px
;
}
}
a
.tree-commit-link
{
color
:
#666
;
&
:hover
{
text-decoration
:
underline
;
.tree_commit
{
color
:
gray
;
.tree-commit-link
{
color
:
#444
;
&
:hover
{
text-decoration
:
underline
;
}
}
}
}
...
...
app/decorators/commit_decorator.rb
View file @
cd9f135a
...
...
@@ -42,6 +42,28 @@ class CommitDecorator < ApplicationDecorator
end
end
# Returns a link to the commit author. If the author has a matching user and
# is a member of the current @project it will link to the team member page.
# Otherwise it will link to the author email as specified in the commit.
#
# options:
# avatar: true will prepend avatar image
def
author_link
(
options
)
text
=
if
options
[
:avatar
]
avatar
=
h
.
image_tag
h
.
gravatar_icon
(
author_email
),
class:
"avatar"
,
width:
16
"
#{
avatar
}
#{
author_name
}
"
else
author_name
end
team_member
=
@project
.
try
(
:team_member_by_name_or_email
,
author_name
,
author_email
)
if
team_member
.
nil?
h
.
mail_to
author_email
,
text
.
html_safe
,
class:
"commit-author-link"
else
h
.
link_to
text
,
h
.
project_team_member_path
(
@project
,
team_member
),
class:
"commit-author-link"
end
end
protected
def
no_commit_message
...
...
app/roles/team.rb
View file @
cd9f135a
module
Team
def
team_member_by_name_or_email
(
email
=
nil
,
name
=
nil
)
user
=
users
.
where
(
"
email like ? or name like ?"
,
email
,
name
).
first
users_projects
.
find_by_user_id
(
user
.
id
)
if
user
def
team_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
user
=
users
.
where
(
"
name like ? or email like ?"
,
name
,
email
).
first
users_projects
.
where
(
user:
user
)
if
user
end
# Get Team Member record by user id
...
...
app/views/refs/logs_tree.js.haml
View file @
cd9f135a
-
@logs
.
each
do
|
content_data
|
-
file_name
=
content_data
[
:file_name
]
-
content_commit
=
content_data
[
:commit
]
-
tm
=
@project
.
team_member_by_name_or_email
(
content_commit
.
author_email
,
content_commit
.
author_name
)
-
commit
=
content_data
[
:commit
]
:plain
var row = $("table.table_
#{
@hex_path
}
tr.file_
#{
hexdigest
(
file_name
)
}
");
row.find("td.tree_time_ago").html('
#{
escape_javascript
(
time_ago_in_words
(
content_commit
.
committed_date
)
)
}
ago');
row.find("td.tree_commit").html('
#{
escape_javascript
(
render
(
"tree/tree_commit"
,
tm:
tm
,
content_commit:
content_commit
)
)
}
');
row.find("td.tree_time_ago").html('
#{
escape_javascript
time_ago_in_words
(
commit
.
committed_date
)
}
ago');
row.find("td.tree_commit").html('
#{
escape_javascript
render
(
"tree/tree_commit_column"
,
commit:
commit
)
}
');
app/views/tree/_tree_commit.html.haml
deleted
100644 → 0
View file @
0189ee97
-
if
tm
=
link_to
"[
#{
tm
.
user_name
}
]"
,
project_team_member_path
(
@project
,
tm
)
=
link_to_gfm
truncate
(
content_commit
.
title
,
length:
tm
?
30
:
50
),
project_commit_path
(
@project
,
content_commit
.
id
),
class:
"tree-commit-link"
app/views/tree/_tree_commit_column.html.haml
0 → 100644
View file @
cd9f135a
%span
.tree_author
=
commit
.
author_link
avatar:
true
=
link_to_gfm
truncate
(
commit
.
title
,
length:
80
),
project_commit_path
(
@project
,
commit
.
id
),
class:
"tree-commit-link"
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