1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00
pixelfed/resources/assets/components/admin/partial/AdminSettingsCheckbox.vue
2024-03-14 05:07:49 -06:00

42 lines
1.2 KiB
Vue

<template>
<div class="card shadow-none border card-body">
<div class="form-group mb-0">
<div class="custom-control custom-checkbox">
<input type="checkbox" :name="elementId" class="custom-control-input" :id="elementId" :checked="value" @change="$emit('change', !value)">
<label class="custom-control-label font-weight-bold" :for="elementId">{{ name }}</label>
</div>
<p class="mt-1 mb-0 small text-muted" v-html="description"></p>
</div>
</div>
</template>
<script>
export default {
props: {
name: {
type: String
},
value: {
type: Boolean
},
description: {
type: String
}
},
computed: {
elementId: {
get() {
let name = this.name;
name = name.toLowerCase();
name = name.replace(/[^a-z0-9 -]/g, ' ');
name = name.replace(/\s+/g, '-');
name = name.replace(/^-+|-+$/g, '');
return 'fec_' + name;
}
}
}
}
</script>