BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
117 additions
and
40 deletions
+117
-40
dispatcher.js
app/assets/javascripts/dispatcher.js
+1
-1
repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+1
-0
repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+14
-8
repo_file.js
app/assets/javascripts/repo/repo_file.js
+12
-7
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+22
-6
repo_prev_directory.js
app/assets/javascripts/repo/repo_prev_directory.js
+21
-0
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+14
-5
repo_store.js
app/assets/javascripts/repo/repo_store.js
+0
-1
repo.scss
app/assets/stylesheets/pages/repo.scss
+20
-3
_blob.html.haml
app/views/projects/blob/_blob.html.haml
+0
-2
_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';
shortcut_handler
=
true
;
break
;
case
'projects:blob:show'
:
new
RepoBundle
();
new
RepoBundle
();
break
;
case
'projects:blame:show'
:
initBlob
();
...
...
app/assets/javascripts/repo/repo_bundle.js
View file @
6190c39e
...
...
@@ -6,6 +6,7 @@ import Helper from './repo_helper'
export
default
class
RepoBundle
{
constructor
()
{
console
.
log
(
document
.
getElementById
(
'ide'
))
const
url
=
document
.
getElementById
(
'ide'
).
dataset
.
url
;
Store
.
service
=
Service
;
Store
.
service
.
url
=
url
;
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
6190c39e
...
...
@@ -35,20 +35,26 @@ export default class RepoEditor {
)
);
}
if
(
this
.
isTree
)
{
self
.
el
.
styles
=
'display: none'
;
}
else
{
self
.
el
.
styles
=
'display: inline-block'
;
}
},
watch
:
{
isTree
()
{
if
(
this
.
isTree
)
{
self
.
el
.
style
.
display
=
'none'
;
}
else
{
self
.
el
.
style
.
display
=
'inline-block'
;
}
},
blobRaw
()
{
if
(
this
.
isTree
)
{
}
else
{
// this.blobRaw
// console.log('models', editor.getModels())
self
.
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'plain'
)
);
}
}
}
...
...
app/assets/javascripts/repo/repo_file.js
View file @
6190c39e
let
RepoFile
=
{
template
:
`
<
li
>
<
div class='col-md-4'
>
<
tr
>
<
td
>
<i class='fa' :class='file.icon'></i>
<a :href='file.url' @click.prevent='linkClicked(file)'>{{file.name}}</a>
</div>
<div class="col-md-4">
<span>{{JSON.stringify(file)}}</span>
</div>
</li>
</td>
<td v-if='isTree'>
<div class='ellipsis'>{{file.lastCommitMessage}}</div>
</td>
<td v-if='isTree'>
<span>{{file.lastCommitUpdate}}</span>
</td>
</tr>
`
,
props
:
{
name
:
'repo-file'
,
file
:
Object
,
isTree
:
Boolean
},
methods
:
{
linkClicked
(
file
)
{
console
.
log
(
this
.
isTree
)
this
.
$emit
(
'linkclicked'
,
file
);
}
}
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
6190c39e
...
...
@@ -11,6 +11,21 @@ let RepoHelper = {
?
window
.
performance
:
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
)
{
const
split
=
url
.
split
(
'/'
);
split
.
pop
();
...
...
@@ -24,7 +39,7 @@ let RepoHelper = {
// may be tree or file.
getContent
()
{
Service
.
getContent
()
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
let
data
=
response
.
data
;
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
...
...
@@ -32,10 +47,10 @@ let RepoHelper = {
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Service
.
getContent
(
parentURL
)
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
.
then
((
response
)
=>
{
Store
.
files
=
this
.
dataToListOfFiles
(
response
.
data
);
})
.
catch
((
response
)
=>
{
.
catch
((
response
)
=>
{
});
}
else
{
...
...
@@ -61,7 +76,9 @@ let RepoHelper = {
type
:
'blob'
,
name
:
blob
.
name
,
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 = {
var
history
=
window
.
history
;
this
.
_key
=
this
.
genKey
();
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'
import
Helper
from
'./repo_helper'
import
Vue
from
'vue'
import
Store
from
'./repo_store'
import
RepoPreviousDirectory
from
'./repo_prev_directory'
import
RepoFile
from
'./repo_file'
export
default
class
RepoSidebar
{
...
...
@@ -9,13 +10,15 @@ export default class RepoSidebar {
this
.
url
=
url
;
this
.
initVue
();
this
.
el
=
document
.
getElementById
(
'ide'
);
console
.
log
(
document
.
getElementById
(
'sidebar'
))
}
initVue
()
{
this
.
vue
=
new
Vue
({
el
:
'#sidebar'
,
components
:
{
'repo-file'
:
RepoFile
,
'repo-previous-directory'
:
RepoPreviousDirectory
,
'repo-file'
:
RepoFile
,
},
created
()
{
...
...
@@ -34,11 +37,16 @@ export default class RepoSidebar {
},
linkClicked
(
file
)
{
Service
.
url
=
file
.
url
;
Helper
.
getContent
();
Helper
.
toURL
(
file
.
url
);
if
(
file
===
'prev'
){
}
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 = {
service
:
''
,
editor
:
''
,
sidebar
:
''
,
isTree
:
false
,
trees
:
[],
blobs
:
[],
...
...
app/assets/stylesheets/pages/repo.scss
View file @
6190c39e
...
...
@@ -2,6 +2,13 @@
display
:
none
;
}
.ellipsis
{
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
width
:
300px
;
}
.fade-enter-active
,
.fade-leave-active
{
transition
:
opacity
.5s
}
...
...
@@ -16,12 +23,22 @@
header
{
background
:
$gray-light
;
padding
:
10px
25px
;
border-bottom
:
1px
solid
$border-color
;
font-size
:
$code_font_size
;
padding
:
10px
15px
;
}
#ide
{
display
:
inline-block
;
width
:
85%
;
}
#sidebar
{
&
.sidebar-mini
{
display
:
inline-block
;
vertical-align
:
top
;
width
:
15%
;
border-right
:
1px
solid
$white-normal
;
}
ul
{
list-style-type
:
none
;
padding
:
0
;
...
...
app/views/projects/blob/_blob.html.haml
View file @
6190c39e
...
...
@@ -8,5 +8,3 @@
=
render
"projects/blob/auxiliary_viewer"
,
blob:
blob
#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
%header
Project
#sidebar
%ul
%repo-file
{
"v-for"
=>
"file in files"
,
":key"
=>
"file.id"
,
":file"
=>
"file"
,
"@linkclicked"
=>
"linkClicked(file)"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
-
if
tree
.
readme
=
render
"projects/tree/readme"
,
readme:
tree
.
readme
#sidebar
.isworking
{
":class"
=>
"{'sidebar-mini' : !isTree}"
}
<
%table
.table
%thead
{
"v-if"
=>
"isTree"
}
%th
Name
%th
{
"v-if"
=>
"isTree"
}
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?
=
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