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
Jérome Perrin
gitlab-ce
Commits
7453b643
Commit
7453b643
authored
Oct 06, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resetting of active Line + setting it for the async display functions
parent
eda9e6b6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
app/assets/javascripts/repo/components/repo_preview.vue
app/assets/javascripts/repo/components/repo_preview.vue
+7
-1
app/assets/javascripts/repo/components/repo_sidebar.vue
app/assets/javascripts/repo/components/repo_sidebar.vue
+12
-10
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+3
-2
No files found.
app/assets/javascripts/repo/components/repo_preview.vue
View file @
7453b643
...
...
@@ -14,6 +14,11 @@ export default {
highlightFile
()
{
$
(
this
.
$el
).
find
(
'
.file-content
'
).
syntaxHighlight
();
},
highlightLine
()
{
if
(
Store
.
activeLine
>
-
1
)
{
this
.
lineHighlighter
.
highlightHash
(
`#L
${
Store
.
activeLine
}
`
);
}
}
},
mounted
()
{
this
.
highlightFile
();
...
...
@@ -26,10 +31,11 @@ export default {
html
()
{
this
.
$nextTick
(()
=>
{
this
.
highlightFile
();
this
.
highlightLine
();
});
},
activeLine
()
{
this
.
lineHighlighter
.
highlightHash
(
`#L
${
Store
.
activeLine
}
`
);
this
.
highlightLine
(
);
},
},
};
...
...
app/assets/javascripts/repo/components/repo_sidebar.vue
View file @
7453b643
...
...
@@ -33,26 +33,25 @@ export default {
// Maybe it is not in the current tree but in the opened tabs
selectedFile
=
Helper
.
getFileFromPath
(
location
.
pathname
);
}
let
lineNumber
=
null
;
if
(
location
.
hash
.
indexOf
(
'
#L
'
)
>
-
1
)
lineNumber
=
Number
(
location
.
hash
.
substr
(
2
));
if
(
selectedFile
)
{
if
(
selectedFile
.
url
!==
this
.
activeFile
.
url
)
{
this
.
fileClicked
(
selectedFile
);
}
if
(
location
.
hash
.
indexOf
(
'
#L
'
)
>
-
1
)
{
const
lineNumber
=
Number
(
location
.
hash
.
substr
(
2
));
if
(
!
isNaN
(
lineNumber
))
{
this
.
fileClicked
(
selectedFile
,
lineNumber
);
}
else
{
Store
.
setActiveLine
(
lineNumber
);
}
}
}
else
{
// Not opened at all lets open new tab
this
.
fileClicked
({
url
:
location
.
href
,
});
}
,
lineNumber
);
}
},
fileClicked
(
clickedFile
)
{
fileClicked
(
clickedFile
,
lineNumber
)
{
let
file
=
clickedFile
;
if
(
file
.
loading
)
return
;
file
.
loading
=
true
;
...
...
@@ -60,17 +59,20 @@ export default {
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
file
=
Store
.
removeChildFilesOfTree
(
file
);
file
.
loading
=
false
;
Store
.
setActiveLine
(
lineNumber
);
}
else
{
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
if
(
openFile
)
{
file
.
loading
=
false
;
Store
.
setActiveFiles
(
openFile
);
Store
.
setActiveLine
(
lineNumber
);
}
else
{
Service
.
url
=
file
.
url
;
Helper
.
getContent
(
file
)
.
then
(()
=>
{
file
.
loading
=
false
;
Helper
.
scrollTabsRight
();
Store
.
setActiveLine
(
lineNumber
);
})
.
catch
(
Helper
.
loadingError
);
}
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
7453b643
...
...
@@ -26,7 +26,7 @@ const RepoStore = {
},
activeFile
:
Helper
.
getDefaultActiveFile
(),
activeFileIndex
:
0
,
activeLine
:
0
,
activeLine
:
-
1
,
activeFileLabel
:
'
Raw
'
,
files
:
[],
isCommitable
:
false
,
...
...
@@ -85,6 +85,7 @@ const RepoStore = {
if
(
!
file
.
loading
)
Helper
.
updateHistoryEntry
(
file
.
url
,
file
.
pageTitle
||
file
.
name
);
RepoStore
.
binary
=
file
.
binary
;
RepoStore
.
setActiveLine
(
-
1
);
},
setFileActivity
(
file
,
openedFile
,
i
)
{
...
...
@@ -102,7 +103,7 @@ const RepoStore = {
},
setActiveLine
(
activeLine
)
{
RepoStore
.
activeLine
=
activeLine
;
if
(
!
isNaN
(
activeLine
))
RepoStore
.
activeLine
=
activeLine
;
},
setActiveToRaw
()
{
...
...
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