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
7465f62e
Commit
7465f62e
authored
Aug 28, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed action name changes after rebase
fixed content not updating in editor when changing template
parent
843467b8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
app/assets/javascripts/ide/components/file_templates/bar.vue
app/assets/javascripts/ide/components/file_templates/bar.vue
+8
-3
app/assets/javascripts/ide/components/file_templates/dropdown.vue
...ts/javascripts/ide/components/file_templates/dropdown.vue
+6
-1
app/assets/javascripts/ide/stores/modules/file_templates/actions.js
.../javascripts/ide/stores/modules/file_templates/actions.js
+4
-0
No files found.
app/assets/javascripts/ide/components/file_templates/bar.vue
View file @
7465f62e
...
@@ -23,16 +23,20 @@ export default {
...
@@ -23,16 +23,20 @@ export default {
this
.
setInitialType
();
this
.
setInitialType
();
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
fileTemplates
'
,
[
'
setTemplateType
'
,
'
fetchTemplate
'
]),
...
mapActions
(
'
fileTemplates
'
,
[
'
setSelectedTemplateType
'
,
'
fetchTemplate
'
,
'
undoFileTemplate
'
,
]),
setInitialType
()
{
setInitialType
()
{
const
type
=
this
.
templateTypes
.
find
(
t
=>
t
.
name
===
this
.
activeFile
.
name
);
const
type
=
this
.
templateTypes
.
find
(
t
=>
t
.
name
===
this
.
activeFile
.
name
);
if
(
type
)
{
if
(
type
)
{
this
.
setTemplateType
(
type
);
this
.
set
Selected
TemplateType
(
type
);
}
}
},
},
selectTemplateType
(
type
)
{
selectTemplateType
(
type
)
{
this
.
setTemplateType
(
type
);
this
.
set
Selected
TemplateType
(
type
);
},
},
selecteTemplate
(
template
)
{
selecteTemplate
(
template
)
{
this
.
fetchTemplate
(
template
);
this
.
fetchTemplate
(
template
);
...
@@ -69,6 +73,7 @@ export default {
...
@@ -69,6 +73,7 @@ export default {
<button
<button
type=
"button"
type=
"button"
class=
"btn btn-default"
class=
"btn btn-default"
@
click=
"undoFileTemplate"
>
>
{{
__
(
'
Undo
'
)
}}
{{
__
(
'
Undo
'
)
}}
</button>
</button>
...
...
app/assets/javascripts/ide/components/file_templates/dropdown.vue
View file @
7465f62e
...
@@ -77,11 +77,12 @@ export default {
...
@@ -77,11 +77,12 @@ export default {
<div
class=
"dropdown"
>
<div
class=
"dropdown"
>
<dropdown-button
<dropdown-button
:toggle-text=
"label"
:toggle-text=
"label"
data-display=
"static"
/>
/>
<div
class=
"dropdown-menu"
>
<div
class=
"dropdown-menu"
>
<div
<div
v-if=
"title"
v-if=
"title"
class=
"dropdown-title"
class=
"dropdown-title
ml-0 mr-0
"
>
>
{{
title
}}
{{
title
}}
</div>
</div>
...
@@ -95,6 +96,10 @@ export default {
...
@@ -95,6 +96,10 @@ export default {
type=
"search"
type=
"search"
class=
"dropdown-input-field"
class=
"dropdown-input-field"
/>
/>
<i
aria-hidden=
"true"
class=
"fa fa-search dropdown-input-search"
></i>
</div>
</div>
<div
class=
"dropdown-content"
>
<div
class=
"dropdown-content"
>
<loading-icon
<loading-icon
...
...
app/assets/javascripts/ide/stores/modules/file_templates/actions.js
View file @
7465f62e
import
Api
from
'
~/api
'
;
import
Api
from
'
~/api
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
eventHub
from
'
../../../eventhub
'
;
export
const
requestTemplateTypes
=
({
commit
})
=>
commit
(
types
.
REQUEST_TEMPLATE_TYPES
);
export
const
requestTemplateTypes
=
({
commit
})
=>
commit
(
types
.
REQUEST_TEMPLATE_TYPES
);
export
const
receiveTemplateTypesError
=
({
commit
,
dispatch
})
=>
{
export
const
receiveTemplateTypesError
=
({
commit
,
dispatch
})
=>
{
...
@@ -69,6 +70,7 @@ export const setFileTemplate = ({ dispatch, commit, rootGetters }, template) =>
...
@@ -69,6 +70,7 @@ export const setFileTemplate = ({ dispatch, commit, rootGetters }, template) =>
{
root
:
true
},
{
root
:
true
},
);
);
commit
(
types
.
SET_UPDATE_SUCCESS
,
true
);
commit
(
types
.
SET_UPDATE_SUCCESS
,
true
);
eventHub
.
$emit
(
`editor.update.model.new.content.
${
rootGetters
.
activeFile
.
key
}
`
,
template
.
content
);
};
};
export
const
undoFileTemplate
=
({
dispatch
,
commit
,
rootGetters
})
=>
{
export
const
undoFileTemplate
=
({
dispatch
,
commit
,
rootGetters
})
=>
{
...
@@ -76,6 +78,8 @@ export const undoFileTemplate = ({ dispatch, commit, rootGetters }) => {
...
@@ -76,6 +78,8 @@ export const undoFileTemplate = ({ dispatch, commit, rootGetters }) => {
dispatch
(
'
changeFileContent
'
,
{
path
:
file
.
path
,
content
:
file
.
raw
},
{
root
:
true
});
dispatch
(
'
changeFileContent
'
,
{
path
:
file
.
path
,
content
:
file
.
raw
},
{
root
:
true
});
commit
(
types
.
SET_UPDATE_SUCCESS
,
false
);
commit
(
types
.
SET_UPDATE_SUCCESS
,
false
);
eventHub
.
$emit
(
`editor.update.model.new.content.
${
file
.
key
}
`
,
file
.
raw
);
};
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
// prevent babel-plugin-rewire from generating an invalid default during karma tests
...
...
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