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

91 lines
2.5 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';
2018-10-15 14:42:47 +05:30
import Icon from '~/vue_shared/components/icon.vue';
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: {
Icon,
},
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"
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
>
2019-02-15 15:39:39 +05:30
<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
>
2019-02-15 15:39:39 +05:30
<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"
type="button"
2019-09-04 21:01:54 +05:30
class="ide-sidebar-link js-ide-commit-mode qa-commit-mode-tab"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
2018-10-15 14:42:47 +05:30
>
2019-02-15 15:39:39 +05:30
<icon name="commit" />
2018-10-15 14:42:47 +05:30
</button>
</li>
</ul>
</nav>
</template>