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';
|
2018-04-26 09:06:35 -04:00
|
|
|
import { activityBarViews } 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: {
|
2018-08-07 09:19:13 -04:00
|
|
|
...mapGetters(['hasChanges']),
|
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);
|
|
|
|
|
|
|
|
$(e.currentTarget).tooltip('hide');
|
|
|
|
},
|
2018-04-13 10:35:03 -04:00
|
|
|
},
|
2018-04-26 09:06:35 -04:00
|
|
|
activityBarViews,
|
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="{
|
2018-11-16 15:07:38 -05:00
|
|
|
active: currentActivityView === $options.activityBarViews.edit,
|
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"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.activityBarViews.edit)"
|
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="{
|
2018-11-16 15:07:38 -05:00
|
|
|
active: currentActivityView === $options.activityBarViews.review,
|
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"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.activityBarViews.review)"
|
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>
|
2018-05-03 09:21:45 -04:00
|
|
|
<li v-show="hasChanges">
|
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="{
|
2018-11-16 15:07:38 -05:00
|
|
|
active: currentActivityView === $options.activityBarViews.commit,
|
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"
|
2019-01-10 16:56:37 -05:00
|
|
|
@click.prevent="changedActivityView($event, $options.activityBarViews.commit)"
|
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>
|