debian-mirror-gitlab/app/assets/javascripts/ide/components/activity_bar.vue

93 lines
2.6 KiB
Vue
Raw Normal View History

2018-10-15 14:42:47 +05:30
<script>
2018-11-08 19:23:39 +05:30
import $ from 'jquery';
2020-06-23 00:09:42 +05:30
import { mapActions, mapState } from 'vuex';
2020-11-24 15:15:51 +05:30
import { GlIcon } from '@gitlab/ui';
2018-10-15 14:42:47 +05:30
import tooltip from '~/vue_shared/directives/tooltip';
2020-03-13 15:44:24 +05:30
import { leftSidebarViews } from '../constants';
2018-10-15 14:42:47 +05:30
export default {
components: {
2020-11-24 15:15:51 +05:30
GlIcon,
2018-10-15 14:42:47 +05:30
},
directives: {
tooltip,
},
computed: {
...mapState(['currentActivityView']),
},
methods: {
...mapActions(['updateActivityBarView']),
2018-11-08 19:23:39 +05:30
changedActivityView(e, view) {
e.currentTarget.blur();
this.updateActivityBarView(view);
2020-06-23 00:09:42 +05:30
// TODO: We must use JQuery here to interact with the Bootstrap tooltip API
// https://gitlab.com/gitlab-org/gitlab/-/issues/217577
2018-11-08 19:23:39 +05:30
$(e.currentTarget).tooltip('hide');
},
2018-10-15 14:42:47 +05:30
},
2020-03-13 15:44:24 +05:30
leftSidebarViews,
2018-10-15 14:42:47 +05:30
};
</script>
<template>
<nav class="ide-activity-bar">
<ul class="list-unstyled">
<li>
<button
v-tooltip
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.edit.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Edit')"
:aria-label="s__('IDE|Edit')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
2020-11-24 15:15:51 +05:30
data-qa-selector="edit_mode_tab"
2018-11-08 19:23:39 +05:30
type="button"
class="ide-sidebar-link js-ide-edit-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="code" />
2018-10-15 14:42:47 +05:30
</button>
</li>
<li>
<button
v-tooltip
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.review.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Review')"
:aria-label="s__('IDE|Review')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
type="button"
class="ide-sidebar-link js-ide-review-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="file-modified" />
2018-10-15 14:42:47 +05:30
</button>
</li>
2020-06-23 00:09:42 +05:30
<li>
2018-10-15 14:42:47 +05:30
<button
v-tooltip
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.commit.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Commit')"
:aria-label="s__('IDE|Commit')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
2020-11-24 15:15:51 +05:30
data-qa-selector="commit_mode_tab"
2018-11-08 19:23:39 +05:30
type="button"
2020-11-24 15:15:51 +05:30
class="ide-sidebar-link js-ide-commit-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="commit" />
2018-10-15 14:42:47 +05:30
</button>
</li>
</ul>
</nav>
</template>