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
78874519
Commit
78874519
authored
Jan 09, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Presentable concern
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
e5a29b45
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
3 deletions
+28
-3
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+1
-0
app/models/concerns/presentable.rb
app/models/concerns/presentable.rb
+7
-0
app/views/projects/builds/show.html.haml
app/views/projects/builds/show.html.haml
+4
-2
spec/models/concerns/presentable_spec.rb
spec/models/concerns/presentable_spec.rb
+15
-0
No files found.
app/controllers/projects/builds_controller.rb
View file @
78874519
...
...
@@ -94,7 +94,7 @@ class Projects::BuildsController < Projects::ApplicationController
private
def
build
@build
||=
project
.
builds
.
find_by!
(
id:
params
[
:id
])
@build
||=
project
.
builds
.
find_by!
(
id:
params
[
:id
])
.
present
(
current_user
)
end
def
build_path
(
build
)
...
...
app/models/ci/build.rb
View file @
78874519
...
...
@@ -2,6 +2,7 @@ module Ci
class
Build
<
CommitStatus
include
TokenAuthenticatable
include
AfterCommitQueue
include
Presentable
belongs_to
:runner
belongs_to
:trigger_request
...
...
app/models/concerns/presentable.rb
0 → 100644
View file @
78874519
module
Presentable
def
present
(
**
attributes
)
Gitlab
::
View
::
Presenter
::
Factory
.
new
(
self
,
attributes
)
.
fabricate!
end
end
app/views/projects/builds/show.html.haml
View file @
78874519
...
...
@@ -51,8 +51,10 @@
.prepend-top-default
-
if
@build
.
erased?
.erased.alert.alert-warning
-
erased_by
=
"by
#{
link_to
@build
.
erased_by
.
name
,
user_path
(
@build
.
erased_by
)
}
"
if
@build
.
erased_by
Build has been erased
#{
erased_by
.
html_safe
}
#{
time_ago_with_tooltip
(
@build
.
erased_at
)
}
-
if
@build
.
erased_by_user?
Build has been erased by
#{
link_to
(
@build
.
erased_by_name
,
user_path
(
@build
.
erased_by
))
}
#{
time_ago_with_tooltip
(
@build
.
erased_at
)
}
-
else
Build has been erased
#{
time_ago_with_tooltip
(
@build
.
erased_at
)
}
-
else
#js-build-scroll
.scroll-controls
.scroll-step
...
...
spec/models/concerns/presentable_spec.rb
0 → 100644
View file @
78874519
require
'spec_helper'
describe
Presentable
do
let
(
:build
)
{
create
(
:ci_build
)
}
describe
'#present'
do
it
'returns a presenter'
do
expect
(
build
.
present
).
to
be_a
(
Ci
::
Build
::
Presenter
)
end
it
'takes optional attributes'
do
expect
(
build
.
present
(
foo:
'bar'
).
foo
).
to
eq
(
'bar'
)
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