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
107333e3
Commit
107333e3
authored
Jun 05, 2020
by
Ashesh Vidyut
Committed by
Kushal Pandya
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create template files in the folder from which new file request was made
parent
c2fc5a4b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
app/assets/javascripts/ide/components/new_dropdown/modal.vue
app/assets/javascripts/ide/components/new_dropdown/modal.vue
+4
-2
changelogs/unreleased/templates-current-folder-fix.yml
changelogs/unreleased/templates-current-folder-fix.yml
+5
-0
spec/frontend/ide/components/new_dropdown/modal_spec.js
spec/frontend/ide/components/new_dropdown/modal_spec.js
+40
-0
No files found.
app/assets/javascripts/ide/components/new_dropdown/modal.vue
View file @
107333e3
...
...
@@ -4,7 +4,7 @@ import flash from '~/flash';
import
{
__
,
sprintf
,
s__
}
from
'
~/locale
'
;
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
{
modalTypes
}
from
'
../../constants
'
;
import
{
trimPathComponents
}
from
'
../../utils
'
;
import
{
trimPathComponents
,
getPathParent
}
from
'
../../utils
'
;
export
default
{
components
:
{
...
...
@@ -85,8 +85,10 @@ export default {
}
},
createFromTemplate
(
template
)
{
const
parent
=
getPathParent
(
this
.
entryName
);
const
name
=
parent
?
`
${
parent
}
/
${
template
.
name
}
`
:
template
.
name
;
this
.
createTempEntry
({
name
:
template
.
name
,
name
,
type
:
this
.
modalType
,
});
...
...
changelogs/unreleased/templates-current-folder-fix.yml
0 → 100644
View file @
107333e3
---
title
:
"
Web
IDE:
Create
template
files
in
the
folder
from
which
new
file
request
was
made"
merge_request
:
33585
author
:
Ashesh Vidyut
type
:
fixed
spec/frontend/ide/components/new_dropdown/modal_spec.js
View file @
107333e3
...
...
@@ -120,6 +120,46 @@ describe('new file modal component', () => {
});
});
describe
(
'
createFromTemplate
'
,
()
=>
{
let
store
;
beforeEach
(()
=>
{
store
=
createStore
();
store
.
state
.
entries
=
{
'
test-path/test
'
:
{
name
:
'
test
'
,
deleted
:
false
,
},
};
vm
=
createComponentWithStore
(
Component
,
store
).
$mount
();
vm
.
open
(
'
blob
'
);
jest
.
spyOn
(
vm
,
'
createTempEntry
'
).
mockImplementation
();
});
it
.
each
`
entryName | newFilePath
${
''
}
|
${
'
.gitignore
'
}
${
'
README.md
'
}
|
${
'
.gitignore
'
}
${
'
test-path/test/
'
}
|
${
'
test-path/test/.gitignore
'
}
${
'
test-path/test
'
}
|
${
'
test-path/.gitignore
'
}
${
'
test-path/test/abc.md
'
}
|
${
'
test-path/test/.gitignore
'
}
`
(
'
creates a new file with the given template name in appropriate directory for path: $path
'
,
({
entryName
,
newFilePath
})
=>
{
vm
.
entryName
=
entryName
;
vm
.
createFromTemplate
({
name
:
'
.gitignore
'
});
expect
(
vm
.
createTempEntry
).
toHaveBeenCalledWith
({
name
:
newFilePath
,
type
:
'
blob
'
,
});
},
);
});
describe
(
'
submitForm
'
,
()
=>
{
let
store
;
...
...
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