BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
dfc62605
Commit
dfc62605
authored
Jan 30, 2018
by
Clement Ho
Committed by
Filipa Lacerda
Jan 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace $.get in single file diff with axios
parent
5f1a09e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
18 deletions
+15
-18
single_file_diff.js
app/assets/javascripts/single_file_diff.js
+15
-11
expand_collapse_diffs_spec.rb
spec/features/expand_collapse_diffs_spec.rb
+0
-7
No files found.
app/assets/javascripts/single_file_diff.js
View file @
dfc62605
/* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, one-var-declaration-per-line, consistent-return, no-param-reassign, max-len */
import
{
__
}
from
'./locale'
;
import
axios
from
'./lib/utils/axios_utils'
;
import
createFlash
from
'./flash'
;
import
FilesCommentButton
from
'./files_comment_button'
;
import
imageDiffHelper
from
'./image_diff/helpers/index'
;
import
syntaxHighlight
from
'./syntax_highlight'
;
...
...
@@ -60,30 +63,31 @@ export default class SingleFileDiff {
getContentHTML
(
cb
)
{
this
.
collapsedContent
.
hide
();
this
.
loadingContent
.
show
();
$
.
get
(
this
.
diffForPath
,
(
function
(
_this
)
{
return
function
(
data
)
{
_this
.
loadingContent
.
hide
();
axios
.
get
(
this
.
diffForPath
)
.
then
(({
data
})
=>
{
this
.
loadingContent
.
hide
();
if
(
data
.
html
)
{
_
this
.
content
=
$
(
data
.
html
);
syntaxHighlight
(
_
this
.
content
);
this
.
content
=
$
(
data
.
html
);
syntaxHighlight
(
this
.
content
);
}
else
{
_
this
.
hasError
=
true
;
_
this
.
content
=
$
(
ERROR_HTML
);
this
.
hasError
=
true
;
this
.
content
=
$
(
ERROR_HTML
);
}
_this
.
collapsedContent
.
after
(
_
this
.
content
);
this
.
collapsedContent
.
after
(
this
.
content
);
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'undefined'
)
{
gl
.
diffNotesCompileComponents
();
}
const
$file
=
$
(
_
this
.
file
);
const
$file
=
$
(
this
.
file
);
FilesCommentButton
.
init
(
$file
);
const
canCreateNote
=
$file
.
closest
(
'.files'
).
is
(
'[data-can-create-note]'
);
imageDiffHelper
.
initImageDiff
(
$file
[
0
],
canCreateNote
);
if
(
cb
)
cb
();
}
;
})(
this
));
}
)
.
catch
(
createFlash
(
__
(
'An error occurred while retrieving diff'
)
));
}
}
spec/features/expand_collapse_diffs_spec.rb
View file @
dfc62605
...
...
@@ -112,13 +112,6 @@ feature 'Expand and collapse diffs', :js do
wait_for_requests
end
it
'makes a request to get the content'
do
ajax_uris
=
evaluate_script
(
'ajaxUris'
)
expect
(
ajax_uris
).
not_to
be_empty
expect
(
ajax_uris
.
first
).
to
include
(
'large_diff.md'
)
end
it
'shows the diff content'
do
expect
(
large_diff
).
to
have_selector
(
'.code'
)
expect
(
large_diff
).
not_to
have_selector
(
'.nothing-here-block'
)
...
...
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