Commit 1814fc3f authored by Tim Zallmann's avatar Tim Zallmann

Fix for MR Widget Header reset

parent 0ea359d2
<script> <script>
import tooltip from '~/vue_shared/directives/tooltip'; import tooltip from '~/vue_shared/directives/tooltip';
import { n__ } from '~/locale'; import { n__ } from '~/locale';
import icon from '~/vue_shared/components/icon.vue'; import icon from '~/vue_shared/components/icon.vue';
import clipboardButton from '~/vue_shared/components/clipboard_button.vue'; import clipboardButton from '~/vue_shared/components/clipboard_button.vue';
export default { export default {
name: 'MRWidgetHeader', name: 'MRWidgetHeader',
directives: { directives: {
tooltip, tooltip,
},
components: {
icon,
clipboardButton,
},
props: {
mr: {
type: Object,
required: true,
}, },
}, components: {
computed: { icon,
shouldShowCommitsBehindText() { clipboardButton,
return this.mr.divergedCommitsCount > 0;
}, },
commitsText() { props: {
return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount); mr: {
type: Object,
required: true,
},
}, },
branchNameClipboardData() { computed: {
// This supports code in app/assets/javascripts/copy_to_clipboard.js that shouldShowCommitsBehindText() {
// works around ClipboardJS limitations to allow the context-specific return this.mr.divergedCommitsCount > 0;
// copy/pasting of plain text or GFM. },
return JSON.stringify({ commitsText() {
text: this.mr.sourceBranch, return n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount);
gfm: `\`${this.mr.sourceBranch}\``, },
}); branchNameClipboardData() {
// This supports code in app/assets/javascripts/copy_to_clipboard.js that
// works around ClipboardJS limitations to allow the context-specific
// copy/pasting of plain text or GFM.
return JSON.stringify({
text: this.mr.sourceBranch,
gfm: `\`${this.mr.sourceBranch}\``,
});
},
isSourceBranchLong() {
return this.isBranchTitleLong(this.mr.sourceBranch);
},
isTargetBranchLong() {
return this.isBranchTitleLong(this.mr.targetBranch);
},
}, },
isSourceBranchLong() { methods: {
return this.isBranchTitleLong(this.mr.sourceBranch); isBranchTitleLong(branchTitle) {
return branchTitle.length > 32;
},
}, },
isTargetBranchLong() { };
return this.isBranchTitleLong(this.mr.targetBranch);
},
},
methods: {
isBranchTitleLong(branchTitle) {
return branchTitle.length > 32;
},
},
};
</script> </script>
<template> <template>
<div class="mr-source-target"> <div class="mr-source-target">
......
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