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
018542b1
Commit
018542b1
authored
Oct 20, 2017
by
Phil Hughes
Committed by
Winnie Hellmann
Oct 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added submodule support in multi-file editor
parent
ce4fece2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
5 deletions
+75
-5
app/assets/javascripts/repo/components/repo_file.vue
app/assets/javascripts/repo/components/repo_file.vue
+18
-1
app/assets/javascripts/repo/components/repo_sidebar.vue
app/assets/javascripts/repo/components/repo_sidebar.vue
+4
-0
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+3
-1
app/serializers/submodule_entity.rb
app/serializers/submodule_entity.rb
+1
-1
changelogs/unreleased/multi-file-editor-submodules.yml
changelogs/unreleased/multi-file-editor-submodules.yml
+5
-0
spec/javascripts/repo/components/repo_file_spec.js
spec/javascripts/repo/components/repo_file_spec.js
+26
-0
spec/javascripts/repo/components/repo_sidebar_spec.js
spec/javascripts/repo/components/repo_sidebar_spec.js
+15
-0
spec/javascripts/repo/mock_data.js
spec/javascripts/repo/mock_data.js
+3
-2
No files found.
app/assets/javascripts/repo/components/repo_file.vue
View file @
018542b1
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
marginLeft
:
`
${
this
.
file
.
level
*
16
}
px`
,
marginLeft
:
`
${
this
.
file
.
level
*
16
}
px`
,
};
};
},
},
shortId
()
{
return
this
.
file
.
id
.
substr
(
0
,
8
);
},
},
},
methods
:
{
methods
:
{
linkClicked
(
file
)
{
linkClicked
(
file
)
{
...
@@ -55,6 +58,17 @@
...
@@ -55,6 +58,17 @@
>
>
{{
file
.
name
}}
{{
file
.
name
}}
</a>
</a>
<template
v-if=
"file.type === 'submodule' && file.id"
>
@
<span
class=
"commit-sha"
>
<a
@
click
.
stop
:href=
"file.tree_url"
>
{{
shortId
}}
</a>
</span>
</
template
>
</td>
</td>
<
template
v-if=
"!isMini"
>
<
template
v-if=
"!isMini"
>
...
@@ -69,7 +83,10 @@
...
@@ -69,7 +83,10 @@
</td>
</td>
<td
class=
"commit-update hidden-xs text-right"
>
<td
class=
"commit-update hidden-xs text-right"
>
<span
:title=
"tooltipTitle(file.lastCommit.updatedAt)"
>
<span
v-if=
"file.lastCommit.updatedAt"
:title=
"tooltipTitle(file.lastCommit.updatedAt)"
>
{{
timeFormated
(
file
.
lastCommit
.
updatedAt
)
}}
{{
timeFormated
(
file
.
lastCommit
.
updatedAt
)
}}
</span>
</span>
</td>
</td>
...
...
app/assets/javascripts/repo/components/repo_sidebar.vue
View file @
018542b1
...
@@ -74,6 +74,10 @@ export default {
...
@@ -74,6 +74,10 @@ export default {
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
Helper
.
setDirectoryToClosed
(
file
);
Helper
.
setDirectoryToClosed
(
file
);
Store
.
setActiveLine
(
lineNumber
);
Store
.
setActiveLine
(
lineNumber
);
}
else
if
(
file
.
type
===
'
submodule
'
)
{
file
.
loading
=
true
;
gl
.
utils
.
visitUrl
(
file
.
url
);
}
else
{
}
else
{
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
018542b1
...
@@ -157,12 +157,14 @@ const RepoHelper = {
...
@@ -157,12 +157,14 @@ const RepoHelper = {
},
},
serializeRepoEntity
(
type
,
entity
,
level
=
0
)
{
serializeRepoEntity
(
type
,
entity
,
level
=
0
)
{
const
{
url
,
name
,
icon
,
last_commit
}
=
entity
;
const
{
id
,
url
,
name
,
icon
,
last_commit
,
tree_url
}
=
entity
;
return
{
return
{
id
,
type
,
type
,
name
,
name
,
url
,
url
,
tree_url
,
level
,
level
,
icon
:
`fa-
${
icon
}
`
,
icon
:
`fa-
${
icon
}
`
,
files
:
[],
files
:
[],
...
...
app/serializers/submodule_entity.rb
View file @
018542b1
...
@@ -7,7 +7,7 @@ class SubmoduleEntity < Grape::Entity
...
@@ -7,7 +7,7 @@ class SubmoduleEntity < Grape::Entity
'archive'
'archive'
end
end
expose
:
project_
url
do
|
blob
|
expose
:url
do
|
blob
|
submodule_links
(
blob
,
request
).
first
submodule_links
(
blob
,
request
).
first
end
end
...
...
changelogs/unreleased/multi-file-editor-submodules.yml
0 → 100644
View file @
018542b1
---
title
:
Added submodule support in multi-file editor
merge_request
:
author
:
type
:
added
spec/javascripts/repo/components/repo_file_spec.js
View file @
018542b1
...
@@ -93,6 +93,32 @@ describe('RepoFile', () => {
...
@@ -93,6 +93,32 @@ describe('RepoFile', () => {
expect
(
vm
.
linkClicked
).
toHaveBeenCalledWith
(
vm
.
file
);
expect
(
vm
.
linkClicked
).
toHaveBeenCalledWith
(
vm
.
file
);
});
});
describe
(
'
submodule
'
,
()
=>
{
let
f
;
let
vm
;
beforeEach
(()
=>
{
f
=
file
(
'
submodule name
'
,
'
123456789
'
);
f
.
type
=
'
submodule
'
;
vm
=
createComponent
({
file
:
f
,
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
renders submodule short ID
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.commit-sha
'
).
textContent
.
trim
()).
toBe
(
'
12345678
'
);
});
it
(
'
renders ID next to submodule name
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
td
'
).
textContent
.
replace
(
/
\s
+/g
,
'
'
)).
toContain
(
'
submodule name @ 12345678
'
);
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
linkClicked
'
,
()
=>
{
describe
(
'
linkClicked
'
,
()
=>
{
it
(
'
$emits fileNameClicked with file obj
'
,
()
=>
{
it
(
'
$emits fileNameClicked with file obj
'
,
()
=>
{
...
...
spec/javascripts/repo/components/repo_sidebar_spec.js
View file @
018542b1
...
@@ -117,6 +117,21 @@ describe('RepoSidebar', () => {
...
@@ -117,6 +117,21 @@ describe('RepoSidebar', () => {
expect
(
Helper
.
setDirectoryToClosed
).
toHaveBeenCalledWith
(
RepoStore
.
files
[
0
]);
expect
(
Helper
.
setDirectoryToClosed
).
toHaveBeenCalledWith
(
RepoStore
.
files
[
0
]);
});
});
describe
(
'
submodule
'
,
()
=>
{
it
(
'
opens submodule project URL
'
,
()
=>
{
spyOn
(
gl
.
utils
,
'
visitUrl
'
);
const
f
=
file
();
f
.
type
=
'
submodule
'
;
vm
=
createComponent
();
vm
.
fileClicked
(
f
);
expect
(
gl
.
utils
.
visitUrl
).
toHaveBeenCalledWith
(
'
url
'
);
});
});
});
});
describe
(
'
goToPreviousDirectoryClicked
'
,
()
=>
{
describe
(
'
goToPreviousDirectoryClicked
'
,
()
=>
{
...
...
spec/javascripts/repo/mock_data.js
View file @
018542b1
import
RepoHelper
from
'
~/repo/helpers/repo_helper
'
;
import
RepoHelper
from
'
~/repo/helpers/repo_helper
'
;
// eslint-disable-next-line import/prefer-default-export
// eslint-disable-next-line import/prefer-default-export
export
const
file
=
(
name
=
'
name
'
)
=>
RepoHelper
.
serializeRepoEntity
(
'
blob
'
,
{
export
const
file
=
(
name
=
'
name
'
,
id
=
name
)
=>
RepoHelper
.
serializeRepoEntity
(
'
blob
'
,
{
id
,
icon
:
'
icon
'
,
icon
:
'
icon
'
,
url
:
'
url
'
,
url
:
'
url
'
,
name
,
name
,
last_commit
:
{
last_commit
:
{
id
:
'
123
'
,
id
:
'
123
'
,
message
:
'
test
'
,
message
:
'
test
'
,
committed_date
:
''
,
committed_date
:
new
Date
().
toISOString
()
,
},
},
});
});
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