diff options
author | Simon Knox <simon@gitlab.com> | 2017-12-04 16:19:07 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-12-04 16:19:07 +0000 |
commit | bf85a90037714c3ba290c9966f435adbfa90b074 (patch) | |
tree | 3fcd899154c11f3e179303cdd341c19cdcdeaaae /app/assets/javascripts | |
parent | a1cd9be42910c89192e82659c09bf0242c8e5dae (diff) | |
download | gitlab-ce-bf85a90037714c3ba290c9966f435adbfa90b074.tar.gz |
issue note component rename
Diffstat (limited to 'app/assets/javascripts')
15 files changed, 62 insertions, 63 deletions
diff --git a/app/assets/javascripts/notes/components/issue_discussion_locked_widget.vue b/app/assets/javascripts/notes/components/discussion_locked_widget.vue index 64466b04b40..e6f7ee56ff3 100644 --- a/app/assets/javascripts/notes/components/issue_discussion_locked_widget.vue +++ b/app/assets/javascripts/notes/components/discussion_locked_widget.vue @@ -1,8 +1,12 @@ <script> - import Icon from '../../vue_shared/components/icon.vue'; + import Icon from '~/vue_shared/components/icon.vue'; + import Issuable from '~/vue_shared/mixins/issuable'; export default { - component: { + mixins: [ + Issuable, + ], + components: { Icon, }, }; @@ -16,7 +20,7 @@ :size="16" class="icon"> </icon> - <span>This issue is locked. Only <b>project members</b> can comment.</span> + <span>This {{ issuableDisplayName }} is locked. Only <b>project members</b> can comment.</span> </span> </div> </template> diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index dbc900f4c04..78986a450c2 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -8,8 +8,8 @@ import * as constants from '../constants'; import eventHub from '../event_hub'; import issueWarning from '../../vue_shared/components/issue/issue_warning.vue'; - import issueNoteSignedOutWidget from './issue_note_signed_out_widget.vue'; - import issueDiscussionLockedWidget from './issue_discussion_locked_widget.vue'; + import noteSignedOutWidget from './note_signed_out_widget.vue'; + import discussionLockedWidget from './discussion_locked_widget.vue'; import markdownField from '../../vue_shared/components/markdown/field.vue'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import issuableStateMixin from '../mixins/issuable_state'; @@ -29,8 +29,8 @@ }, components: { issueWarning, - issueNoteSignedOutWidget, - issueDiscussionLockedWidget, + noteSignedOutWidget, + discussionLockedWidget, markdownField, userAvatarLink, }, @@ -240,8 +240,11 @@ <template> <div> - <issue-note-signed-out-widget v-if="!isLoggedIn" /> - <issue-discussion-locked-widget v-else-if="!canCreateNote" /> + <note-signed-out-widget v-if="!isLoggedIn" /> + <discussion-locked-widget + issuable-type="issue" + v-else-if="!canCreateNote" + /> <ul v-else class="notes notes-form timeline"> diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue index 26f729d8875..460fde9b62a 100644 --- a/app/assets/javascripts/notes/components/issue_discussion.vue +++ b/app/assets/javascripts/notes/components/issue_discussion.vue @@ -4,10 +4,9 @@ import { SYSTEM_NOTE } from '../constants'; import issueNote from './issue_note.vue'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; - import issueNoteHeader from './issue_note_header.vue'; - import issueNoteActions from './issue_note_actions.vue'; - import issueNoteSignedOutWidget from './issue_note_signed_out_widget.vue'; - import issueNoteEditedText from './issue_note_edited_text.vue'; + import noteHeader from './note_header.vue'; + import noteSignedOutWidget from './note_signed_out_widget.vue'; + import noteEditedText from './note_edited_text.vue'; import issueNoteForm from './issue_note_form.vue'; import placeholderNote from '../../vue_shared/components/notes/placeholder_note.vue'; import placeholderSystemNote from '../../vue_shared/components/notes/placeholder_system_note.vue'; @@ -28,10 +27,9 @@ components: { issueNote, userAvatarLink, - issueNoteHeader, - issueNoteActions, - issueNoteSignedOutWidget, - issueNoteEditedText, + noteHeader, + noteSignedOutWidget, + noteEditedText, issueNoteForm, placeholderNote, placeholderSystemNote, @@ -171,7 +169,7 @@ <div class="timeline-content"> <div class="discussion"> <div class="discussion-header"> - <issue-note-header + <note-header :author="author" :created-at="discussion.created_at" :note-id="discussion.id" @@ -179,8 +177,8 @@ @toggleHandler="toggleDiscussionHandler" action-text="started a discussion" class="discussion" - /> - <issue-note-edited-text + /> + <note-edited-text v-if="lastUpdatedAt" :edited-at="lastUpdatedAt" :edited-by="lastUpdatedBy" @@ -220,7 +218,7 @@ @cancelFormEdition="cancelReplyForm" ref="noteForm" /> - <issue-note-signed-out-widget v-if="!canReply" /> + <note-signed-out-widget v-if="!canReply" /> </div> </div> </div> diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index 40318f9a600..8c81c5d6df3 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -2,8 +2,8 @@ import { mapGetters, mapActions } from 'vuex'; import Flash from '../../flash'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; - import issueNoteHeader from './issue_note_header.vue'; - import issueNoteActions from './issue_note_actions.vue'; + import noteHeader from './note_header.vue'; + import noteActions from './note_actions.vue'; import issueNoteBody from './issue_note_body.vue'; import eventHub from '../event_hub'; @@ -23,8 +23,8 @@ }, components: { userAvatarLink, - issueNoteHeader, - issueNoteActions, + noteHeader, + noteActions, issueNoteBody, }, computed: { @@ -155,13 +155,13 @@ </div> <div class="timeline-content"> <div class="note-header"> - <issue-note-header + <note-header :author="author" :created-at="note.created_at" :note-id="note.id" action-text="commented" /> - <issue-note-actions + <note-actions :author-id="author.id" :note-id="note.id" :access-level="note.human_access" diff --git a/app/assets/javascripts/notes/components/issue_note_body.vue b/app/assets/javascripts/notes/components/issue_note_body.vue index 5f9003bfd87..a16c5f6a785 100644 --- a/app/assets/javascripts/notes/components/issue_note_body.vue +++ b/app/assets/javascripts/notes/components/issue_note_body.vue @@ -1,7 +1,7 @@ <script> - import issueNoteEditedText from './issue_note_edited_text.vue'; - import issueNoteAwardsList from './issue_note_awards_list.vue'; - import issueNoteAttachment from './issue_note_attachment.vue'; + import noteEditedText from './note_edited_text.vue'; + import noteAwardsList from './note_awards_list.vue'; + import noteAttachment from './note_attachment.vue'; import issueNoteForm from './issue_note_form.vue'; import TaskList from '../../task_list'; import autosave from '../mixins/autosave'; @@ -26,9 +26,9 @@ autosave, ], components: { - issueNoteEditedText, - issueNoteAwardsList, - issueNoteAttachment, + noteEditedText, + noteAwardsList, + noteAttachment, issueNoteForm, }, computed: { @@ -101,20 +101,20 @@ v-model="note.note" :data-update-url="note.path" class="hidden js-task-list-field"></textarea> - <issue-note-edited-text + <note-edited-text v-if="note.last_edited_at" :edited-at="note.last_edited_at" :edited-by="note.last_edited_by" action-text="Edited" /> - <issue-note-awards-list + <note-awards-list v-if="note.award_emoji.length" :note-id="note.id" :note-author-id="note.author.id" :awards="note.award_emoji" :toggle-award-path="note.toggle_award_path" /> - <issue-note-attachment + <note-attachment v-if="note.attachment" :attachment="note.attachment" /> diff --git a/app/assets/javascripts/notes/components/issue_note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue index feb3e73194b..45fc6196be4 100644 --- a/app/assets/javascripts/notes/components/issue_note_actions.vue +++ b/app/assets/javascripts/notes/components/note_actions.vue @@ -5,11 +5,11 @@ import emojiSmiley from 'icons/_emoji_smiley.svg'; import editSvg from 'icons/_icon_pencil.svg'; import ellipsisSvg from 'icons/_ellipsis_v.svg'; - import loadingIcon from '../../vue_shared/components/loading_icon.vue'; - import tooltip from '../../vue_shared/directives/tooltip'; + import loadingIcon from '~/vue_shared/components/loading_icon.vue'; + import tooltip from '~/vue_shared/directives/tooltip'; export default { - name: 'issueNoteActions', + name: 'noteActions', props: { authorId: { type: Number, diff --git a/app/assets/javascripts/notes/components/issue_note_attachment.vue b/app/assets/javascripts/notes/components/note_attachment.vue index 7134a3eb47e..cd9571a4002 100644 --- a/app/assets/javascripts/notes/components/issue_note_attachment.vue +++ b/app/assets/javascripts/notes/components/note_attachment.vue @@ -1,6 +1,6 @@ <script> export default { - name: 'issueNoteAttachment', + name: 'noteAttachment', props: { attachment: { type: Object, diff --git a/app/assets/javascripts/notes/components/issue_note_awards_list.vue b/app/assets/javascripts/notes/components/note_awards_list.vue index c3a340139e7..c3a340139e7 100644 --- a/app/assets/javascripts/notes/components/issue_note_awards_list.vue +++ b/app/assets/javascripts/notes/components/note_awards_list.vue diff --git a/app/assets/javascripts/notes/components/issue_note_edited_text.vue b/app/assets/javascripts/notes/components/note_edited_text.vue index 49e09f0ecc5..49e09f0ecc5 100644 --- a/app/assets/javascripts/notes/components/issue_note_edited_text.vue +++ b/app/assets/javascripts/notes/components/note_edited_text.vue diff --git a/app/assets/javascripts/notes/components/issue_note_header.vue b/app/assets/javascripts/notes/components/note_header.vue index 63aa3d777d0..63aa3d777d0 100644 --- a/app/assets/javascripts/notes/components/issue_note_header.vue +++ b/app/assets/javascripts/notes/components/note_header.vue diff --git a/app/assets/javascripts/notes/components/issue_note_signed_out_widget.vue b/app/assets/javascripts/notes/components/note_signed_out_widget.vue index 77af3594c1c..45d3c2de355 100644 --- a/app/assets/javascripts/notes/components/issue_note_signed_out_widget.vue +++ b/app/assets/javascripts/notes/components/note_signed_out_widget.vue @@ -2,7 +2,6 @@ import { mapGetters } from 'vuex'; export default { - name: 'singInLinksNotes', computed: { ...mapGetters([ 'getNotesDataByProp', diff --git a/app/assets/javascripts/sidebar/components/lock/edit_form.vue b/app/assets/javascripts/sidebar/components/lock/edit_form.vue index c7a6edc7c70..242e826d471 100644 --- a/app/assets/javascripts/sidebar/components/lock/edit_form.vue +++ b/app/assets/javascripts/sidebar/components/lock/edit_form.vue @@ -18,11 +18,6 @@ export default { required: true, type: Function, }, - - issuableType: { - required: true, - type: String, - }, }, mixins: [ @@ -39,13 +34,13 @@ export default { <div class="dropdown open"> <div class="dropdown-menu sidebar-item-warning-message"> <p class="text" v-if="isLocked"> - Unlock this {{ issuableDisplayName(issuableType) }}? + Unlock this {{ issuableDisplayName }}? <strong>Everyone</strong> will be able to comment. </p> <p class="text" v-else> - Lock this {{ issuableDisplayName(issuableType) }}? + Lock this {{ issuableDisplayName }}? Only <strong>project members</strong> will be able to comment. diff --git a/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue b/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue index 9aff53cf8af..04c3a96bf74 100644 --- a/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue +++ b/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue @@ -23,11 +23,6 @@ export default { return mediatorObject.service && mediatorObject.service.update && mediatorObject.store; }, }, - - issuableType: { - required: true, - type: String, - }, }, mixins: [ @@ -59,7 +54,7 @@ export default { discussion_locked: locked, }) .then(() => location.reload()) - .catch(() => Flash(this.__(`Something went wrong trying to change the locked state of this ${this.issuableDisplayName(this.issuableType)}`))); + .catch(() => Flash(this.__(`Something went wrong trying to change the locked state of this ${this.issuableDisplayName}`))); }, }, }; @@ -77,7 +72,7 @@ export default { </div> <div class="title hide-collapsed"> - Lock {{issuableDisplayName(issuableType) }} + Lock {{ issuableDisplayName }} <button v-if="isEditable" class="pull-right lock-edit btn btn-blank" diff --git a/app/assets/javascripts/vue_shared/components/notes/system_note.vue b/app/assets/javascripts/vue_shared/components/notes/system_note.vue index 98f8f32557d..2248699c399 100644 --- a/app/assets/javascripts/vue_shared/components/notes/system_note.vue +++ b/app/assets/javascripts/vue_shared/components/notes/system_note.vue @@ -17,7 +17,7 @@ * /> */ import { mapGetters } from 'vuex'; - import issueNoteHeader from '../../../notes/components/issue_note_header.vue'; + import noteHeader from '~/notes/components/note_header.vue'; import { spriteIcon } from '../../../lib/utils/common_utils'; export default { @@ -29,7 +29,7 @@ }, }, components: { - issueNoteHeader, + noteHeader, }, computed: { ...mapGetters([ @@ -60,12 +60,12 @@ </div> <div class="timeline-content"> <div class="note-header"> - <issue-note-header + <note-header :author="note.author" :created-at="note.created_at" :note-id="note.id" :action-text-html="note.note_html" - /> + /> </div> </div> </div> diff --git a/app/assets/javascripts/vue_shared/mixins/issuable.js b/app/assets/javascripts/vue_shared/mixins/issuable.js index 263361587e0..fab0919d96e 100644 --- a/app/assets/javascripts/vue_shared/mixins/issuable.js +++ b/app/assets/javascripts/vue_shared/mixins/issuable.js @@ -1,9 +1,14 @@ export default { - methods: { - issuableDisplayName(issuableType) { - const displayName = issuableType.replace(/_/, ' '); + props: { + issuableType: { + required: true, + type: String, + }, + }, - return this.__ ? this.__(displayName) : displayName; + computed: { + issuableDisplayName() { + return this.issuableType.replace(/_/g, ' '); }, }, }; |