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
Léo-Paul Géneau
gitlab-ce
Commits
b507682d
Commit
b507682d
authored
Jul 27, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made the changed files holder sticky
parent
655510ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
4 deletions
+77
-4
app/assets/javascripts/lib/utils/sticky.js
app/assets/javascripts/lib/utils/sticky.js
+21
-0
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+3
-0
app/assets/stylesheets/pages/diff.scss
app/assets/stylesheets/pages/diff.scss
+41
-0
app/views/projects/diffs/_stats.html.haml
app/views/projects/diffs/_stats.html.haml
+12
-4
No files found.
app/assets/javascripts/lib/utils/sticky.js
0 → 100644
View file @
b507682d
export
const
isSticky
=
(
el
,
stickyTop
)
=>
{
const
top
=
el
.
getBoundingClientRect
().
top
;
if
(
top
===
stickyTop
)
{
el
.
classList
.
add
(
'
is-stuck
'
);
}
else
{
el
.
classList
.
remove
(
'
is-stuck
'
);
}
};
export
default
(
el
)
=>
{
const
computedStyle
=
window
.
getComputedStyle
(
el
);
if
(
!
/sticky/
.
test
(
computedStyle
.
position
))
return
;
const
stickyTop
=
parseInt
(
computedStyle
.
top
,
10
);
document
.
addEventListener
(
'
scroll
'
,
()
=>
isSticky
(
el
,
stickyTop
),
{
passive
:
true
,
});
};
app/assets/javascripts/merge_request_tabs.js
View file @
b507682d
...
...
@@ -7,6 +7,7 @@ import Cookies from 'js-cookie';
import
'
./breakpoints
'
;
import
'
./flash
'
;
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
stickyMonitor
from
'
./lib/utils/sticky
'
;
/* eslint-disable max-len */
// MergeRequestTabs
...
...
@@ -268,6 +269,8 @@ import BlobForkSuggestion from './blob/blob_fork_suggestion';
this
.
initChangesDropdown
();
stickyMonitor
(
document
.
querySelector
(
'
.js-diff-files-changed
'
));
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'
undefined
'
)
{
gl
.
diffNotesCompileComponents
();
}
...
...
app/assets/stylesheets/pages/diff.scss
View file @
b507682d
...
...
@@ -559,6 +559,47 @@
}
}
.diff-files-changed
{
.commit-stat-summary
{
z-index
:
-1
;
}
@media
(
min-width
:
$screen-sm-min
)
{
position
:
-
webkit-sticky
;
position
:
sticky
;
top
:
100px
;
background-color
:
$white-light
;
z-index
:
190
;
+
.files
{
margin-top
:
1px
;
}
.diff-stats-additions-deletions-collapsed
{
display
:
none
;
}
&
.is-stuck
{
padding-top
:
0
;
padding-bottom
:
0
;
border-bottom
:
1px
solid
$white-dark
;
.diff-stats-additions-deletions-expanded
,
.inline-parallel-buttons
{
display
:
none
;
}
.diff-stats-additions-deletions-collapsed
{
display
:
block
;
}
+
.files
{
margin-top
:
16px
;
}
}
}
}
.diff-file-changes
{
width
:
450px
;
z-index
:
150
;
...
...
app/views/projects/diffs/_stats.html.haml
View file @
b507682d
-
sum_added_lines
=
diff_files
.
sum
(
&
:added_lines
)
-
sum_removed_lines
=
diff_files
.
sum
(
&
:removed_lines
)
.commit-stat-summary.dropdown
Showing
%button
.diff-stats-summary-toggler.js-diff-stats-dropdown
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
<
=
pluralize
(
diff_files
.
size
,
"changed file"
)
=
icon
(
"caret-down fw"
)
with
%strong
.cgreen
#{
diff_files
.
sum
(
&
:added_lines
)
}
additions
and
%strong
.cred
#{
diff_files
.
sum
(
&
:removed_lines
)
}
deletions
%span
.diff-stats-additions-deletions-expanded
with
%strong
.cgreen
#{
sum_added_lines
}
additions
and
%strong
.cred
#{
sum_removed_lines
}
deletions
.diff-stats-additions-deletions-collapsed.pull-right
{
"aria-hidden"
:
"true"
}
%strong
.cgreen
<
+
#{
sum_added_lines
}
%strong
.cred
<
\
-
#{
sum_removed_lines
}
.dropdown-menu.diff-file-changes
=
dropdown_filter
(
"Search file"
)
.dropdown-content
...
...
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