BigW Consortium Gitlab

convert notification subscription button into toggle

parent 34760245
......@@ -2,11 +2,11 @@
/* eslint-disable vue/require-default-prop */
import { __ } from '../../../locale';
import eventHub from '../../event_hub';
import loadingButton from '../../../vue_shared/components/loading_button.vue';
import toggleButton from '../../../vue_shared/components/toggle_button.vue';
export default {
components: {
loadingButton,
toggleButton,
},
props: {
loading: {
......@@ -24,15 +24,8 @@
},
},
computed: {
buttonLabel() {
let label;
if (this.subscribed === false) {
label = __('Subscribe');
} else if (this.subscribed === true) {
label = __('Unsubscribe');
}
return label;
showLoadingState() {
return this.subscribed === null || this.loading;
},
},
methods: {
......@@ -55,12 +48,12 @@
<span class="issuable-header-text hide-collapsed pull-left">
{{ __('Notifications') }}
</span>
<loading-button
<toggle-button
ref="loadingButton"
class="btn btn-default pull-right hide-collapsed js-issuable-subscribe-button"
:loading="loading"
:label="buttonLabel"
@click="toggleSubscription"
class="pull-right hide-collapsed js-issuable-subscribe-button"
:is-loading="showLoadingState"
:value="subscribed"
@change="toggleSubscription"
/>
</div>
</template>
......@@ -23,11 +23,10 @@
name: {
type: String,
required: false,
default: '',
},
value: {
type: Boolean,
required: true,
required: false,
},
disabledInput: {
type: Boolean,
......@@ -61,6 +60,7 @@
<template>
<label class="toggle-wrapper">
<input
v-if="name"
type="hidden"
:name="name"
:value="value"
......
......@@ -162,10 +162,6 @@
border: 0;
}
span {
display: inline-block;
}
.select2-container span {
margin-top: 0;
}
......
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