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
6a43c200
Commit
6a43c200
authored
7 years ago
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Navigate to new tree.
parent
7e9100fc
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
172 additions
and
38 deletions
+172
-38
repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+2
-1
repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+8
-2
repo_file.js
app/assets/javascripts/repo/repo_file.js
+19
-0
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+94
-0
repo_service.js
app/assets/javascripts/repo/repo_service.js
+7
-2
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+18
-24
repo_store.js
app/assets/javascripts/repo/repo_store.js
+3
-1
repo.scss
app/assets/stylesheets/pages/repo.scss
+15
-0
renders_blob.rb
app/controllers/concerns/renders_blob.rb
+1
-1
tree_helper.rb
app/helpers/tree_helper.rb
+1
-1
_files.html.haml
app/views/projects/_files.html.haml
+0
-6
_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-0
_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+3
-0
No files found.
app/assets/javascripts/repo/repo_bundle.js
View file @
6a43c200
...
@@ -2,6 +2,7 @@ import Sidebar from './repo_sidebar'
...
@@ -2,6 +2,7 @@ import Sidebar from './repo_sidebar'
import
Editor
from
'./repo_editor'
import
Editor
from
'./repo_editor'
import
Service
from
'./repo_service'
import
Service
from
'./repo_service'
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
export
default
class
RepoBundle
{
export
default
class
RepoBundle
{
constructor
()
{
constructor
()
{
...
@@ -10,6 +11,6 @@ export default class RepoBundle {
...
@@ -10,6 +11,6 @@ export default class RepoBundle {
Store
.
service
.
url
=
url
;
Store
.
service
.
url
=
url
;
Store
.
sidebar
=
new
Sidebar
(
url
);
Store
.
sidebar
=
new
Sidebar
(
url
);
Store
.
editor
=
new
Editor
();
Store
.
editor
=
new
Editor
();
Store
.
sideba
r
.
getContent
();
Helpe
r
.
getContent
();
}
}
}
}
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_editor.js
View file @
6a43c200
...
@@ -5,6 +5,7 @@ import Store from './repo_store'
...
@@ -5,6 +5,7 @@ import Store from './repo_store'
export
default
class
RepoEditor
{
export
default
class
RepoEditor
{
constructor
()
{
constructor
()
{
this
.
initMonaco
();
this
.
initMonaco
();
this
.
el
=
document
.
getElementById
(
'ide'
);
}
}
initMonaco
()
{
initMonaco
()
{
...
@@ -21,13 +22,12 @@ export default class RepoEditor {
...
@@ -21,13 +22,12 @@ export default class RepoEditor {
}
}
initVue
()
{
initVue
()
{
const
self
=
this
;
const
monacoEditor
=
this
.
monacoEditor
;
const
monacoEditor
=
this
.
monacoEditor
;
this
.
vue
=
new
Vue
({
this
.
vue
=
new
Vue
({
data
:
()
=>
Store
,
data
:
()
=>
Store
,
created
()
{
created
()
{
if
(
this
.
blobRaw
!==
''
){
if
(
this
.
blobRaw
!==
''
){
console
.
log
(
monacoEditor
)
monacoEditor
.
setModel
(
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
blobRaw
,
...
@@ -35,6 +35,12 @@ export default class RepoEditor {
...
@@ -35,6 +35,12 @@ export default class RepoEditor {
)
)
);
);
}
}
if
(
this
.
isTree
)
{
self
.
el
.
styles
=
'display: none'
;
}
else
{
self
.
el
.
styles
=
'display: inline-block'
;
}
},
},
watch
:
{
watch
:
{
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_file.js
0 → 100644
View file @
6a43c200
let
RepoFile
=
{
template
:
`
<li>
<i class='fa' :class='file.icon'></i>
<a :href='file.url' @click.prevent='linkClicked(file)'>{{file.name}}</a>
</li>
`
,
props
:
{
name
:
'repo-file'
,
file
:
Object
,
},
methods
:
{
linkClicked
(
file
)
{
this
.
$emit
(
'linkclicked'
,
file
);
}
}
};
export
default
RepoFile
;
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_helper.js
View file @
6a43c200
import
Service
from
'./repo_service'
import
Store
from
'./repo_store'
let
RepoHelper
=
{
let
RepoHelper
=
{
isTree
(
data
)
{
isTree
(
data
)
{
return
data
.
hasOwnProperty
(
'blobs'
);
return
data
.
hasOwnProperty
(
'blobs'
);
},
},
Time
:
window
.
performance
&&
window
.
performance
.
now
?
window
.
performance
:
Date
,
blobURLtoParent
(
url
)
{
blobURLtoParent
(
url
)
{
const
split
=
url
.
split
(
'/'
);
const
split
=
url
.
split
(
'/'
);
split
.
pop
();
split
.
pop
();
...
@@ -11,6 +19,92 @@ let RepoHelper = {
...
@@ -11,6 +19,92 @@ let RepoHelper = {
split
[
blobIndex
]
=
'tree'
;
split
[
blobIndex
]
=
'tree'
;
}
}
return
split
.
join
(
'/'
);
return
split
.
join
(
'/'
);
},
// may be tree or file.
getContent
()
{
Service
.
getContent
()
.
then
((
response
)
=>
{
let
data
=
response
.
data
;
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
// it's a blob
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Service
.
getContent
(
parentURL
)
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
})
.
catch
((
response
)
=>
{
});
}
else
{
// it's a tree
Store
.
files
=
this
.
dataToListOfFiles
(
data
);
}
})
.
catch
((
response
)
=>
{
console
.
log
(
'error response'
,
response
);
});
},
toFA
(
icon
)
{
return
`fa-
${
icon
}
`
},
dataToListOfFiles
(
data
)
{
let
a
=
[];
//push in blobs
data
.
blobs
.
forEach
((
blob
)
=>
{
a
.
push
({
type
:
'blob'
,
name
:
blob
.
name
,
url
:
blob
.
url
,
icon
:
this
.
toFA
(
blob
.
icon
)
})
});
data
.
trees
.
forEach
((
tree
)
=>
{
a
.
push
({
type
:
'tree'
,
name
:
tree
.
name
,
url
:
tree
.
url
,
icon
:
this
.
toFA
(
tree
.
icon
)
})
});
data
.
submodules
.
forEach
((
submodule
)
=>
{
a
.
push
({
type
:
'submodule'
,
name
:
submodule
.
name
,
url
:
submodule
.
url
,
icon
:
this
.
toFA
(
submodule
.
icon
)
})
});
return
a
;
},
genKey
()
{
return
this
.
Time
.
now
().
toFixed
(
3
)
},
_key
:
''
,
getStateKey
()
{
return
this
.
_key
},
setStateKey
(
key
)
{
this
.
_key
=
key
;
},
toURL
(
url
)
{
var
history
=
window
.
history
;
this
.
_key
=
this
.
genKey
();
history
.
pushState
({
key
:
this
.
_key
},
''
,
url
);
window
.
scrollTo
(
0
,
0
);
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_service.js
View file @
6a43c200
...
@@ -2,6 +2,11 @@ import axios from 'axios';
...
@@ -2,6 +2,11 @@ import axios from 'axios';
let
RepoService
=
{
let
RepoService
=
{
url
:
''
,
url
:
''
,
params
:
{
params
:
{
format
:
'json'
}
},
setUrl
(
url
)
{
setUrl
(
url
)
{
this
.
url
=
url
;
this
.
url
=
url
;
...
@@ -9,9 +14,9 @@ let RepoService = {
...
@@ -9,9 +14,9 @@ let RepoService = {
getContent
(
url
)
{
getContent
(
url
)
{
if
(
url
){
if
(
url
){
return
axios
.
get
(
url
);
return
axios
.
get
(
url
,
this
.
params
);
}
}
return
axios
.
get
(
this
.
url
);
return
axios
.
get
(
this
.
url
,
this
.
params
);
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_sidebar.js
View file @
6a43c200
import
Service
from
'./repo_service'
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
RepoFile
from
'./repo_file'
export
default
class
RepoSidebar
{
export
default
class
RepoSidebar
{
constructor
(
url
)
{
constructor
(
url
)
{
this
.
url
=
url
;
this
.
url
=
url
;
this
.
initVue
();
this
.
initVue
();
this
.
el
=
document
.
getElementById
(
'ide'
);
}
}
// may be tree or file.
initVue
()
{
getContent
()
{
this
.
vue
=
new
Vue
({
Service
.
getContent
()
el
:
'#sidebar'
,
.
then
((
response
)
=>
{
components
:
{
let
data
=
response
.
data
;
'repo-file'
:
RepoFile
,
Store
.
isTree
=
Helper
.
isTree
(
data
);
},
if
(
!
Store
.
isTree
)
{
// it's a blob
data
:
()
=>
Store
,
const
parentURL
=
Helper
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Service
.
getContent
(
parentURL
+
'/?format=json'
)
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
})
.
catch
((
response
)
=>
{
});
methods
:
{
}
else
{
linkClicked
(
file
)
{
Service
.
url
=
file
.
url
;
Helper
.
getContent
();
Helper
.
toURL
(
file
.
url
);
}
}
}
})
.
catch
((
response
)
=>
{
console
.
log
(
'error response'
,
response
);
});
});
}
}
initVue
()
{}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_store.js
View file @
6a43c200
...
@@ -8,6 +8,8 @@ let RepoStore = {
...
@@ -8,6 +8,8 @@ let RepoStore = {
blobs
:
[],
blobs
:
[],
submodules
:
[],
submodules
:
[],
blobRaw
:
''
,
blobRaw
:
''
,
blobRendered
:
''
blobRendered
:
''
,
files
:
[]
};
};
export
default
RepoStore
;
export
default
RepoStore
;
This diff is collapsed.
Click to expand it.
app/assets/stylesheets/pages/repo.scss
0 → 100644
View file @
6a43c200
[
v-cloak
]
{
display
:
none
;
}
#sidebar
{
ul
{
list-style-type
:
none
;
padding
:
0
;
li
{
border-bottom
:
1px
solid
$border-gray-normal
;
padding
:
10px
20px
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/controllers/concerns/renders_blob.rb
View file @
6a43c200
...
@@ -12,7 +12,7 @@ module RendersBlob
...
@@ -12,7 +12,7 @@ module RendersBlob
blob
.
simple_viewer
blob
.
simple_viewer
end
end
return
render_404
unless
viewer
return
render_404
unless
viewer
puts
blob
render
json:
{
render
json:
{
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
),
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
),
plain:
blob
.
data
,
plain:
blob
.
data
,
...
...
This diff is collapsed.
Click to expand it.
app/helpers/tree_helper.rb
View file @
6a43c200
...
@@ -13,7 +13,7 @@ module TreeHelper
...
@@ -13,7 +13,7 @@ module TreeHelper
end
end
def
repo_url
()
def
repo_url
()
url_for
(
params
.
merge
(
format: :json
))
request
.
original_url
end
end
# Return an image icon depending on the file type and mode
# Return an image icon depending on the file type and mode
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/_files.html.haml
View file @
6a43c200
...
@@ -5,10 +5,4 @@
...
@@ -5,10 +5,4 @@
.nav-block
.nav-block
=
render
'projects/tree/tree_header'
,
tree:
@tree
=
render
'projects/tree/tree_header'
,
tree:
@tree
-
if
commit
.info-well.hidden-xs.project-last-commit.append-bottom-default
.well-segment
%ul
.blob-commit-info
=
render
'projects/commits/commit'
,
commit:
commit
,
ref:
ref
,
project:
project
=
render
'projects/tree/tree_content'
,
tree:
@tree
=
render
'projects/tree/tree_content'
,
tree:
@tree
This diff is collapsed.
Click to expand it.
app/views/projects/blob/_blob.html.haml
View file @
6a43c200
...
@@ -8,4 +8,5 @@
...
@@ -8,4 +8,5 @@
=
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;"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
This diff is collapsed.
Click to expand it.
app/views/projects/tree/_tree_content.html.haml
View file @
6a43c200
.tree-content-holder
.tree-content-holder
#sidebar
%ul
%repo-file
{
"v-for"
=>
"file in files"
,
":file"
=>
"file"
,
"@linkclicked"
=>
"linkClicked(file)"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
-
if
tree
.
readme
-
if
tree
.
readme
...
...
This diff is collapsed.
Click to expand it.
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