зеркало из https://github.com/nextcloud/forms.git
Lint-Fix
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
Родитель
e2ad812d9d
Коммит
c7f04df887
|
@ -241,7 +241,7 @@ export default {
|
|||
/**
|
||||
* Request to clone a form, store returned form and open it.
|
||||
*
|
||||
* @param {Number} id id of the form to clone
|
||||
* @param {number} id id of the form to clone
|
||||
*/
|
||||
async onCloneForm(id) {
|
||||
try {
|
||||
|
@ -259,7 +259,7 @@ export default {
|
|||
/**
|
||||
* Remove form from forms list after successful server deletion request
|
||||
*
|
||||
* @param {Number} id the form id
|
||||
* @param {number} id the form id
|
||||
*/
|
||||
async onDeleteForm(id) {
|
||||
const formIndex = this.forms.findIndex(form => form.id === id)
|
||||
|
|
|
@ -118,7 +118,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
|
@ -129,7 +130,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Return the form share link
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
formLink() {
|
||||
return window.location.protocol + '//' + window.location.host + generateUrl(`/apps/forms/${this.form.hash}`)
|
||||
|
@ -137,7 +139,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Clipboard v-tooltip message
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
clipboardTooltip() {
|
||||
if (this.copied) {
|
||||
|
@ -152,7 +155,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Route to use, depending on readOnly
|
||||
* @returns {string} Route to 'submit' or 'formRoot'
|
||||
*
|
||||
* @return {string} Route to 'submit' or 'formRoot'
|
||||
*/
|
||||
routerTarget() {
|
||||
if (this.readOnly) {
|
||||
|
|
|
@ -141,8 +141,8 @@ export default {
|
|||
/**
|
||||
* Create an unsynced answer to the server
|
||||
*
|
||||
* @param {Object} answer the answer to sync
|
||||
* @returns {Object} answer
|
||||
* @param {object} answer the answer to sync
|
||||
* @return {object} answer
|
||||
*/
|
||||
async createAnswer(answer) {
|
||||
try {
|
||||
|
@ -170,7 +170,7 @@ export default {
|
|||
* Save to the server, only do it after 500ms
|
||||
* of no change
|
||||
*
|
||||
* @param {Object} answer the answer to sync
|
||||
* @param {object} answer the answer to sync
|
||||
*/
|
||||
async updateAnswer(answer) {
|
||||
try {
|
||||
|
|
|
@ -132,7 +132,8 @@ export default {
|
|||
computed: {
|
||||
/**
|
||||
* Extend text with asterisk if question is required
|
||||
* @returns {Boolean}
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
computedText() {
|
||||
if (this.isRequired) {
|
||||
|
@ -143,7 +144,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Question valid, if text not empty and content valid
|
||||
* @returns {Boolean} true if question valid
|
||||
*
|
||||
* @return {boolean} true if question valid
|
||||
*/
|
||||
questionValid() {
|
||||
return this.text && this.contentValid
|
||||
|
|
|
@ -88,7 +88,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Calculating the format, that moment should use. With or without time.
|
||||
* @returns {String}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
getMomentFormat() {
|
||||
if (this.datetimePickerType === 'datetime') {
|
||||
|
@ -99,7 +100,8 @@ export default {
|
|||
|
||||
/**
|
||||
* All non-exposed props onto datepicker input-element.
|
||||
* @returns {Object}
|
||||
*
|
||||
* @return {object}
|
||||
*/
|
||||
inputAttr() {
|
||||
return {
|
||||
|
@ -112,16 +114,18 @@ export default {
|
|||
/**
|
||||
* DateTimepicker show date-text
|
||||
* Format depends on component-type date/datetime
|
||||
*
|
||||
* @param {Date} date the selected datepicker Date
|
||||
* @returns {String}
|
||||
* @return {string}
|
||||
*/
|
||||
stringify(date) {
|
||||
return moment(date).format(this.getMomentFormat)
|
||||
},
|
||||
/**
|
||||
* Reinterpret the stringified date
|
||||
* @param {String} dateString Stringified date
|
||||
* @returns {Date}
|
||||
*
|
||||
* @param {string} dateString Stringified date
|
||||
* @return {Date}
|
||||
*/
|
||||
parse(dateString) {
|
||||
return moment(dateString, this.getMomentFormat).toDate()
|
||||
|
@ -129,7 +133,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Store Value
|
||||
* @param {String} dateString The parsed string to store
|
||||
*
|
||||
* @param {string} dateString The parsed string to store
|
||||
*/
|
||||
onValueChange(dateString) {
|
||||
this.$emit('update:values', [dateString])
|
||||
|
|
|
@ -172,8 +172,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Is the provided answer checked ?
|
||||
*
|
||||
* @param {number} id the answer id
|
||||
* @returns {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
isChecked(id) {
|
||||
return this.values.indexOf(id) > -1
|
||||
|
@ -181,6 +182,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Update the options
|
||||
*
|
||||
* @param {Array} options options to change
|
||||
*/
|
||||
updateOptions(options) {
|
||||
|
@ -191,7 +193,7 @@ export default {
|
|||
* Update an existing answer locally
|
||||
*
|
||||
* @param {string|number} id the answer id
|
||||
* @param {Object} answer the answer to update
|
||||
* @param {object} answer the answer to update
|
||||
*/
|
||||
updateAnswer(id, answer) {
|
||||
const options = this.options.slice()
|
||||
|
@ -228,7 +230,7 @@ export default {
|
|||
/**
|
||||
* Restore an option locally
|
||||
*
|
||||
* @param {Object} option the option
|
||||
* @param {object} option the option
|
||||
* @param {number} index the options index in this.options
|
||||
*/
|
||||
restoreOption(option, index) {
|
||||
|
@ -274,7 +276,7 @@ export default {
|
|||
* Delete the option from Db in background.
|
||||
* Restore option if delete not possible
|
||||
*
|
||||
* @param {Object} option The option to delete
|
||||
* @param {object} option The option to delete
|
||||
*/
|
||||
deleteOptionFromDatabase(option) {
|
||||
const optionIndex = this.options.findIndex(opt => opt.id === option.id)
|
||||
|
@ -294,7 +296,7 @@ export default {
|
|||
/**
|
||||
* Focus the input matching the index
|
||||
*
|
||||
* @param {Number} index the value index
|
||||
* @param {number} index the value index
|
||||
*/
|
||||
focusIndex(index) {
|
||||
const inputs = this.$refs.input
|
||||
|
|
|
@ -179,8 +179,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Is the provided answer checked ?
|
||||
*
|
||||
* @param {number} id the answer id
|
||||
* @returns {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
isChecked(id) {
|
||||
return this.values.indexOf(id) > -1
|
||||
|
@ -192,8 +193,9 @@ export default {
|
|||
* doesn't allow to require at least ONE checked.
|
||||
* So we require the one that are checked or all
|
||||
* if none are checked yet.
|
||||
*
|
||||
* @param {number} id the answer id
|
||||
* @returns {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
checkRequired(id) {
|
||||
// false, if question not required
|
||||
|
@ -212,6 +214,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Update the options
|
||||
*
|
||||
* @param {Array} options options to change
|
||||
*/
|
||||
updateOptions(options) {
|
||||
|
@ -222,7 +225,7 @@ export default {
|
|||
* Update an existing answer locally
|
||||
*
|
||||
* @param {string|number} id the answer id
|
||||
* @param {Object} answer the answer to update
|
||||
* @param {object} answer the answer to update
|
||||
*/
|
||||
updateAnswer(id, answer) {
|
||||
const options = this.options.slice()
|
||||
|
@ -259,7 +262,7 @@ export default {
|
|||
/**
|
||||
* Restore an option locally
|
||||
*
|
||||
* @param {Object} option the option
|
||||
* @param {object} option the option
|
||||
* @param {number} index the options index in this.options
|
||||
*/
|
||||
restoreOption(option, index) {
|
||||
|
@ -305,7 +308,7 @@ export default {
|
|||
* Delete the option from Db in background.
|
||||
* Restore option if delete not possible
|
||||
*
|
||||
* @param {Object} option The option to delete
|
||||
* @param {object} option The option to delete
|
||||
*/
|
||||
deleteOptionFromDatabase(option) {
|
||||
const optionIndex = this.options.findIndex(opt => opt.id === option.id)
|
||||
|
@ -325,7 +328,7 @@ export default {
|
|||
/**
|
||||
* Focus the input matching the index
|
||||
*
|
||||
* @param {Number} index the value index
|
||||
* @param {number} index the value index
|
||||
*/
|
||||
focusIndex(index) {
|
||||
const inputs = this.$refs.input
|
||||
|
|
|
@ -78,7 +78,8 @@ export default {
|
|||
/**
|
||||
* Join answered Questions with corresponding answers.
|
||||
* Multiple answers to a question are squashed into one string.
|
||||
* @returns {Array}
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
answeredQuestions() {
|
||||
const answeredQuestionsArray = []
|
||||
|
|
|
@ -112,7 +112,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Is the search valid ?
|
||||
* @returns {boolean}
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
isValidQuery() {
|
||||
return this.query && this.query.trim() !== '' && this.query.length > this.minSearchStringLength
|
||||
|
@ -122,7 +123,8 @@ export default {
|
|||
* Multiseelct options. Recommendations by default,
|
||||
* direct search when search query is valid.
|
||||
* Filter out existing shares
|
||||
* @returns {Array}
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
options() {
|
||||
const shares = [...this.userShares, ...this.groupShares]
|
||||
|
@ -156,7 +158,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Add a new share and dispatch the change to the parent
|
||||
* @param {Object} share the new share
|
||||
*
|
||||
* @param {object} share the new share
|
||||
*/
|
||||
addShare(share) {
|
||||
const users = this.userShares.slice()
|
||||
|
@ -282,8 +285,8 @@ export default {
|
|||
/**
|
||||
* Filter out unwated shares
|
||||
*
|
||||
* @param {Object[]} shares the array of shares object
|
||||
* @returns {Object[]}
|
||||
* @param {object[]} shares the array of shares object
|
||||
* @return {object[]}
|
||||
*/
|
||||
filterOutUnwantedShares(shares) {
|
||||
return shares.reduce((arr, share) => {
|
||||
|
@ -311,8 +314,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Format shares for the multiselect options
|
||||
* @param {Object} result select entry item
|
||||
* @returns {Object}
|
||||
*
|
||||
* @param {object} result select entry item
|
||||
* @return {object}
|
||||
*/
|
||||
formatForMultiselect(result) {
|
||||
return {
|
||||
|
@ -329,8 +333,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Get the icon based on the share type
|
||||
*
|
||||
* @param {number} type the share type
|
||||
* @returns {string} the icon class
|
||||
* @return {string} the icon class
|
||||
*/
|
||||
shareTypeToIcon(type) {
|
||||
switch (type) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2018 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
* @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
|
||||
|
@ -18,7 +16,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import { generateFilePath } from '@nextcloud/router'
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @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
|
||||
|
@ -121,7 +119,7 @@ export default {
|
|||
/**
|
||||
* Forward the required change to the parent and store to db
|
||||
*
|
||||
* @param {Boolean} isRequiredValue new isRequired Value
|
||||
* @param {boolean} isRequiredValue new isRequired Value
|
||||
*/
|
||||
onRequiredChange: debounce(function(isRequiredValue) {
|
||||
this.$emit('update:isRequired', isRequiredValue)
|
||||
|
@ -147,7 +145,8 @@ export default {
|
|||
/**
|
||||
* Don't automatically submit form on Enter, parent will handle that
|
||||
* To be called with prevent: @keydown.enter.prevent="onKeydownEnter"
|
||||
* @param {Object} event The fired event
|
||||
*
|
||||
* @param {object} event The fired event
|
||||
*/
|
||||
onKeydownEnter(event) {
|
||||
this.$emit('keydown', event)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2019 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
|
||||
|
@ -17,7 +15,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @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
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @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
|
||||
|
@ -17,7 +15,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
||||
|
@ -27,30 +24,30 @@ import QuestionLong from '../components/Questions/QuestionLong'
|
|||
import QuestionDate from '../components/Questions/QuestionDate'
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnswerTypes
|
||||
* @property {string} multiple
|
||||
* @property {string} multiple_unique
|
||||
* @property {string} dropdown
|
||||
* @property {string} short
|
||||
* @property {string} long
|
||||
* @property {string} date
|
||||
* @property {string} datetime
|
||||
* @typedef {object} AnswerTypes
|
||||
* @property {string} multiple Checkbox Answer
|
||||
* @property {string} multiple_unique Multiple-Choice Answer
|
||||
* @property {string} dropdown Dropdown Answer
|
||||
* @property {string} short Short Text Answer
|
||||
* @property {string} long Long Text Answer
|
||||
* @property {string} date Date Answer
|
||||
* @property {string} datetime Date and Time Answer
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* !! Keep in SYNC with lib/Constants.php for props that are necessary on php !!
|
||||
* Specifying Question-Models in a common place
|
||||
* Further type-specific parameters are possible.
|
||||
* @prop component The vue-component this answer-type relies on
|
||||
* @prop icon The icon corresponding to this answer-type
|
||||
* @prop label The answer-type label, that users will see as answer-type.
|
||||
* @prop SYNC predefined This AnswerType has/needs predefined Options.
|
||||
* @prop validate *optional* Define conditions where this question is not ok
|
||||
*
|
||||
* @prop titlePlaceholder The placeholder users see as empty question-title in edit-mode
|
||||
* @prop createPlaceholder *optional* The placeholder that is visible in edit-mode, to indicate a submission form-input field
|
||||
* @prop submitPlaceholder *optional* The placeholder that is visible in submit-mode, to indicate a form input-field
|
||||
* @prop warningInvalid The warning users see in edit mode, if the question is invalid.
|
||||
* @property {object} component The vue-component this answer-type relies on
|
||||
* @property {string} icon The icon corresponding to this answer-type
|
||||
* @property {string} label The answer-type label, that users will see as answer-type.
|
||||
* @property {boolean} predefined SYNC This AnswerType has/needs predefined Options.
|
||||
* @property {Function} validate *optional* Define conditions where this question is not ok
|
||||
* @property {string} titlePlaceholder The placeholder users see as empty question-title in edit-mode
|
||||
* @property {string} createPlaceholder *optional* The placeholder that is visible in edit-mode, to indicate a submission form-input field
|
||||
* @property {string} submitPlaceholder *optional* The placeholder that is visible in submit-mode, to indicate a form input-field
|
||||
* @property {string} warningInvalid The warning users see in edit mode, if the question is invalid.
|
||||
*/
|
||||
|
||||
multiple: {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
||||
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
* @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
|
||||
|
@ -19,7 +17,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import Vue from 'vue'
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @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
|
||||
|
@ -17,7 +15,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import { translate, translatePlural } from '@nextcloud/l10n'
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2019 Marco Ambrosini <marcoambrosini@pm.me>
|
||||
*
|
||||
* @author Marco Ambrosini <marcoambrosini@pm.me>
|
||||
* @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
|
||||
|
@ -18,7 +16,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
|
@ -26,8 +23,8 @@ import axios from '@nextcloud/axios'
|
|||
/**
|
||||
* Creates a cancelable axios 'request object'.
|
||||
*
|
||||
* @param {function} request the axios promise request
|
||||
* @returns {Object}
|
||||
* @param {Function} request the axios promise request
|
||||
* @return {object}
|
||||
*/
|
||||
const CancelableRequest = function(request) {
|
||||
/**
|
||||
|
@ -40,7 +37,7 @@ const CancelableRequest = function(request) {
|
|||
* Execute the request
|
||||
*
|
||||
* @param {string} url the url to send the request to
|
||||
* @param {Object} [options] optional config for the request
|
||||
* @param {object} [options] optional config for the request
|
||||
*/
|
||||
const fetch = async function(url, options) {
|
||||
return request(
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
/**
|
||||
* @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
|
||||
|
@ -18,7 +16,6 @@
|
|||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
const GenRandomId = (length) => {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2021 Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -23,8 +21,8 @@
|
|||
* Extract actual data from Axios OCS response
|
||||
* Just a small wrapper for nice code.
|
||||
*
|
||||
* @param {Object} response response returned by axios
|
||||
* @returns {Object} The actual data out of the ocs response
|
||||
* @param {object} response response returned by axios
|
||||
* @return {object} The actual data out of the ocs response
|
||||
*/
|
||||
const OcsResponse2Data = function(response) {
|
||||
return response.data.ocs.data
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2020 Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -22,7 +20,7 @@
|
|||
/**
|
||||
* Set the Window-Title to current FormTitle including suffix.
|
||||
*
|
||||
* @param {String} formTitle Title of current form to set on window.
|
||||
* @param {string} formTitle Title of current form to set on window.
|
||||
*/
|
||||
const SetWindowTitle = function(formTitle) {
|
||||
if (formTitle === '') {
|
||||
|
|
|
@ -191,7 +191,8 @@ export default {
|
|||
computed: {
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
|
@ -300,7 +301,7 @@ export default {
|
|||
/**
|
||||
* Delete a question
|
||||
*
|
||||
* @param {Object} question the question to delete
|
||||
* @param {object} question the question to delete
|
||||
* @param {number} question.id the question id to delete
|
||||
*/
|
||||
async deleteQuestion({ id }) {
|
||||
|
@ -369,6 +370,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Select the text in the input if it is still set to 'Form title'
|
||||
*
|
||||
* @param {Event} e the click event
|
||||
*/
|
||||
selectIfUnchanged(e) {
|
||||
|
|
|
@ -178,7 +178,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
|
@ -189,7 +190,8 @@ export default {
|
|||
|
||||
/**
|
||||
* Generate the export to csv url
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
downloadUrl() {
|
||||
return generateOcsUrl('apps/forms/api/v1.1/submissions/export/{hash}', { hash: this.form.hash })
|
||||
|
@ -240,7 +242,7 @@ export default {
|
|||
async onStoreToFiles() {
|
||||
// picker.pick() does not reject Promise -> await would never resolve.
|
||||
picker.pick()
|
||||
.then(async(path) => {
|
||||
.then(async (path) => {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v1.1/submissions/export'), {
|
||||
hash: this.form.hash,
|
||||
|
|
|
@ -242,6 +242,7 @@ export default {
|
|||
|
||||
/**
|
||||
* On date picker change
|
||||
*
|
||||
* @param {Date} datetime the expiration Date
|
||||
*/
|
||||
onExpiresChange(datetime) {
|
||||
|
@ -251,8 +252,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Datepicker timestamp to string
|
||||
*
|
||||
* @param {Date} datetime the datepicker Date
|
||||
* @returns {string}
|
||||
* @return {string}
|
||||
*/
|
||||
stringify(datetime) {
|
||||
const date = moment(datetime).format('LLL')
|
||||
|
@ -265,8 +267,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Form expires timestamp to Date form the datepicker
|
||||
*
|
||||
* @param {number} value the expires timestamp
|
||||
* @returns {Date}
|
||||
* @return {Date}
|
||||
*/
|
||||
parse(value) {
|
||||
return moment(value, 'X').toDate()
|
||||
|
@ -274,8 +277,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Prevent selecting a day before today
|
||||
*
|
||||
* @param {Date} datetime the datepicker Date
|
||||
* @returns {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
notBeforeToday(datetime) {
|
||||
return datetime < moment().add(-1, 'day').toDate()
|
||||
|
@ -283,8 +287,9 @@ export default {
|
|||
|
||||
/**
|
||||
* Prevent selecting a time before the current one + 1hour
|
||||
*
|
||||
* @param {Date} datetime the datepicker Date
|
||||
* @returns {boolean}
|
||||
* @return {boolean}
|
||||
*/
|
||||
notBeforeNow(datetime) {
|
||||
return datetime < moment().add(1, 'hour').toDate()
|
||||
|
|
|
@ -128,7 +128,8 @@ export default {
|
|||
computed: {
|
||||
/**
|
||||
* Return form title, or placeholder if not set
|
||||
* @returns {string}
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
formTitle() {
|
||||
if (this.form.title) {
|
||||
|
@ -200,7 +201,8 @@ export default {
|
|||
/**
|
||||
* On Enter, focus next form-element
|
||||
* Last form element is the submit button, the form submits on enter then
|
||||
* @param {Object} event The fired event.
|
||||
*
|
||||
* @param {object} event The fired event.
|
||||
*/
|
||||
onKeydownEnter(event) {
|
||||
const formInputs = Array.from(this.$refs.form)
|
||||
|
|
Загрузка…
Ссылка в новой задаче