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
1543679e
Unverified
Commit
1543679e
authored
Oct 26, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly activate the next tab when closing a tab
scroll to the active tab when opening/closing [ci skip]
parent
b4f7496b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
actions.js
app/assets/javascripts/repo/stores/actions.js
+10
-0
file.js
app/assets/javascripts/repo/stores/actions/file.js
+17
-3
repo.scss
app/assets/stylesheets/pages/repo.scss
+1
-0
No files found.
app/assets/javascripts/repo/stores/actions.js
View file @
1543679e
import
Vue
from
'vue'
;
import
flash
from
'../../flash'
;
import
service
from
'../services'
;
import
*
as
types
from
'./mutation_types'
;
...
...
@@ -99,6 +100,15 @@ export const popHistoryState = ({ state, dispatch, getters }) => {
}
};
export
const
scrollToTab
=
()
=>
{
Vue
.
nextTick
(()
=>
{
const
tabs
=
document
.
getElementById
(
'tabs'
);
const
tabEl
=
tabs
.
querySelector
(
'.active'
);
tabs
.
scrollLeft
=
tabEl
.
offsetLeft
;
});
};
export
*
from
'./actions/tree'
;
export
*
from
'./actions/file'
;
export
*
from
'./actions/branch'
;
app/assets/javascripts/repo/stores/actions/file.js
View file @
1543679e
import
flash
from
'../../../flash'
;
import
service
from
'../../services'
;
import
*
as
types
from
'../mutation_types'
;
import
{
createTemp
}
from
'../utils'
;
import
{
createTemp
,
findIndexOfFile
,
}
from
'../utils'
;
export
const
closeFile
=
({
commit
},
file
)
=>
{
export
const
closeFile
=
({
commit
,
state
,
dispatch
},
file
)
=>
{
if
(
file
.
changed
||
file
.
tempFile
)
return
;
const
indexOfClosedFile
=
findIndexOfFile
(
state
.
openFiles
,
file
);
const
fileWasActive
=
file
.
active
;
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
);
commit
(
types
.
SET_FILE_ACTIVE
,
{
file
,
active
:
false
});
if
(
state
.
openFiles
.
length
>
0
&&
fileWasActive
)
{
const
nextIndexToOpen
=
indexOfClosedFile
===
0
?
0
:
indexOfClosedFile
-
1
;
const
nextFileToOpen
=
state
.
openFiles
[
nextIndexToOpen
];
dispatch
(
'setFileActive'
,
nextFileToOpen
);
}
};
export
const
setFileActive
=
({
commit
,
state
,
getters
},
file
)
=>
{
export
const
setFileActive
=
({
commit
,
state
,
getters
,
dispatch
},
file
)
=>
{
const
currentActiveFile
=
getters
.
activeFile
;
if
(
currentActiveFile
)
{
...
...
@@ -18,6 +31,7 @@ export const setFileActive = ({ commit, state, getters }, file) => {
}
commit
(
types
.
SET_FILE_ACTIVE
,
{
file
,
active
:
true
});
dispatch
(
'scrollToTab'
);
};
export
const
getFileData
=
({
commit
,
dispatch
},
file
)
=>
{
...
...
app/assets/stylesheets/pages/repo.scss
View file @
1543679e
...
...
@@ -138,6 +138,7 @@
}
#tabs
{
position
:
relative
;
flex-shrink
:
0
;
display
:
flex
;
width
:
100%
;
...
...
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