Commit db6e4b74 authored by Mark Florian's avatar Mark Florian

Merge branch 'Updating-editor-mode-dropdown-ab' into 'master'

Updating IDE editor mode dropdown to gl dropdown

See merge request gitlab-org/gitlab!46820
parents df35dd1a 7d7fae7b
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { viewerTypes } from '../constants'; import { viewerTypes } from '../constants';
export default { export default {
components: { components: {
GlButton, GlDropdown,
GlDropdownItem,
}, },
props: { props: {
viewer: { viewer: {
...@@ -18,10 +19,21 @@ export default { ...@@ -18,10 +19,21 @@ export default {
}, },
}, },
computed: { computed: {
mergeReviewLine() { modeDropdownItems() {
return sprintf(__('Reviewing (merge request !%{mergeRequestId})'), { return [
mergeRequestId: this.mergeRequestId, {
}); viewerType: this.$options.viewerTypes.mr,
title: sprintf(__('Reviewing (merge request !%{mergeRequestId})'), {
mergeRequestId: this.mergeRequestId,
}),
content: __('Compare changes with the merge request target branch'),
},
{
viewerType: this.$options.viewerTypes.diff,
title: __('Reviewing'),
content: __('Compare changes with the last commit'),
},
];
}, },
}, },
methods: { methods: {
...@@ -34,39 +46,16 @@ export default { ...@@ -34,39 +46,16 @@ export default {
</script> </script>
<template> <template>
<div class="dropdown"> <gl-dropdown :text="__('Edit')" size="small">
<gl-button variant="link" data-toggle="dropdown">{{ __('Edit') }}</gl-button> <gl-dropdown-item
<div class="dropdown-menu dropdown-menu-selectable dropdown-open-left"> v-for="mode in modeDropdownItems"
<ul> :key="mode.viewerType"
<li> :is-check-item="true"
<a :is-checked="viewer === mode.viewerType"
:class="{ @click="changeMode(mode.viewerType)"
'is-active': viewer === $options.viewerTypes.mr, >
}" <strong class="dropdown-menu-inner-title"> {{ mode.title }} </strong>
href="#" <span class="dropdown-menu-inner-content"> {{ mode.content }} </span>
@click.prevent="changeMode($options.viewerTypes.mr)" </gl-dropdown-item>
> </gl-dropdown>
<strong class="dropdown-menu-inner-title"> {{ mergeReviewLine }} </strong>
<span class="dropdown-menu-inner-content">
{{ __('Compare changes with the merge request target branch') }}
</span>
</a>
</li>
<li>
<a
:class="{
'is-active': viewer === $options.viewerTypes.diff,
}"
href="#"
@click.prevent="changeMode($options.viewerTypes.diff)"
>
<strong class="dropdown-menu-inner-title">{{ __('Reviewing') }}</strong>
<span class="dropdown-menu-inner-content">
{{ __('Compare changes with the last commit') }}
</span>
</a>
</li>
</ul>
</div>
</div>
</template> </template>
---
title: Use GitLab's standard dropdown for the review mode chooser in the WebIDE
merge_request: 46820
author:
type: other
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