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
Boxiang Sun
gitlab-ce
Commits
1543679e
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
app/assets/javascripts/repo/stores/actions.js
app/assets/javascripts/repo/stores/actions.js
+10
-0
app/assets/javascripts/repo/stores/actions/file.js
app/assets/javascripts/repo/stores/actions/file.js
+17
-3
app/assets/stylesheets/pages/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
flash
from
'
../../flash
'
;
import
service
from
'
../services
'
;
import
service
from
'
../services
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
...
@@ -99,6 +100,15 @@ export const popHistoryState = ({ state, dispatch, getters }) => {
...
@@ -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/tree
'
;
export
*
from
'
./actions/file
'
;
export
*
from
'
./actions/file
'
;
export
*
from
'
./actions/branch
'
;
export
*
from
'
./actions/branch
'
;
app/assets/javascripts/repo/stores/actions/file.js
View file @
1543679e
import
flash
from
'
../../../flash
'
;
import
flash
from
'
../../../flash
'
;
import
service
from
'
../../services
'
;
import
service
from
'
../../services
'
;
import
*
as
types
from
'
../mutation_types
'
;
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
;
if
(
file
.
changed
||
file
.
tempFile
)
return
;
const
indexOfClosedFile
=
findIndexOfFile
(
state
.
openFiles
,
file
);
const
fileWasActive
=
file
.
active
;
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
);
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
);
commit
(
types
.
SET_FILE_ACTIVE
,
{
file
,
active
:
false
});
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
;
const
currentActiveFile
=
getters
.
activeFile
;
if
(
currentActiveFile
)
{
if
(
currentActiveFile
)
{
...
@@ -18,6 +31,7 @@ export const setFileActive = ({ commit, state, getters }, file) => {
...
@@ -18,6 +31,7 @@ export const setFileActive = ({ commit, state, getters }, file) => {
}
}
commit
(
types
.
SET_FILE_ACTIVE
,
{
file
,
active
:
true
});
commit
(
types
.
SET_FILE_ACTIVE
,
{
file
,
active
:
true
});
dispatch
(
'
scrollToTab
'
);
};
};
export
const
getFileData
=
({
commit
,
dispatch
},
file
)
=>
{
export
const
getFileData
=
({
commit
,
dispatch
},
file
)
=>
{
...
...
app/assets/stylesheets/pages/repo.scss
View file @
1543679e
...
@@ -138,6 +138,7 @@
...
@@ -138,6 +138,7 @@
}
}
#tabs
{
#tabs
{
position
:
relative
;
flex-shrink
:
0
;
flex-shrink
:
0
;
display
:
flex
;
display
:
flex
;
width
:
100%
;
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