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
74123332
Commit
74123332
authored
Oct 20, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added submodule support in multi-file editor
parent
b4dc0ba2
Changes
8
Show 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 @
74123332
...
...
@@ -28,6 +28,9 @@
marginLeft
:
`
${
this
.
file
.
level
*
16
}
px`
,
};
},
shortId
()
{
return
this
.
file
.
id
.
substr
(
0
,
8
);
},
},
methods
:
{
linkClicked
(
file
)
{
...
...
@@ -55,6 +58,17 @@
>
{{
file
.
name
}}
</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>
<
template
v-if=
"!isMini"
>
...
...
@@ -69,7 +83,10 @@
</td>
<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
)
}}
</span>
</td>
...
...
app/assets/javascripts/repo/components/repo_sidebar.vue
View file @
74123332
...
...
@@ -74,6 +74,10 @@ export default {
if
(
file
.
type
===
'
tree
'
&&
file
.
opened
)
{
Helper
.
setDirectoryToClosed
(
file
);
Store
.
setActiveLine
(
lineNumber
);
}
else
if
(
file
.
type
===
'
submodule
'
)
{
file
.
loading
=
true
;
gl
.
utils
.
visitUrl
(
file
.
url
);
}
else
{
const
openFile
=
Helper
.
getFileFromPath
(
file
.
url
);
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
74123332
...
...
@@ -157,12 +157,14 @@ const RepoHelper = {
},
serializeRepoEntity
(
type
,
entity
,
level
=
0
)
{
const
{
url
,
name
,
icon
,
last_commit
}
=
entity
;
const
{
id
,
url
,
name
,
icon
,
last_commit
,
tree_url
}
=
entity
;
return
{
id
,
type
,
name
,
url
,
tree_url
,
level
,
icon
:
`fa-
${
icon
}
`
,
files
:
[],
...
...
app/serializers/submodule_entity.rb
View file @
74123332
...
...
@@ -7,7 +7,7 @@ class SubmoduleEntity < Grape::Entity
'archive'
end
expose
:
project_
url
do
|
blob
|
expose
:url
do
|
blob
|
submodule_links
(
blob
,
request
).
first
end
...
...
changelogs/unreleased/multi-file-editor-submodules.yml
0 → 100644
View file @
74123332
---
title
:
Added submodule support in multi-file editor
merge_request
:
author
:
type
:
added
spec/javascripts/repo/components/repo_file_spec.js
View file @
74123332
...
...
@@ -93,6 +93,32 @@ describe('RepoFile', () => {
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
(
'
linkClicked
'
,
()
=>
{
it
(
'
$emits fileNameClicked with file obj
'
,
()
=>
{
...
...
spec/javascripts/repo/components/repo_sidebar_spec.js
View file @
74123332
...
...
@@ -117,6 +117,21 @@ describe('RepoSidebar', () => {
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
'
,
()
=>
{
...
...
spec/javascripts/repo/mock_data.js
View file @
74123332
import
RepoHelper
from
'
~/repo/helpers/repo_helper
'
;
// 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
'
,
url
:
'
url
'
,
name
,
last_commit
:
{
id
:
'
123
'
,
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