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
Boxiang Sun
gitlab-ce
Commits
5d6103e2
Commit
5d6103e2
authored
Aug 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added constants for modal type
parent
bc827dfd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
app/assets/javascripts/ide/components/new_dropdown/index.vue
app/assets/javascripts/ide/components/new_dropdown/index.vue
+4
-2
app/assets/javascripts/ide/components/new_dropdown/modal.vue
app/assets/javascripts/ide/components/new_dropdown/modal.vue
+11
-8
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+5
-0
No files found.
app/assets/javascripts/ide/components/new_dropdown/index.vue
View file @
5d6103e2
...
...
@@ -4,6 +4,7 @@ import icon from '~/vue_shared/components/icon.vue';
import
newModal
from
'
./modal.vue
'
;
import
upload
from
'
./upload.vue
'
;
import
ItemButton
from
'
./button.vue
'
;
import
{
modalTypes
}
from
'
../../constants
'
;
export
default
{
components
:
{
...
...
@@ -54,6 +55,7 @@ export default {
this
.
dropdownOpen
=
!
this
.
dropdownOpen
;
},
},
modalTypes
,
};
</
script
>
...
...
@@ -104,7 +106,7 @@ export default {
class=
"d-flex"
icon=
"folder-new"
icon-classes=
"mr-2"
@
click=
"createNewItem(
'tree'
)"
@
click=
"createNewItem(
$options.modalTypes.tree
)"
/>
</li>
<li
class=
"divider"
></li>
...
...
@@ -115,7 +117,7 @@ export default {
class=
"d-flex"
icon=
"pencil"
icon-classes=
"mr-2"
@
click=
"createNewItem(
'rename'
)"
@
click=
"createNewItem(
$options.modalTypes.rename
)"
/>
</li>
<li>
...
...
app/assets/javascripts/ide/components/new_dropdown/modal.vue
View file @
5d6103e2
...
...
@@ -2,6 +2,7 @@
import
{
__
}
from
'
~/locale
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
{
modalTypes
}
from
'
../../constants
'
;
export
default
{
components
:
{
...
...
@@ -16,7 +17,9 @@ export default {
...
mapState
([
'
entryModal
'
]),
entryName
:
{
get
()
{
if
(
this
.
entryModal
.
type
===
'
rename
'
)
return
this
.
name
||
this
.
entryModal
.
entry
.
name
;
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
return
this
.
name
||
this
.
entryModal
.
entry
.
name
;
}
return
this
.
name
||
(
this
.
entryModal
.
path
!==
''
?
`
${
this
.
entryModal
.
path
}
/`
:
''
);
},
...
...
@@ -25,19 +28,19 @@ export default {
},
},
modalTitle
()
{
if
(
this
.
entryModal
.
type
===
'
tree
'
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
return
__
(
'
Create new directory
'
);
}
else
if
(
this
.
entryModal
.
type
===
'
rename
'
)
{
return
this
.
entryModal
.
entry
.
type
===
'
tree
'
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
return
__
(
'
Create new file
'
);
},
buttonLabel
()
{
if
(
this
.
entryModal
.
type
===
'
tree
'
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
tree
)
{
return
__
(
'
Create directory
'
);
}
else
if
(
this
.
entryModal
.
type
===
'
rename
'
)
{
return
this
.
entryModal
.
entry
.
type
===
'
tree
'
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
else
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
return
this
.
entryModal
.
entry
.
type
===
modalTypes
.
tree
?
__
(
'
Rename folder
'
)
:
__
(
'
Rename file
'
);
}
return
__
(
'
Create file
'
);
...
...
@@ -46,7 +49,7 @@ export default {
methods
:
{
...
mapActions
([
'
createTempEntry
'
,
'
renameEntry
'
]),
submitForm
()
{
if
(
this
.
entryModal
.
type
===
'
rename
'
)
{
if
(
this
.
entryModal
.
type
===
modalTypes
.
rename
)
{
this
.
renameEntry
({
path
:
this
.
entryModal
.
entry
.
path
,
name
:
this
.
entryName
,
...
...
app/assets/javascripts/ide/constants.js
View file @
5d6103e2
...
...
@@ -53,3 +53,8 @@ export const commitItemIconMap = {
class
:
'
ide-file-deletion
'
,
},
};
export
const
modalTypes
=
{
rename
:
'
rename
'
,
tree
:
'
tree
'
,
};
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