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>
import { GlButton } from '@gitlab/ui';
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import { viewerTypes } from '../constants';
export default {
components: {
GlButton,
GlDropdown,
GlDropdownItem,
},
props: {
viewer: {
......@@ -18,10 +19,21 @@ export default {
},
},
computed: {
mergeReviewLine() {
return sprintf(__('Reviewing (merge request !%{mergeRequestId})'), {
mergeRequestId: this.mergeRequestId,
});
modeDropdownItems() {
return [
{
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: {
......@@ -34,39 +46,16 @@ export default {
</script>
<template>
<div class="dropdown">
<gl-button variant="link" data-toggle="dropdown">{{ __('Edit') }}</gl-button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-open-left">
<ul>
<li>
<a
:class="{
'is-active': viewer === $options.viewerTypes.mr,
}"
href="#"
@click.prevent="changeMode($options.viewerTypes.mr)"
>
<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>
<gl-dropdown :text="__('Edit')" size="small">
<gl-dropdown-item
v-for="mode in modeDropdownItems"
:key="mode.viewerType"
:is-check-item="true"
:is-checked="viewer === mode.viewerType"
@click="changeMode(mode.viewerType)"
>
<strong class="dropdown-menu-inner-title"> {{ mode.title }} </strong>
<span class="dropdown-menu-inner-content"> {{ mode.content }} </span>
</gl-dropdown-item>
</gl-dropdown>
</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