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
Jérome Perrin
gitlab-ce
Commits
5416d0e0
Commit
5416d0e0
authored
Oct 21, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass `@ref` along so we know which pipeline to show
Closes #23615
parent
4028022f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
44 additions
and
18 deletions
+44
-18
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-1
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+8
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+12
-2
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+5
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+5
-3
app/models/commit.rb
app/models/commit.rb
+4
-0
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-2
app/views/projects/commits/_commit_list.html.haml
app/views/projects/commits/_commit_list.html.haml
+1
-1
app/views/projects/commits/_commits.html.haml
app/views/projects/commits/_commits.html.haml
+1
-4
app/views/projects/commits/show.html.haml
app/views/projects/commits/show.html.haml
+1
-1
app/views/projects/merge_requests/branch_from.html.haml
app/views/projects/merge_requests/branch_from.html.haml
+1
-1
app/views/projects/merge_requests/branch_to.html.haml
app/views/projects/merge_requests/branch_to.html.haml
+1
-1
app/views/projects/merge_requests/show/_commits.html.haml
app/views/projects/merge_requests/show/_commits.html.haml
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
5416d0e0
...
...
@@ -192,9 +192,10 @@ class ApplicationController < ActionController::Base
end
# JSON for infinite scroll via Pager object
def
pager_json
(
partial
,
count
)
def
pager_json
(
partial
,
count
,
locals
=
{}
)
html
=
render_to_string
(
partial
,
locals:
locals
,
layout:
false
,
formats:
[
:html
]
)
...
...
app/controllers/projects/commits_controller.rb
View file @
5416d0e0
...
...
@@ -26,8 +26,15 @@ class Projects::CommitsController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
{
pager_json
(
"projects/commits/_commits"
,
@commits
.
size
)
}
format
.
atom
{
render
layout:
false
}
format
.
json
do
pager_json
(
'projects/commits/_commits'
,
@commits
.
size
,
project:
@project
,
ref:
@ref
)
end
end
end
end
app/controllers/projects/merge_requests_controller.rb
View file @
5416d0e0
...
...
@@ -352,13 +352,23 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
branch_from
# This is always source
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
@commit
=
@repository
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@commit
=
@repository
.
commit
(
@ref
)
end
render
layout:
false
end
def
branch_to
@target_project
=
selected_target_project
@commit
=
@target_project
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@commit
=
@target_project
.
commit
(
@ref
)
end
render
layout:
false
end
...
...
app/helpers/ci_status_helper.rb
View file @
5416d0e0
...
...
@@ -54,6 +54,11 @@ module CiStatusHelper
custom_icon
(
icon_name
)
end
def
render_commit_ref_status
(
commit
,
ref
=
nil
,
**
args
)
pipeline
=
commit
.
pipelines_for
(
ref
).
last
render_pipeline_status
(
pipeline
,
**
args
)
end
def
render_commit_status
(
commit
,
tooltip_placement:
'auto left'
)
project
=
commit
.
project
path
=
pipelines_namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
...
...
app/helpers/commits_helper.rb
View file @
5416d0e0
...
...
@@ -25,9 +25,11 @@ module CommitsHelper
end
end
def
commit_to_html
(
commit
,
project
,
inline
=
true
)
template
=
inline
?
"inline_commit"
:
"commit"
render
"projects/commits/
#{
template
}
"
,
commit:
commit
,
project:
project
unless
commit
.
nil?
def
commit_to_html
(
commit
,
ref
,
project
)
render
'projects/commits/commit'
,
commit:
commit
,
ref:
ref
,
project:
project
end
# Breadcrumb links for a Project and, if applicable, a tree path
...
...
app/models/commit.rb
View file @
5416d0e0
...
...
@@ -225,6 +225,10 @@ class Commit
)
end
def
pipelines_for
(
ref
)
project
.
pipelines
.
where
(
sha:
sha
,
ref:
ref
)
end
def
pipelines
@pipeline
||=
project
.
pipelines
.
where
(
sha:
sha
)
end
...
...
app/views/projects/commits/_commit.html.haml
View file @
5416d0e0
...
...
@@ -20,13 +20,13 @@
=
commit
.
short_id
-
if
commit
.
status
.visible-xs-inline
=
render_commit_
status
(
commit
)
=
render_commit_
ref_status
(
commit
,
ref
)
-
if
commit
.
description?
%a
.text-expander.hidden-xs.js-toggle-button
...
.commit-actions.hidden-xs
-
if
commit
.
status
=
render_commit_
status
(
commit
)
=
render_commit_
ref_status
(
commit
,
ref
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-short-id btn btn-transparent"
=
link_to_browse_code
(
project
,
commit
)
...
...
app/views/projects/commits/_commit_list.html.haml
View file @
5416d0e0
...
...
@@ -11,4 +11,4 @@
%li
.warning-row.unstyled
#{
number_with_delimiter
(
hidden
)
}
additional commits have been omitted to prevent performance issues.
-
else
%ul
.content-list
=
render
commits
,
project:
@project
%ul
.content-list
=
render
commits
,
project:
@project
,
ref:
@ref
app/views/projects/commits/_commits.html.haml
View file @
5416d0e0
-
unless
defined?
(
project
)
-
project
=
@project
-
commits
,
hidden
=
limited_commits
(
@commits
)
-
commits
.
chunk
{
|
c
|
c
.
committed_date
.
in_time_zone
.
to_date
}.
each
do
|
day
,
commits
|
%li
.commit-header
=
"
#{
day
.
strftime
(
'%d %b, %Y'
)
}
#{
pluralize
(
commits
.
count
,
'commit'
)
}
"
%li
.commits-row
%ul
.list-unstyled.commit-list
=
render
commits
,
project:
project
=
render
commits
,
project:
project
,
ref:
ref
-
if
hidden
>
0
%li
.alert.alert-warning
...
...
app/views/projects/commits/show.html.haml
View file @
5416d0e0
...
...
@@ -35,7 +35,7 @@
%div
{
id:
dom_id
(
@project
)}
%ol
#commits-list
.list-unstyled.content_list
=
render
"commits"
,
project:
@project
=
render
'commits'
,
project:
@project
,
ref:
@ref
=
spinner
:javascript
...
...
app/views/projects/merge_requests/branch_from.html.haml
View file @
5416d0e0
=
commit_to_html
(
@commit
,
@
source_project
,
false
)
=
commit_to_html
(
@commit
,
@
ref
,
@source_project
)
if
@commit
app/views/projects/merge_requests/branch_to.html.haml
View file @
5416d0e0
=
commit_to_html
(
@commit
,
@
target_project
,
false
)
=
commit_to_html
(
@commit
,
@
ref
,
@target_project
)
if
@commit
app/views/projects/merge_requests/show/_commits.html.haml
View file @
5416d0e0
...
...
@@ -3,4 +3,4 @@
Most recent commits displayed first
%ol
#commits-list
.list-unstyled
=
render
"projects/commits/commits"
,
project:
@merge_request
.
project
=
render
"projects/commits/commits"
,
project:
@merge_request
.
project
,
ref:
@merge_request
.
source_branch
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