Commit 3ef0ab72 authored by Mike Greiling's avatar Mike Greiling

add tooltip for notifications icon in collapsed sidebar

parent 5d444418
<script> <script>
import { __ } from '~/locale';
import icon from '~/vue_shared/components/icon.vue';
import toggleButton from '~/vue_shared/components/toggle_button.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
import icon from '../../../vue_shared/components/icon.vue';
import toggleButton from '../../../vue_shared/components/toggle_button.vue'; const ICON_ON = 'notifications';
const ICON_OFF = 'notifications-off';
const LABEL_ON = __('Notifications on');
const LABEL_OFF = __('Notifications off');
export default { export default {
directives: {
tooltip,
},
components: { components: {
icon, icon,
toggleButton, toggleButton,
...@@ -30,8 +40,11 @@ ...@@ -30,8 +40,11 @@
return this.subscribed === null || this.loading; return this.subscribed === null || this.loading;
}, },
notificationIcon() { notificationIcon() {
return this.subscribed ? 'notifications' : 'notifications-off'; return this.subscribed ? ICON_ON : ICON_OFF;
}, },
notificationTooltip() {
return this.subscribed ? LABEL_ON : LABEL_OFF;
}
}, },
methods: { methods: {
toggleSubscription() { toggleSubscription() {
...@@ -44,12 +57,19 @@ ...@@ -44,12 +57,19 @@
<template> <template>
<div> <div>
<div class="sidebar-collapsed-icon"> <div class="sidebar-collapsed-icon">
<icon <span
:name="notificationIcon" v-tooltip
:size="16" :title="notificationTooltip"
aria-hidden="true" data-container="body"
class="sidebar-item-icon is-active" data-placement="left"
/> >
<icon
:name="notificationIcon"
:size="16"
aria-hidden="true"
class="sidebar-item-icon is-active"
/>
</span>
</div> </div>
<span class="issuable-header-text hide-collapsed pull-left"> <span class="issuable-header-text hide-collapsed pull-left">
{{ __('Notifications') }} {{ __('Notifications') }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment