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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
bc027c51
Commit
bc027c51
authored
Jun 17, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load the Merge Request > Commits tab lazily
parent
ce204006
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
18 deletions
+70
-18
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-1
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+2
-2
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+64
-15
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
bc027c51
...
@@ -71,7 +71,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -71,7 +71,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
commits
def
commits
render
'show'
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
json
{
render
json:
{
html:
view_to_html_string
(
'projects/merge_requests/show/_commits'
)
}
}
end
end
end
def
new
def
new
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
bc027c51
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#notes
.notes.tab-pane.voting_notes
#notes
.notes.tab-pane.voting_notes
=
render
"projects/merge_requests/discussion"
=
render
"projects/merge_requests/discussion"
#commits
.commits.tab-pane
#commits
.commits.tab-pane
-
if
current_page?
(
action:
'commits'
)
=
render
"projects/merge_requests/show/commits"
=
render
"projects/merge_requests/show/commits"
#diffs
.diffs.tab-pane
#diffs
.diffs.tab-pane
-
if
current_page?
(
action:
'diffs'
)
-
if
current_page?
(
action:
'diffs'
)
...
@@ -64,7 +65,6 @@
...
@@ -64,7 +65,6 @@
.mr-loading-status
.mr-loading-status
=
spinner
=
spinner
:javascript
:javascript
var
merge_request
;
var
merge_request
;
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
bc027c51
...
@@ -79,8 +79,32 @@ describe Projects::MergeRequestsController do
...
@@ -79,8 +79,32 @@ describe Projects::MergeRequestsController do
end
end
end
end
context
'#diffs with forked projects with submodules'
do
describe
'GET diffs'
do
def
go
(
format:
'html'
)
get
:diffs
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
end
context
'as html'
do
it
'renders the diff template'
do
go
expect
(
response
).
to
render_template
(
'diffs'
)
end
end
context
'as json'
do
it
'renders the diffs template to a string'
do
go
format:
'json'
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_diffs'
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
have_key
(
'html'
)
end
end
context
'with forked projects with submodules'
do
render_views
render_views
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
source_project:
fork_project
,
source_branch:
'add-submodule-version-bump'
,
target_branch:
'master'
,
target_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
source_project:
fork_project
,
source_branch:
'add-submodule-version-bump'
,
target_branch:
'master'
,
target_project:
project
)
}
...
@@ -91,11 +115,36 @@ describe Projects::MergeRequestsController do
...
@@ -91,11 +115,36 @@ describe Projects::MergeRequestsController do
merge_request
.
reload
merge_request
.
reload
end
end
it
'#diff
s'
do
it
'render
s'
do
get
(
:diffs
,
namespace_id:
project
.
namespace
.
to_param
,
go
format:
'json'
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
'json'
)
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
expect
(
response
.
body
).
to
have_content
(
'Subproject commit'
)
expect
(
response
.
body
).
to
have_content
(
'Subproject commit'
)
end
end
end
end
end
describe
'GET commits'
do
def
go
(
format:
'html'
)
get
:commits
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
end
context
'as html'
do
it
'renders the show template'
do
go
expect
(
response
).
to
render_template
(
'show'
)
end
end
context
'as json'
do
it
'renders the commits template to a string'
do
go
format:
'json'
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_commits'
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
have_key
(
'html'
)
end
end
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