Commit 10a1aaae authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '9971-move-ee-differences-for-app-assets-javascripts-notes-components-note_form-vue-ce' into 'master'

EE Backport to CE of EE!11151

See merge request gitlab-org/gitlab-ce!27824
parents 61ad5abc 3a62be84
...@@ -8,6 +8,7 @@ import issuableStateMixin from '../mixins/issuable_state'; ...@@ -8,6 +8,7 @@ import issuableStateMixin from '../mixins/issuable_state';
import resolvable from '../mixins/resolvable'; import resolvable from '../mixins/resolvable';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { getDraft, updateDraft } from '~/lib/utils/autosave'; import { getDraft, updateDraft } from '~/lib/utils/autosave';
import noteFormMixin from 'ee_else_ce/notes/mixins/note_form';
export default { export default {
name: 'NoteForm', name: 'NoteForm',
...@@ -15,7 +16,7 @@ export default { ...@@ -15,7 +16,7 @@ export default {
issueWarning, issueWarning,
markdownField, markdownField,
}, },
mixins: [issuableStateMixin, resolvable], mixins: [issuableStateMixin, resolvable, noteFormMixin],
props: { props: {
noteBody: { noteBody: {
type: String, type: String,
...@@ -195,21 +196,6 @@ export default { ...@@ -195,21 +196,6 @@ export default {
return shouldResolve || shouldToggleState; return shouldResolve || shouldToggleState;
}, },
handleKeySubmit() {
this.handleUpdate();
},
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
this.isSubmitting = false;
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
});
},
editMyLastNote() { editMyLastNote() {
if (this.updatedNoteBody === '') { if (this.updatedNoteBody === '') {
const lastNoteInDiscussion = this.getDiscussionLastNote(this.discussion); const lastNoteInDiscussion = this.getDiscussionLastNote(this.discussion);
...@@ -279,28 +265,74 @@ export default { ...@@ -279,28 +265,74 @@ export default {
></textarea> ></textarea>
</markdown-field> </markdown-field>
<div class="note-form-actions clearfix"> <div class="note-form-actions clearfix">
<button <template v-if="showBatchCommentsActions">
:disabled="isDisabled" <p v-if="showResolveDiscussionToggle">
type="button" <label>
class="js-vue-issue-save btn btn-success js-comment-button qa-reply-comment-button" <template v-if="discussionResolved">
@click="handleUpdate()" <input
> v-model="isUnresolving"
{{ saveButtonTitle }} type="checkbox"
</button> class="qa-unresolve-review-discussion"
<button />
v-if="discussion.resolvable" {{ __('Unresolve discussion') }}
class="btn btn-nr btn-default append-right-10 js-comment-resolve-button" </template>
@click.prevent="handleUpdate(true)" <template v-else>
> <input v-model="isResolving" type="checkbox" class="qa-resolve-review-discussion" />
{{ resolveButtonTitle }} {{ __('Resolve discussion') }}
</button> </template>
<button </label>
class="btn btn-cancel note-edit-cancel js-close-discussion-note-form" </p>
type="button" <div>
@click="cancelHandler()" <button
> :disabled="isDisabled"
Cancel type="button"
</button> class="btn btn-success qa-start-review"
@click="handleAddToReview"
>
<template v-if="hasDrafts">{{ __('Add to review') }}</template>
<template v-else>{{ __('Start a review') }}</template>
</button>
<button
:disabled="isDisabled"
type="button"
class="btn qa-comment-now"
@click="handleUpdate()"
>
{{ __('Add comment now') }}
</button>
<button
class="btn btn-cancel note-edit-cancel js-close-discussion-note-form"
type="button"
@click="cancelHandler()"
>
{{ __('Cancel') }}
</button>
</div>
</template>
<template v-else>
<button
:disabled="isDisabled"
type="button"
class="js-vue-issue-save btn btn-success js-comment-button qa-reply-comment-button"
@click="handleUpdate()"
>
{{ saveButtonTitle }}
</button>
<button
v-if="discussion.resolvable"
class="btn btn-nr btn-default append-right-10 js-comment-resolve-button"
@click.prevent="handleUpdate(true)"
>
{{ resolveButtonTitle }}
</button>
<button
class="btn btn-cancel note-edit-cancel js-close-discussion-note-form"
type="button"
@click="cancelHandler()"
>
Cancel
</button>
</template>
</div> </div>
</form> </form>
</div> </div>
......
export default {
data() {
return {
showBatchCommentsActions: false,
};
},
methods: {
handleKeySubmit() {
this.handleUpdate();
},
handleUpdate(shouldResolve) {
const beforeSubmitDiscussionState = this.discussionResolved;
this.isSubmitting = true;
this.$emit('handleFormUpdate', this.updatedNoteBody, this.$refs.editNoteForm, () => {
this.isSubmitting = false;
if (this.shouldToggleResolved(shouldResolve, beforeSubmitDiscussionState)) {
this.resolveHandler(beforeSubmitDiscussionState);
}
});
},
},
};
...@@ -529,6 +529,9 @@ msgstr "" ...@@ -529,6 +529,9 @@ msgstr ""
msgid "Add bold text" msgid "Add bold text"
msgstr "" msgstr ""
msgid "Add comment now"
msgstr ""
msgid "Add header and footer to emails. Please note that color settings will only be applied within the application interface" msgid "Add header and footer to emails. Please note that color settings will only be applied within the application interface"
msgstr "" msgstr ""
...@@ -562,6 +565,9 @@ msgstr "" ...@@ -562,6 +565,9 @@ msgstr ""
msgid "Add to project" msgid "Add to project"
msgstr "" msgstr ""
msgid "Add to review"
msgstr ""
msgid "Add todo" msgid "Add todo"
msgstr "" msgstr ""
...@@ -8864,6 +8870,9 @@ msgstr "" ...@@ -8864,6 +8870,9 @@ msgstr ""
msgid "Start a new merge request" msgid "Start a new merge request"
msgstr "" msgstr ""
msgid "Start a review"
msgstr ""
msgid "Start and due date" msgid "Start and due date"
msgstr "" msgstr ""
......
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