2018-04-13 10:35:03 -04:00
|
|
|
<script>
|
2018-05-31 06:18:21 -04:00
|
|
|
import $ from 'jquery';
|
2018-04-13 10:35:03 -04:00
|
|
|
import { mapActions, mapGetters, mapState } from 'vuex';
|
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2018-05-06 04:52:32 -04:00
|
|
|
import tooltip from '~/vue_shared/directives/tooltip';
|
2020-02-18 01:09:06 -05:00
|
|
|
import { leftSidebarViews } from '../constants';
|
2018-04-13 10:35:03 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
},
|
2018-05-06 04:52:32 -04:00
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2018-04-13 10:35:03 -04:00
|
|
|
computed: {
|
2020-05-29 11:08:14 -04:00
|
|
|
...mapGetters(['someUncommittedChanges']),
|
2018-04-13 10:35:03 -04:00
|
|
|
...mapState(['currentActivityView']),
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['updateActivityBarView']),
|
2018-05-31 06:18:21 -04:00
|
|
|
changedActivityView(e, view) {
|
|
|
|
e.currentTarget.blur();
|
|
|
|
|
|
|
|
this.updateActivityBarView(view);
|
|
|
|
|
2020-05-20 02:08:06 -04:00
|
|
|
// TODO: We must use JQuery here to interact with the Bootstrap tooltip API
|
|
|
|
// https://gitlab.com/gitlab-org/gitlab/-/issues/217577
|
2018-05-31 06:18:21 -04:00
|
|
|
$(e.currentTarget).tooltip('hide');
|
|
|
|
},
|
2018-04-13 10:35:03 -04:00
|
|
|
},
|
2020-02-18 01:09:06 -05:00
|
|
|
leftSidebarViews,
|
2018-04-13 10:35:03 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<nav class="ide-activity-bar">
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li>
|
2018-04-16 11:29:34 -04:00
|
|
|
<button
|
2018-05-06 04:52:32 -04:00
|
|
|
v-tooltip
|
2018-04-13 10:35:03 -04:00
|
|
|
:class="{
|
2020-02-18 01:09:06 -05:00
|
|
|
active: currentActivityView === $options.leftSidebarViews.edit.name,
|
2018-04-13 10:35:03 -04:00
|
|
|
}"
|
2018-05-06 04:52:32 -04:00
|
|
|
:title="s__('IDE|Edit')"
|
|
|
|
:aria-label="s__('IDE|Edit')"
|
2018-06-11 05:49:47 -04:00
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
|
|
|
type="button"
|
|
|
|
class="ide-sidebar-link js-ide-edit-mode"
|
2020-02-18 01:09:06 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)"
|
2018-04-13 10:35:03 -04:00
|
|
|
>
|
2018-11-16 15:07:38 -05:00
|
|
|
<icon name="code" />
|
2018-04-16 11:29:34 -04:00
|
|
|
</button>
|
2018-04-13 10:35:03 -04:00
|
|
|
</li>
|
2018-05-03 09:21:45 -04:00
|
|
|
<li>
|
2018-04-20 04:09:19 -04:00
|
|
|
<button
|
2018-05-06 04:52:32 -04:00
|
|
|
v-tooltip
|
2018-04-20 04:09:19 -04:00
|
|
|
:class="{
|
2020-02-18 01:09:06 -05:00
|
|
|
active: currentActivityView === $options.leftSidebarViews.review.name,
|
2018-04-20 04:09:19 -04:00
|
|
|
}"
|
2018-05-06 04:52:32 -04:00
|
|
|
:title="s__('IDE|Review')"
|
|
|
|
:aria-label="s__('IDE|Review')"
|
2018-06-11 05:49:47 -04:00
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
|
|
|
type="button"
|
|
|
|
class="ide-sidebar-link js-ide-review-mode"
|
2020-02-18 01:09:06 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)"
|
2018-04-20 04:09:19 -04:00
|
|
|
>
|
2018-11-16 15:07:38 -05:00
|
|
|
<icon name="file-modified" />
|
2018-04-20 04:09:19 -04:00
|
|
|
</button>
|
|
|
|
</li>
|
2020-05-29 11:08:14 -04:00
|
|
|
<li v-show="someUncommittedChanges">
|
2018-04-16 11:29:34 -04:00
|
|
|
<button
|
2018-05-06 04:52:32 -04:00
|
|
|
v-tooltip
|
2018-04-13 10:35:03 -04:00
|
|
|
:class="{
|
2020-02-18 01:09:06 -05:00
|
|
|
active: currentActivityView === $options.leftSidebarViews.commit.name,
|
2018-04-13 10:35:03 -04:00
|
|
|
}"
|
2018-05-06 04:52:32 -04:00
|
|
|
:title="s__('IDE|Commit')"
|
|
|
|
:aria-label="s__('IDE|Commit')"
|
2018-06-11 05:49:47 -04:00
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
|
|
|
type="button"
|
2019-06-05 04:46:30 -04:00
|
|
|
class="ide-sidebar-link js-ide-commit-mode qa-commit-mode-tab"
|
2020-02-18 01:09:06 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
|
2018-04-13 10:35:03 -04:00
|
|
|
>
|
2018-11-16 15:07:38 -05:00
|
|
|
<icon name="commit" />
|
2018-04-16 11:29:34 -04:00
|
|
|
</button>
|
2018-04-13 10:35:03 -04:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</template>
|