BigW Consortium Gitlab

convert notification subscription button into toggle

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