summaryrefslogtreecommitdiff
path: root/assets/js/components/submit-cancel.js
blob: 1950c0609360bf8690ce2ab928db87657332573c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Vue.component('submit-cancel', {
    props: ['labelButton', 'labelOr', 'labelCancel', 'callback'],
    template: '<div class="form-actions">' +
              '<button type="button" class="btn btn-blue" @click="onSubmit" :disabled="isLoading">' +
              '<span v-show="isLoading"><i class="fa fa-spinner fa-pulse"></i> </span>' +
              '{{ labelButton }}' +
              '</button> ' +
              '{{ labelOr }} <a href="#" v-on:click.prevent="onCancel">{{ labelCancel }}</a>' +
              '</div>'
    ,
    data: function () {
        return {
            loading: false
        };
    },
    computed: {
        isLoading: function () {
            return this.loading;
        }
    },
    methods: {
        onSubmit: function () {
            this.loading = true;
            this.callback();
        },
        onCancel: function () {
            _KB.get('Popover').close();
        }
    }
});