fixed issuable shortcuts not working

moved setstate method into store
This commit is contained in:
Phil Hughes 2017-05-30 11:58:50 +01:00
parent 3465e1e52c
commit df7c90116b
8 changed files with 32 additions and 8 deletions

View file

@ -108,7 +108,7 @@ export default {
openForm() {
if (!this.showForm) {
this.showForm = true;
this.store.formState = Object.assign(this.store.formState, {
this.store.setFormState({
title: this.state.titleText,
confidential: this.isConfidential,
description: this.state.descriptionText,
@ -126,7 +126,9 @@ export default {
confirm('Are you sure you want to move this issue to another project?') : true; // eslint-disable-line no-alert
if (!canPostUpdate) {
this.store.formState.updateLoading = false;
this.store.setFormState({
updateLoading: false,
});
return;
}

View file

@ -4,7 +4,7 @@ export default {
this.preAnimation = true;
this.pulseAnimation = false;
this.$nextTick(() => {
setTimeout(() => {
this.preAnimation = false;
this.pulseAnimation = true;
});

View file

@ -38,4 +38,8 @@ export default class Store {
description: this.state.descriptionText !== data.description_text,
};
}
setFormState(state) {
this.formState = Object.assign(this.formState, state);
}
}

View file

@ -77,7 +77,9 @@ import './shortcuts_navigation';
ShortcutsIssuable.prototype.editIssue = function() {
var $editBtn;
$editBtn = $('.issuable-edit');
return gl.utils.visitUrl($editBtn.attr('href'));
// Need to click the element as on issues, editing is inline
// on merge request, editing is on a different page
$editBtn.get(0).click();
};
ShortcutsIssuable.prototype.openSidebarDropdown = function(name) {

View file

@ -69,7 +69,7 @@
<template>
<div
class="md-area prepend-top-default append-bottom-default"
class="md-area prepend-top-default append-bottom-default js-vue-markdown-field"
ref="gl-form">
<markdown-header
:preview-markdown="previewMarkdown"

View file

@ -16,12 +16,24 @@
toolbarButton,
},
methods: {
toggleMarkdownPreview(e) {
e.target.blur();
toggleMarkdownPreview(e, form) {
if (form && !form.find('.js-vue-markdown-field').length) {
return;
} else if (e.target.blur) {
e.target.blur();
}
this.$emit('toggle-markdown');
},
},
mounted() {
$(document).on('markdown-preview:show.vue', this.toggleMarkdownPreview);
$(document).on('markdown-preview:hide.vue', this.toggleMarkdownPreview);
},
beforeDestroy() {
$(document).on('markdown-preview:show.vue', this.toggleMarkdownPreview);
$(document).off('markdown-preview:hide.vue', this.toggleMarkdownPreview);
},
};
</script>

View file

@ -0,0 +1,4 @@
---
title: Enables inline editing for an issues title & description
merge_request:
author:

View file

@ -287,7 +287,7 @@ describe('Issuable output', () => {
});
});
it('stops polling when deleteing', (done) => {
it('stops polling when deleting', (done) => {
spyOn(gl.utils, 'visitUrl');
spyOn(vm.poll, 'stop');
spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve) => {