add tel question type

Signed-off-by: Simon Vieille <simon@deblan.fr>
This commit is contained in:
Simon Vieille 2020-07-16 15:33:24 +02:00
parent 1f6328a973
commit d2deda44f2
5 changed files with 54 additions and 0 deletions

View file

@ -32,6 +32,7 @@
@include icon-black-white('answer-date', 'forms', 1);
@include icon-black-white('answer-datetime', 'forms', 1);
@include icon-black-white('answer-email', 'forms', 1);
@include icon-black-white('answer-tel', 'forms', 1);
@include icon-black-white('drag-handle', 'forms', 1);
.icon-yes {

3
img/answer-tel.svg Normal file
View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path d="M6.225 1.345c-1.479 0-2.218 0-2.218 1.72v9.87c0 1.72.74 1.72 2.218 1.72h3.55c1.479 0 2.218 0 2.218-1.72v-9.87c0-1.72-.74-1.72-2.218-1.72zm-1.33 1.331h6.21v9.317h-6.21zM8 12.584a.74.74 0 0 1 .74.74.74.74 0 0 1-.74.74.74.74 0 0 1-.74-.74.74.74 0 0 1 .74-.74z"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

View file

@ -57,6 +57,7 @@ class Question extends Entity {
'date',
'datetime',
'email',
'tel',
];
public function __construct() {

View file

@ -0,0 +1,37 @@
<!--
- @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/>.
-
-->
<script>
import QuestionShort from './QuestionShort'
export default {
name: 'QuestionTel',
mixins: [QuestionShort],
data() {
return {
type: 'tel',
}
},
}
</script>

View file

@ -27,6 +27,7 @@ import QuestionLong from '../components/Questions/QuestionLong'
import QuestionDate from '../components/Questions/QuestionDate'
import QuestionDatetime from '../components/Questions/QuestionDatetime'
import QuestionEmail from '../components/Questions/QuestionEmail'
import QuestionTel from '../components/Questions/QuestionTel'
/**
* @typedef {Object} AnswerTypes
@ -140,4 +141,15 @@ export default {
submitPlaceholder: t('forms', 'Enter an email'),
warningInvalid: t('forms', 'This question needs a title!'),
},
tel: {
component: QuestionTel,
icon: 'icon-answer-tel',
label: t('forms', 'Phone number'),
titlePlaceholder: t('forms', 'Phone number question title'),
createPlaceholder: t('forms', ''),
submitPlaceholder: t('forms', 'Enter a phone number'),
warningInvalid: t('forms', 'This question needs a title!'),
},
}