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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
c0923cbd
Commit
c0923cbd
authored
Aug 28, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added quick create new file buttons to modal
parent
7465f62e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
app/assets/javascripts/ide/components/new_dropdown/modal.vue
app/assets/javascripts/ide/components/new_dropdown/modal.vue
+35
-5
No files found.
app/assets/javascripts/ide/components/new_dropdown/modal.vue
View file @
c0923cbd
<
script
>
<
script
>
import
$
from
'
jquery
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
{
modalTypes
}
from
'
../../constants
'
;
import
{
modalTypes
}
from
'
../../constants
'
;
...
@@ -15,6 +16,7 @@ export default {
...
@@ -15,6 +16,7 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
'
entryModal
'
]),
...
mapState
([
'
entryModal
'
]),
...
mapGetters
(
'
fileTemplates
'
,
[
'
templateTypes
'
]),
entryName
:
{
entryName
:
{
get
()
{
get
()
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
...
@@ -31,7 +33,9 @@ export default {
...
@@ -31,7 +33,9 @@ export default {
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
return
__
(
'
Create new directory
'
);
return
__
(
'
Create new directory
'
);
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
}
return
__
(
'
Create new file
'
);
return
__
(
'
Create new file
'
);
...
@@ -40,7 +44,9 @@ export default {
...
@@ -40,7 +44,9 @@ export default {
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
return
__
(
'
Create directory
'
);
return
__
(
'
Create directory
'
);
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
}
return
__
(
'
Create file
'
);
return
__
(
'
Create file
'
);
...
@@ -61,6 +67,14 @@ export default {
...
@@ -61,6 +67,14 @@ export default {
});
});
}
}
},
},
createFromTemplate
(
template
)
{
this
.
createTempEntry
({
name
:
template
.
name
,
type
:
this
.
entryModal
.
type
,
});
$
(
'
#ide-new-entry
'
).
modal
(
'
toggle
'
);
},
focusInput
()
{
focusInput
()
{
this
.
$refs
.
fieldName
.
focus
();
this
.
$refs
.
fieldName
.
focus
();
},
},
...
@@ -84,16 +98,32 @@ export default {
...
@@ -84,16 +98,32 @@ export default {
<div
<div
class=
"form-group row"
class=
"form-group row"
>
>
<label
class=
"label-bold col-form-label col-sm-
3
"
>
<label
class=
"label-bold col-form-label col-sm-
2
"
>
{{
__
(
'
Name
'
)
}}
{{
__
(
'
Name
'
)
}}
</label>
</label>
<div
class=
"col-sm-
9
"
>
<div
class=
"col-sm-
10
"
>
<input
<input
ref=
"fieldName"
ref=
"fieldName"
v-model=
"entryName"
v-model=
"entryName"
type=
"text"
type=
"text"
class=
"form-control"
class=
"form-control"
placeholder=
"/dir/file_name"
/>
/>
<ul
class=
"prepend-top-default list-inline"
>
<li
v-for=
"(template, index) in templateTypes"
:key=
"index"
class=
"list-inline-item"
>
<button
type=
"button"
class=
"btn btn-missing p-1 pr-2 pl-2"
@
click=
"createFromTemplate(template)"
>
{{
template
.
name
}}
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
</gl-modal>
</gl-modal>
...
...
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