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
631ee31f
Commit
631ee31f
authored
Jul 14, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial line linking.
parent
a9555221
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
14 deletions
+41
-14
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+24
-1
app/assets/javascripts/repo/repo_file_buttons.js
app/assets/javascripts/repo/repo_file_buttons.js
+2
-3
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+0
-6
app/assets/javascripts/repo/repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+1
-0
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+1
-0
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+13
-4
No files found.
app/assets/javascripts/repo/repo_editor.js
View file @
631ee31f
...
...
@@ -9,6 +9,20 @@ export default class RepoEditor {
this
.
el
=
document
.
getElementById
(
'
ide
'
);
}
addMonacoEvents
()
{
this
.
vue
.
$watch
(
'
activeFile.lineNumber
'
,
()
=>
{
console
.
log
(
'
cahnged
'
)
})
this
.
monacoEditor
.
onMouseUp
(
this
.
onMonacoEditorMouseUp
);
}
onMonacoEditorMouseUp
(
e
)
{
if
(
e
.
target
.
element
.
className
===
'
line-numbers
'
)
{
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
}
}
initMonaco
()
{
window
.
require
.
config
({
paths
:
{
vs
:
'
/monaco-editor/min/vs
'
}
});
window
.
require
([
'
vs/editor/editor.main
'
],
()
=>
{
...
...
@@ -19,10 +33,12 @@ export default class RepoEditor {
readOnly
:
true
,
contextmenu
:
false
,
}
)
);
Helper
.
monacoInstance
=
monaco
;
this
.
initVue
();
monaco
.
languages
.
getLanguages
();
this
.
addMonacoEvents
();
});
}
...
...
@@ -54,6 +70,13 @@ export default class RepoEditor {
},
watch
:
{
activeLine
()
{
self
.
monacoEditor
.
setPosition
({
lineNumber
:
this
.
activeLine
,
column
:
1
});
},
isTree
()
{
this
.
showHide
();
},
...
...
app/assets/javascripts/repo/repo_file_buttons.js
View file @
631ee31f
...
...
@@ -14,7 +14,7 @@ export default class RepoSidebar {
el
:
'
#repo-file-buttons
'
,
data
:
()
=>
Store
,
template
:
`
<div id='repo-file-buttons' v-if='
!isTree
'>
<div id='repo-file-buttons' v-if='
isMini
'>
<a :href='rawFileURL' target='_blank' class='btn btn-default'>Download file</a>
<div class="btn-group" role="group" aria-label="File actions">
<a :href='blameFileUrl' class='btn btn-default'>Blame</a>
...
...
@@ -36,7 +36,6 @@ export default class RepoSidebar {
},
rawFileURL
()
{
console
.
log
(
this
.
activeFile
)
return
Helper
.
getRawURLFromBlobURL
(
this
.
activeFile
.
url
);
},
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
631ee31f
...
...
@@ -37,7 +37,6 @@ let RepoHelper = {
split
[
blobIndex
]
=
'
tree
'
;
}
joined
=
split
.
join
(
'
/
'
);
console
.
log
(
split
)
return
split
.
join
(
'
/
'
);
},
...
...
@@ -164,14 +163,12 @@ let RepoHelper = {
// may be tree or file.
getContent
(
file
)
{
console
.
log
(
'
file
'
)
const
loadingData
=
this
.
setLoading
(
true
);
Service
.
getContent
()
.
then
((
response
)
=>
{
let
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
{
file
=
data
;
...
...
@@ -185,7 +182,6 @@ let RepoHelper = {
data
);
data
.
binary
=
true
;
console
.
log
(
'
file1
'
,
file
)
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
}
...
...
@@ -194,7 +190,6 @@ let RepoHelper = {
this
.
setActiveFile
(
data
);
}
else
{
Store
.
blobRaw
=
data
.
plain
;
console
.
log
(
'
file2
'
,
file
)
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
}
...
...
@@ -219,7 +214,6 @@ let RepoHelper = {
}
})
.
catch
((
response
)
=>
{
console
.
log
(
'
response
'
,
response
)
this
.
setLoading
(
false
,
loadingData
);
new
Flash
(
'
Unable to load the file at this time.
'
)
});
...
...
app/assets/javascripts/repo/repo_sidebar.js
View file @
631ee31f
...
...
@@ -35,6 +35,7 @@ export default class RepoSidebar {
methods
:
{
addPopEventListener
()
{
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'
#
'
)
>
-
1
)
return
;
this
.
linkClicked
({
url
:
location
.
href
});
...
...
app/assets/javascripts/repo/repo_store.js
View file @
631ee31f
...
...
@@ -21,6 +21,7 @@ let RepoStore = {
size
:
0
,
url
:
''
},
activeLine
:
0
,
files
:
[],
binary
:
false
,
binaryMimeType
:
''
,
...
...
app/assets/stylesheets/pages/repo.scss
View file @
631ee31f
...
...
@@ -28,10 +28,19 @@ header {
display
:
inline-block
;
width
:
85%
;
.monaco-editor.vs
.cursor
{
.monaco-editor.vs
{
.line-numbers
{
cursor
:
pointer
;
&
:hover
{
text-decoration
:
underline
;
}
}
.cursor
{
background
:
rgba
(
255
,
255
,
255
,
0
);
border-color
:
rgba
(
255
,
255
,
255
,
0
);
}
}
#tabs
{
height
:
41px
;
...
...
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