Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-02-11 12:53:36 +0300
committerdartcafe <github@dartcafe.de>2021-02-11 12:53:36 +0300
commit3cd99cb01775eb6015a91b0466bc37e9b98c9ba0 (patch)
treeb5b259ae43d163a6ffc45b497b3df2743957f970 /src/js/components/Base
parentad7e34e1dee5e706b36bd39721e5cc4a4390719d (diff)
Add RadioGroupDiv
Diffstat (limited to 'src/js/components/Base')
-rw-r--r--src/js/components/Base/RadioGroupDiv.vue62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/js/components/Base/RadioGroupDiv.vue b/src/js/components/Base/RadioGroupDiv.vue
new file mode 100644
index 00000000..387216bb
--- /dev/null
+++ b/src/js/components/Base/RadioGroupDiv.vue
@@ -0,0 +1,62 @@
+<!--
+ - @copyright Copyright (c) 2018 René Gieling <github@dartcafe.de>
+ -
+ - @author René Gieling <github@dartcafe.de>
+ -
+ - @license GNU AGPL version 3 or any later version
+ -
+ - This program is free software: you can redistribute it and/or modify
+ - it under the terms of the GNU Affero General Public License as
+ - published by the Free Software Foundation, either version 3 of the
+ - License, or (at your option) any later version.
+ -
+ - This program is distributed in the hope that it will be useful,
+ - but WITHOUT ANY WARRANTY; without even the implied warranty of
+ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ - GNU Affero General Public License for more details.
+ -
+ - You should have received a copy of the GNU Affero General Public License
+ - along with this program. If not, see <http://www.gnu.org/licenses/>.
+ -
+ -->
+
+<template lang="html">
+ <div class="radio-group-div">
+ <fieldset v-for="(option, index) in options" :key="option.value">
+ <input :id="id + '_' + index"
+ :checked="option.value === value"
+ :value="option.value"
+ type="radio"
+ class="radio"
+ @change="$emit('input', option.value)">
+ <label :for="id + '_' + index">
+ <slot name="before" />
+ {{ option.label }}
+ </label>
+ </fieldset>
+ </div>
+</template>
+
+<script>
+const RandId = () => {
+ return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10)
+}
+
+export default {
+ name: 'RadioGroupDiv',
+ props: {
+ id: {
+ type: String,
+ default: 'id_' + RandId(),
+ },
+ options: {
+ type: Array,
+ required: true,
+ },
+ value: {
+ type: String,
+ default: null,
+ },
+ },
+}
+</script>