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
0ffdf51d
Commit
0ffdf51d
authored
Aug 20, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add current file and total files to the file-by-file nav
parent
6aea0191
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
17 deletions
+31
-17
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+31
-12
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+0
-5
No files found.
app/assets/javascripts/diffs/components/app.vue
View file @
0ffdf51d
<
script
>
<
script
>
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
GlLoadingIcon
,
GlButton
,
GlAlert
,
GlPagination
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
,
GlButton
,
GlAlert
,
GlPagination
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
Mousetrap
from
'
mousetrap
'
;
import
Mousetrap
from
'
mousetrap
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
getParameterByName
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
getParameterByName
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
...
@@ -40,6 +40,7 @@ export default {
...
@@ -40,6 +40,7 @@ export default {
GlPagination
,
GlPagination
,
GlButton
,
GlButton
,
GlAlert
,
GlAlert
,
GlSprintf
,
},
},
mixins
:
[
glFeatureFlagsMixin
()],
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
props
:
{
...
@@ -169,15 +170,21 @@ export default {
...
@@ -169,15 +170,21 @@ export default {
isDiffHead
()
{
isDiffHead
()
{
return
parseBoolean
(
getParameterByName
(
'
diff_head
'
));
return
parseBoolean
(
getParameterByName
(
'
diff_head
'
));
},
},
previousFile
()
{
showFileByFileNavigation
()
{
const
currentFile
=
this
.
currentDiffIndex
+
1
;
return
this
.
diffFiles
.
length
>
1
&&
this
.
viewDiffsFileByFile
;
},
currentFileNumber
()
{
return
this
.
currentDiffIndex
+
1
;
},
previousFileNumber
()
{
const
{
currentDiffIndex
}
=
this
;
return
current
File
>=
2
?
currentFile
-
1
:
null
;
return
current
DiffIndex
>=
1
?
currentDiffIndex
:
null
;
},
},
nextFile
()
{
nextFile
Number
()
{
const
currentFile
=
this
.
currentDiffIndex
+
1
;
const
{
currentFileNumber
,
diffFiles
}
=
this
;
return
currentFile
<
this
.
diffFiles
.
length
?
currentFile
+
1
:
null
;
return
currentFile
Number
<
diffFiles
.
length
?
currentFileNumber
+
1
:
null
;
},
},
},
},
watch
:
{
watch
:
{
...
@@ -284,6 +291,9 @@ export default {
...
@@ -284,6 +291,9 @@ export default {
'
toggleShowTreeList
'
,
'
toggleShowTreeList
'
,
'
navigateToDiffFileIndex
'
,
'
navigateToDiffFileIndex
'
,
]),
]),
navigateToDiffFileNumber
(
number
)
{
this
.
navigateToDiffFileIndex
(
number
-
1
);
},
refetchDiffData
()
{
refetchDiffData
()
{
this
.
fetchData
(
false
);
this
.
fetchData
(
false
);
},
},
...
@@ -519,13 +529,22 @@ export default {
...
@@ -519,13 +529,22 @@ export default {
:can-current-user-fork=
"canCurrentUserFork"
:can-current-user-fork=
"canCurrentUserFork"
:view-diffs-file-by-file=
"viewDiffsFileByFile"
:view-diffs-file-by-file=
"viewDiffsFileByFile"
/>
/>
<div
v-if=
"viewDiffsFileByFile"
class=
"file-by-file-navigation"
>
<div
v-if=
"showFileByFileNavigation"
data-testid=
"file-by-file-navigation"
class=
"gl-display-grid gl-text-center"
>
<gl-pagination
<gl-pagination
:value=
"currentDiffIndex + 1"
class=
"gl-mx-auto"
:prev-page=
"previousFile"
:value=
"currentFileNumber"
:next-page=
"nextFile"
:prev-page=
"previousFileNumber"
@
input=
"val => navigateToDiffFileIndex(val - 1)"
:next-page=
"nextFileNumber"
@
input=
"navigateToDiffFileNumber"
/>
/>
<gl-sprintf
:message=
"__('File %
{current} of %{total}')">
<template
#current
>
{{
currentFileNumber
}}
</
template
>
<
template
#total
>
{{
diffFiles
.
length
}}
</
template
>
</gl-sprintf>
</div>
</div>
</template>
</template>
<no-changes
v-else
:changes-empty-state-illustration=
"changesEmptyStateIllustration"
/>
<no-changes
v-else
:changes-empty-state-illustration=
"changesEmptyStateIllustration"
/>
...
...
app/assets/stylesheets/pages/merge_requests.scss
View file @
0ffdf51d
...
@@ -1035,8 +1035,3 @@ $mr-widget-min-height: 69px;
...
@@ -1035,8 +1035,3 @@ $mr-widget-min-height: 69px;
.diff-file-row.is-active
{
.diff-file-row.is-active
{
background-color
:
$gray-50
;
background-color
:
$gray-50
;
}
}
.file-by-file-navigation
{
display
:
grid
;
place-items
:
center
;
}
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