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
6190c39e
Commit
6190c39e
authored
Jun 29, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Functionality to move between files.
To show file and to start to go back.
parent
c2e34bab
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
115 additions
and
40 deletions
+115
-40
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+1
-1
app/assets/javascripts/repo/repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+1
-0
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+14
-8
app/assets/javascripts/repo/repo_file.js
app/assets/javascripts/repo/repo_file.js
+12
-7
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+22
-6
app/assets/javascripts/repo/repo_prev_directory.js
app/assets/javascripts/repo/repo_prev_directory.js
+20
-0
app/assets/javascripts/repo/repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+13
-5
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+0
-1
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+20
-3
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+0
-2
app/views/projects/tree/_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+12
-7
No files found.
app/assets/javascripts/dispatcher.js
View file @
6190c39e
...
@@ -342,7 +342,7 @@ import RepoBundle from './repo/repo_bundle';
...
@@ -342,7 +342,7 @@ import RepoBundle from './repo/repo_bundle';
shortcut_handler
=
true
;
shortcut_handler
=
true
;
break
;
break
;
case
'
projects:blob:show
'
:
case
'
projects:blob:show
'
:
new
RepoBundle
();
new
RepoBundle
();
break
;
break
;
case
'
projects:blame:show
'
:
case
'
projects:blame:show
'
:
initBlob
();
initBlob
();
...
...
app/assets/javascripts/repo/repo_bundle.js
View file @
6190c39e
...
@@ -6,6 +6,7 @@ import Helper from './repo_helper'
...
@@ -6,6 +6,7 @@ import Helper from './repo_helper'
export
default
class
RepoBundle
{
export
default
class
RepoBundle
{
constructor
()
{
constructor
()
{
console
.
log
(
document
.
getElementById
(
'
ide
'
))
const
url
=
document
.
getElementById
(
'
ide
'
).
dataset
.
url
;
const
url
=
document
.
getElementById
(
'
ide
'
).
dataset
.
url
;
Store
.
service
=
Service
;
Store
.
service
=
Service
;
Store
.
service
.
url
=
url
;
Store
.
service
.
url
=
url
;
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
6190c39e
...
@@ -35,20 +35,26 @@ export default class RepoEditor {
...
@@ -35,20 +35,26 @@ export default class RepoEditor {
)
)
);
);
}
}
if
(
this
.
isTree
)
{
self
.
el
.
styles
=
'
display: none
'
;
}
else
{
self
.
el
.
styles
=
'
display: inline-block
'
;
}
},
},
watch
:
{
watch
:
{
isTree
()
{
if
(
this
.
isTree
)
{
self
.
el
.
style
.
display
=
'
none
'
;
}
else
{
self
.
el
.
style
.
display
=
'
inline-block
'
;
}
},
blobRaw
()
{
blobRaw
()
{
if
(
this
.
isTree
)
{
if
(
this
.
isTree
)
{
}
else
{
}
else
{
// this.blobRaw
self
.
monacoEditor
.
setModel
(
// console.log('models', editor.getModels())
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plain
'
)
);
}
}
}
}
}
}
...
...
app/assets/javascripts/repo/repo_file.js
View file @
6190c39e
let
RepoFile
=
{
let
RepoFile
=
{
template
:
`
template
:
`
<
li
>
<
tr
>
<
div class='col-md-4'
>
<
td
>
<i class='fa' :class='file.icon'></i>
<i class='fa' :class='file.icon'></i>
<a :href='file.url' @click.prevent='linkClicked(file)'>{{file.name}}</a>
<a :href='file.url' @click.prevent='linkClicked(file)'>{{file.name}}</a>
</div>
</td>
<div class="col-md-4">
<td v-if='isTree'>
<span>{{JSON.stringify(file)}}</span>
<div class='ellipsis'>{{file.lastCommitMessage}}</div>
</div>
</td>
</li>
<td v-if='isTree'>
<span>{{file.lastCommitUpdate}}</span>
</td>
</tr>
`
,
`
,
props
:
{
props
:
{
name
:
'
repo-file
'
,
name
:
'
repo-file
'
,
file
:
Object
,
file
:
Object
,
isTree
:
Boolean
},
},
methods
:
{
methods
:
{
linkClicked
(
file
)
{
linkClicked
(
file
)
{
console
.
log
(
this
.
isTree
)
this
.
$emit
(
'
linkclicked
'
,
file
);
this
.
$emit
(
'
linkclicked
'
,
file
);
}
}
}
}
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
6190c39e
...
@@ -11,6 +11,21 @@ let RepoHelper = {
...
@@ -11,6 +11,21 @@ let RepoHelper = {
?
window
.
performance
?
window
.
performance
:
Date
,
:
Date
,
getLanguagesForMimeType
(
mimetypeNeedle
,
monaco
)
{
const
langs
=
monaco
.
languages
.
getLanguages
();
let
lang
=
''
;
langs
.
every
((
lang
)
=>
{
const
hasLang
=
lang
.
mimetypes
.
some
((
mimetype
)
=>
{
return
mimetypeNeedle
===
mimetype
});
if
(
hasLang
)
{
lang
=
lang
.
id
;
return
true
;
}
return
false
;
});
},
blobURLtoParent
(
url
)
{
blobURLtoParent
(
url
)
{
const
split
=
url
.
split
(
'
/
'
);
const
split
=
url
.
split
(
'
/
'
);
split
.
pop
();
split
.
pop
();
...
@@ -24,7 +39,7 @@ let RepoHelper = {
...
@@ -24,7 +39,7 @@ let RepoHelper = {
// may be tree or file.
// may be tree or file.
getContent
()
{
getContent
()
{
Service
.
getContent
()
Service
.
getContent
()
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
let
data
=
response
.
data
;
let
data
=
response
.
data
;
Store
.
isTree
=
this
.
isTree
(
data
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
Store
.
isTree
)
{
...
@@ -32,10 +47,10 @@ let RepoHelper = {
...
@@ -32,10 +47,10 @@ let RepoHelper = {
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Store
.
blobRaw
=
data
.
plain
;
Service
.
getContent
(
parentURL
)
Service
.
getContent
(
parentURL
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
Store
.
files
=
this
.
dataToListOfFiles
(
response
.
data
);
})
})
.
catch
((
response
)
=>
{
.
catch
((
response
)
=>
{
});
});
}
else
{
}
else
{
...
@@ -61,7 +76,9 @@ let RepoHelper = {
...
@@ -61,7 +76,9 @@ let RepoHelper = {
type
:
'
blob
'
,
type
:
'
blob
'
,
name
:
blob
.
name
,
name
:
blob
.
name
,
url
:
blob
.
url
,
url
:
blob
.
url
,
icon
:
this
.
toFA
(
blob
.
icon
)
icon
:
this
.
toFA
(
blob
.
icon
),
lastCommitMessage
:
blob
.
last_commit
.
message
,
lastCommitUpdate
:
blob
.
last_commit
.
committed_date
})
})
});
});
...
@@ -104,7 +121,6 @@ let RepoHelper = {
...
@@ -104,7 +121,6 @@ let RepoHelper = {
var
history
=
window
.
history
;
var
history
=
window
.
history
;
this
.
_key
=
this
.
genKey
();
this
.
_key
=
this
.
genKey
();
history
.
pushState
({
key
:
this
.
_key
},
''
,
url
);
history
.
pushState
({
key
:
this
.
_key
},
''
,
url
);
window
.
scrollTo
(
0
,
0
);
}
}
};
};
...
...
app/assets/javascripts/repo/repo_prev_directory.js
0 → 100644
View file @
6190c39e
let
RepoPreviousDirectory
=
{
template
:
`
<tr>
<td colspan='3'>
<a href='#' @click.prevent='linkClicked("prev")'>..</a>
</td>
</tr>
`
,
props
:
{
name
:
'
repo-previous-directory
'
,
},
methods
:
{
linkClicked
(
file
)
{
console
.
log
(
this
.
isTree
)
this
.
$emit
(
'
linkclicked
'
,
file
);
}
}
};
export
default
RepoPreviousDirectory
;
\ No newline at end of file
app/assets/javascripts/repo/repo_sidebar.js
View file @
6190c39e
...
@@ -2,6 +2,7 @@ import Service from './repo_service'
...
@@ -2,6 +2,7 @@ import Service from './repo_service'
import
Helper
from
'
./repo_helper
'
import
Helper
from
'
./repo_helper
'
import
Vue
from
'
vue
'
import
Vue
from
'
vue
'
import
Store
from
'
./repo_store
'
import
Store
from
'
./repo_store
'
import
RepoPreviousDirectory
from
'
./repo_prev_directory
'
import
RepoFile
from
'
./repo_file
'
import
RepoFile
from
'
./repo_file
'
export
default
class
RepoSidebar
{
export
default
class
RepoSidebar
{
...
@@ -9,13 +10,15 @@ export default class RepoSidebar {
...
@@ -9,13 +10,15 @@ export default class RepoSidebar {
this
.
url
=
url
;
this
.
url
=
url
;
this
.
initVue
();
this
.
initVue
();
this
.
el
=
document
.
getElementById
(
'
ide
'
);
this
.
el
=
document
.
getElementById
(
'
ide
'
);
console
.
log
(
document
.
getElementById
(
'
sidebar
'
))
}
}
initVue
()
{
initVue
()
{
this
.
vue
=
new
Vue
({
this
.
vue
=
new
Vue
({
el
:
'
#sidebar
'
,
el
:
'
#sidebar
'
,
components
:
{
components
:
{
'
repo-file
'
:
RepoFile
,
'
repo-previous-directory
'
:
RepoPreviousDirectory
,
'
repo-file
'
:
RepoFile
,
},
},
created
()
{
created
()
{
...
@@ -34,11 +37,16 @@ export default class RepoSidebar {
...
@@ -34,11 +37,16 @@ export default class RepoSidebar {
},
},
linkClicked
(
file
)
{
linkClicked
(
file
)
{
Service
.
url
=
file
.
url
;
if
(
file
===
'
prev
'
){
Helper
.
getContent
();
Helper
.
toURL
(
file
.
url
);
}
else
{
Service
.
url
=
file
.
url
;
Helper
.
getContent
();
Helper
.
toURL
(
file
.
url
);
}
}
}
}
}
,
});
});
}
}
}
}
\ No newline at end of file
app/assets/javascripts/repo/repo_store.js
View file @
6190c39e
...
@@ -2,7 +2,6 @@ let RepoStore = {
...
@@ -2,7 +2,6 @@ let RepoStore = {
service
:
''
,
service
:
''
,
editor
:
''
,
editor
:
''
,
sidebar
:
''
,
sidebar
:
''
,
isTree
:
false
,
isTree
:
false
,
trees
:
[],
trees
:
[],
blobs
:
[],
blobs
:
[],
...
...
app/assets/stylesheets/pages/repo.scss
View file @
6190c39e
...
@@ -2,6 +2,13 @@
...
@@ -2,6 +2,13 @@
display
:
none
;
display
:
none
;
}
}
.ellipsis
{
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
width
:
300px
;
}
.fade-enter-active
,
.fade-leave-active
{
.fade-enter-active
,
.fade-leave-active
{
transition
:
opacity
.5s
transition
:
opacity
.5s
}
}
...
@@ -16,12 +23,22 @@
...
@@ -16,12 +23,22 @@
header
{
header
{
background
:
$gray-light
;
background
:
$gray-light
;
padding
:
10px
25px
;
padding
:
10px
15px
;
border-bottom
:
1px
solid
$border-color
;
}
font-size
:
$code_font_size
;
#ide
{
display
:
inline-block
;
width
:
85%
;
}
}
#sidebar
{
#sidebar
{
&
.sidebar-mini
{
display
:
inline-block
;
vertical-align
:
top
;
width
:
15%
;
border-right
:
1px
solid
$white-normal
;
}
ul
{
ul
{
list-style-type
:
none
;
list-style-type
:
none
;
padding
:
0
;
padding
:
0
;
...
...
app/views/projects/blob/_blob.html.haml
View file @
6190c39e
...
@@ -8,5 +8,3 @@
...
@@ -8,5 +8,3 @@
=
render
"projects/blob/auxiliary_viewer"
,
blob:
blob
=
render
"projects/blob/auxiliary_viewer"
,
blob:
blob
#blob-content-holder
.blob-content-holder
#blob-content-holder
.blob-content-holder
#sidebar
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
app/views/projects/tree/_tree_content.html.haml
View file @
6190c39e
.tree-content-holder
.tree-content-holder
%header
%header
Project
Project
#sidebar
#sidebar
.isworking
{
":class"
=>
"{'sidebar-mini' : !isTree}"
}
<
%ul
%table
.table
%repo-file
{
"v-for"
=>
"file in files"
,
":key"
=>
"file.id"
,
":file"
=>
"file"
,
"@linkclicked"
=>
"linkClicked(file)"
}
%thead
{
"v-if"
=>
"isTree"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
%th
Name
-
if
tree
.
readme
%th
{
"v-if"
=>
"isTree"
}
=
render
"projects/tree/readme"
,
readme:
tree
.
readme
Last
Commit
%th
{
"v-if"
=>
"isTree"
}
Last
Update
%tr
{
is:
"repo-previous-directory"
}
%tr
{
is:
"repo-file"
,
"v-for"
=>
"file in files"
,
":key"
=>
"file.id"
,
":file"
=>
"file"
,
"@linkclicked"
=>
"linkClicked(file)"
,
":is-tree"
=>
"isTree"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
>
-
if
can_edit_tree?
-
if
can_edit_tree?
=
render
'projects/blob/upload'
,
title:
_
(
'Upload New File'
),
placeholder:
_
(
'Upload New File'
),
button_title:
_
(
'Upload file'
),
form_path:
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
=
render
'projects/blob/upload'
,
title:
_
(
'Upload New File'
),
placeholder:
_
(
'Upload New File'
),
button_title:
_
(
'Upload file'
),
form_path:
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
...
...
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