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
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
Hide 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 {
...
@@ -9,6 +9,20 @@ export default class RepoEditor {
this
.
el
=
document
.
getElementById
(
'
ide
'
);
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
()
{
initMonaco
()
{
window
.
require
.
config
({
paths
:
{
vs
:
'
/monaco-editor/min/vs
'
}
});
window
.
require
.
config
({
paths
:
{
vs
:
'
/monaco-editor/min/vs
'
}
});
window
.
require
([
'
vs/editor/editor.main
'
],
()
=>
{
window
.
require
([
'
vs/editor/editor.main
'
],
()
=>
{
...
@@ -19,10 +33,12 @@ export default class RepoEditor {
...
@@ -19,10 +33,12 @@ export default class RepoEditor {
readOnly
:
true
,
readOnly
:
true
,
contextmenu
:
false
,
contextmenu
:
false
,
}
}
)
);
Helper
.
monacoInstance
=
monaco
;
Helper
.
monacoInstance
=
monaco
;
this
.
initVue
();
this
.
initVue
();
monaco
.
languages
.
getLanguages
();
monaco
.
languages
.
getLanguages
();
this
.
addMonacoEvents
();
});
});
}
}
...
@@ -54,6 +70,13 @@ export default class RepoEditor {
...
@@ -54,6 +70,13 @@ export default class RepoEditor {
},
},
watch
:
{
watch
:
{
activeLine
()
{
self
.
monacoEditor
.
setPosition
({
lineNumber
:
this
.
activeLine
,
column
:
1
});
},
isTree
()
{
isTree
()
{
this
.
showHide
();
this
.
showHide
();
},
},
...
...
app/assets/javascripts/repo/repo_file_buttons.js
View file @
631ee31f
...
@@ -14,7 +14,7 @@ export default class RepoSidebar {
...
@@ -14,7 +14,7 @@ export default class RepoSidebar {
el
:
'
#repo-file-buttons
'
,
el
:
'
#repo-file-buttons
'
,
data
:
()
=>
Store
,
data
:
()
=>
Store
,
template
:
`
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>
<a :href='rawFileURL' target='_blank' class='btn btn-default'>Download file</a>
<div class="btn-group" role="group" aria-label="File actions">
<div class="btn-group" role="group" aria-label="File actions">
<a :href='blameFileUrl' class='btn btn-default'>Blame</a>
<a :href='blameFileUrl' class='btn btn-default'>Blame</a>
...
@@ -35,8 +35,7 @@ export default class RepoSidebar {
...
@@ -35,8 +35,7 @@ export default class RepoSidebar {
return
this
.
activeFile
.
extension
===
'
md
'
;
return
this
.
activeFile
.
extension
===
'
md
'
;
},
},
rawFileURL
()
{
rawFileURL
()
{
console
.
log
(
this
.
activeFile
)
return
Helper
.
getRawURLFromBlobURL
(
this
.
activeFile
.
url
);
return
Helper
.
getRawURLFromBlobURL
(
this
.
activeFile
.
url
);
},
},
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
631ee31f
...
@@ -37,7 +37,6 @@ let RepoHelper = {
...
@@ -37,7 +37,6 @@ let RepoHelper = {
split
[
blobIndex
]
=
'
tree
'
;
split
[
blobIndex
]
=
'
tree
'
;
}
}
joined
=
split
.
join
(
'
/
'
);
joined
=
split
.
join
(
'
/
'
);
console
.
log
(
split
)
return
split
.
join
(
'
/
'
);
return
split
.
join
(
'
/
'
);
},
},
...
@@ -164,14 +163,12 @@ let RepoHelper = {
...
@@ -164,14 +163,12 @@ let RepoHelper = {
// may be tree or file.
// may be tree or file.
getContent
(
file
)
{
getContent
(
file
)
{
console
.
log
(
'
file
'
)
const
loadingData
=
this
.
setLoading
(
true
);
const
loadingData
=
this
.
setLoading
(
true
);
Service
.
getContent
()
Service
.
getContent
()
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
let
data
=
response
.
data
;
let
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
{
if
(
!
file
)
{
file
=
data
;
file
=
data
;
...
@@ -185,7 +182,6 @@ let RepoHelper = {
...
@@ -185,7 +182,6 @@ let RepoHelper = {
data
data
);
);
data
.
binary
=
true
;
data
.
binary
=
true
;
console
.
log
(
'
file1
'
,
file
)
if
(
!
file
.
url
)
{
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
file
.
url
=
location
.
pathname
;
}
}
...
@@ -194,7 +190,6 @@ let RepoHelper = {
...
@@ -194,7 +190,6 @@ let RepoHelper = {
this
.
setActiveFile
(
data
);
this
.
setActiveFile
(
data
);
}
else
{
}
else
{
Store
.
blobRaw
=
data
.
plain
;
Store
.
blobRaw
=
data
.
plain
;
console
.
log
(
'
file2
'
,
file
)
if
(
!
file
.
url
)
{
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
file
.
url
=
location
.
pathname
;
}
}
...
@@ -219,7 +214,6 @@ let RepoHelper = {
...
@@ -219,7 +214,6 @@ let RepoHelper = {
}
}
})
})
.
catch
((
response
)
=>
{
.
catch
((
response
)
=>
{
console
.
log
(
'
response
'
,
response
)
this
.
setLoading
(
false
,
loadingData
);
this
.
setLoading
(
false
,
loadingData
);
new
Flash
(
'
Unable to load the file at this time.
'
)
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 {
...
@@ -35,6 +35,7 @@ export default class RepoSidebar {
methods
:
{
methods
:
{
addPopEventListener
()
{
addPopEventListener
()
{
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'
#
'
)
>
-
1
)
return
;
this
.
linkClicked
({
this
.
linkClicked
({
url
:
location
.
href
url
:
location
.
href
});
});
...
...
app/assets/javascripts/repo/repo_store.js
View file @
631ee31f
...
@@ -21,6 +21,7 @@ let RepoStore = {
...
@@ -21,6 +21,7 @@ let RepoStore = {
size
:
0
,
size
:
0
,
url
:
''
url
:
''
},
},
activeLine
:
0
,
files
:
[],
files
:
[],
binary
:
false
,
binary
:
false
,
binaryMimeType
:
''
,
binaryMimeType
:
''
,
...
...
app/assets/stylesheets/pages/repo.scss
View file @
631ee31f
...
@@ -27,10 +27,19 @@ header {
...
@@ -27,10 +27,19 @@ header {
.panel-right
{
.panel-right
{
display
:
inline-block
;
display
:
inline-block
;
width
:
85%
;
width
:
85%
;
.monaco-editor.vs
.cursor
{
.monaco-editor.vs
{
background
:
rgba
(
255
,
255
,
255
,
0
);
.line-numbers
{
border-color
:
rgba
(
255
,
255
,
255
,
0
);
cursor
:
pointer
;
&
:hover
{
text-decoration
:
underline
;
}
}
.cursor
{
background
:
rgba
(
255
,
255
,
255
,
0
);
border-color
:
rgba
(
255
,
255
,
255
,
0
);
}
}
}
#tabs
{
#tabs
{
...
...
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