Commit 7465f62e authored by Phil Hughes's avatar Phil Hughes

fixed action name changes after rebase

fixed content not updating in editor when changing template
parent 843467b8
...@@ -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.setSelectedTemplateType(type);
} }
}, },
selectTemplateType(type) { selectTemplateType(type) {
this.setTemplateType(type); this.setSelectedTemplateType(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>
......
...@@ -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
......
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment