gitlab-org--gitlab-foss/app/assets/javascripts/vue_shared/components/popup_dialog.vue

86 lines
1.6 KiB
Vue
Raw Normal View History

<script>
2017-08-15 18:16:42 +00:00
export default {
name: 'popup-dialog',
props: {
2017-08-15 18:16:42 +00:00
title: {
type: String,
required: true,
},
body: {
type: String,
required: true,
},
kind: {
type: String,
2017-08-15 18:16:42 +00:00
required: false,
default: 'primary',
},
closeButtonLabel: {
type: String,
2017-08-15 18:16:42 +00:00
required: false,
default: 'Cancel',
},
primaryButtonLabel: {
type: String,
2017-08-15 18:16:42 +00:00
required: true,
},
},
computed: {
2017-08-15 18:16:42 +00:00
btnKindClass() {
return {
[`btn-${this.kind}`]: true,
};
2017-08-01 13:41:24 +00:00
},
},
methods: {
close() {
this.$emit('toggle', false);
},
2017-08-15 18:16:42 +00:00
emitSubmit(status) {
this.$emit('submit', status);
2017-08-01 13:41:24 +00:00
},
},
};
</script>
2017-08-15 18:16:42 +00:00
<template>
2017-08-15 18:16:42 +00:00
<div
class="modal popup-dialog"
role="dialog"
tabindex="-1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2017-08-15 18:16:42 +00:00
<button type="button"
class="close"
@click="close"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{this.title}}</h4>
</div>
<div class="modal-body">
<p>{{this.body}}</p>
</div>
<div class="modal-footer">
2017-08-15 18:16:42 +00:00
<button
type="button"
class="btn btn-default"
@click="emitSubmit(false)">
{{closeButtonLabel}}
</button>
<button type="button"
class="btn"
:class="btnKindClass"
@click="emitSubmit(true)">
{{primaryButtonLabel}}
</button>
</div>
</div>
</div>
</div>
2017-08-01 13:41:24 +00:00
</template>