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
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 {
...
@@ -14,6 +14,11 @@ export default {
highlightFile
()
{
highlightFile
()
{
$
(
this
.
$el
).
find
(
'
.file-content
'
).
syntaxHighlight
();
$
(
this
.
$el
).
find
(
'
.file-content
'
).
syntaxHighlight
();
},
},
highlightLine
()
{
if
(
Store
.
activeLine
>
-
1
)
{
this
.
lineHighlighter
.
highlightHash
(
`#L
${
Store
.
activeLine
}
`
);
}
}
},
},
mounted
()
{
mounted
()
{
this
.
highlightFile
();
this
.
highlightFile
();
...
@@ -26,10 +31,11 @@ export default {
...
@@ -26,10 +31,11 @@ export default {
html
()
{
html
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
highlightFile
();
this
.
highlightFile
();
this
.
highlightLine
();
});
});
},
},
activeLine
()
{
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 {
...
@@ -33,26 +33,25 @@ export default {
// Maybe it is not in the current tree but in the opened tabs
// Maybe it is not in the current tree but in the opened tabs
selectedFile
=
Helper
.
getFileFromPath
(
location
.
pathname
);
selectedFile
=
Helper
.
getFileFromPath
(
location
.
pathname
);
}
}
let
lineNumber
=
null
;
if
(
location
.
hash
.
indexOf
(
'
#L
'
)
>
-
1
)
lineNumber
=
Number
(
location
.
hash
.
substr
(
2
));
if
(
selectedFile
)
{
if
(
selectedFile
)
{
if
(
selectedFile
.
url
!==
this
.
activeFile
.
url
)
{
if
(
selectedFile
.
url
!==
this
.
activeFile
.
url
)
{
this
.
fileClicked
(
selectedFile
);
this
.
fileClicked
(
selectedFile
,
lineNumber
);
}
}
else
{
if
(
location
.
hash
.
indexOf
(
'
#L
'
)
>
-
1
)
{
const
lineNumber
=
Number
(
location
.
hash
.
substr
(
2
));
if
(
!
isNaN
(
lineNumber
))
{
Store
.
setActiveLine
(
lineNumber
);
Store
.
setActiveLine
(
lineNumber
);
}
}
}
}
else
{
}
else
{
// Not opened at all lets open new tab
// Not opened at all lets open new tab
this
.
fileClicked
({
this
.
fileClicked
({
url
:
location
.
href
,
url
:
location
.
href
,
});
}
,
lineNumber
);
}
}
},
},
fileClicked
(
clickedFile
)
{
fileClicked
(
clickedFile
,
lineNumber
)
{
let
file
=
clickedFile
;
let
file
=
clickedFile
;
if
(
file
.
loading
)
return
;
if
(
file
.
loading
)
return
;
file
.
loading
=
true
;
file
.
loading
=
true
;
...
@@ -60,17 +59,20 @@ export default {
...
@@ -60,17 +59,20 @@ export default {
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
file
=
Store
.
removeChildFilesOfTree
(
file
);
file
=
Store
.
removeChildFilesOfTree
(
file
);
file
.
loading
=
false
;
file
.
loading
=
false
;
Store
.
setActiveLine
(
lineNumber
);
}
else
{
}
else
{
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
if
(
openFile
)
{
if
(
openFile
)
{
file
.
loading
=
false
;
file
.
loading
=
false
;
Store
.
setActiveFiles
(
openFile
);
Store
.
setActiveFiles
(
openFile
);
Store
.
setActiveLine
(
lineNumber
);
}
else
{
}
else
{
Service
.
url
=
file
.
url
;
Service
.
url
=
file
.
url
;
Helper
.
getContent
(
file
)
Helper
.
getContent
(
file
)
.
then
(()
=>
{
.
then
(()
=>
{
file
.
loading
=
false
;
file
.
loading
=
false
;
Helper
.
scrollTabsRight
();
Helper
.
scrollTabsRight
();
Store
.
setActiveLine
(
lineNumber
);
})
})
.
catch
(
Helper
.
loadingError
);
.
catch
(
Helper
.
loadingError
);
}
}
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
7453b643
...
@@ -26,7 +26,7 @@ const RepoStore = {
...
@@ -26,7 +26,7 @@ const RepoStore = {
},
},
activeFile
:
Helper
.
getDefaultActiveFile
(),
activeFile
:
Helper
.
getDefaultActiveFile
(),
activeFileIndex
:
0
,
activeFileIndex
:
0
,
activeLine
:
0
,
activeLine
:
-
1
,
activeFileLabel
:
'
Raw
'
,
activeFileLabel
:
'
Raw
'
,
files
:
[],
files
:
[],
isCommitable
:
false
,
isCommitable
:
false
,
...
@@ -85,6 +85,7 @@ const RepoStore = {
...
@@ -85,6 +85,7 @@ const RepoStore = {
if
(
!
file
.
loading
)
Helper
.
updateHistoryEntry
(
file
.
url
,
file
.
pageTitle
||
file
.
name
);
if
(
!
file
.
loading
)
Helper
.
updateHistoryEntry
(
file
.
url
,
file
.
pageTitle
||
file
.
name
);
RepoStore
.
binary
=
file
.
binary
;
RepoStore
.
binary
=
file
.
binary
;
RepoStore
.
setActiveLine
(
-
1
);
},
},
setFileActivity
(
file
,
openedFile
,
i
)
{
setFileActivity
(
file
,
openedFile
,
i
)
{
...
@@ -102,7 +103,7 @@ const RepoStore = {
...
@@ -102,7 +103,7 @@ const RepoStore = {
},
},
setActiveLine
(
activeLine
)
{
setActiveLine
(
activeLine
)
{
RepoStore
.
activeLine
=
activeLine
;
if
(
!
isNaN
(
activeLine
))
RepoStore
.
activeLine
=
activeLine
;
},
},
setActiveToRaw
()
{
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