add date question
add datetime question
This commit is contained in:
parent
688c73ebac
commit
eaed2c7ac7
|
@ -29,6 +29,8 @@
|
||||||
@include icon-black-white('answer-dropdown', 'forms', 1);
|
@include icon-black-white('answer-dropdown', 'forms', 1);
|
||||||
@include icon-black-white('answer-short', 'forms', 1);
|
@include icon-black-white('answer-short', 'forms', 1);
|
||||||
@include icon-black-white('answer-long', 'forms', 1);
|
@include icon-black-white('answer-long', 'forms', 1);
|
||||||
|
@include icon-black-white('answer-date', 'forms', 1);
|
||||||
|
@include icon-black-white('answer-datetime', 'forms', 1);
|
||||||
@include icon-black-white('drag-handle', 'forms', 1);
|
@include icon-black-white('drag-handle', 'forms', 1);
|
||||||
|
|
||||||
.icon-yes {
|
.icon-yes {
|
||||||
|
|
5
img/answer-date.svg
Normal file
5
img/answer-date.svg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
|
||||||
|
<rect style="marker:none" width="11.678" height="11.469" x="2.161" y="2.266" ry="0" rx="0" color="#000" overflow="visible" fill="none" stroke="#000" stroke-width="1.358" stroke-linecap="square" paint-order="fill markers stroke"/>
|
||||||
|
<path style="marker:none" color="#000" overflow="visible" stroke="#000" stroke-width=".351" stroke-linecap="square" paint-order="stroke markers fill" d="M9.837 9.978h2.209v2.169H9.837z"/>
|
||||||
|
<rect style="marker:none" width="11.873" height="2.124" x="2.064" y="2.168" ry="0" rx="0" color="#000" overflow="visible" stroke="#000" stroke-width="1.163" stroke-linecap="square" paint-order="fill markers stroke"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 712 B |
4
img/answer-datetime.svg
Normal file
4
img/answer-datetime.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
|
||||||
|
<rect style="marker:none" width="11.678" height="11.469" x="2.161" y="2.266" ry="5.734" rx="5.734" color="#000" overflow="visible" fill="none" stroke="#000" stroke-width="1.358" stroke-linecap="square" paint-order="fill markers stroke"/>
|
||||||
|
<path d="M6.893 4.811l.822 3.516 3.795 2.023" fill="none" stroke="#000"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 387 B |
|
@ -53,7 +53,9 @@ class Question extends Entity {
|
||||||
'long',
|
'long',
|
||||||
'multiple',
|
'multiple',
|
||||||
'multiple_unique',
|
'multiple_unique',
|
||||||
'dropdown'
|
'dropdown',
|
||||||
|
'date',
|
||||||
|
'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
68
src/components/Questions/QuestionDate.vue
Normal file
68
src/components/Questions/QuestionDate.vue
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<!--
|
||||||
|
- @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
-
|
||||||
|
- @author Simon Vieille <contact@deblan.fr>
|
||||||
|
-
|
||||||
|
- @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>
|
||||||
|
<Question
|
||||||
|
v-bind.sync="$attrs"
|
||||||
|
:text="text"
|
||||||
|
:mandatory="mandatory"
|
||||||
|
:edit.sync="edit"
|
||||||
|
:read-only="readOnly"
|
||||||
|
:max-question-length="maxStringLengths.questionText"
|
||||||
|
:title-placeholder="answerType.titlePlaceholder"
|
||||||
|
:warning-invalid="answerType.warningInvalid"
|
||||||
|
@update:text="onTitleChange"
|
||||||
|
@update:mandatory="onMandatoryChange"
|
||||||
|
@delete="onDelete">
|
||||||
|
<div v-if="readOnly" class="question__content">
|
||||||
|
<DatetimePicker
|
||||||
|
v-model="time" />
|
||||||
|
</div>
|
||||||
|
</Question>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import QuestionShort from './QuestionShort'
|
||||||
|
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'QuestionDate',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
DatetimePicker,
|
||||||
|
},
|
||||||
|
|
||||||
|
mixins: [QuestionShort],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
time: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
time(value) {
|
||||||
|
this.$emit('update:values', [value])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
69
src/components/Questions/QuestionDatetime.vue
Normal file
69
src/components/Questions/QuestionDatetime.vue
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<!--
|
||||||
|
- @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
-
|
||||||
|
- @author Simon Vieille <contact@deblan.fr>
|
||||||
|
-
|
||||||
|
- @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>
|
||||||
|
<Question
|
||||||
|
v-bind.sync="$attrs"
|
||||||
|
:text="text"
|
||||||
|
:mandatory="mandatory"
|
||||||
|
:edit.sync="edit"
|
||||||
|
:read-only="readOnly"
|
||||||
|
:max-question-length="maxStringLengths.questionText"
|
||||||
|
:title-placeholder="answerType.titlePlaceholder"
|
||||||
|
:warning-invalid="answerType.warningInvalid"
|
||||||
|
@update:text="onTitleChange"
|
||||||
|
@update:mandatory="onMandatoryChange"
|
||||||
|
@delete="onDelete">
|
||||||
|
<div v-if="readOnly" class="question__content">
|
||||||
|
<DatetimePicker
|
||||||
|
v-model="time"
|
||||||
|
type="datetime" />
|
||||||
|
</div>
|
||||||
|
</Question>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import QuestionShort from './QuestionShort'
|
||||||
|
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'QuestionDatetime',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
DatetimePicker,
|
||||||
|
},
|
||||||
|
|
||||||
|
mixins: [QuestionShort],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
time: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
time(value) {
|
||||||
|
this.$emit('update:values', [value])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -24,6 +24,8 @@ import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
||||||
import QuestionDropdown from '../components/Questions/QuestionDropdown'
|
import QuestionDropdown from '../components/Questions/QuestionDropdown'
|
||||||
import QuestionShort from '../components/Questions/QuestionShort'
|
import QuestionShort from '../components/Questions/QuestionShort'
|
||||||
import QuestionLong from '../components/Questions/QuestionLong'
|
import QuestionLong from '../components/Questions/QuestionLong'
|
||||||
|
import QuestionDate from '../components/Questions/QuestionDate'
|
||||||
|
import QuestionDatetime from '../components/Questions/QuestionDatetime'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} AnswerTypes
|
* @typedef {Object} AnswerTypes
|
||||||
|
@ -105,4 +107,25 @@ export default {
|
||||||
warningInvalid: t('forms', 'This question needs a title!'),
|
warningInvalid: t('forms', 'This question needs a title!'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
date: {
|
||||||
|
component: QuestionDate,
|
||||||
|
icon: 'icon-answer-date',
|
||||||
|
label: t('forms', 'Date'),
|
||||||
|
|
||||||
|
titlePlaceholder: t('forms', 'Date question title'),
|
||||||
|
createPlaceholder: t('forms', ''),
|
||||||
|
submitPlaceholder: t('forms', 'Enter a date'),
|
||||||
|
warningInvalid: t('forms', 'This question needs a title!'),
|
||||||
|
},
|
||||||
|
|
||||||
|
datetime: {
|
||||||
|
component: QuestionDatetime,
|
||||||
|
icon: 'icon-answer-datetime',
|
||||||
|
label: t('forms', 'Datetime'),
|
||||||
|
|
||||||
|
titlePlaceholder: t('forms', 'Datetime question title'),
|
||||||
|
createPlaceholder: t('forms', ''),
|
||||||
|
submitPlaceholder: t('forms', 'Enter a date'),
|
||||||
|
warningInvalid: t('forms', 'This question needs a title!'),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue