add date question, add datetime question
Signed-off-by: Simon Vieille <simon@deblan.fr>
This commit is contained in:
parent
1f707f7358
commit
670f7f04c4
|
@ -29,6 +29,8 @@
|
|||
@include icon-black-white('answer-dropdown', 'forms', 1);
|
||||
@include icon-black-white('answer-short', '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);
|
||||
|
||||
.icon-yes {
|
||||
|
|
122
img/answer-date.svg
Normal file
122
img/answer-date.svg
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
version="1.1"
|
||||
id="svg957"
|
||||
sodipodi:docname="answer-date.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata963">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs961" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1918"
|
||||
inkscape:window-height="1027"
|
||||
id="namedview959"
|
||||
showgrid="false"
|
||||
inkscape:zoom="23.71875"
|
||||
inkscape:cx="5.7986639"
|
||||
inkscape:cy="9.3162873"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="21"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg957" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.35800004;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;enable-background:accumulate"
|
||||
id="rect965"
|
||||
width="11.678105"
|
||||
height="11.468822"
|
||||
x="2.1609473"
|
||||
y="2.2655892"
|
||||
ry="0"
|
||||
rx="0" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="4.0071607" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="4.0071611" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="4.0071611" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-5"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-3"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7-5"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-5-6"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="9.9777613" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-3-2"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="9.9777622" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7-5-9"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="9.9777622" />
|
||||
</svg>
|
After Width: | Height: | Size: 6.4 KiB |
122
img/answer-datetime.svg
Normal file
122
img/answer-datetime.svg
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
version="1.1"
|
||||
id="svg957"
|
||||
sodipodi:docname="answer-datetime.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata963">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs961" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1918"
|
||||
inkscape:window-height="1027"
|
||||
id="namedview959"
|
||||
showgrid="false"
|
||||
inkscape:zoom="23.71875"
|
||||
inkscape:cx="5.7986639"
|
||||
inkscape:cy="9.3162873"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="21"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg957" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.35800004;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;enable-background:accumulate"
|
||||
id="rect965"
|
||||
width="11.678105"
|
||||
height="11.468822"
|
||||
x="2.1609473"
|
||||
y="2.2655892"
|
||||
ry="0"
|
||||
rx="0" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="4.0071607" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="4.0071611" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="4.0071611" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-5"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-3"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7-5"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="7.1437907" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-5-6"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="4.0588136"
|
||||
y="9.9777613" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-3-2"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="6.9478145"
|
||||
y="9.9777622" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.35140774;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke markers fill;enable-background:accumulate"
|
||||
id="rect965-3-6-7-5-9"
|
||||
width="2.2087064"
|
||||
height="2.1691241"
|
||||
x="9.8368149"
|
||||
y="9.9777622" />
|
||||
</svg>
|
After Width: | Height: | Size: 6.4 KiB |
|
@ -53,7 +53,9 @@ class Question extends Entity {
|
|||
'long',
|
||||
'multiple',
|
||||
'multiple_unique',
|
||||
'dropdown'
|
||||
'dropdown',
|
||||
'date',
|
||||
'datetime',
|
||||
];
|
||||
|
||||
public function __construct() {
|
||||
|
|
97
src/components/Questions/QuestionDate.vue
Normal file
97
src/components/Questions/QuestionDate.vue
Normal file
|
@ -0,0 +1,97 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||
-
|
||||
- @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||
-
|
||||
- @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 class="question__content">
|
||||
<input ref="input"
|
||||
:aria-label="t('forms', 'A answer for the question “{text}”', { text })"
|
||||
:placeholder="submissionInputPlaceholder"
|
||||
:disabled="!readOnly"
|
||||
:required="mandatory"
|
||||
:value="values[0]"
|
||||
class="question__input"
|
||||
:maxlength="maxStringLengths.answerText"
|
||||
minlength="1"
|
||||
type="date"
|
||||
@input="onInput"
|
||||
@keydown.enter.exact.prevent="onKeydownEnter">
|
||||
</div>
|
||||
</Question>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QuestionMixin from '../../mixins/QuestionMixin'
|
||||
|
||||
export default {
|
||||
name: 'QuestionDate',
|
||||
|
||||
mixins: [QuestionMixin],
|
||||
|
||||
computed: {
|
||||
submissionInputPlaceholder() {
|
||||
if (this.readOnly) {
|
||||
return this.answerType.submitPlaceholder
|
||||
}
|
||||
return this.answerType.createPlaceholder
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
onInput() {
|
||||
const input = this.$refs.input
|
||||
this.$emit('update:values', [input.value])
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// Using type to have a higher order than the input styling of server
|
||||
.question__input[type=text] {
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
margin: 0;
|
||||
padding: 6px 0;
|
||||
border: 0;
|
||||
border-bottom: 1px dotted var(--color-border-dark);
|
||||
border-radius: 0;
|
||||
|
||||
&:disabled {
|
||||
// Just overrides Server CSS-Styling for disabled inputs. -> Not Good??
|
||||
background-color: var(--color-main-background);
|
||||
color: var(--color-main-text);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
97
src/components/Questions/QuestionDatetime.vue
Normal file
97
src/components/Questions/QuestionDatetime.vue
Normal file
|
@ -0,0 +1,97 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||
-
|
||||
- @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||
-
|
||||
- @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 class="question__content">
|
||||
<input ref="input"
|
||||
:aria-label="t('forms', 'A answer for the question “{text}”', { text })"
|
||||
:placeholder="submissionInputPlaceholder"
|
||||
:disabled="!readOnly"
|
||||
:required="mandatory"
|
||||
:value="values[0]"
|
||||
class="question__input"
|
||||
:maxlength="maxStringLengths.answerText"
|
||||
minlength="1"
|
||||
type="datetime-local"
|
||||
@input="onInput"
|
||||
@keydown.enter.exact.prevent="onKeydownEnter">
|
||||
</div>
|
||||
</Question>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QuestionMixin from '../../mixins/QuestionMixin'
|
||||
|
||||
export default {
|
||||
name: 'QuestionDatetime',
|
||||
|
||||
mixins: [QuestionMixin],
|
||||
|
||||
computed: {
|
||||
submissionInputPlaceholder() {
|
||||
if (this.readOnly) {
|
||||
return this.answerType.submitPlaceholder
|
||||
}
|
||||
return this.answerType.createPlaceholder
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
onInput() {
|
||||
const input = this.$refs.input
|
||||
this.$emit('update:values', [input.value])
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// Using type to have a higher order than the input styling of server
|
||||
.question__input[type=text] {
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
margin: 0;
|
||||
padding: 6px 0;
|
||||
border: 0;
|
||||
border-bottom: 1px dotted var(--color-border-dark);
|
||||
border-radius: 0;
|
||||
|
||||
&:disabled {
|
||||
// Just overrides Server CSS-Styling for disabled inputs. -> Not Good??
|
||||
background-color: var(--color-main-background);
|
||||
color: var(--color-main-text);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -24,6 +24,8 @@ import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
|||
import QuestionDropdown from '../components/Questions/QuestionDropdown'
|
||||
import QuestionShort from '../components/Questions/QuestionShort'
|
||||
import QuestionLong from '../components/Questions/QuestionLong'
|
||||
import QuestionDate from '../components/Questions/QuestionDate'
|
||||
import QuestionDatetime from '../components/Questions/QuestionDatetime'
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnswerTypes
|
||||
|
@ -105,4 +107,25 @@ export default {
|
|||
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