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
Boxiang Sun
gitlab-ce
Commits
a57890bc
Commit
a57890bc
authored
Mar 20, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helpers for pipeline user link & user avatar
parent
e2d5818e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
3 deletions
+50
-3
app/helpers/pipelines_helper.rb
app/helpers/pipelines_helper.rb
+11
-0
app/views/projects/pipelines/_info.html.haml
app/views/projects/pipelines/_info.html.haml
+2
-2
changelogs/unreleased/tc-pipeline-show-trigger-date.yml
changelogs/unreleased/tc-pipeline-show-trigger-date.yml
+1
-1
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+1
-0
spec/helpers/pipelines_helper_spec.rb
spec/helpers/pipelines_helper_spec.rb
+35
-0
No files found.
app/helpers/pipelines_helper.rb
0 → 100644
View file @
a57890bc
module
PipelinesHelper
def
pipeline_user_avatar
(
pipeline
)
user_avatar
(
user:
pipeline
.
user
,
size:
24
)
end
def
pipeline_user_link
(
pipeline
)
link_to
(
pipeline
.
user
.
name
,
user_path
(
pipeline
.
user
),
title:
pipeline
.
user
.
email
,
class:
'has-tooltip commit-committer-link'
)
end
end
app/views/projects/pipelines/_info.html.haml
View file @
a57890bc
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
triggered
#{
time_ago_with_tooltip
(
@pipeline
.
created_at
)
}
triggered
#{
time_ago_with_tooltip
(
@pipeline
.
created_at
)
}
-
if
@pipeline
.
user
-
if
@pipeline
.
user
by
by
=
user_avatar
(
user:
@pipeline
.
user
,
size:
24
,
css_class:
'hidden-xs'
)
=
pipeline_user_avatar
(
@pipeline
)
=
link_to
(
@pipeline
.
user
.
name
,
user_path
(
@pipeline
.
user
.
username
),
title:
@pipeline
.
user
.
email
,
class:
'has-tooltip commit-committer-link'
)
=
pipeline_user_link
(
@pipeline
)
.header-action-buttons
.header-action-buttons
-
if
can?
(
current_user
,
:update_pipeline
,
@pipeline
.
project
)
-
if
can?
(
current_user
,
:update_pipeline
,
@pipeline
.
project
)
-
if
@pipeline
.
retryable?
-
if
@pipeline
.
retryable?
...
...
changelogs/unreleased/tc-pipeline-show-trigger-date.yml
View file @
a57890bc
---
---
title
:
Show
pipeline creator & created_at in heading
title
:
Show
correct user & creation time in heading of the pipeline page
merge_request
:
9936
merge_request
:
9936
author
:
author
:
spec/features/commits_spec.rb
View file @
a57890bc
...
@@ -12,6 +12,7 @@ describe 'Commits' do
...
@@ -12,6 +12,7 @@ describe 'Commits' do
end
end
let
(
:creator
)
{
create
(
:user
)
}
let
(
:creator
)
{
create
(
:user
)
}
let!
(
:pipeline
)
do
let!
(
:pipeline
)
do
create
(
:ci_pipeline
,
create
(
:ci_pipeline
,
project:
project
,
project:
project
,
...
...
spec/helpers/pipelines_helper_spec.rb
0 → 100644
View file @
a57890bc
require
'rails_helper'
describe
PipelinesHelper
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
user:
user
)
}
describe
'#pipeline_user_avatar'
do
subject
{
helper
.
pipeline_user_avatar
(
pipeline
)
}
it
"links to the user's profile"
do
is_expected
.
to
include
(
"href=
\"
#{
user_path
(
user
)
}
\"
"
)
end
it
"has the user's name as title"
do
is_expected
.
to
include
(
"title=
\"
#{
user
.
name
}
\"
"
)
end
it
"contains the user's avatar image"
do
is_expected
.
to
include
(
CGI
.
escapeHTML
(
user
.
avatar_url
(
24
)))
end
end
describe
'#pipeline_user_link'
do
subject
{
helper
.
pipeline_user_link
(
pipeline
)
}
it
"links to the user's profile"
do
is_expected
.
to
include
(
"href=
\"
#{
user_path
(
user
)
}
\"
"
)
end
it
"has the user's email as title"
do
is_expected
.
to
include
(
"title=
\"
#{
user
.
email
}
\"
"
)
end
end
end
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