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
5c52ca9a
Commit
5c52ca9a
authored
Jul 06, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor SingleFileDiff class to ES module syntax
parent
a23db42e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
14 deletions
+7
-14
app/assets/javascripts/diff.js
app/assets/javascripts/diff.js
+6
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/single_file_diff.js
app/assets/javascripts/single_file_diff.js
+1
-11
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+0
-1
No files found.
app/assets/javascripts/diff.js
View file @
5c52ca9a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
'
./lib/utils/url_utility
'
;
import
'
./lib/utils/url_utility
'
;
import
FilesCommentButton
from
'
./files_comment_button
'
;
import
FilesCommentButton
from
'
./files_comment_button
'
;
import
SingleFileDiff
from
'
./single_file_diff
'
;
const
UNFOLD_COUNT
=
20
;
const
UNFOLD_COUNT
=
20
;
let
isBound
=
false
;
let
isBound
=
false
;
...
@@ -10,7 +11,11 @@ class Diff {
...
@@ -10,7 +11,11 @@ class Diff {
constructor
()
{
constructor
()
{
const
$diffFile
=
$
(
'
.files .diff-file
'
);
const
$diffFile
=
$
(
'
.files .diff-file
'
);
$diffFile
.
singleFileDiff
();
$diffFile
.
each
((
index
,
file
)
=>
{
if
(
!
$
.
data
(
file
,
'
singleFileDiff
'
))
{
$
.
data
(
file
,
'
singleFileDiff
'
,
new
SingleFileDiff
(
file
));
}
});
FilesCommentButton
.
init
(
$diffFile
);
FilesCommentButton
.
init
(
$diffFile
);
...
...
app/assets/javascripts/main.js
View file @
5c52ca9a
...
@@ -144,7 +144,6 @@ import './right_sidebar';
...
@@ -144,7 +144,6 @@ import './right_sidebar';
import
'
./search
'
;
import
'
./search
'
;
import
'
./search_autocomplete
'
;
import
'
./search_autocomplete
'
;
import
'
./signin_tabs_memoizer
'
;
import
'
./signin_tabs_memoizer
'
;
import
'
./single_file_diff
'
;
import
'
./smart_interval
'
;
import
'
./smart_interval
'
;
import
'
./snippets_list
'
;
import
'
./snippets_list
'
;
import
'
./star
'
;
import
'
./star
'
;
...
...
app/assets/javascripts/single_file_diff.js
View file @
5c52ca9a
...
@@ -7,7 +7,7 @@ const LOADING_HTML = '<i class="fa fa-spinner fa-spin"></i>';
...
@@ -7,7 +7,7 @@ const LOADING_HTML = '<i class="fa fa-spinner fa-spin"></i>';
const
ERROR_HTML
=
'
<div class="nothing-here-block"><i class="fa fa-warning"></i> Could not load diff</div>
'
;
const
ERROR_HTML
=
'
<div class="nothing-here-block"><i class="fa fa-warning"></i> Could not load diff</div>
'
;
const
COLLAPSED_HTML
=
'
<div class="nothing-here-block diff-collapsed">This diff is collapsed. <a class="click-to-expand">Click to expand it.</a></div>
'
;
const
COLLAPSED_HTML
=
'
<div class="nothing-here-block diff-collapsed">This diff is collapsed. <a class="click-to-expand">Click to expand it.</a></div>
'
;
class
SingleFileDiff
{
export
default
class
SingleFileDiff
{
constructor
(
file
)
{
constructor
(
file
)
{
this
.
file
=
file
;
this
.
file
=
file
;
this
.
toggleDiff
=
this
.
toggleDiff
.
bind
(
this
);
this
.
toggleDiff
=
this
.
toggleDiff
.
bind
(
this
);
...
@@ -81,13 +81,3 @@ class SingleFileDiff {
...
@@ -81,13 +81,3 @@ class SingleFileDiff {
})(
this
));
})(
this
));
}
}
}
}
$
.
fn
.
singleFileDiff
=
function
()
{
return
this
.
each
(
function
()
{
if
(
!
$
.
data
(
this
,
'
singleFileDiff
'
))
{
return
$
.
data
(
this
,
'
singleFileDiff
'
,
new
window
.
SingleFileDiff
(
this
));
}
});
};
window
.
SingleFileDiff
=
SingleFileDiff
;
spec/javascripts/merge_request_tabs_spec.js
View file @
5c52ca9a
...
@@ -6,7 +6,6 @@ import '~/commit/pipelines/pipelines_bundle';
...
@@ -6,7 +6,6 @@ import '~/commit/pipelines/pipelines_bundle';
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/diff
'
;
import
'
~/diff
'
;
import
'
~/single_file_diff
'
;
import
'
~/files_comment_button
'
;
import
'
~/files_comment_button
'
;
import
'
~/notes
'
;
import
'
~/notes
'
;
import
'
vendor/jquery.scrollTo
'
;
import
'
vendor/jquery.scrollTo
'
;
...
...
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