From e0e535f5d157326d9862e3bbdc769dbfff4d5e39 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 10 Jul 2020 14:47:44 +0200 Subject: [PATCH 1/8] add date question, add datetime question Signed-off-by: Simon Vieille --- css/icons.scss | 2 + img/answer-date.svg | 122 ++++++++++++++++++ img/answer-datetime.svg | 122 ++++++++++++++++++ lib/Db/Question.php | 4 +- src/components/Questions/QuestionDate.vue | 97 ++++++++++++++ src/components/Questions/QuestionDatetime.vue | 97 ++++++++++++++ src/models/AnswerTypes.js | 23 ++++ 7 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 img/answer-date.svg create mode 100644 img/answer-datetime.svg create mode 100644 src/components/Questions/QuestionDate.vue create mode 100644 src/components/Questions/QuestionDatetime.vue diff --git a/css/icons.scss b/css/icons.scss index 4aa373b..114b94f 100644 --- a/css/icons.scss +++ b/css/icons.scss @@ -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 { diff --git a/img/answer-date.svg b/img/answer-date.svg new file mode 100644 index 0000000..f73e6ed --- /dev/null +++ b/img/answer-date.svg @@ -0,0 +1,122 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/img/answer-datetime.svg b/img/answer-datetime.svg new file mode 100644 index 0000000..0c88190 --- /dev/null +++ b/img/answer-datetime.svg @@ -0,0 +1,122 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/lib/Db/Question.php b/lib/Db/Question.php index 26549d0..16dbeb6 100644 --- a/lib/Db/Question.php +++ b/lib/Db/Question.php @@ -53,7 +53,9 @@ class Question extends Entity { 'long', 'multiple', 'multiple_unique', - 'dropdown' + 'dropdown', + 'date', + 'datetime', ]; public function __construct() { diff --git a/src/components/Questions/QuestionDate.vue b/src/components/Questions/QuestionDate.vue new file mode 100644 index 0000000..33307b8 --- /dev/null +++ b/src/components/Questions/QuestionDate.vue @@ -0,0 +1,97 @@ + + + + + + + diff --git a/src/components/Questions/QuestionDatetime.vue b/src/components/Questions/QuestionDatetime.vue new file mode 100644 index 0000000..b576d4f --- /dev/null +++ b/src/components/Questions/QuestionDatetime.vue @@ -0,0 +1,97 @@ + + + + + + + diff --git a/src/models/AnswerTypes.js b/src/models/AnswerTypes.js index f8b4631..3d909af 100644 --- a/src/models/AnswerTypes.js +++ b/src/models/AnswerTypes.js @@ -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!'), + }, } From b61207f32bc6892824821963aaf41df9d046fb47 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 10 Jul 2020 14:53:28 +0200 Subject: [PATCH 2/8] fix date/datetime css Signed-off-by: Simon Vieille --- src/components/Questions/QuestionDate.vue | 2 +- src/components/Questions/QuestionDatetime.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Questions/QuestionDate.vue b/src/components/Questions/QuestionDate.vue index 33307b8..51be528 100644 --- a/src/components/Questions/QuestionDate.vue +++ b/src/components/Questions/QuestionDate.vue @@ -78,7 +78,7 @@ export default { diff --git a/src/models/AnswerTypes.js b/src/models/AnswerTypes.js index 3d909af..e07ff7c 100644 --- a/src/models/AnswerTypes.js +++ b/src/models/AnswerTypes.js @@ -26,6 +26,7 @@ import QuestionShort from '../components/Questions/QuestionShort' import QuestionLong from '../components/Questions/QuestionLong' import QuestionDate from '../components/Questions/QuestionDate' import QuestionDatetime from '../components/Questions/QuestionDatetime' +import QuestionEmail from '../components/Questions/QuestionEmail' /** * @typedef {Object} AnswerTypes @@ -128,4 +129,15 @@ export default { submitPlaceholder: t('forms', 'Enter a date'), warningInvalid: t('forms', 'This question needs a title!'), }, + + email: { + component: QuestionEmail, + icon: 'icon-answer-email', + label: t('forms', 'Email'), + + titlePlaceholder: t('forms', 'Email question title'), + createPlaceholder: t('forms', ''), + submitPlaceholder: t('forms', 'Enter an email'), + warningInvalid: t('forms', 'This question needs a title!'), + }, } From 1b745459e09e3f596f4267f776ea5ad50035c840 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 10 Jul 2020 15:11:56 +0200 Subject: [PATCH 4/8] update icons Signed-off-by: Simon Vieille --- img/answer-date.svg | 77 ++++++++----------------------------- img/answer-datetime.svg | 85 +++++++---------------------------------- 2 files changed, 29 insertions(+), 133 deletions(-) diff --git a/img/answer-date.svg b/img/answer-date.svg index f73e6ed..161303b 100644 --- a/img/answer-date.svg +++ b/img/answer-date.svg @@ -21,7 +21,7 @@ image/svg+xml - + @@ -37,14 +37,14 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1918" - inkscape:window-height="1027" + inkscape:window-height="1008" id="namedview959" showgrid="false" - inkscape:zoom="23.71875" - inkscape:cx="5.7986639" - inkscape:cy="9.3162873" + inkscape:zoom="33.543378" + inkscape:cx="8.6003143" + inkscape:cy="9.8220565" inkscape:window-x="1920" - inkscape:window-y="21" + inkscape:window-y="41" inkscape:window-maximized="0" inkscape:current-layer="svg957" /> - - - - - - - - + diff --git a/img/answer-datetime.svg b/img/answer-datetime.svg index 0c88190..0842b44 100644 --- a/img/answer-datetime.svg +++ b/img/answer-datetime.svg @@ -21,7 +21,7 @@ image/svg+xml - + @@ -37,14 +37,14 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1918" - inkscape:window-height="1027" + inkscape:window-height="1008" id="namedview959" showgrid="false" - inkscape:zoom="23.71875" - inkscape:cx="5.7986639" - inkscape:cy="9.3162873" + inkscape:zoom="16.771689" + inkscape:cx="6.5224393" + inkscape:cy="13.0769" inkscape:window-x="1920" - inkscape:window-y="21" + inkscape:window-y="41" inkscape:window-maximized="0" inkscape:current-layer="svg957" /> - - - - - - - - - + ry="5.7344108" + rx="5.7344108" /> + From 1353071f869548ce3f61e7eeba7c072a1d566bf9 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 10 Jul 2020 15:14:46 +0200 Subject: [PATCH 5/8] optimize icons Signed-off-by: Simon Vieille --- img/answer-date.svg | 78 +++-------------------------------------- img/answer-datetime.svg | 67 ++--------------------------------- img/answer-email.svg | 60 ++----------------------------- 3 files changed, 10 insertions(+), 195 deletions(-) diff --git a/img/answer-date.svg b/img/answer-date.svg index 161303b..354bd02 100644 --- a/img/answer-date.svg +++ b/img/answer-date.svg @@ -1,75 +1,5 @@ - - - - - - image/svg+xml - - - - - - - - - - + + + + diff --git a/img/answer-datetime.svg b/img/answer-datetime.svg index 0842b44..6fd29ab 100644 --- a/img/answer-datetime.svg +++ b/img/answer-datetime.svg @@ -1,65 +1,4 @@ - - - - - - image/svg+xml - - - - - - - - - + + + diff --git a/img/answer-email.svg b/img/answer-email.svg index 06756dc..e046163 100644 --- a/img/answer-email.svg +++ b/img/answer-email.svg @@ -1,59 +1,5 @@ - - - - - - image/svg+xml - - - - - - - - - + + + From 4461b38713c4f842d970487bdcf460ce1149db89 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 16 Jul 2020 15:32:09 +0200 Subject: [PATCH 6/8] refactoring of questions (date, datetime, short) --- src/components/Questions/QuestionDate.vue | 74 ++----------------- src/components/Questions/QuestionDatetime.vue | 74 ++----------------- src/components/Questions/QuestionEmail.vue | 74 ++----------------- src/components/Questions/QuestionShort.vue | 14 +++- 4 files changed, 33 insertions(+), 203 deletions(-) diff --git a/src/components/Questions/QuestionDate.vue b/src/components/Questions/QuestionDate.vue index 51be528..009aebf 100644 --- a/src/components/Questions/QuestionDate.vue +++ b/src/components/Questions/QuestionDate.vue @@ -1,7 +1,7 @@ -
- -
- - - - - diff --git a/src/components/Questions/QuestionDatetime.vue b/src/components/Questions/QuestionDatetime.vue index 04ed091..c0f5a2e 100644 --- a/src/components/Questions/QuestionDatetime.vue +++ b/src/components/Questions/QuestionDatetime.vue @@ -1,7 +1,7 @@ - - - - diff --git a/src/components/Questions/QuestionEmail.vue b/src/components/Questions/QuestionEmail.vue index 2ac0300..b6658e4 100644 --- a/src/components/Questions/QuestionEmail.vue +++ b/src/components/Questions/QuestionEmail.vue @@ -1,7 +1,7 @@ - - - - diff --git a/src/components/Questions/QuestionShort.vue b/src/components/Questions/QuestionShort.vue index 42c2288..468e7ea 100644 --- a/src/components/Questions/QuestionShort.vue +++ b/src/components/Questions/QuestionShort.vue @@ -43,7 +43,7 @@ class="question__input" :maxlength="maxStringLengths.answerText" minlength="1" - type="text" + v-bind:type="type" @input="onInput" @keydown.enter.exact.prevent="onKeydownEnter"> @@ -58,6 +58,12 @@ export default { mixins: [QuestionMixin], + data() { + return { + type: 'text', + } + }, + computed: { submissionInputPlaceholder() { if (this.readOnly) { @@ -72,13 +78,17 @@ export default { const input = this.$refs.input this.$emit('update:values', [input.value]) }, + + getType() { + return 'text' + } }, }