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
21ed2da0
Commit
21ed2da0
authored
Sep 06, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed double scroll
improved variable & prop names
parent
3f650038
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
16 deletions
+17
-16
app/assets/javascripts/ide/components/file_templates/bar.vue
app/assets/javascripts/ide/components/file_templates/bar.vue
+6
-6
app/assets/javascripts/ide/components/file_templates/dropdown.vue
...ts/javascripts/ide/components/file_templates/dropdown.vue
+5
-5
app/assets/stylesheets/page_bundles/ide.scss
app/assets/stylesheets/page_bundles/ide.scss
+1
-2
spec/javascripts/ide/components/file_templates/bar_spec.js
spec/javascripts/ide/components/file_templates/bar_spec.js
+4
-2
spec/javascripts/ide/components/file_templates/dropdown_spec.js
...avascripts/ide/components/file_templates/dropdown_spec.js
+1
-1
No files found.
app/assets/javascripts/ide/components/file_templates/bar.vue
View file @
21ed2da0
...
@@ -27,14 +27,14 @@ export default {
...
@@ -27,14 +27,14 @@ export default {
'
undoFileTemplate
'
,
'
undoFileTemplate
'
,
]),
]),
setInitialType
()
{
setInitialType
()
{
const
t
ype
=
this
.
templateTypes
.
find
(
t
=>
t
.
name
===
this
.
activeFile
.
name
);
const
initialTemplateT
ype
=
this
.
templateTypes
.
find
(
t
=>
t
.
name
===
this
.
activeFile
.
name
);
if
(
t
ype
)
{
if
(
initialTemplateT
ype
)
{
this
.
setSelectedTemplateType
(
t
ype
);
this
.
setSelectedTemplateType
(
initialTemplateT
ype
);
}
}
},
},
selectTemplateType
(
type
)
{
selectTemplateType
(
t
emplateT
ype
)
{
this
.
setSelectedTemplateType
(
type
);
this
.
setSelectedTemplateType
(
t
emplateT
ype
);
},
},
selectTemplate
(
template
)
{
selectTemplate
(
template
)
{
this
.
fetchTemplate
(
template
);
this
.
fetchTemplate
(
template
);
...
@@ -60,7 +60,7 @@ export default {
...
@@ -60,7 +60,7 @@ export default {
<dropdown
<dropdown
v-if=
"showTemplatesDropdown"
v-if=
"showTemplatesDropdown"
:label=
"__('Choose a template...')"
:label=
"__('Choose a template...')"
:
async
=
"true"
:
is-async-data
=
"true"
:searchable=
"true"
:searchable=
"true"
:title=
"__('File templates')"
:title=
"__('File templates')"
class=
"mr-2"
class=
"mr-2"
...
...
app/assets/javascripts/ide/components/file_templates/dropdown.vue
View file @
21ed2da0
...
@@ -24,7 +24,7 @@ export default {
...
@@ -24,7 +24,7 @@ export default {
required
:
false
,
required
:
false
,
default
:
null
,
default
:
null
,
},
},
async
:
{
isAsyncData
:
{
type
:
Boolean
,
type
:
Boolean
,
required
:
false
,
required
:
false
,
default
:
false
,
default
:
false
,
...
@@ -43,14 +43,14 @@ export default {
...
@@ -43,14 +43,14 @@ export default {
computed
:
{
computed
:
{
...
mapState
(
'
fileTemplates
'
,
[
'
templates
'
,
'
isLoading
'
]),
...
mapState
(
'
fileTemplates
'
,
[
'
templates
'
,
'
isLoading
'
]),
outputData
()
{
outputData
()
{
return
(
this
.
async
?
this
.
templates
:
this
.
data
).
filter
(
t
=>
{
return
(
this
.
isAsyncData
?
this
.
templates
:
this
.
data
).
filter
(
t
=>
{
if
(
!
this
.
searchable
)
return
true
;
if
(
!
this
.
searchable
)
return
true
;
return
t
.
name
.
toLowerCase
().
indexOf
(
this
.
search
.
toLowerCase
())
>=
0
;
return
t
.
name
.
toLowerCase
().
indexOf
(
this
.
search
.
toLowerCase
())
>=
0
;
});
});
},
},
showLoading
()
{
showLoading
()
{
return
this
.
async
?
this
.
isLoading
:
false
;
return
this
.
isAsyncData
?
this
.
isLoading
:
false
;
},
},
},
},
mounted
()
{
mounted
()
{
...
@@ -62,7 +62,7 @@ export default {
...
@@ -62,7 +62,7 @@ export default {
methods
:
{
methods
:
{
...
mapActions
(
'
fileTemplates
'
,
[
'
fetchTemplateTypes
'
]),
...
mapActions
(
'
fileTemplates
'
,
[
'
fetchTemplateTypes
'
]),
fetchTemplatesIfAsync
()
{
fetchTemplatesIfAsync
()
{
if
(
this
.
async
)
{
if
(
this
.
isAsyncData
)
{
this
.
fetchTemplateTypes
();
this
.
fetchTemplateTypes
();
}
}
},
},
...
@@ -79,7 +79,7 @@ export default {
...
@@ -79,7 +79,7 @@ export default {
:toggle-text=
"label"
:toggle-text=
"label"
data-display=
"static"
data-display=
"static"
/>
/>
<div
class=
"dropdown-menu"
>
<div
class=
"dropdown-menu
pb-0
"
>
<div
<div
v-if=
"title"
v-if=
"title"
class=
"dropdown-title ml-0 mr-0"
class=
"dropdown-title ml-0 mr-0"
...
...
app/assets/stylesheets/page_bundles/ide.scss
View file @
21ed2da0
...
@@ -1452,8 +1452,7 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
...
@@ -1452,8 +1452,7 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
min-width
:
180px
;
min-width
:
180px
;
}
}
.dropdown-
menu
{
.dropdown-
content
{
max-height
:
222px
;
max-height
:
222px
;
overflow
:
hidden
;
}
}
}
}
spec/javascripts/ide/components/file_templates/bar_spec.js
View file @
21ed2da0
...
@@ -98,14 +98,16 @@ describe('IDE file templates bar component', () => {
...
@@ -98,14 +98,16 @@ describe('IDE file templates bar component', () => {
});
});
it
(
'
calls setSelectedTemplateType if activeFile name matches a template
'
,
done
=>
{
it
(
'
calls setSelectedTemplateType if activeFile name matches a template
'
,
done
=>
{
const
fileName
=
'
.gitlab-ci.yml
'
;
spyOn
(
vm
,
'
setSelectedTemplateType
'
);
spyOn
(
vm
,
'
setSelectedTemplateType
'
);
vm
.
$store
.
state
.
openFiles
[
0
].
name
=
'
.gitlab-ci.yml
'
;
vm
.
$store
.
state
.
openFiles
[
0
].
name
=
fileName
;
vm
.
setInitialType
();
vm
.
setInitialType
();
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
setSelectedTemplateType
).
toHaveBeenCalledWith
({
expect
(
vm
.
setSelectedTemplateType
).
toHaveBeenCalledWith
({
name
:
'
.gitlab-ci.yml
'
,
name
:
fileName
,
key
:
'
gitlab_ci_ymls
'
,
key
:
'
gitlab_ci_ymls
'
,
});
});
...
...
spec/javascripts/ide/components/file_templates/dropdown_spec.js
View file @
21ed2da0
...
@@ -28,7 +28,7 @@ describe('IDE file templates dropdown component', () => {
...
@@ -28,7 +28,7 @@ describe('IDE file templates dropdown component', () => {
describe
(
'
async
'
,
()
=>
{
describe
(
'
async
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
.
async
=
true
;
vm
.
isAsyncData
=
true
;
});
});
it
(
'
calls async store method on Bootstrap dropdown event
'
,
()
=>
{
it
(
'
calls async store method on Bootstrap dropdown event
'
,
()
=>
{
...
...
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