From 7462be7bfedc8a2d55cdd5ad5a2fa36dfc8dc121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 28 Apr 2020 10:50:44 +0200 Subject: [PATCH] Initial load and display of public form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- .eslintrc.js | 3 + js/submit.js | 9516 ----------------- lib/Controller/PageController.php | 50 +- package-lock.json | 8 + package.json | 1 + src/components/Questions/Question.vue | 17 +- src/components/Questions/QuestionLong.vue | 2 +- src/components/Questions/QuestionMultiple.vue | 20 +- src/components/Questions/QuestionShort.vue | 2 +- src/models/AnswerTypes.js | 4 + src/views/Create.vue | 2 +- src/views/Submit.vue | 134 +- webpack.common.js | 4 +- 13 files changed, 227 insertions(+), 9536 deletions(-) delete mode 100644 js/submit.js diff --git a/.eslintrc.js b/.eslintrc.js index 2f845f6..4a44f68 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,7 @@ module.exports = { + globals: { + appName: true, + }, extends: [ '@nextcloud', ] diff --git a/js/submit.js b/js/submit.js deleted file mode 100644 index a8e4fe6..0000000 --- a/js/submit.js +++ /dev/null @@ -1,9516 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/js/"; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./src/submit.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./node_modules/@nextcloud/l10n/dist/index.js": -/*!****************************************************!*\ - !*** ./node_modules/@nextcloud/l10n/dist/index.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getLocale = getLocale; -exports.getLanguage = getLanguage; -exports.translate = translate; -exports.translatePlural = translatePlural; -exports.getFirstDay = getFirstDay; -exports.getDayNames = getDayNames; -exports.getDayNamesShort = getDayNamesShort; -exports.getDayNamesMin = getDayNamesMin; -exports.getMonthNames = getMonthNames; -exports.getMonthNamesShort = getMonthNamesShort; - -/// - -/** - * Returns the user's locale - */ -function getLocale() { - if (typeof OC === 'undefined') { - console.warn('No OC found'); - return 'en'; - } - - return OC.getLocale(); -} -/** - * Returns the user's language - */ - - -function getLanguage() { - if (typeof OC === 'undefined') { - console.warn('No OC found'); - return 'en'; - } - - return OC.getLanguage(); -} - -/** - * Translate a string - * - * @param {string} app the id of the app for which to translate the string - * @param {string} text the string to translate - * @param {object} vars map of placeholder key to value - * @param {number} number to replace %n with - * @param {object} [options] options object - * @return {string} - */ -function translate(app, text, vars, count, options) { - if (typeof OC === 'undefined') { - console.warn('No OC found'); - return text; - } - - return OC.L10N.translate(app, text, vars, count, options); -} -/** - * Translate a plural string - * - * @param {string} app the id of the app for which to translate the string - * @param {string} textSingular the string to translate for exactly one object - * @param {string} textPlural the string to translate for n objects - * @param {number} count number to determine whether to use singular or plural - * @param {Object} vars of placeholder key to value - * @param {object} options options object - * @return {string} - */ - - -function translatePlural(app, textSingular, textPlural, count, vars, options) { - if (typeof OC === 'undefined') { - console.warn('No OC found'); - return textSingular; - } - - return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options); -} -/** - * Get the first day of the week - * - * @return {number} - */ - - -function getFirstDay() { - if (typeof window.firstDay === 'undefined') { - console.warn('No firstDay found'); - return 1; - } - - return window.firstDay; -} -/** - * Get a list of day names (full names) - * - * @return {string[]} - */ - - -function getDayNames() { - if (typeof window.dayNames === 'undefined') { - console.warn('No dayNames found'); - return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; - } - - return window.dayNames; -} -/** - * Get a list of day names (short names) - * - * @return {string[]} - */ - - -function getDayNamesShort() { - if (typeof window.dayNamesShort === 'undefined') { - console.warn('No dayNamesShort found'); - return ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.']; - } - - return window.dayNamesShort; -} -/** - * Get a list of day names (minified names) - * - * @return {string[]} - */ - - -function getDayNamesMin() { - if (typeof window.dayNamesMin === 'undefined') { - console.warn('No dayNamesMin found'); - return ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']; - } - - return window.dayNamesMin; -} -/** - * Get a list of month names (full names) - * - * @return {string[]} - */ - - -function getMonthNames() { - if (typeof window.monthNames === 'undefined') { - console.warn('No monthNames found'); - return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; - } - - return window.monthNames; -} -/** - * Get a list of month names (short names) - * - * @return {string[]} - */ - - -function getMonthNamesShort() { - if (typeof window.monthNamesShort === 'undefined') { - console.warn('No monthNamesShort found'); - return ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']; - } - - return window.monthNamesShort; -} -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./src/views/Submit.vue?vue&type=script&lang=js&": -/*!*****************************************************************************************************************************************!*\ - !*** ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Submit.vue?vue&type=script&lang=js& ***! - \*****************************************************************************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -/* harmony default export */ __webpack_exports__["default"] = ({ - name: 'Submit' -}); - -/***/ }), - -/***/ "./node_modules/process/browser.js": -/*!*****************************************!*\ - !*** ./node_modules/process/browser.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), - -/***/ "./node_modules/setimmediate/setImmediate.js": -/*!***************************************************!*\ - !*** ./node_modules/setimmediate/setImmediate.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { - "use strict"; - - if (global.setImmediate) { - return; - } - - var nextHandle = 1; // Spec says greater than zero - var tasksByHandle = {}; - var currentlyRunningATask = false; - var doc = global.document; - var registerImmediate; - - function setImmediate(callback) { - // Callback can either be a function or a string - if (typeof callback !== "function") { - callback = new Function("" + callback); - } - // Copy function arguments - var args = new Array(arguments.length - 1); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i + 1]; - } - // Store and register the task - var task = { callback: callback, args: args }; - tasksByHandle[nextHandle] = task; - registerImmediate(nextHandle); - return nextHandle++; - } - - function clearImmediate(handle) { - delete tasksByHandle[handle]; - } - - function run(task) { - var callback = task.callback; - var args = task.args; - switch (args.length) { - case 0: - callback(); - break; - case 1: - callback(args[0]); - break; - case 2: - callback(args[0], args[1]); - break; - case 3: - callback(args[0], args[1], args[2]); - break; - default: - callback.apply(undefined, args); - break; - } - } - - function runIfPresent(handle) { - // From the spec: "Wait until any invocations of this algorithm started before this one have completed." - // So if we're currently running a task, we'll need to delay this invocation. - if (currentlyRunningATask) { - // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a - // "too much recursion" error. - setTimeout(runIfPresent, 0, handle); - } else { - var task = tasksByHandle[handle]; - if (task) { - currentlyRunningATask = true; - try { - run(task); - } finally { - clearImmediate(handle); - currentlyRunningATask = false; - } - } - } - } - - function installNextTickImplementation() { - registerImmediate = function(handle) { - process.nextTick(function () { runIfPresent(handle); }); - }; - } - - function canUsePostMessage() { - // The test against `importScripts` prevents this implementation from being installed inside a web worker, - // where `global.postMessage` means something completely different and can't be used for this purpose. - if (global.postMessage && !global.importScripts) { - var postMessageIsAsynchronous = true; - var oldOnMessage = global.onmessage; - global.onmessage = function() { - postMessageIsAsynchronous = false; - }; - global.postMessage("", "*"); - global.onmessage = oldOnMessage; - return postMessageIsAsynchronous; - } - } - - function installPostMessageImplementation() { - // Installs an event handler on `global` for the `message` event: see - // * https://developer.mozilla.org/en/DOM/window.postMessage - // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages - - var messagePrefix = "setImmediate$" + Math.random() + "$"; - var onGlobalMessage = function(event) { - if (event.source === global && - typeof event.data === "string" && - event.data.indexOf(messagePrefix) === 0) { - runIfPresent(+event.data.slice(messagePrefix.length)); - } - }; - - if (global.addEventListener) { - global.addEventListener("message", onGlobalMessage, false); - } else { - global.attachEvent("onmessage", onGlobalMessage); - } - - registerImmediate = function(handle) { - global.postMessage(messagePrefix + handle, "*"); - }; - } - - function installMessageChannelImplementation() { - var channel = new MessageChannel(); - channel.port1.onmessage = function(event) { - var handle = event.data; - runIfPresent(handle); - }; - - registerImmediate = function(handle) { - channel.port2.postMessage(handle); - }; - } - - function installReadyStateChangeImplementation() { - var html = doc.documentElement; - registerImmediate = function(handle) { - // Create a - diff --git a/src/components/Questions/QuestionShort.vue b/src/components/Questions/QuestionShort.vue index 100b872..e52e7c3 100644 --- a/src/components/Questions/QuestionShort.vue +++ b/src/components/Questions/QuestionShort.vue @@ -32,7 +32,7 @@ question.options.length > 0, }, multiple: { component: QuestionMultiple, icon: 'icon-answer-checkbox', label: t('forms', 'Checkboxes'), + // Define conditions where this questions is not ok + validate: question => question.options.length > 0, }, short: { diff --git a/src/views/Create.vue b/src/views/Create.vue index 12d6524..807e931 100644 --- a/src/views/Create.vue +++ b/src/views/Create.vue @@ -392,7 +392,7 @@ export default { font-size: 2em; font-weight: bold; padding-left: 14px; // align with description (compensate font size diff) - overflow-x: hidden; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } diff --git a/src/views/Submit.vue b/src/views/Submit.vue index 1e3dc9d..5edfa10 100644 --- a/src/views/Submit.vue +++ b/src/views/Submit.vue @@ -21,11 +21,143 @@ --> + diff --git a/webpack.common.js b/webpack.common.js index 7c70b11..a828262 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -4,8 +4,8 @@ const webpack = require('webpack') const StyleLintPlugin = require('stylelint-webpack-plugin') const VueLoaderPlugin = require('vue-loader/lib/plugin') -const appName = process.env.npm_package_name -const appVersion = process.env.npm_package_version +const appName = process.env.npm_package_name.toString() +const appVersion = process.env.npm_package_version.toString() console.info('Building', appName, appVersion, '\n') module.exports = {