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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e58d30a0
Commit
e58d30a0
authored
Jul 27, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide
parents
31afd42e
71d08bfb
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
24 deletions
+72
-24
app/assets/javascripts/repo/index.js
app/assets/javascripts/repo/index.js
+2
-1
app/assets/javascripts/repo/repo_binary_viewer.vue
app/assets/javascripts/repo/repo_binary_viewer.vue
+0
-3
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+1
-0
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+38
-2
app/assets/javascripts/repo/repo_sidebar.vue
app/assets/javascripts/repo/repo_sidebar.vue
+1
-0
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+25
-18
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+5
-0
No files found.
app/assets/javascripts/repo/index.js
View file @
e58d30a0
...
...
@@ -23,13 +23,14 @@ function initRepo() {
Store
.
checkIsCommitable
();
Store
.
projectId
=
repo
.
dataset
.
projectId
;
Store
.
tempPrivateToken
=
repo
.
dataset
.
tempToken
;
Store
.
projectUrl
=
repo
.
dataset
.
projectUrl
;
this
.
vm
=
new
Vue
({
el
:
repo
,
data
:
()
=>
Store
,
template
:
`
<div class="tree-content-holder">
<repo-sidebar/><div class="panel-right" :class="{'edit-mode':
readOnly
}">
<repo-sidebar/><div class="panel-right" :class="{'edit-mode':
editMode
}">
<repo-tabs/>
<repo-file-buttons/>
<repo-editor/>
...
...
app/assets/javascripts/repo/repo_binary_viewer.vue
View file @
e58d30a0
...
...
@@ -13,12 +13,10 @@ const RepoBinaryViewer = {
methods
:
{
errored
()
{
console
.
log
(
'
errored
'
);
Store
.
binaryLoaded
=
false
;
},
loaded
()
{
console
.
log
(
'
loaded
'
);
Store
.
binaryLoaded
=
true
;
},
...
...
@@ -39,7 +37,6 @@ const RepoBinaryViewer = {
if
(
!
this
.
binary
)
return
;
switch
(
this
.
binaryMimeType
)
{
case
'
image/png
'
:
console
.
log
(
'
png bitch
'
)
this
.
binaryTypes
.
png
=
true
;
break
;
default
:
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
e58d30a0
...
...
@@ -65,6 +65,7 @@ const RepoEditor = {
},
editMode
()
{
console
.
log
(
'
edit mode changed
'
)
const
readOnly
=
!
this
.
editMode
;
Store
.
readOnly
=
readOnly
;
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
e58d30a0
...
...
@@ -4,6 +4,24 @@ import Store from './repo_store';
import
'
../flash
'
;
const
RepoHelper
=
{
getDefaultActiveFile
()
{
return
{
active
:
true
,
binary
:
false
,
extension
:
''
,
html
:
''
,
mime_type
:
''
,
name
:
'
loading...
'
,
plain
:
''
,
size
:
0
,
url
:
''
,
raw
:
false
,
newContent
:
''
,
changed
:
false
,
loading
:
false
,
}
},
key
:
''
,
isTree
(
data
)
{
...
...
@@ -100,8 +118,24 @@ const RepoHelper = {
return
0
;
},
isRoot
(
url
)
{
// the url we are requesting -> split by the project URL. Grab the right side.
const
isRoot
=
!!
url
.
split
(
Store
.
projectUrl
)[
1
]
// remove the first "/"
.
slice
(
1
)
// split this by "/"
.
split
(
'
/
'
)
// remove the first two items of the array... usually /tree/master.
.
slice
(
2
)
// we want to know the length of the array.
// If greater than 0 not root.
.
length
;
return
isRoot
;
},
getContent
(
treeOrFile
,
cb
)
{
let
file
=
treeOrFile
;
console
.
log
(
'
file
'
,
file
)
// const loadingData = RepoHelper.setLoading(true);
return
Service
.
getContent
()
.
then
((
response
)
=>
{
...
...
@@ -115,7 +149,8 @@ const RepoHelper = {
if
(
data
.
binary
)
{
Store
.
binaryMimeType
=
data
.
mime_type
;
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
);
// file might be undefined
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
||
Service
.
url
);
RepoHelper
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
data
.
binary
=
true
;
}
else
{
...
...
@@ -139,13 +174,14 @@ const RepoHelper = {
}
}
else
{
// it's a tree
if
(
!
file
)
Store
.
isRoot
=
RepoHelper
.
isRoot
(
Service
.
url
);
file
=
RepoHelper
.
setDirectoryOpen
(
file
);
const
newDirectory
=
RepoHelper
.
dataToListOfFiles
(
data
);
Store
.
addFilesToDirectory
(
file
,
Store
.
files
,
newDirectory
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
}
})
.
catch
(()
=>
{
.
catch
((
e
)
=>
{
// RepoHelper.setLoading(false, loadingData);
RepoHelper
.
loadingError
();
});
...
...
app/assets/javascripts/repo/repo_sidebar.vue
View file @
e58d30a0
...
...
@@ -82,6 +82,7 @@ export default RepoSidebar;
:is-mini=
"isMini"
:project-name=
"projectName"
/>
<repo-previous-directory
v-if=
"isRoot"
:prev-url=
"prevURL"
@
linkclicked=
"linkClicked(prevURL)"
/>
<repo-loading-file
...
...
app/assets/javascripts/repo/repo_store.js
View file @
e58d30a0
...
...
@@ -11,9 +11,11 @@ const RepoStore = {
editButton
:
''
,
editMode
:
false
,
isTree
:
false
,
isRoot
:
false
,
prevURL
:
''
,
projectId
:
''
,
projectName
:
''
,
projectUrl
:
''
,
trees
:
[],
blobs
:
[],
submodules
:
[],
...
...
@@ -27,21 +29,7 @@ const RepoStore = {
tempPrivateToken
:
''
,
submitCommitsLoading
:
false
,
binaryLoaded
:
false
,
activeFile
:
{
active
:
true
,
binary
:
false
,
extension
:
''
,
html
:
''
,
mime_type
:
''
,
name
:
'
loading...
'
,
plain
:
''
,
size
:
0
,
url
:
''
,
raw
:
false
,
newContent
:
''
,
changed
:
false
,
loading
:
false
,
},
activeFile
:
RepoHelper
.
getDefaultActiveFile
(),
activeFileIndex
:
0
,
activeLine
:
0
,
activeFileLabel
:
'
Raw
'
,
...
...
@@ -64,7 +52,6 @@ const RepoStore = {
readOnly
:
true
,
// mutations
checkIsCommitable
()
{
RepoStore
.
service
.
checkCurrentBranchIsCommitable
()
.
then
((
data
)
=>
{
...
...
@@ -87,7 +74,6 @@ const RepoStore = {
setActiveFiles
(
file
)
{
if
(
RepoStore
.
isActiveFile
(
file
))
return
;
RepoStore
.
openedFiles
=
RepoStore
.
openedFiles
.
map
((
openedFile
,
i
)
=>
RepoStore
.
setFileActivity
(
file
,
openedFile
,
i
));
...
...
@@ -149,8 +135,29 @@ const RepoStore = {
removeFromOpenedFiles
(
file
)
{
if
(
file
.
type
===
'
tree
'
)
return
;
let
foundIndex
;
RepoStore
.
openedFiles
=
RepoStore
.
openedFiles
.
filter
((
openedFile
,
i
)
=>
{
if
(
openedFile
.
url
===
file
.
url
)
foundIndex
=
i
;
return
openedFile
.
url
!==
file
.
url
;
});
RepoStore
.
openedFiles
=
RepoStore
.
openedFiles
.
filter
(
openedFile
=>
openedFile
.
url
!==
file
.
url
);
// now activate the right tab based on what you closed.
if
(
RepoStore
.
openedFiles
.
length
===
0
)
{
console
.
log
(
'
open 0
'
)
RepoStore
.
activeFile
=
{};
return
;
}
if
(
RepoStore
.
openedFiles
.
length
===
1
||
foundIndex
===
0
)
{
RepoStore
.
setActiveFiles
(
RepoStore
.
openedFiles
[
0
]);
return
;
}
if
(
foundIndex
)
{
if
(
foundIndex
>
0
)
{
RepoStore
.
setActiveFiles
(
RepoStore
.
openedFiles
[
foundIndex
-
1
]);
}
}
},
addPlaceholderFile
()
{
...
...
app/assets/stylesheets/pages/repo.scss
View file @
e58d30a0
...
...
@@ -100,6 +100,7 @@
&
.close
{
width
:
auto
;
font-size
:
15px
;
opacity
:
1
;
}
}
...
...
@@ -110,6 +111,10 @@
margin-left
:
15px
;
color
:
$gray-darkest
;
}
i
.fa.fa-circle
{
color
:
$brand-success
;
}
}
}
...
...
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