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

90 lines
2.4 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';
2018-10-15 14:42:47 +05:30
import { mapActions, mapGetters, mapState } from 'vuex';
import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import { activityBarViews } from '../constants';
export default {
components: {
Icon,
},
directives: {
tooltip,
},
computed: {
2018-11-18 11:00:15 +05:30
...mapGetters(['hasChanges']),
2018-10-15 14:42:47 +05:30
...mapState(['currentActivityView']),
},
methods: {
...mapActions(['updateActivityBarView']),
2018-11-08 19:23:39 +05:30
changedActivityView(e, view) {
e.currentTarget.blur();
this.updateActivityBarView(view);
$(e.currentTarget).tooltip('hide');
},
2018-10-15 14:42:47 +05:30
},
activityBarViews,
};
</script>
<template>
<nav class="ide-activity-bar">
<ul class="list-unstyled">
<li>
<button
v-tooltip
:class="{
2018-12-23 12:14:25 +05:30
active: currentActivityView === $options.activityBarViews.edit,
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"
2018-12-23 12:14:25 +05:30
@click.prevent="changedActivityView($event, $options.activityBarViews.edit);"
2018-10-15 14:42:47 +05:30
>
2018-12-23 12:14:25 +05:30
<icon name="code" />
2018-10-15 14:42:47 +05:30
</button>
</li>
<li>
<button
v-tooltip
:class="{
2018-12-23 12:14:25 +05:30
active: currentActivityView === $options.activityBarViews.review,
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"
2018-12-23 12:14:25 +05:30
@click.prevent="changedActivityView($event, $options.activityBarViews.review);"
2018-10-15 14:42:47 +05:30
>
2018-12-23 12:14:25 +05:30
<icon name="file-modified" />
2018-10-15 14:42:47 +05:30
</button>
</li>
<li v-show="hasChanges">
<button
v-tooltip
:class="{
2018-12-23 12:14:25 +05:30
active: currentActivityView === $options.activityBarViews.commit,
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"
class="ide-sidebar-link js-ide-commit-mode"
2018-12-23 12:14:25 +05:30
@click.prevent="changedActivityView($event, $options.activityBarViews.commit);"
2018-10-15 14:42:47 +05:30
>
2018-12-23 12:14:25 +05:30
<icon name="commit" />
2018-10-15 14:42:47 +05:30
</button>
</li>
</ul>
</nav>
</template>