debian-mirror-gitlab/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue

47 lines
1 KiB
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2018-05-09 12:01:36 +05:30
import $ from 'jquery';
import eventHub from '../../event_hub';
2017-09-10 17:25:29 +05:30
export default {
props: {
isConfidential: {
required: true,
type: Boolean,
},
updateConfidentialAttribute: {
required: true,
type: Function,
},
},
computed: {
2018-03-17 18:26:18 +05:30
toggleButtonText() {
2017-09-10 17:25:29 +05:30
return this.isConfidential ? 'Turn Off' : 'Turn On';
},
updateConfidentialBool() {
return !this.isConfidential;
},
},
2018-05-09 12:01:36 +05:30
methods: {
closeForm() {
eventHub.$emit('closeConfidentialityForm');
$(this.$el).trigger('hidden.gl.dropdown');
},
submitForm() {
this.closeForm();
this.updateConfidentialAttribute(this.updateConfidentialBool);
},
},
2017-09-10 17:25:29 +05:30
};
</script>
<template>
2018-03-17 18:26:18 +05:30
<div class="sidebar-item-warning-message-actions">
2019-02-15 15:39:39 +05:30
<button type="button" class="btn btn-default append-right-10" @click="closeForm">
2018-03-17 18:26:18 +05:30
{{ __('Cancel') }}
2017-09-10 17:25:29 +05:30
</button>
2019-02-15 15:39:39 +05:30
<button type="button" class="btn btn-close" @click.prevent="submitForm">
2018-03-17 18:26:18 +05:30
{{ toggleButtonText }}
2017-09-10 17:25:29 +05:30
</button>
</div>
</template>