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

53 lines
1,015 B
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2020-01-01 13:55:28 +05:30
import { __ } from '~/locale';
2018-05-09 12:01:36 +05:30
import eventHub from '../../event_hub';
2018-03-17 18:26:18 +05:30
export default {
props: {
isLocked: {
required: true,
type: Boolean,
},
updateLockedAttribute: {
required: true,
type: Function,
},
},
computed: {
buttonText() {
2018-11-20 20:47:30 +05:30
return this.isLocked ? __('Unlock') : __('Lock');
2018-03-17 18:26:18 +05:30
},
toggleLock() {
return !this.isLocked;
},
},
2018-05-09 12:01:36 +05:30
methods: {
closeForm() {
eventHub.$emit('closeLockForm');
$(this.$el).trigger('hidden.gl.dropdown');
},
submitForm() {
this.closeForm();
this.updateLockedAttribute(this.toggleLock);
},
},
2018-03-17 18:26:18 +05:30
};
</script>
<template>
<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') }}
</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
{{ buttonText }}
</button>
</div>
</template>