diff --git a/js/dist/admin.js b/js/dist/admin.js index 8881cba0..3dd24ef2 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,163 @@ -(()=>{var s={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return s.d(e,{a:e}),e},d:(o,e)=>{for(var t in e)s.o(e,t)&&!s.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},o={};(()=>{"use strict";s.r(o);const e=flarum.core.compat["admin/app"];var t=s.n(e);t().initializers.add("fof/polls",(function(){t().extensionData.for("fof-polls").registerSetting({setting:"fof-polls.allowOptionImage",type:"switch",label:t().translator.trans("fof-polls.admin.settings.allow_option_image")}).registerSetting({setting:"fof-polls.optionsColorBlend",type:"switch",label:t().translator.trans("fof-polls.admin.settings.options_color_blend"),help:t().translator.trans("fof-polls.admin.settings.options_color_blend_help")}).registerSetting({setting:"fof-polls.maxOptions",type:"number",label:t().translator.trans("fof-polls.admin.settings.max_options"),min:2}).registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.view_results_without_voting"),permission:"discussion.polls.viewResultsWithoutVoting",allowGuest:!0},"view").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.start"),permission:"discussion.polls.start"},"start").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.self_edit"),permission:"polls.selfEdit"},"start").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.self_post_edit"),permission:"polls.selfPostEdit"},"start").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.vote"),permission:"discussion.polls.vote"},"reply").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.change_vote"),permission:"polls.changeVote"},"reply").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.moderate"),permission:"discussion.polls.moderate"},"moderate")}))})(),module.exports=o})(); +/******/ (() => { // webpackBootstrap +/******/ // runtime can't be in strict mode because a global variable is assign and maybe created. +/******/ var __webpack_modules__ = ({ + +/***/ "./src/admin/index.ts": +/*!****************************!*\ + !*** ./src/admin/index.ts ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var flarum_admin_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/admin/app */ "flarum/admin/app"); +/* harmony import */ var flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_admin_app__WEBPACK_IMPORTED_MODULE_0__); + +flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('fof/polls', function () { + flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().extensionData["for"]('fof-polls').registerSetting({ + setting: 'fof-polls.allowOptionImage', + type: 'switch', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.settings.allow_option_image') + }).registerSetting({ + setting: 'fof-polls.optionsColorBlend', + type: 'switch', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.settings.options_color_blend'), + help: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.settings.options_color_blend_help') + }).registerSetting({ + setting: 'fof-polls.maxOptions', + type: 'number', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.settings.max_options'), + min: 2 + }).registerPermission({ + icon: 'fas fa-signal', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.view_results_without_voting'), + permission: 'discussion.polls.viewResultsWithoutVoting', + allowGuest: true + }, 'view').registerPermission({ + icon: 'fas fa-signal', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.start'), + permission: 'discussion.polls.start' + }, 'start').registerPermission({ + icon: 'fas fa-signal', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.start_global'), + permission: 'startGlobalPoll' + }, 'start').registerPermission({ + icon: 'fas fa-pencil-alt', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.self_edit'), + permission: 'polls.selfEdit' + }, 'start').registerPermission({ + icon: 'fas fa-pencil-alt', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.self_post_edit'), + permission: 'polls.selfPostEdit' + }, 'start').registerPermission({ + icon: 'fas fa-signal', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.vote'), + permission: 'discussion.polls.vote' + }, 'reply').registerPermission({ + icon: 'fas fa-signal', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.change_vote'), + permission: 'polls.changeVote' + }, 'reply').registerPermission({ + icon: 'fas fa-pencil-alt', + label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.admin.permissions.moderate'), + permission: 'discussion.polls.moderate' + }, 'moderate'); +}); + +/***/ }), + +/***/ "flarum/admin/app": +/*!**************************************************!*\ + !*** external "flarum.core.compat['admin/app']" ***! + \**************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['admin/app']; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!******************!*\ + !*** ./admin.ts ***! + \******************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _src_admin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/admin */ "./src/admin/index.ts"); + +})(); + +module.exports = __webpack_exports__; +/******/ })() +; //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index ed33b1bb..5d66d3c9 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAiBC,IAAI,aAAa,WAChCD,IAAAA,cAAiB,IACV,aACJE,gBAAgB,CACfC,QAAS,6BACTC,KAAM,SACNC,MAAOL,IAAAA,WAAeM,MAAM,iDAE7BJ,gBAAgB,CACfC,QAAS,8BACTC,KAAM,SACNC,MAAOL,IAAAA,WAAeM,MAAM,gDAC5BC,KAAMP,IAAAA,WAAeM,MAAM,uDAE5BJ,gBAAgB,CACfC,QAAS,uBACTC,KAAM,SACNC,MAAOL,IAAAA,WAAeM,MAAM,wCAC5BE,IAAK,IAENC,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,2DAC5BK,WAAY,4CACZC,YAAY,GAEd,QAEDH,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,qCAC5BK,WAAY,0BAEd,SAEDF,mBACC,CACEC,KAAM,oBACNL,MAAOL,IAAAA,WAAeM,MAAM,yCAC5BK,WAAY,kBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNL,MAAOL,IAAAA,WAAeM,MAAM,8CAC5BK,WAAY,sBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,oCAC5BK,WAAY,yBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,2CAC5BK,WAAY,oBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNL,MAAOL,IAAAA,WAAeM,MAAM,wCAC5BK,WAAY,6BAEd,WAEN,G","sources":["webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object","webpack://@fof/polls/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/polls/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('fof/polls', () => {\n app.extensionData\n .for('fof-polls')\n .registerSetting({\n setting: 'fof-polls.allowOptionImage',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.allow_option_image'),\n })\n .registerSetting({\n setting: 'fof-polls.optionsColorBlend',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.options_color_blend'),\n help: app.translator.trans('fof-polls.admin.settings.options_color_blend_help'),\n })\n .registerSetting({\n setting: 'fof-polls.maxOptions',\n type: 'number',\n label: app.translator.trans('fof-polls.admin.settings.max_options'),\n min: 2,\n })\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.view_results_without_voting'),\n permission: 'discussion.polls.viewResultsWithoutVoting',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.start'),\n permission: 'discussion.polls.start',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_edit'),\n permission: 'polls.selfEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_post_edit'),\n permission: 'polls.selfPostEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.vote'),\n permission: 'discussion.polls.vote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.change_vote'),\n permission: 'polls.changeVote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.moderate'),\n permission: 'discussion.polls.moderate',\n },\n 'moderate'\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","add","registerSetting","setting","type","label","trans","help","min","registerPermission","icon","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":";;;;;;;;;;;;;;AAAmC;AAEnCA,oEAAgB,CAACE,GAAG,CAAC,WAAW,EAAE,YAAM;EACtCF,qEAAiB,OACX,CAAC,WAAW,CAAC,CAChBI,eAAe,CAAC;IACfC,OAAO,EAAE,4BAA4B;IACrCC,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAEP,kEAAc,CAACS,KAAK,CAAC,6CAA6C;EAC3E,CAAC,CAAC,CACDL,eAAe,CAAC;IACfC,OAAO,EAAE,6BAA6B;IACtCC,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAEP,kEAAc,CAACS,KAAK,CAAC,8CAA8C,CAAC;IAC3EC,IAAI,EAAEV,kEAAc,CAACS,KAAK,CAAC,mDAAmD;EAChF,CAAC,CAAC,CACDL,eAAe,CAAC;IACfC,OAAO,EAAE,sBAAsB;IAC/BC,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAEP,kEAAc,CAACS,KAAK,CAAC,sCAAsC,CAAC;IACnEE,GAAG,EAAE;EACP,CAAC,CAAC,CACDC,kBAAkB,CACjB;IACEC,IAAI,EAAE,eAAe;IACrBN,KAAK,EAAEP,kEAAc,CAACS,KAAK,CAAC,yDAAyD,CAAC;IACtFK,UAAU,EAAE,2CAA2C;IACvDC,UAAU,EAAE;EACd,CAAC,EACD,MACF,CAAC,CACAH,kBAAkB,CACjB;IACEC,IAAI,EAAE,eAAe;IACrBN,KAAK,EAAEP,kEAAc,CAACS,KAAK,CAAC,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;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@fof/polls/./src/admin/index.ts","webpack://@fof/polls/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object","webpack://@fof/polls/./admin.ts"],"sourcesContent":["import app from 'flarum/admin/app';\n\napp.initializers.add('fof/polls', () => {\n app.extensionData\n .for('fof-polls')\n .registerSetting({\n setting: 'fof-polls.allowOptionImage',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.allow_option_image'),\n })\n .registerSetting({\n setting: 'fof-polls.optionsColorBlend',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.options_color_blend'),\n help: app.translator.trans('fof-polls.admin.settings.options_color_blend_help'),\n })\n .registerSetting({\n setting: 'fof-polls.maxOptions',\n type: 'number',\n label: app.translator.trans('fof-polls.admin.settings.max_options'),\n min: 2,\n })\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.view_results_without_voting'),\n permission: 'discussion.polls.viewResultsWithoutVoting',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.start'),\n permission: 'discussion.polls.start',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.start_global'),\n permission: 'startGlobalPoll',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_edit'),\n permission: 'polls.selfEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_post_edit'),\n permission: 'polls.selfPostEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.vote'),\n permission: 'discussion.polls.vote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.change_vote'),\n permission: 'polls.changeVote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.moderate'),\n permission: 'discussion.polls.moderate',\n },\n 'moderate'\n );\n});\n","module.exports = flarum.core.compat['admin/app'];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './src/admin';\n"],"names":["app","initializers","add","extensionData","registerSetting","setting","type","label","translator","trans","help","min","registerPermission","icon","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 3542e39f..cddc958f 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2902 @@ -(()=>{var t={n:o=>{var n=o&&o.__esModule?()=>o.default:()=>o;return t.d(n,{a:n}),n},d:(o,n)=>{for(var e in n)t.o(n,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:n[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{components:()=>it,extend:()=>wt,models:()=>dt});const n=flarum.core.compat["forum/app"];var e=t.n(n);const a=flarum.core.compat["common/extend"],l=flarum.core.compat["common/components/Badge"];var s=t.n(l);const i=flarum.core.compat["forum/components/DiscussionList"];var r=t.n(i);const p=flarum.core.compat["common/models/Discussion"];var u=t.n(p);const c=flarum.core.compat["common/utils/classList"];var d=t.n(c);const h=flarum.core.compat["forum/components/DiscussionComposer"];var f=t.n(h);const v=flarum.core.compat["forum/components/ReplyComposer"];var b=t.n(v);function g(t,o){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},g(t,o)}function y(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,g(t,o)}const w=flarum.core.compat["common/components/Button"];var V=t.n(w);const P=flarum.core.compat["common/components/Modal"];var x=t.n(P);const N=flarum.core.compat["common/components/Switch"];var M=t.n(N);const O=flarum.core.compat["common/utils/ItemList"];var C=t.n(O);const _=flarum.core.compat["common/utils/Stream"];var D=t.n(_);const I=flarum.core.compat["common/utils/extractText"];var S=t.n(I),k=function(t){function o(){return t.apply(this,arguments)||this}y(o,t);var n=o.prototype;return n.oninit=function(o){var n=this;t.prototype.oninit.call(this,o),this.options=[D()(""),D()("")],this.optionImageUrls=[D()(""),D()("")],this.question=D()(""),this.endDate=D()(),this.publicPoll=D()(!1),this.hideVotes=D()(!1),this.allowChangeVote=D()(!0),this.allowMultipleVotes=D()(!1),this.maxVotes=D()(0),this.datepickerMinDate=this.formatDate(void 0);var e=this.attrs.poll;e&&Array.isArray(e.options)&&(this.options=[],this.optionImageUrls=[],e.options.forEach((function(t){n.options.push(D()(t.answer)),n.optionImageUrls.push(D()(t.imageUrl))})),this.question(e.question),this.publicPoll(e.publicPoll),this.hideVotes(e.hideVotes),this.allowChangeVote(e.allowChangeVote),this.allowMultipleVotes(e.allowMultipleVotes),this.maxVotes(e.maxVotes||0),this.endDate(this.formatDate(e.endDate)),this.endDate()&&dayjs(e.endDate).isAfter(dayjs())&&(this.datepickerMinDate=this.formatDate(e.endDate)))},n.title=function(){return e().translator.trans("fof-polls.forum.modal.add_title")},n.className=function(){return"PollDiscussionModal Modal--medium"},n.content=function(){return[m("div",{className:"Modal-body"},m("div",{className:"PollDiscussionModal-form"},this.fields().toArray()))]},n.fields=function(){var t=new(C());return t.add("question",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.question_placeholder")),m("input",{type:"text",name:"question",className:"FormControl",bidi:this.question})),100),t.add("answers",m("div",{className:"PollModal--answers Form-group"},m("label",{className:"label PollModal--answers-title"},m("span",null,e().translator.trans("fof-polls.forum.modal.options_label")),V().component({className:"Button PollModal--button small",icon:"fas fa-plus",onclick:this.addOption.bind(this)})),this.displayOptions()),80),t.add("date",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.date_placeholder")),m("div",{className:"PollModal--date"},m("input",{className:"FormControl",type:"datetime-local",name:"date",bidi:this.endDate,min:this.datepickerMinDate,max:this.formatDate("2038")}),V().component({className:"Button PollModal--button",icon:"fas fa-times",onclick:this.endDate.bind(this,null)})),this.endDate()&&m("p",{className:"helpText"},m("i",{class:"icon fas fa-clock"})," ",dayjs(this.endDate()).isBefore(dayjs())?e().translator.trans("fof-polls.forum.poll_ended"):e().translator.trans("fof-polls.forum.days_remaining",{time:dayjs(this.endDate()).fromNow()}))),40),t.add("public",m("div",{className:"Form-group"},M().component({state:this.publicPoll()||!1,onchange:this.publicPoll},e().translator.trans("fof-polls.forum.modal.public_poll_label"))),20),t.add("hide-votes",m("div",{className:"Form-group"},m(M(),{state:this.endDate()&&this.hideVotes(),onchange:this.hideVotes,disabled:!this.endDate()},e().translator.trans("fof-polls.forum.modal.hide_votes_label"))),20),t.add("allow-change-vote",m("div",{className:"Form-group"},m(M(),{state:this.allowChangeVote(),onchange:this.allowChangeVote},e().translator.trans("fof-polls.forum.modal.allow_change_vote_label"))),20),t.add("allow-multiple-votes",m("div",{className:"Form-group"},M().component({state:this.allowMultipleVotes()||!1,onchange:this.allowMultipleVotes},e().translator.trans("fof-polls.forum.modal.allow_multiple_votes_label"))),15),this.allowMultipleVotes()&&t.add("max-votes",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.max_votes_label")),m("input",{type:"number",min:"0",max:this.options.length,name:"maxVotes",className:"FormControl",bidi:this.maxVotes}),m("p",{className:"helpText"},e().translator.trans("fof-polls.forum.modal.max_votes_help"))),15),t.add("submit",m("div",{className:"Form-group"},V().component({type:"submit",className:"Button Button--primary PollModal-SubmitButton",loading:this.loading},e().translator.trans("fof-polls.forum.modal.submit"))),-10),t},n.displayOptions=function(){var t=this;return Object.keys(this.options).map((function(o,n){return m("div",{className:"Form-group"},m("fieldset",{className:"Poll-answer-input"},m("input",{className:"FormControl",type:"text",name:"answer"+(n+1),bidi:t.options[n],placeholder:e().translator.trans("fof-polls.forum.modal.option_placeholder")+" #"+(n+1)}),e().forum.attribute("allowPollOptionImage")?m("input",{className:"FormControl",type:"text",name:"answerImage"+(n+1),bidi:t.optionImageUrls[n],placeholder:e().translator.trans("fof-polls.forum.modal.image_option_placeholder")+" #"+(n+1)}):null),n>=2?V().component({type:"button",className:"Button Button--warning PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length=2?V().component({type:"button",className:"Button PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length0;return!e().session.user||a.canVote()||a.hasEnded()||n.add("no-permission",m("span",null,m("i",{className:"icon fas fa-times-circle fa-fw"}),e().translator.trans("fof-polls.forum.no_permission"))),a.endDate()&&n.add("end-date",m("span",null,m("i",{class:"icon fas fa-clock fa-fw"}),a.hasEnded()?e().translator.trans("fof-polls.forum.poll_ended"):e().translator.trans("fof-polls.forum.days_remaining",{time:dayjs(a.endDate()).fromNow()}))),a.canVote()&&(n.add("max-votes",m("span",null,m("i",{className:"icon fas fa-poll fa-fw"}),e().translator.trans("fof-polls.forum.max_votes_allowed",{max:t}))),a.canChangeVote()||n.add("cannot-change-vote",m("span",null,m("i",{className:"icon fas fa-"+(l?"times":"exclamation")+"-circle fa-fw"}),e().translator.trans("fof-polls.forum.poll.cannot_change_vote")))),n},n.viewOption=function(t){var o,n,a,l=this.attrs.poll,s=(null==(o=l.myVotes())?void 0:o.length)>0,i=l.voteCount(),r=this.pendingOptions?this.pendingOptions.has(t.id()):null==(n=l.myVotes())||null==n.some?void 0:n.some((function(o){return o.option()===t})),p=t.voteCount(),u=i>0?Math.round(p/i*100):0,c="number"==typeof p,h=this.loadingOptions||s&&!l.canChangeVote(),f=c?u:Number(r)/((null==(a=l.myVotes())?void 0:a.length)||1)*100,v=!e().session.user||!l.hasEnded()&&l.canVote()&&(!s||l.canChangeVote()),b=m("div",{className:"PollBar","data-selected":!!r,style:"--poll-option-width: "+f+"%"},v&&m("label",{className:"PollAnswer-checkbox checkbox"},m("input",{onchange:this.changeVote.bind(this,t),type:"checkbox",checked:r,disabled:h}),m("span",{className:"checkmark"})),m("div",{className:"PollAnswer-text"},m("span",{className:"PollAnswer-text-answer"},t.answer()),r&&!v&&X()("fas fa-check-circle",{className:"PollAnswer-check"}),c&&m("span",{className:d()("PollPercent",100!==u&&"PollPercent--option")},u,"%")),t.imageUrl()?m("img",{className:"PollAnswer-image",src:t.imageUrl(),alt:t.answer()}):null);return m("div",{className:d()("PollOption",s&&"PollVoted",l.hasEnded()&&"PollEnded",t.imageUrl()&&"PollOption-hasImage"),"data-id":t.id()},c?m(Q(),{text:e().translator.trans("fof-polls.forum.tooltip.votes",{count:p}),onremove:this.hideOptionTooltip},b):b)},n.changeVote=function(t,o){var n,a;if(!e().session.user)return e().modal.show(F()),void(o.target.checked=!1);var l=this.pendingOptions||new Set(null==(n=(a=this.attrs.poll.myVotes()).map)?void 0:n.call(a,(function(t){return t.option().id()}))),s=l.delete(t.id());return this.attrs.poll.allowMultipleVotes()||l.clear(),s||l.add(t.id()),this.useSubmitUI?(this.pendingOptions=l.size?l:null,void(this.pendingSubmit=!!this.pendingOptions)):this.submit(l,null,(function(){return o.target.checked=s}))},n.onsubmit=function(){var t=this;return this.submit(this.pendingOptions,(function(){t.pendingOptions=null,t.pendingSubmit=!1}))},n.submit=function(t,o,n){var a=this;return this.loadingOptions=!0,m.redraw(),e().request({method:"PATCH",url:e().forum.attribute("apiUrl")+"/fof/polls/"+this.attrs.poll.id()+"/votes",body:{data:{optionIds:Array.from(t)}}}).then((function(t){e().store.pushPayload(t),null==o||o()})).catch((function(t){null==n||n(t)})).finally((function(){a.loadingOptions=!1,m.redraw()}))},n.showVoters=function(){e().modal.show(G,{poll:this.attrs.poll,post:this.attrs.post})},n.deletePoll=function(){confirm(e().translator.trans("fof-polls.forum.moderation.delete_confirm"))&&this.attrs.poll.delete().then((function(){m.redraw.sync()}))},n.hideOptionTooltip=function(t){t.attrs.tooltipVisible=!1,t.state.updateVisibility()},n.preventClose=function(t){if(this.pendingOptions)return t.preventDefault(),!0},o}(B());const ot=flarum.core.compat["forum/components/DiscussionPage"];var nt=t.n(ot);function et(t,o){(null==o||o>t.length)&&(o=t.length);for(var n=0,e=new Array(o);n=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(o.polls());!(n=e()).done;){var a=n.value;a&&t.push(m(tt,{post:o,poll:a}))}})),(0,a.extend)(j().prototype,"oninit",(function(){var t=this;this.subtree.check((function(){var o=t.attrs.post.polls(),n=null==o||null==o.map?void 0:o.map((function(t){var o,n,e,a,l;return t&&[null==(o=t.data)?void 0:o.attributes,null==(n=(e=t.options()).map)?void 0:n.call(e,(function(t){var o;return null==t||null==(o=t.data)?void 0:o.attributes})),null==(a=(l=t.myVotes()).map)?void 0:a.call(l,(function(t){var o;return null==(o=t.option())?void 0:o.id()}))]}));return JSON.stringify(n)}))})),(0,a.extend)(nt().prototype,"oncreate",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.bind("updatedPollOptions",(function(t){var o=e().store.getById("polls",t.pollId);o&&o.pushAttributes({voteCount:t.pollVoteCount});var n=t.options;for(var a in n){var l=e().store.getById("poll_options",a);l&&void 0!==l.voteCount()&&l.pushAttributes({voteCount:n[a]})}m.redraw()}))}))})),(0,a.extend)(nt().prototype,"onremove",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.unbind("updatedPollOptions")}))})),t=function(t){return e().modal.show(k,{onsubmit:function(o){return e().store.createRecord("polls").save(at({},o,{relationships:{post:t}}),{data:{include:"options,myVotes,myVotes.option"}}).then((function(o){var n;return null==(n=t.rawRelationship("polls"))||null==n.push||n.push({type:"polls",id:o.id()}),o}))}})},(0,a.extend)(st(),"moderationControls",(function(o,n){!n.isHidden()&&n.canStartPoll()&&o.add("addPoll",m(V(),{icon:"fas fa-poll",onclick:t.bind(this,n)},e().translator.trans("fof-polls.forum.moderation.add")))}))}))})(),module.exports=o})(); +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./src/common/index.js": +/*!*****************************!*\ + !*** ./src/common/index.js ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ slug: () => (/* binding */ slug) +/* harmony export */ }); +var slug = 'fof-polls'; + +/***/ }), + +/***/ "./src/forum/addComposerItems.js": +/*!***************************************!*\ + !*** ./src/forum/addComposerItems.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ addToComposer: () => (/* binding */ addToComposer), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/utils/classList */ "flarum/common/utils/classList"); +/* harmony import */ var flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_components_DiscussionComposer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/components/DiscussionComposer */ "flarum/forum/components/DiscussionComposer"); +/* harmony import */ var flarum_forum_components_DiscussionComposer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionComposer__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_forum_components_ReplyComposer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/forum/components/ReplyComposer */ "flarum/forum/components/ReplyComposer"); +/* harmony import */ var flarum_forum_components_ReplyComposer__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_ReplyComposer__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _components_CreatePollModal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/CreatePollModal */ "./src/forum/components/CreatePollModal.js"); + + + + + + +var addToComposer = function addToComposer(composer) { + composer.prototype.addPoll = function () { + var _this = this; + flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().modal.show(_components_CreatePollModal__WEBPACK_IMPORTED_MODULE_5__["default"], { + poll: this.composer.fields.poll, + onsubmit: function onsubmit(poll) { + return _this.composer.fields.poll = poll; + } + }); + }; + + // Add button to DiscussionComposer header + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)(composer.prototype, 'headerItems', function (items) { + var _this$composer$body, _discussion$canStartP; + var discussion = (_this$composer$body = this.composer.body) == null || (_this$composer$body = _this$composer$body.attrs) == null ? void 0 : _this$composer$body.discussion; + var canStartPoll = (_discussion$canStartP = discussion == null ? void 0 : discussion.canStartPoll()) != null ? _discussion$canStartP : flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().forum.canStartPolls(); + if (canStartPoll) { + items.add('polls', m("a", { + className: "ComposerBody-poll", + onclick: this.addPoll.bind(this) + }, m("span", { + className: flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_2___default()('PollLabel', !this.composer.fields.poll && 'none') + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans("fof-polls.forum.composer_discussion." + (this.composer.fields.poll ? 'edit' : 'add') + "_poll"))), 1); + } + }); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)(composer.prototype, 'data', function (data) { + if (this.composer.fields.poll) { + data.poll = this.composer.fields.poll; + } + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () { + addToComposer((flarum_forum_components_DiscussionComposer__WEBPACK_IMPORTED_MODULE_3___default())); + addToComposer((flarum_forum_components_ReplyComposer__WEBPACK_IMPORTED_MODULE_4___default())); +}); + +/***/ }), + +/***/ "./src/forum/addDiscussionBadge.js": +/*!*****************************************!*\ + !*** ./src/forum/addDiscussionBadge.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_components_Badge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/components/Badge */ "flarum/common/components/Badge"); +/* harmony import */ var flarum_common_components_Badge__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Badge__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_components_DiscussionList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/components/DiscussionList */ "flarum/forum/components/DiscussionList"); +/* harmony import */ var flarum_forum_components_DiscussionList__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionList__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/common/models/Discussion */ "flarum/common/models/Discussion"); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_4__); + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_DiscussionList__WEBPACK_IMPORTED_MODULE_3___default().prototype), 'requestParams', function (params) { + params.include.push('poll'); + }); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_4___default().prototype), 'badges', function (badges) { + if (this.hasPoll()) { + badges.add('poll', flarum_common_components_Badge__WEBPACK_IMPORTED_MODULE_2___default().component({ + type: 'poll', + label: flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.forum.tooltip.badge'), + icon: 'fas fa-signal' + }), 5); + } + }); +}); + +/***/ }), + +/***/ "./src/forum/addNavItem.ts": +/*!*********************************!*\ + !*** ./src/forum/addNavItem.ts ***! + \*********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ addNavItem) +/* harmony export */ }); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/components/IndexPage */ "flarum/forum/components/IndexPage"); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/common/components/LinkButton */ "flarum/common/components/LinkButton"); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_3__); + + + + +function addNavItem() { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_2___default().prototype), 'navItems', function (items) { + items.add('fof-polls-directory', flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_3___default().component({ + href: flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().route('fof_polls_directory'), + icon: 'fas fa-poll' + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().translator.trans('fof-polls.forum.page.nav')), 35); + }); +} + +/***/ }), + +/***/ "./src/forum/addPollsLink.js": +/*!***********************************!*\ + !*** ./src/forum/addPollsLink.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/components/IndexPage */ "flarum/forum/components/IndexPage"); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/components/LinkButton */ "flarum/common/components/LinkButton"); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_3__); + + + + +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_0__.extend)((flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_1___default().prototype), 'navItems', function (items) { + items.add('polls', m((flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_2___default()), { + icon: "fas fa-poll", + href: flarum_forum_app__WEBPACK_IMPORTED_MODULE_3___default().route('polls') + }, "Polls"), -11); + }); +} + +/***/ }), + +/***/ "./src/forum/addPollsToPost.js": +/*!*************************************!*\ + !*** ./src/forum/addPollsToPost.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/components/CommentPost */ "flarum/forum/components/CommentPost"); +/* harmony import */ var flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _components_PostPoll__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/PostPoll */ "./src/forum/components/PostPoll.js"); +/* harmony import */ var flarum_forum_components_DiscussionPage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/forum/components/DiscussionPage */ "flarum/forum/components/DiscussionPage"); +/* harmony import */ var flarum_forum_components_DiscussionPage__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionPage__WEBPACK_IMPORTED_MODULE_4__); +function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () { + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default().prototype), 'content', function (content) { + var post = this.attrs.post; + if ((!post.isHidden() || this.revealContent) && post.polls()) { + for (var _iterator = _createForOfIteratorHelperLoose(post.polls()), _step; !(_step = _iterator()).done;) { + var poll = _step.value; + if (poll) { + content.push(m(_components_PostPoll__WEBPACK_IMPORTED_MODULE_3__["default"], { + post: post, + poll: poll + })); + } + } + } + }); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_CommentPost__WEBPACK_IMPORTED_MODULE_2___default().prototype), 'oninit', function () { + var _this = this; + this.subtree.check(function () { + var polls = _this.attrs.post.polls(); + var checks = polls == null || polls.map == null ? void 0 : polls.map(function (poll) { + var _poll$data, _poll$options$map, _poll$options, _poll$myVotes$map, _poll$myVotes; + return poll && [(_poll$data = poll.data) == null ? void 0 : _poll$data.attributes, (_poll$options$map = (_poll$options = poll.options()).map) == null ? void 0 : _poll$options$map.call(_poll$options, function (option) { + var _option$data; + return option == null || (_option$data = option.data) == null ? void 0 : _option$data.attributes; + }), (_poll$myVotes$map = (_poll$myVotes = poll.myVotes()).map) == null ? void 0 : _poll$myVotes$map.call(_poll$myVotes, function (vote) { + var _vote$option; + return (_vote$option = vote.option()) == null ? void 0 : _vote$option.id(); + })]; + }); + return JSON.stringify(checks); + }); + }); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_DiscussionPage__WEBPACK_IMPORTED_MODULE_4___default().prototype), 'oncreate', function () { + if ((flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().pusher)) { + flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().pusher.then(function (binding) { + // We will listen for updates to all polls and options + // Even if that model is not in the current discussion, it doesn't really matter + binding.channels.main.bind('updatedPollOptions', function (data) { + var poll = flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().store.getById('polls', data['pollId']); + if (poll) { + poll.pushAttributes({ + voteCount: data['pollVoteCount'] + }); + + // Not redrawing here, as the option below should trigger the redraw already + } + var changedOptions = data['options']; + for (var optionId in changedOptions) { + var option = flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().store.getById('poll_options', optionId); + if (option && option.voteCount() !== undefined) { + option.pushAttributes({ + voteCount: changedOptions[optionId] + }); + } + } + m.redraw(); + }); + }); + } + }); + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__.extend)((flarum_forum_components_DiscussionPage__WEBPACK_IMPORTED_MODULE_4___default().prototype), 'onremove', function () { + if ((flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().pusher)) { + flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().pusher.then(function (binding) { + binding.channels.main.unbind('updatedPollOptions'); + }); + } + }); +}); + +/***/ }), + +/***/ "./src/forum/addPostControls.js": +/*!**************************************!*\ + !*** ./src/forum/addPostControls.js ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); +/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_forum_utils_PostControls__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/forum/utils/PostControls */ "flarum/forum/utils/PostControls"); +/* harmony import */ var flarum_forum_utils_PostControls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_utils_PostControls__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _components_CreatePollModal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/CreatePollModal */ "./src/forum/components/CreatePollModal.js"); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/common/components/Button */ "flarum/common/components/Button"); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_5__); + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () { + var createPoll = function createPoll(post) { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().modal.show(_components_CreatePollModal__WEBPACK_IMPORTED_MODULE_4__["default"], { + onsubmit: function onsubmit(data) { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.createRecord('polls').save((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, data, { + relationships: { + post: post + } + }), { + data: { + include: 'options,myVotes,myVotes.option' + } + }).then(function (poll) { + var _post$rawRelationship; + (_post$rawRelationship = post.rawRelationship('polls')) == null || _post$rawRelationship.push == null || _post$rawRelationship.push({ + type: 'polls', + id: poll.id() + }); + return poll; + }); + } + }); + }; + (0,flarum_common_extend__WEBPACK_IMPORTED_MODULE_2__.extend)((flarum_forum_utils_PostControls__WEBPACK_IMPORTED_MODULE_3___default()), 'moderationControls', function (items, post) { + if (!post.isHidden() && post.canStartPoll()) { + items.add('addPoll', m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_5___default()), { + icon: "fas fa-poll", + onclick: createPoll.bind(this, post) + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.moderation.add'))); + } + }); +}); + +/***/ }), + +/***/ "./src/forum/components/CreatePollModal.js": +/*!*************************************************!*\ + !*** ./src/forum/components/CreatePollModal.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ CreatePollModal) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/components/Modal */ "flarum/common/components/Modal"); +/* harmony import */ var flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _PollForm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PollForm */ "./src/forum/components/PollForm.js"); + + + + +var CreatePollModal = /*#__PURE__*/function (_Modal) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(CreatePollModal, _Modal); + function CreatePollModal() { + return _Modal.apply(this, arguments) || this; + } + var _proto = CreatePollModal.prototype; + _proto.title = function title() { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.modal.add_title'); + }; + _proto.className = function className() { + return 'PollDiscussionModal Modal--medium'; + }; + _proto.content = function content() { + //@todo check if bind is needed for onsubmit + return [m("div", { + className: "Modal-body" + }, m(_PollForm__WEBPACK_IMPORTED_MODULE_3__["default"], { + modal: this, + poll: this.attrs.poll, + onsubmit: this.onsubmit.bind(this) + }))]; + }; + _proto.onsubmit = function onsubmit(poll) { + this.hide(); + this.attrs.onsubmit(poll); + }; + return CreatePollModal; +}((flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2___default())); + + +/***/ }), + +/***/ "./src/forum/components/EditPollModal.js": +/*!***********************************************!*\ + !*** ./src/forum/components/EditPollModal.js ***! + \***********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ EditPollModal) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _CreatePollModal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreatePollModal */ "./src/forum/components/CreatePollModal.js"); + + + +var EditPollModal = /*#__PURE__*/function (_CreatePollModal) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(EditPollModal, _CreatePollModal); + function EditPollModal() { + return _CreatePollModal.apply(this, arguments) || this; + } + var _proto = EditPollModal.prototype; + _proto.title = function title() { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.modal.edit_title'); + }; + return EditPollModal; +}(_CreatePollModal__WEBPACK_IMPORTED_MODULE_2__["default"]); + + +/***/ }), + +/***/ "./src/forum/components/ListVotersModal.js": +/*!*************************************************!*\ + !*** ./src/forum/components/ListVotersModal.js ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ ListVotersModal) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/components/Modal */ "flarum/common/components/Modal"); +/* harmony import */ var flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_common_helpers_avatar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/common/helpers/avatar */ "flarum/common/helpers/avatar"); +/* harmony import */ var flarum_common_helpers_avatar__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_common_helpers_avatar__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_common_helpers_username__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/common/helpers/username */ "flarum/common/helpers/username"); +/* harmony import */ var flarum_common_helpers_username__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_common_helpers_username__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/common/components/Link */ "flarum/common/components/Link"); +/* harmony import */ var flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/common/utils/Stream */ "flarum/common/utils/Stream"); +/* harmony import */ var flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var flarum_common_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/common/components/LoadingIndicator */ "flarum/common/components/LoadingIndicator"); +/* harmony import */ var flarum_common_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_7__); + + + + + + + + +var ListVotersModal = /*#__PURE__*/function (_Modal) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(ListVotersModal, _Modal); + function ListVotersModal() { + return _Modal.apply(this, arguments) || this; + } + var _proto = ListVotersModal.prototype; + _proto.oninit = function oninit(vnode) { + var _this = this; + _Modal.prototype.oninit.call(this, vnode); + this.loading = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_6___default()(true); + flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.find('fof/polls', this.attrs.poll.id(), { + include: 'votes,votes.user,votes.option' + }).then(function () { + return _this.loading(false); + })["finally"](function () { + return m.redraw(); + }); + }; + _proto.className = function className() { + return 'Modal--medium VotesModal'; + }; + _proto.title = function title() { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.votes_modal.title'); + }; + _proto.content = function content() { + return m("div", { + className: "Modal-body" + }, this.loading() ? m((flarum_common_components_LoadingIndicator__WEBPACK_IMPORTED_MODULE_7___default()), null) : this.attrs.poll.options().map(this.optionContent.bind(this))); + }; + _proto.optionContent = function optionContent(opt) { + var votes = (this.attrs.poll.votes() || []).filter(function (v) { + return opt.id() === v.option().id(); + }); + return m("div", { + className: "VotesModal-option" + }, m("h2", null, opt.answer() + ':'), votes.length ? m("div", { + className: "VotesModal-list" + }, votes.map(this.voteContent.bind(this))) : m("h4", null, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.modal.no_voters'))); + }; + _proto.voteContent = function voteContent(vote) { + var user = vote.user(); + var attrs = user && { + href: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().route.user(user) + }; + return m((flarum_common_components_Link__WEBPACK_IMPORTED_MODULE_5___default()), attrs, flarum_common_helpers_avatar__WEBPACK_IMPORTED_MODULE_3___default()(user), " ", flarum_common_helpers_username__WEBPACK_IMPORTED_MODULE_4___default()(user)); + }; + return ListVotersModal; +}((flarum_common_components_Modal__WEBPACK_IMPORTED_MODULE_2___default())); + + +/***/ }), + +/***/ "./src/forum/components/PollForm.js": +/*!******************************************!*\ + !*** ./src/forum/components/PollForm.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PollForm) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../common */ "./src/common/index.js"); +/* harmony import */ var flarum_common_Component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/common/Component */ "flarum/common/Component"); +/* harmony import */ var flarum_common_Component__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Component__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/common/components/Button */ "flarum/common/components/Button"); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/common/components/Switch */ "flarum/common/components/Switch"); +/* harmony import */ var flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/common/utils/ItemList */ "flarum/common/utils/ItemList"); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! flarum/common/utils/Stream */ "flarum/common/utils/Stream"); +/* harmony import */ var flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! flarum/common/utils/extractText */ "flarum/common/utils/extractText"); +/* harmony import */ var flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var _form_FormError__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./form/FormError */ "./src/forum/components/form/FormError.js"); +/* harmony import */ var _states_PollFormState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../states/PollFormState */ "./src/forum/states/PollFormState.js"); + + + + + + + + + + + + + + +// Make translation calls shorter +var t = flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans.bind((flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator)); +var prfx = _common__WEBPACK_IMPORTED_MODULE_3__.slug + ".forum.poll_form"; +var PollForm = /*#__PURE__*/function (_Component) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(PollForm, _Component); + function PollForm() { + return _Component.apply(this, arguments) || this; + } + var _proto = PollForm.prototype; + _proto.oninit = function oninit(vnode) { + _Component.prototype.oninit.call(this, vnode); + this.state = new _states_PollFormState__WEBPACK_IMPORTED_MODULE_12__["default"](this.attrs.poll); + + // state handles poll initialization + var poll = this.state.poll; + + //@todo way the options are destructured into options (answers) and optionImageUrls + this.options = poll.options(); + this.optionAnswers = this.options.map(function (o) { + return flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(o.answer()); + }); + this.optionImageUrls = this.options.map(function (o) { + return flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(o.imageUrl()); + }); + this.question = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.question()); + this.endDate = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(this.formatDate(poll.endDate())); + this.publicPoll = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.publicPoll()); + this.allowMultipleVotes = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.allowMultipleVotes()); + this.hideVotes = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.hideVotes()); + this.allowChangeVote = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.allowChangeVote()); + this.maxVotes = flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()(poll.maxVotes() || 0); + this.datepickerMinDate = this.formatDate(undefined); + + // Replace minimum of 'today' for poll end date only if the poll is not already closed + if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) { + this.datepickerMinDate = this.formatDate(poll.endDate); + } + }; + _proto.view = function view() { + return m("form", { + onsubmit: this.onsubmit.bind(this) + }, m("div", { + className: "PollDiscussionModal-form" + }, this.fields().toArray())); + }; + _proto.fields = function fields() { + var items = new (flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_8___default())(); + items.add('question', m("div", { + className: "Form-group" + }, m("label", { + className: "label" + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.question_placeholder')), m("input", { + type: "text", + name: "question", + className: "FormControl", + bidi: this.question + })), 100); + items.add('answers', m("div", { + className: "PollModal--answers Form-group" + }, m("label", { + className: "label PollModal--answers-title" + }, m("span", null, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.options_label')), flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default().component({ + className: 'Button PollModal--button small', + icon: 'fas fa-plus', + onclick: this.addOption.bind(this) + })), this.displayOptions()), 80); + items.add('date', m("div", { + className: "Form-group" + }, m("label", { + className: "label" + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.date_placeholder')), m("div", { + className: "PollModal--date" + }, m("input", { + className: "FormControl", + type: "datetime-local", + name: "date", + bidi: this.endDate, + min: this.datepickerMinDate, + max: this.formatDate('2038') + }), flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default().component({ + className: 'Button PollModal--button', + icon: 'fas fa-times', + onclick: this.endDate.bind(this, null) + })), this.endDate() && m("p", { + className: "helpText" + }, m("i", { + "class": "icon fas fa-clock" + }), "\xA0", dayjs(this.endDate()).isBefore(dayjs()) ? flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.poll_ended') : flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.days_remaining', { + time: dayjs(this.endDate()).fromNow() + }))), 40); + items.add('public', m("div", { + className: "Form-group" + }, flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7___default().component({ + state: this.publicPoll() || false, + onchange: this.publicPoll + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.public_poll_label'))), 20); + items.add('hide-votes', m("div", { + className: "Form-group" + }, m((flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7___default()), { + state: this.endDate() && this.hideVotes(), + onchange: this.hideVotes, + disabled: !this.endDate() + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.hide_votes_label'))), 20); + items.add('allow-change-vote', m("div", { + className: "Form-group" + }, m((flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7___default()), { + state: this.allowChangeVote(), + onchange: this.allowChangeVote + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.allow_change_vote_label'))), 20); + items.add('allow-multiple-votes', m("div", { + className: "Form-group" + }, flarum_common_components_Switch__WEBPACK_IMPORTED_MODULE_7___default().component({ + state: this.allowMultipleVotes() || false, + onchange: this.allowMultipleVotes + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.allow_multiple_votes_label'))), 15); + if (this.allowMultipleVotes()) { + items.add('max-votes', m("div", { + className: "Form-group" + }, m("label", { + className: "label" + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.max_votes_label')), m("input", { + type: "number", + min: "0", + max: this.options.length, + name: "maxVotes", + className: "FormControl", + bidi: this.maxVotes + }), m("p", { + className: "helpText" + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.max_votes_help'))), 15); + } + items.add('submit', m("div", { + className: "Form-group" + }, m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default()), { + type: "submit", + className: "Button Button--primary PollModal-SubmitButton", + icon: "fas fa-save", + loading: this.state.loading + }, t('fof-polls.forum.modal.submit')), this.state.poll.exists && m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default()), { + className: "Button Button--secondary", + icon: "fas fa-trash-alt", + loading: this.state.deleting, + onclick: this["delete"].bind(this) + }, t(prfx + ".delete"))), -10); + return items; + }; + _proto.displayOptions = function displayOptions() { + var _this = this; + return Object.keys(this.options).map(function (option, i) { + return m("div", { + className: "Form-group" + }, m("fieldset", { + className: "Poll-answer-input" + }, m("input", { + className: "FormControl", + type: "text", + name: 'answer' + (i + 1), + bidi: _this.optionAnswers[i], + placeholder: flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.option_placeholder') + ' #' + (i + 1) + }), flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().forum.attribute('allowPollOptionImage') ? m("input", { + className: "FormControl", + type: "text", + name: 'answerImage' + (i + 1), + bidi: _this.optionImageUrls[i], + placeholder: flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.image_option_placeholder') + ' #' + (i + 1) + }) : null), i >= 2 ? flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default().component({ + type: 'button', + className: 'Button Button--warning PollModal--button', + icon: 'fas fa-minus', + onclick: i >= 2 ? _this.removeOption.bind(_this, i) : '' + }) : ''); + }); + }; + _proto.addOption = function addOption() { + var max = Math.max(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().forum.attribute('pollMaxOptions'), 2); + if (this.options.length < max) { + this.options.push(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().store.createRecord('poll_options')); + this.optionAnswers.push(flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()('')); + this.optionImageUrls.push(flarum_common_utils_Stream__WEBPACK_IMPORTED_MODULE_9___default()('')); + } else { + alert(flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_10___default()(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.max', { + max: max + }))); + } + }; + _proto.removeOption = function removeOption(i) { + this.options.splice(i, 1); + this.optionAnswers.splice(i, 1); + this.optionImageUrls.splice(i, 1); + }; + _proto.data = function data() { + var _this2 = this; + var options = this.options.map(function (o, i) { + if (!o.data.attributes) o.data.attributes = {}; + o.data.attributes.answer = _this2.optionAnswers[i](); + o.data.attributes.imageUrl = _this2.optionImageUrls[i](); + return o.data; + }); + if (this.question() === '') { + throw new _form_FormError__WEBPACK_IMPORTED_MODULE_11__["default"](flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.include_question')); + } + if (options.length < 2) { + throw new _form_FormError__WEBPACK_IMPORTED_MODULE_11__["default"](flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().translator.trans('fof-polls.forum.modal.min')); + } + return { + question: this.question(), + endDate: this.dateToTimestamp(this.endDate()), + publicPoll: this.publicPoll(), + hideVotes: this.hideVotes(), + allowChangeVote: this.allowChangeVote(), + allowMultipleVotes: this.allowMultipleVotes(), + maxVotes: this.maxVotes(), + options: options + }; + }; + _proto.onsubmit = /*#__PURE__*/function () { + var _onsubmit = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default().mark(function _callee(e) { + var _this3 = this; + var alertId; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + e.preventDefault(); + _context.prev = 1; + _context.next = 4; + return this.state.save(this.data()); + case 4: + // Show success alert + alertId = flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.show({ + type: 'success', + controls: [m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_6___default()), { + className: "Button Button--link", + onclick: function onclick() { + return m.route.set(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().route('compose-poll', { + edit: _this3.state.collection.id() + })); + } + }, t(prfx + ".continue_editing"))] + }, t(prfx + ".success")); // Hide alert after 10 seconds + setTimeout(function () { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.dismiss(alertId); + }, 10000); + + // Check if we need to call a custom onsubmit callback + if (this.attrs.onsubmit) { + this.attrs.onsubmit(this.state.poll); + } else { + // Otherwise redirect to pools list + m.route.set(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().route('polls-manager')); + } + _context.next = 12; + break; + case 9: + _context.prev = 9; + _context.t0 = _context["catch"](1); + if (_context.t0 instanceof _form_FormError__WEBPACK_IMPORTED_MODULE_11__["default"]) { + flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.show({ + type: 'error' + }, _context.t0.message); + } else { + // Show error alert + flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.show({ + type: 'error' + }, t(prfx + ".error")); + } + case 12: + _context.prev = 12; + this.state.loading = false; + m.redraw(); + return _context.finish(12); + case 16: + case "end": + return _context.stop(); + } + }, _callee, this, [[1, 9, 12, 16]]); + })); + function onsubmit(_x) { + return _onsubmit.apply(this, arguments); + } + return onsubmit; + }(); + _proto["delete"] = /*#__PURE__*/function () { + var _delete2 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default().mark(function _callee2() { + var alertId; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + if (confirm(t(prfx + ".delete_confirm"))) { + _context2.next = 2; + break; + } + return _context2.abrupt("return"); + case 2: + _context2.prev = 2; + _context2.next = 5; + return this.state["delete"](); + case 5: + // Show success alert + alertId = flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.show({ + type: 'success' + }, t(prfx + ".delete_success")); // Hide alert after 10 seconds + setTimeout(function () { + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.dismiss(alertId); + }, 10000); + + // Redirect to polls list + m.route.set(flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().route('polls-manager')); + _context2.next = 13; + break; + case 10: + _context2.prev = 10; + _context2.t0 = _context2["catch"](2); + // Show error alert + flarum_forum_app__WEBPACK_IMPORTED_MODULE_5___default().alerts.show({ + type: 'error' + }, t(prfx + ".delete_error")); + case 13: + case "end": + return _context2.stop(); + } + }, _callee2, this, [[2, 10]]); + })); + function _delete() { + return _delete2.apply(this, arguments); + } + return _delete; + }(); + _proto.formatDate = function formatDate(date, def) { + if (def === void 0) { + def = false; + } + var dayjsDate = dayjs(date); + if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null; + return dayjsDate.format('YYYY-MM-DDTHH:mm'); + }; + _proto.dateToTimestamp = function dateToTimestamp(date) { + var dayjsDate = dayjs(date); + if (!date || !dayjsDate.isValid()) return false; + return dayjsDate.format(); + }; + return PollForm; +}((flarum_common_Component__WEBPACK_IMPORTED_MODULE_4___default())); + + +/***/ }), + +/***/ "./src/forum/components/PollsDirectory.tsx": +/*!*************************************************!*\ + !*** ./src/forum/components/PollsDirectory.tsx ***! + \*************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PollsDirectory) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_common_components_Page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/common/components/Page */ "flarum/common/components/Page"); +/* harmony import */ var flarum_common_components_Page__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Page__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/common/utils/extractText */ "flarum/common/utils/extractText"); +/* harmony import */ var flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! flarum/forum/components/IndexPage */ "flarum/forum/components/IndexPage"); +/* harmony import */ var flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/common/utils/ItemList */ "flarum/common/utils/ItemList"); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/common/helpers/listItems */ "flarum/common/helpers/listItems"); +/* harmony import */ var flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var flarum_common_components_SelectDropdown__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/common/components/SelectDropdown */ "flarum/common/components/SelectDropdown"); +/* harmony import */ var flarum_common_components_SelectDropdown__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_SelectDropdown__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! flarum/common/components/LinkButton */ "flarum/common/components/LinkButton"); +/* harmony import */ var flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var flarum_common_components_Select__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! flarum/common/components/Select */ "flarum/common/components/Select"); +/* harmony import */ var flarum_common_components_Select__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Select__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! flarum/common/components/Button */ "flarum/common/components/Button"); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_11__); + + + + + + + + + + + + +var PollsDirectory = /*#__PURE__*/function (_Page) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(PollsDirectory, _Page); + function PollsDirectory() { + return _Page.apply(this, arguments) || this; + } + var _proto = PollsDirectory.prototype; + _proto.oncreate = function oncreate(vnode) { + _Page.prototype.oncreate.call(this, vnode); + flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().setTitle(flarum_common_utils_extractText__WEBPACK_IMPORTED_MODULE_4___default()(flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().translator.trans('fof-polls.forum.page.nav'))); + }; + _proto.view = function view() { + return m("div", { + className: "IndexPage" + }, flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5___default().prototype.hero(), m("div", { + className: "container" + }, m("div", { + className: "sideNavContainer" + }, m("nav", { + className: "IndexPage-nav sideNav" + }, m("ul", null, flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7___default()(this.sidebarItems().toArray()))), m("div", { + className: "IndexPage-results sideNavOffset" + }, m("div", { + className: "IndexPage-toolbar" + }, m("ul", { + className: "IndexPage-toolbar-view" + }, flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7___default()(this.viewItems().toArray())), m("ul", { + className: "IndexPage-toolbar-action" + }, flarum_common_helpers_listItems__WEBPACK_IMPORTED_MODULE_7___default()(this.actionItems().toArray()))))))); + } + + /** + * Our own sidebar. Re-uses Index.sidebarItems as the base + * Elements added here will only show up on the user directory page + */; + _proto.sidebarItems = function sidebarItems() { + var items = flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5___default().prototype.sidebarItems(); + items.setContent('nav', flarum_common_components_SelectDropdown__WEBPACK_IMPORTED_MODULE_8___default().component({ + buttonClassName: 'Button', + className: 'App-titleControl' + }, this.navItems().toArray())); + return items; + } + + /** + * Our own sidebar navigation. Re-uses Index.navItems as the base + * Elements added here will only show up on the user directory page + */; + _proto.navItems = function navItems() { + var items = flarum_forum_components_IndexPage__WEBPACK_IMPORTED_MODULE_5___default().prototype.navItems(); + var params = this.stickyParams(); + items.setContent('fof-polls-directory', flarum_common_components_LinkButton__WEBPACK_IMPORTED_MODULE_9___default().component({ + href: flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().route('fof_polls_directory', params), + icon: 'fas fa-poll' + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().translator.trans('fof-polls.forum.page.nav'))); + return items; + }; + _proto.stickyParams = function stickyParams() { + return { + sort: m.route.param('sort'), + q: m.route.param('q') + }; + }; + _proto.changeParams = function changeParams(sort) { + var params = this.params(); + if (sort === flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().forum.attribute('pollsDirectoryDefaultSort')) { + delete params.sort; + } else { + params.sort = sort; + } + this.state.refreshParams(params); + var routeParams = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, params); + delete routeParams.qBuilder; + m.route.set(flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().route('fof_polls_directory', routeParams)); + }; + _proto.viewItems = function viewItems() { + var items = new (flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_6___default())(); + var sortMap = this.state.sortMap(); + var sortOptions = {}; + for (var i in sortMap) { + sortOptions[i] = flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().translator.trans('fof-polls.lib.sort.' + i); + } + items.add('sort', flarum_common_components_Select__WEBPACK_IMPORTED_MODULE_10___default().component({ + options: sortOptions, + value: this.state.getParams().sort || flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().forum.attribute('pollsDirectoryDefaultSort'), + onchange: this.changeParams.bind(this) + }), 100); + return items; + }; + _proto.actionItems = function actionItems() { + var _this = this; + var items = new (flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_6___default())(); + items.add('refresh', flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_11___default().component({ + title: flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().translator.trans('fof-polls.forum.page.refresh_tooltip'), + icon: 'fas fa-sync', + className: 'Button Button--icon', + onclick: function onclick() { + _this.state.refresh(); + } + })); + return items; + }; + return PollsDirectory; +}((flarum_common_components_Page__WEBPACK_IMPORTED_MODULE_3___default())); + + +/***/ }), + +/***/ "./src/forum/components/PostPoll.js": +/*!******************************************!*\ + !*** ./src/forum/components/PostPoll.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PostPoll) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_Component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/Component */ "flarum/common/Component"); +/* harmony import */ var flarum_common_Component__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Component__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/common/components/Button */ "flarum/common/components/Button"); +/* harmony import */ var flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var flarum_forum_components_LogInModal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! flarum/forum/components/LogInModal */ "flarum/forum/components/LogInModal"); +/* harmony import */ var flarum_forum_components_LogInModal__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_LogInModal__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _ListVotersModal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ListVotersModal */ "./src/forum/components/ListVotersModal.js"); +/* harmony import */ var flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! flarum/common/utils/classList */ "flarum/common/utils/classList"); +/* harmony import */ var flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! flarum/common/utils/ItemList */ "flarum/common/utils/ItemList"); +/* harmony import */ var flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! flarum/common/components/Tooltip */ "flarum/common/components/Tooltip"); +/* harmony import */ var flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var flarum_common_helpers_icon__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! flarum/common/helpers/icon */ "flarum/common/helpers/icon"); +/* harmony import */ var flarum_common_helpers_icon__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(flarum_common_helpers_icon__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var _EditPollModal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./EditPollModal */ "./src/forum/components/EditPollModal.js"); + + + + + + + + + + + +var PostPoll = /*#__PURE__*/function (_Component) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(PostPoll, _Component); + function PostPoll() { + return _Component.apply(this, arguments) || this; + } + var _proto = PostPoll.prototype; + _proto.oninit = function oninit(vnode) { + var _this$attrs$poll, _this$attrs$poll2; + _Component.prototype.oninit.call(this, vnode); + this.loadingOptions = false; + this.useSubmitUI = !((_this$attrs$poll = this.attrs.poll) != null && _this$attrs$poll.canChangeVote()) && ((_this$attrs$poll2 = this.attrs.poll) == null ? void 0 : _this$attrs$poll2.allowMultipleVotes()); + this.pendingSubmit = false; + this.pendingOptions = null; + }; + _proto.oncreate = function oncreate(vnode) { + _Component.prototype.oncreate.call(this, vnode); + this.preventClose = this.preventClose.bind(this); + window.addEventListener('beforeunload', this.preventClose); + }; + _proto.onremove = function onremove(vnode) { + _Component.prototype.onremove.call(this, vnode); + window.removeEventListener('beforeunload', this.preventClose); + }; + _proto.view = function view() { + var poll = this.attrs.poll; + var options = poll.options() || []; + var maxVotes = poll.allowMultipleVotes() ? poll.maxVotes() : 1; + if (maxVotes === 0) maxVotes = options.length; + var infoItems = this.infoItems(maxVotes); + return m("div", { + className: "Post-poll", + "data-id": poll.id() + }, m("div", { + className: "PollHeading" + }, m("h3", { + className: "PollHeading-title" + }, poll.question()), poll.canSeeVoters() && m((flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8___default()), { + text: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.public_poll') + }, m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3___default()), { + className: "Button PollHeading-voters", + onclick: this.showVoters.bind(this), + icon: "fas fa-poll" + })), poll.canEdit() && m((flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8___default()), { + text: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.moderation.edit') + }, m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3___default()), { + className: "Button PollHeading-edit", + onclick: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().modal.show.bind((flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().modal), _EditPollModal__WEBPACK_IMPORTED_MODULE_10__["default"], { + poll: poll + }), + icon: "fas fa-pen" + })), poll.canDelete() && m((flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8___default()), { + text: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.moderation.delete') + }, m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3___default()), { + className: "Button PollHeading-delete", + onclick: this.deletePoll.bind(this), + icon: "fas fa-trash" + }))), m("div", null, m("div", { + className: "PollOptions" + }, options.map(this.viewOption.bind(this))), m("div", { + className: "Poll-sticky" + }, !infoItems.isEmpty() && m("div", { + className: "helpText PollInfoText" + }, infoItems.toArray()), this.useSubmitUI && this.pendingSubmit && m((flarum_common_components_Button__WEBPACK_IMPORTED_MODULE_3___default()), { + className: "Button Button--primary Poll-submit", + loading: this.loadingOptions, + onclick: this.onsubmit.bind(this) + }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.poll.submit_button'))))); + }; + _proto.infoItems = function infoItems(maxVotes) { + var _poll$myVotes; + var items = new (flarum_common_utils_ItemList__WEBPACK_IMPORTED_MODULE_7___default())(); + var poll = this.attrs.poll; + var hasVoted = ((_poll$myVotes = poll.myVotes()) == null ? void 0 : _poll$myVotes.length) > 0; + if ((flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().session).user && !poll.canVote() && !poll.hasEnded()) { + items.add('no-permission', m("span", null, m("i", { + className: "icon fas fa-times-circle fa-fw" + }), flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.no_permission'))); + } + if (poll.endDate()) { + items.add('end-date', m("span", null, m("i", { + "class": "icon fas fa-clock fa-fw" + }), poll.hasEnded() ? flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.poll_ended') : flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.days_remaining', { + time: dayjs(poll.endDate()).fromNow() + }))); + } + if (poll.canVote()) { + items.add('max-votes', m("span", null, m("i", { + className: "icon fas fa-poll fa-fw" + }), flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.max_votes_allowed', { + max: maxVotes + }))); + if (!poll.canChangeVote()) { + items.add('cannot-change-vote', m("span", null, m("i", { + className: "icon fas fa-" + (hasVoted ? 'times' : 'exclamation') + "-circle fa-fw" + }), flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.poll.cannot_change_vote'))); + } + } + return items; + }; + _proto.viewOption = function viewOption(opt) { + var _poll$myVotes2, _poll$myVotes3, _poll$myVotes4; + var poll = this.attrs.poll; + var hasVoted = ((_poll$myVotes2 = poll.myVotes()) == null ? void 0 : _poll$myVotes2.length) > 0; + var totalVotes = poll.voteCount(); + var voted = this.pendingOptions ? this.pendingOptions.has(opt.id()) : (_poll$myVotes3 = poll.myVotes()) == null || _poll$myVotes3.some == null ? void 0 : _poll$myVotes3.some(function (vote) { + return vote.option() === opt; + }); + var votes = opt.voteCount(); + var percent = totalVotes > 0 ? Math.round(votes / totalVotes * 100) : 0; + + // isNaN(null) is false, so we have to check type directly now that API always returns the field + var canSeeVoteCount = typeof votes === 'number'; + var isDisabled = this.loadingOptions || hasVoted && !poll.canChangeVote(); + var width = canSeeVoteCount ? percent : Number(voted) / (((_poll$myVotes4 = poll.myVotes()) == null ? void 0 : _poll$myVotes4.length) || 1) * 100; + var showCheckmark = !(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().session).user || !poll.hasEnded() && poll.canVote() && (!hasVoted || poll.canChangeVote()); + var bar = m("div", { + className: "PollBar", + "data-selected": !!voted, + style: "--poll-option-width: " + width + "%" + }, showCheckmark && m("label", { + className: "PollAnswer-checkbox checkbox" + }, m("input", { + onchange: this.changeVote.bind(this, opt), + type: "checkbox", + checked: voted, + disabled: isDisabled + }), m("span", { + className: "checkmark" + })), m("div", { + className: "PollAnswer-text" + }, m("span", { + className: "PollAnswer-text-answer" + }, opt.answer()), voted && !showCheckmark && flarum_common_helpers_icon__WEBPACK_IMPORTED_MODULE_9___default()('fas fa-check-circle', { + className: 'PollAnswer-check' + }), canSeeVoteCount && m("span", { + className: flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_6___default()('PollPercent', percent !== 100 && 'PollPercent--option') + }, percent, "%")), opt.imageUrl() ? m("img", { + className: "PollAnswer-image", + src: opt.imageUrl(), + alt: opt.answer() + }) : null); + return m("div", { + className: flarum_common_utils_classList__WEBPACK_IMPORTED_MODULE_6___default()('PollOption', hasVoted && 'PollVoted', poll.hasEnded() && 'PollEnded', opt.imageUrl() && 'PollOption-hasImage'), + "data-id": opt.id() + }, canSeeVoteCount ? m((flarum_common_components_Tooltip__WEBPACK_IMPORTED_MODULE_8___default()), { + text: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.tooltip.votes', { + count: votes + }), + onremove: this.hideOptionTooltip + }, bar) : bar); + }; + _proto.changeVote = function changeVote(option, evt) { + var _this$attrs$poll$myVo, _this$attrs$poll$myVo2; + if (!(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().session).user) { + flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().modal.show((flarum_forum_components_LogInModal__WEBPACK_IMPORTED_MODULE_4___default())); + evt.target.checked = false; + return; + } + var optionIds = this.pendingOptions || new Set((_this$attrs$poll$myVo = (_this$attrs$poll$myVo2 = this.attrs.poll.myVotes()).map) == null ? void 0 : _this$attrs$poll$myVo.call(_this$attrs$poll$myVo2, function (v) { + return v.option().id(); + })); + var isUnvoting = optionIds["delete"](option.id()); + var allowsMultiple = this.attrs.poll.allowMultipleVotes(); + if (!allowsMultiple) { + optionIds.clear(); + } + if (!isUnvoting) { + optionIds.add(option.id()); + } + if (this.useSubmitUI) { + this.pendingOptions = optionIds.size ? optionIds : null; + this.pendingSubmit = !!this.pendingOptions; + return; + } + return this.submit(optionIds, null, function () { + return evt.target.checked = isUnvoting; + }); + }; + _proto.onsubmit = function onsubmit() { + var _this = this; + return this.submit(this.pendingOptions, function () { + _this.pendingOptions = null; + _this.pendingSubmit = false; + }); + }; + _proto.submit = function submit(optionIds, cb, onerror) { + var _this2 = this; + this.loadingOptions = true; + m.redraw(); + return flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().request({ + method: 'PATCH', + url: flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().forum.attribute('apiUrl') + "/fof/polls/" + this.attrs.poll.id() + "/votes", + body: { + data: { + optionIds: Array.from(optionIds) + } + } + }).then(function (res) { + flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().store.pushPayload(res); + cb == null || cb(); + })["catch"](function (err) { + onerror == null || onerror(err); + })["finally"](function () { + _this2.loadingOptions = false; + m.redraw(); + }); + }; + _proto.showVoters = function showVoters() { + // Load all the votes only when opening the votes list + flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().modal.show(_ListVotersModal__WEBPACK_IMPORTED_MODULE_5__["default"], { + poll: this.attrs.poll, + post: this.attrs.post + }); + }; + _proto.deletePoll = function deletePoll() { + if (confirm(flarum_forum_app__WEBPACK_IMPORTED_MODULE_1___default().translator.trans('fof-polls.forum.moderation.delete_confirm'))) { + this.attrs.poll["delete"]().then(function () { + m.redraw.sync(); + }); + } + } + + /** + * Attempting to use the `tooltipVisible` attr on the Tooltip component set to 'false' when no vote count + * caused the tooltip to break on click. This is a workaround to hide the tooltip when no vote count is available, + * called on 'onremove' of the Tooltip component. It doesn't always work as intended either, but it does the job. + */; + _proto.hideOptionTooltip = function hideOptionTooltip(vnode) { + vnode.attrs.tooltipVisible = false; + vnode.state.updateVisibility(); + } + + /** + * Alert before navigating away using browser's 'beforeunload' event + */; + _proto.preventClose = function preventClose(e) { + if (this.pendingOptions) { + e.preventDefault(); + return true; + } + }; + return PostPoll; +}((flarum_common_Component__WEBPACK_IMPORTED_MODULE_2___default())); + + +/***/ }), + +/***/ "./src/forum/components/form/FormError.js": +/*!************************************************!*\ + !*** ./src/forum/components/form/FormError.js ***! + \************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ FormError) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var _babel_runtime_helpers_esm_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/wrapNativeSuper */ "./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js"); + + +var FormError = /*#__PURE__*/function (_Error) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(FormError, _Error); + function FormError() { + return _Error.apply(this, arguments) || this; + } + return FormError; +}( /*#__PURE__*/(0,_babel_runtime_helpers_esm_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_1__["default"])(Error)); + + +/***/ }), + +/***/ "./src/forum/components/index.ts": +/*!***************************************!*\ + !*** ./src/forum/components/index.ts ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ components: () => (/* binding */ components) +/* harmony export */ }); +/* harmony import */ var _CreatePollModal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CreatePollModal */ "./src/forum/components/CreatePollModal.js"); +/* harmony import */ var _PostPoll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PostPoll */ "./src/forum/components/PostPoll.js"); +/* harmony import */ var _EditPollModal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./EditPollModal */ "./src/forum/components/EditPollModal.js"); +/* harmony import */ var _ListVotersModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ListVotersModal */ "./src/forum/components/ListVotersModal.js"); +/* harmony import */ var _PollForm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PollForm */ "./src/forum/components/PollForm.js"); + + + + + +var components = { + CreatePollModal: _CreatePollModal__WEBPACK_IMPORTED_MODULE_0__["default"], + PostPoll: _PostPoll__WEBPACK_IMPORTED_MODULE_1__["default"], + EditPollModal: _EditPollModal__WEBPACK_IMPORTED_MODULE_2__["default"], + ListVotersModal: _ListVotersModal__WEBPACK_IMPORTED_MODULE_3__["default"], + PollForm: _PollForm__WEBPACK_IMPORTED_MODULE_4__["default"] +}; + +/***/ }), + +/***/ "./src/forum/extend.ts": +/*!*****************************!*\ + !*** ./src/forum/extend.ts ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/common/extenders */ "flarum/common/extenders"); +/* harmony import */ var flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var flarum_common_models_Post__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/models/Post */ "flarum/common/models/Post"); +/* harmony import */ var flarum_common_models_Post__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Post__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_common_models_Forum__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/common/models/Forum */ "flarum/common/models/Forum"); +/* harmony import */ var flarum_common_models_Forum__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Forum__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! flarum/common/models/Discussion */ "flarum/common/models/Discussion"); +/* harmony import */ var flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _models_Poll__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models/Poll */ "./src/forum/models/Poll.ts"); +/* harmony import */ var _models_PollOption__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./models/PollOption */ "./src/forum/models/PollOption.ts"); +/* harmony import */ var _models_PollVote__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./models/PollVote */ "./src/forum/models/PollVote.ts"); +/* harmony import */ var _components_PollsDirectory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/PollsDirectory */ "./src/forum/components/PollsDirectory.tsx"); + + + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([new (flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default().Routes)() // +.add('fof_polls_directory', '/polls', _components_PollsDirectory__WEBPACK_IMPORTED_MODULE_7__["default"]), new (flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default().Store)() // +.add('polls', _models_Poll__WEBPACK_IMPORTED_MODULE_4__["default"]).add('poll_options', _models_PollOption__WEBPACK_IMPORTED_MODULE_5__["default"]).add('poll_votes', _models_PollVote__WEBPACK_IMPORTED_MODULE_6__["default"]), new (flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default().Model)((flarum_common_models_Post__WEBPACK_IMPORTED_MODULE_1___default())) // +.hasMany('polls').attribute('canStartPoll'), new (flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default().Model)((flarum_common_models_Forum__WEBPACK_IMPORTED_MODULE_2___default())) // +.attribute('canStartPolls'), new (flarum_common_extenders__WEBPACK_IMPORTED_MODULE_0___default().Model)((flarum_common_models_Discussion__WEBPACK_IMPORTED_MODULE_3___default())) // +.attribute('hasPoll').attribute('canStartPoll')]); + +/***/ }), + +/***/ "./src/forum/index.ts": +/*!****************************!*\ + !*** ./src/forum/index.ts ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ components: () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_7__.components), +/* harmony export */ extend: () => (/* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_9__["default"]), +/* harmony export */ models: () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_8__.models) +/* harmony export */ }); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _addDiscussionBadge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./addDiscussionBadge */ "./src/forum/addDiscussionBadge.js"); +/* harmony import */ var _addComposerItems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./addComposerItems */ "./src/forum/addComposerItems.js"); +/* harmony import */ var _addPollsLink__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./addPollsLink */ "./src/forum/addPollsLink.js"); +/* harmony import */ var _addPollsToPost__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addPollsToPost */ "./src/forum/addPollsToPost.js"); +/* harmony import */ var _addPostControls__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./addPostControls */ "./src/forum/addPostControls.js"); +/* harmony import */ var _addNavItem__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./addNavItem */ "./src/forum/addNavItem.ts"); +/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components */ "./src/forum/components/index.ts"); +/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./models */ "./src/forum/models/index.ts"); +/* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./extend */ "./src/forum/extend.ts"); + + + + + + + + + +flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('fof/polls', function () { + (0,_addDiscussionBadge__WEBPACK_IMPORTED_MODULE_1__["default"])(); + (0,_addComposerItems__WEBPACK_IMPORTED_MODULE_2__["default"])(); + (0,_addPollsLink__WEBPACK_IMPORTED_MODULE_3__["default"])(); + (0,_addPollsToPost__WEBPACK_IMPORTED_MODULE_4__["default"])(); + (0,_addPostControls__WEBPACK_IMPORTED_MODULE_5__["default"])(); + (0,_addNavItem__WEBPACK_IMPORTED_MODULE_6__["default"])(); +}); + + +/***/ }), + +/***/ "./src/forum/models/Poll.ts": +/*!**********************************!*\ + !*** ./src/forum/models/Poll.ts ***! + \**********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Poll) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/Model */ "flarum/common/Model"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__); + + +var Poll = /*#__PURE__*/function (_Model) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(Poll, _Model); + function Poll() { + return _Model.apply(this, arguments) || this; + } + var _proto = Poll.prototype; + _proto.question = function question() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('question').call(this); + }; + _proto.hasEnded = function hasEnded() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('hasEnded').call(this); + }; + _proto.endDate = function endDate() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('endDate', (flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().transformDate)).call(this); + }; + _proto.publicPoll = function publicPoll() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('publicPoll').call(this); + }; + _proto.hideVotes = function hideVotes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('hideVotes').call(this); + }; + _proto.allowChangeVote = function allowChangeVote() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('allowChangeVote').call(this); + }; + _proto.allowMultipleVotes = function allowMultipleVotes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('allowMultipleVotes').call(this); + }; + _proto.maxVotes = function maxVotes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('maxVotes').call(this); + }; + _proto.voteCount = function voteCount() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('voteCount').call(this); + }; + _proto.canVote = function canVote() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('canVote').call(this); + }; + _proto.canEdit = function canEdit() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('canEdit').call(this); + }; + _proto.canDelete = function canDelete() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('canDelete').call(this); + }; + _proto.canSeeVoters = function canSeeVoters() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('canSeeVoters').call(this); + }; + _proto.canChangeVote = function canChangeVote() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('canChangeVote').call(this); + }; + _proto.options = function options() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasMany('options').call(this); + }; + _proto.votes = function votes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasMany('votes').call(this); + }; + _proto.myVotes = function myVotes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasMany('myVotes').call(this); + }; + _proto.isGlobal = function isGlobal() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('isGlobal').call(this); + }; + _proto.apiEndpoint = function apiEndpoint() { + /** @ts-ignore */ + return "/fof/polls" + (this.exists ? "/" + this.data.id : ''); + }; + return Poll; +}((flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default())); + + +/***/ }), + +/***/ "./src/forum/models/PollOption.ts": +/*!****************************************!*\ + !*** ./src/forum/models/PollOption.ts ***! + \****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PollOption) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/Model */ "flarum/common/Model"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__); + + +var PollOption = /*#__PURE__*/function (_Model) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(PollOption, _Model); + function PollOption() { + return _Model.apply(this, arguments) || this; + } + var _proto = PollOption.prototype; + _proto.answer = function answer() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('answer').call(this); + }; + _proto.imageUrl = function imageUrl() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('imageUrl').call(this); + }; + _proto.voteCount = function voteCount() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('voteCount').call(this); + }; + _proto.poll = function poll() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasOne('polls').call(this); + }; + _proto.votes = function votes() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasMany('votes').call(this); + }; + _proto.apiEndpoint = function apiEndpoint() { + /** @ts-ignore */ + return "/fof/polls/answers" + (this.exists ? "/" + this.data.id : ''); + }; + return PollOption; +}((flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default())); + + +/***/ }), + +/***/ "./src/forum/models/PollVote.ts": +/*!**************************************!*\ + !*** ./src/forum/models/PollVote.ts ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PollVote) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/Model */ "flarum/common/Model"); +/* harmony import */ var flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_Model__WEBPACK_IMPORTED_MODULE_1__); + + +var PollVote = /*#__PURE__*/function (_Model) { + (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(PollVote, _Model); + function PollVote() { + return _Model.apply(this, arguments) || this; + } + var _proto = PollVote.prototype; + _proto.poll = function poll() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasOne('poll').call(this); + }; + _proto.option = function option() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasOne('option').call(this); + }; + _proto.user = function user() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().hasOne('user').call(this); + }; + _proto.pollId = function pollId() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('pollId').call(this); + }; + _proto.optionId = function optionId() { + return flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default().attribute('optionId').call(this); + }; + _proto.apiEndpoint = function apiEndpoint() { + return "/fof/polls/" + this.pollId() + "/vote"; + }; + return PollVote; +}((flarum_common_Model__WEBPACK_IMPORTED_MODULE_1___default())); + + +/***/ }), + +/***/ "./src/forum/models/index.ts": +/*!***********************************!*\ + !*** ./src/forum/models/index.ts ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ models: () => (/* binding */ models) +/* harmony export */ }); +/* harmony import */ var _Poll__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Poll */ "./src/forum/models/Poll.ts"); +/* harmony import */ var _PollOption__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PollOption */ "./src/forum/models/PollOption.ts"); +/* harmony import */ var _PollVote__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PollVote */ "./src/forum/models/PollVote.ts"); + + + +var models = { + Poll: _Poll__WEBPACK_IMPORTED_MODULE_0__["default"], + PollOption: _PollOption__WEBPACK_IMPORTED_MODULE_1__["default"], + PollVote: _PollVote__WEBPACK_IMPORTED_MODULE_2__["default"] +}; + +/***/ }), + +/***/ "./src/forum/states/PollFormState.js": +/*!*******************************************!*\ + !*** ./src/forum/states/PollFormState.js ***! + \*******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ PollFormState) +/* harmony export */ }); +/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); +/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_2__); + + + +var PollFormState = /*#__PURE__*/function () { + function PollFormState(poll) { + if (!poll) { + poll = flarum_forum_app__WEBPACK_IMPORTED_MODULE_2___default().store.createRecord('polls'); + poll.pushAttributes({ + question: '', + endDate: '', + publicPoll: false, + allowMultipleVotes: false, + hideVotes: false, + allowChangeVote: false, + maxVotes: 0 + }); + poll.pushData({ + relationships: { + options: [] + } + }); + } + this.loading = false; + this.deleting = false; + this.poll = poll; + this.expandedGroup = 'setup'; + } + var _proto = PollFormState.prototype; + _proto.isExpanded = function isExpanded(groupKey) { + return this.expandedGroup === groupKey; + }; + _proto.expand = function expand(groupKey) { + this.expandedGroup = groupKey; + m.redraw(); + }; + _proto.save = /*#__PURE__*/function () { + var _save = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee(data) { + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + this.loading = true; + m.redraw(); + _context.prev = 2; + _context.next = 5; + return this.poll.save(data); + case 5: + this.poll = _context.sent; + case 6: + _context.prev = 6; + this.loading = false; + m.redraw(); + return _context.finish(6); + case 10: + case "end": + return _context.stop(); + } + }, _callee, this, [[2,, 6, 10]]); + })); + function save(_x) { + return _save.apply(this, arguments); + } + return save; + }(); + _proto["delete"] = /*#__PURE__*/function () { + var _delete2 = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee2() { + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + this.loading = true; + m.redraw(); + _context2.prev = 2; + _context2.next = 5; + return this.poll["delete"](); + case 5: + this.deleting = true; + case 6: + _context2.prev = 6; + this.loading = false; + m.redraw(); + return _context2.finish(6); + case 10: + case "end": + return _context2.stop(); + } + }, _callee2, this, [[2,, 6, 10]]); + })); + function _delete() { + return _delete2.apply(this, arguments); + } + return _delete; + }(); + return PollFormState; +}(); + + +/***/ }), + +/***/ "flarum/common/Component": +/*!*********************************************************!*\ + !*** external "flarum.core.compat['common/Component']" ***! + \*********************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/Component']; + +/***/ }), + +/***/ "flarum/common/Model": +/*!*****************************************************!*\ + !*** external "flarum.core.compat['common/Model']" ***! + \*****************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/Model']; + +/***/ }), + +/***/ "flarum/common/components/Badge": +/*!****************************************************************!*\ + !*** external "flarum.core.compat['common/components/Badge']" ***! + \****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Badge']; + +/***/ }), + +/***/ "flarum/common/components/Button": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/components/Button']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Button']; + +/***/ }), + +/***/ "flarum/common/components/Link": +/*!***************************************************************!*\ + !*** external "flarum.core.compat['common/components/Link']" ***! + \***************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Link']; + +/***/ }), + +/***/ "flarum/common/components/LinkButton": +/*!*********************************************************************!*\ + !*** external "flarum.core.compat['common/components/LinkButton']" ***! + \*********************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/LinkButton']; + +/***/ }), + +/***/ "flarum/common/components/LoadingIndicator": +/*!***************************************************************************!*\ + !*** external "flarum.core.compat['common/components/LoadingIndicator']" ***! + \***************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/LoadingIndicator']; + +/***/ }), + +/***/ "flarum/common/components/Modal": +/*!****************************************************************!*\ + !*** external "flarum.core.compat['common/components/Modal']" ***! + \****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Modal']; + +/***/ }), + +/***/ "flarum/common/components/Page": +/*!***************************************************************!*\ + !*** external "flarum.core.compat['common/components/Page']" ***! + \***************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Page']; + +/***/ }), + +/***/ "flarum/common/components/Select": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/components/Select']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Select']; + +/***/ }), + +/***/ "flarum/common/components/SelectDropdown": +/*!*************************************************************************!*\ + !*** external "flarum.core.compat['common/components/SelectDropdown']" ***! + \*************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/SelectDropdown']; + +/***/ }), + +/***/ "flarum/common/components/Switch": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/components/Switch']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Switch']; + +/***/ }), + +/***/ "flarum/common/components/Tooltip": +/*!******************************************************************!*\ + !*** external "flarum.core.compat['common/components/Tooltip']" ***! + \******************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/components/Tooltip']; + +/***/ }), + +/***/ "flarum/common/extend": +/*!******************************************************!*\ + !*** external "flarum.core.compat['common/extend']" ***! + \******************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/extend']; + +/***/ }), + +/***/ "flarum/common/extenders": +/*!*********************************************************!*\ + !*** external "flarum.core.compat['common/extenders']" ***! + \*********************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/extenders']; + +/***/ }), + +/***/ "flarum/common/helpers/avatar": +/*!**************************************************************!*\ + !*** external "flarum.core.compat['common/helpers/avatar']" ***! + \**************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/helpers/avatar']; + +/***/ }), + +/***/ "flarum/common/helpers/icon": +/*!************************************************************!*\ + !*** external "flarum.core.compat['common/helpers/icon']" ***! + \************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/helpers/icon']; + +/***/ }), + +/***/ "flarum/common/helpers/listItems": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/helpers/listItems']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/helpers/listItems']; + +/***/ }), + +/***/ "flarum/common/helpers/username": +/*!****************************************************************!*\ + !*** external "flarum.core.compat['common/helpers/username']" ***! + \****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/helpers/username']; + +/***/ }), + +/***/ "flarum/common/models/Discussion": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/models/Discussion']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/models/Discussion']; + +/***/ }), + +/***/ "flarum/common/models/Forum": +/*!************************************************************!*\ + !*** external "flarum.core.compat['common/models/Forum']" ***! + \************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/models/Forum']; + +/***/ }), + +/***/ "flarum/common/models/Post": +/*!***********************************************************!*\ + !*** external "flarum.core.compat['common/models/Post']" ***! + \***********************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/models/Post']; + +/***/ }), + +/***/ "flarum/common/utils/ItemList": +/*!**************************************************************!*\ + !*** external "flarum.core.compat['common/utils/ItemList']" ***! + \**************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/utils/ItemList']; + +/***/ }), + +/***/ "flarum/common/utils/Stream": +/*!************************************************************!*\ + !*** external "flarum.core.compat['common/utils/Stream']" ***! + \************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/utils/Stream']; + +/***/ }), + +/***/ "flarum/common/utils/classList": +/*!***************************************************************!*\ + !*** external "flarum.core.compat['common/utils/classList']" ***! + \***************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/utils/classList']; + +/***/ }), + +/***/ "flarum/common/utils/extractText": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['common/utils/extractText']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['common/utils/extractText']; + +/***/ }), + +/***/ "flarum/forum/app": +/*!**************************************************!*\ + !*** external "flarum.core.compat['forum/app']" ***! + \**************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/app']; + +/***/ }), + +/***/ "flarum/forum/components/CommentPost": +/*!*********************************************************************!*\ + !*** external "flarum.core.compat['forum/components/CommentPost']" ***! + \*********************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/CommentPost']; + +/***/ }), + +/***/ "flarum/forum/components/DiscussionComposer": +/*!****************************************************************************!*\ + !*** external "flarum.core.compat['forum/components/DiscussionComposer']" ***! + \****************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/DiscussionComposer']; + +/***/ }), + +/***/ "flarum/forum/components/DiscussionList": +/*!************************************************************************!*\ + !*** external "flarum.core.compat['forum/components/DiscussionList']" ***! + \************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/DiscussionList']; + +/***/ }), + +/***/ "flarum/forum/components/DiscussionPage": +/*!************************************************************************!*\ + !*** external "flarum.core.compat['forum/components/DiscussionPage']" ***! + \************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/DiscussionPage']; + +/***/ }), + +/***/ "flarum/forum/components/IndexPage": +/*!*******************************************************************!*\ + !*** external "flarum.core.compat['forum/components/IndexPage']" ***! + \*******************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/IndexPage']; + +/***/ }), + +/***/ "flarum/forum/components/LogInModal": +/*!********************************************************************!*\ + !*** external "flarum.core.compat['forum/components/LogInModal']" ***! + \********************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/LogInModal']; + +/***/ }), + +/***/ "flarum/forum/components/ReplyComposer": +/*!***********************************************************************!*\ + !*** external "flarum.core.compat['forum/components/ReplyComposer']" ***! + \***********************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/components/ReplyComposer']; + +/***/ }), + +/***/ "flarum/forum/utils/PostControls": +/*!*****************************************************************!*\ + !*** external "flarum.core.compat['forum/utils/PostControls']" ***! + \*****************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = flarum.core.compat['forum/utils/PostControls']; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! + \*******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +function _regeneratorRuntime() { + "use strict"; + + /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + module.exports = _regeneratorRuntime = function _regeneratorRuntime() { + return e; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function define(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function value(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw new Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw new Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + "catch": function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/typeof.js": +/*!*******************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! + \*******************************************************/ +/***/ ((module) => { + +function _typeof(o) { + "@babel/helpers - typeof"; + + return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o); +} +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/regenerator/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@babel/runtime/regenerator/index.js ***! + \**********************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// TODO(Babel 8): Remove this file. + +var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); +module.exports = runtime; + +// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _asyncToGenerator) +/* harmony export */ }); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } +} +function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(undefined); + }); + }; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/construct.js": +/*!**************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/construct.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _construct) +/* harmony export */ }); +/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); +/* harmony import */ var _isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isNativeReflectConstruct.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js"); + + +function _construct(t, e, r) { + if ((0,_isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__["default"])()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(p, r.prototype), p; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": +/*!************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _extends) +/* harmony export */ }); +function _extends() { + _extends = Object.assign ? Object.assign.bind() : function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _getPrototypeOf) +/* harmony export */ }); +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _inheritsLoose) +/* harmony export */ }); +/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); + +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _isNativeFunction) +/* harmony export */ }); +function _isNativeFunction(fn) { + try { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } catch (e) { + return typeof fn === "function"; + } +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _isNativeReflectConstruct) +/* harmony export */ }); +function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { + return !!t; + })(); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _setPrototypeOf) +/* harmony export */ }); +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js": +/*!********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _wrapNativeSuper) +/* harmony export */ }); +/* harmony import */ var _getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"); +/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); +/* harmony import */ var _isNativeFunction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isNativeFunction.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js"); +/* harmony import */ var _construct_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./construct.js */ "./node_modules/@babel/runtime/helpers/esm/construct.js"); + + + + +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !(0,_isNativeFunction_js__WEBPACK_IMPORTED_MODULE_2__["default"])(Class)) return Class; + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + function Wrapper() { + return (0,_construct_js__WEBPACK_IMPORTED_MODULE_3__["default"])(Class, arguments, (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__["default"])(Wrapper, Class); + }; + return _wrapNativeSuper(Class); +} + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!******************!*\ + !*** ./forum.ts ***! + \******************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ components: () => (/* reexport safe */ _src_forum__WEBPACK_IMPORTED_MODULE_0__.components), +/* harmony export */ extend: () => (/* reexport safe */ _src_forum__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ models: () => (/* reexport safe */ _src_forum__WEBPACK_IMPORTED_MODULE_0__.models) +/* harmony export */ }); +/* harmony import */ var _src_forum__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/forum */ "./src/forum/index.ts"); + +})(); + +module.exports = __webpack_exports__; +/******/ })() +; //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 652a3b04..6c270ac9 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,sFCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,2B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCOxD,MCPM,EAA+BF,OAAOC,KAAKC,OAAO,0B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,kC,aCAzC,SAASC,EAAgBhB,EAAGiB,GAKzC,OAJAD,EAAkBf,OAAOiB,eAAiBjB,OAAOiB,eAAeC,OAAS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Y,WACvCvO,IAAAA,QACFA,IAAAA,OAAWoD,MAAK,SAACoL,GACfA,EAAQC,SAASC,KAAKI,OAAO,qBAC/B,GAEJ,IDrEMnC,EAAa,SAAC7B,GAAI,OACtB9K,IAAAA,MAAUqE,KAAKvG,EAAiB,CAC9BgF,SAAU,SAACJ,GAAI,OACb1C,IAAAA,MACGoG,aAAa,SACbE,KAAI8E,GAAC,CAAD,EAEE1I,EAAI,CACPqM,cAAe,CACbjE,KAAAA,KAGJ,CACEpI,KAAM,CACJwC,QAAS,oCAId9B,MAAK,SAAChE,GAAS,IAAA4P,EAGd,OAF6B,OAA7BA,EAAAlE,EAAKmE,gBAAgB,WAAc,MAAnCD,EAA+BtP,MAA/BsP,EAA+BtP,KAAO,CAAEgB,KAAM,QAASuE,GAAI7F,EAAK6F,OAEzD7F,CACT,GAAE,GACN,GAEJkF,EAAAA,EAAAA,QAAO4K,KAAc,sBAAsB,SAAU3O,EAAOuK,IACrDA,EAAKuC,YAAcvC,EAAKlG,gBAC3BrE,EAAME,IACJ,UACAL,EAACS,IAAM,CAACC,KAAK,cAAcC,QAAS4L,EAAWpP,KAAKe,KAAMwM,IACvD9K,IAAAA,WAAeC,MAAM,mCAI9B,GD3BF,G","sources":["webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object","webpack://@fof/polls/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@fof/polls/./src/forum/addDiscussionBadge.js","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionComposer']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/polls/./src/forum/components/CreatePollModal.js","webpack://@fof/polls/./src/forum/addComposerItems.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/LogInModal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Link']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/polls/./src/forum/components/ListVotersModal.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/polls/./src/forum/components/EditPollModal.js","webpack://@fof/polls/./src/forum/components/PostPoll.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/polls/./src/forum/components/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/polls/./src/forum/models/Poll.js","webpack://@fof/polls/./src/forum/models/PollOption.js","webpack://@fof/polls/./src/forum/models/PollVote.js","webpack://@fof/polls/./src/forum/models/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/extenders']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Post']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Forum']\"","webpack://@fof/polls/./src/forum/extend.js","webpack://@fof/polls/./src/forum/index.js","webpack://@fof/polls/./src/forum/addPostControls.js","webpack://@fof/polls/./src/forum/addPollsToPost.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport Discussion from 'flarum/common/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.hasPoll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fas fa-signal',\n }),\n 5\n );\n }\n });\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/ReplyComposer'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Modal from 'flarum/common/components/Modal';\nimport Switch from 'flarum/common/components/Switch';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport default class CreatePollModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.options = [Stream(''), Stream('')];\n this.optionImageUrls = [Stream(''), Stream('')];\n\n this.question = Stream('');\n\n this.endDate = Stream();\n\n this.publicPoll = Stream(false);\n this.hideVotes = Stream(false);\n this.allowChangeVote = Stream(true);\n this.allowMultipleVotes = Stream(false);\n this.maxVotes = Stream(0);\n\n this.datepickerMinDate = this.formatDate(undefined);\n\n const { poll } = this.attrs;\n\n // When re-opening the modal for the same discussion composer where we already set poll attributes\n if (poll && Array.isArray(poll.options)) {\n this.options = [];\n this.optionImageUrls = [];\n poll.options.forEach((option) => {\n this.options.push(Stream(option.answer));\n this.optionImageUrls.push(Stream(option.imageUrl));\n });\n\n this.question(poll.question);\n this.publicPoll(poll.publicPoll);\n this.hideVotes(poll.hideVotes);\n this.allowChangeVote(poll.allowChangeVote);\n this.allowMultipleVotes(poll.allowMultipleVotes);\n this.maxVotes(poll.maxVotes || 0);\n\n this.endDate(this.formatDate(poll.endDate));\n\n // Replace minimum of 'today' for poll end date only if the poll is not already closed\n if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(poll.endDate);\n }\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--medium';\n }\n\n content() {\n return [\n
\n
{this.fields().toArray()}
\n
,\n ];\n }\n\n fields() {\n const items = new ItemList();\n\n items.add(\n 'question',\n
\n \n\n \n
,\n 100\n );\n\n items.add(\n 'answers',\n
\n \n\n {this.displayOptions()}\n
,\n 80\n );\n\n items.add(\n 'date',\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n onclick: this.endDate.bind(this, null),\n })}\n
\n\n {this.endDate() && (\n

\n \n  \n {dayjs(this.endDate()).isBefore(dayjs())\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.endDate()).fromNow() })}\n

\n )}\n
,\n 40\n );\n\n items.add(\n 'public',\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
,\n 20\n );\n\n items.add(\n 'hide-votes',\n
\n \n {app.translator.trans('fof-polls.forum.modal.hide_votes_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-change-vote',\n
\n \n {app.translator.trans('fof-polls.forum.modal.allow_change_vote_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-multiple-votes',\n
\n {Switch.component(\n {\n state: this.allowMultipleVotes() || false,\n onchange: this.allowMultipleVotes,\n },\n app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label')\n )}\n
,\n 15\n );\n\n if (this.allowMultipleVotes()) {\n items.add(\n 'max-votes',\n
\n \n\n \n\n

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

\n
,\n 15\n );\n }\n\n items.add(\n 'submit',\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary PollModal-SubmitButton',\n loading: this.loading,\n },\n app.translator.trans('fof-polls.forum.modal.submit')\n )}\n
,\n -10\n );\n\n return items;\n }\n\n displayOptions() {\n return Object.keys(this.options).map((el, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(option) {\n this.options.splice(option, 1);\n this.optionImageUrls.splice(option, 1);\n }\n\n data() {\n const poll = {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowChangeVote: this.allowChangeVote(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options: [],\n };\n\n this.options.forEach((answer, index) => {\n if (answer()) {\n poll.options.push({\n answer: answer(),\n imageUrl: this.optionImageUrls[index](),\n });\n }\n });\n\n if (this.question() === '') {\n alert(app.translator.trans('fof-polls.forum.modal.include_question'));\n\n return null;\n }\n\n if (poll.options.length < 2) {\n alert(app.translator.trans('fof-polls.forum.modal.min'));\n\n return null;\n }\n\n return poll;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n const data = this.data();\n\n if (data === null) {\n return;\n }\n\n const promise = this.attrs.onsubmit(data);\n\n if (promise instanceof Promise) {\n this.loading = true;\n\n promise.then(this.hide.bind(this), (err) => {\n console.error(err);\n this.onerror(err);\n this.loaded();\n });\n } else {\n app.modal.close();\n }\n }\n\n formatDate(date, def = false) {\n const dayjsDate = dayjs(date);\n\n if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null;\n\n return dayjsDate.format('YYYY-MM-DDTHH:mm');\n }\n\n dateToTimestamp(date) {\n const dayjsDate = dayjs(date);\n\n if (!date || !dayjsDate.isValid()) return false;\n\n return dayjsDate.format();\n }\n}\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\nimport DiscussionComposer from 'flarum/forum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport const addToComposer = (composer) => {\n composer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.composer.fields.poll,\n onsubmit: (poll) => (this.composer.fields.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(composer.prototype, 'headerItems', function (items) {\n const discussion = this.composer.body?.attrs?.discussion;\n const canStartPoll = discussion?.canStartPoll() ?? app.forum.canStartPolls();\n\n if (canStartPoll) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.composer.fields.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(composer.prototype, 'data', function (data) {\n if (this.composer.fields.poll) {\n data.poll = this.composer.fields.poll;\n }\n });\n};\n\nexport default () => {\n addToComposer(DiscussionComposer);\n addToComposer(ReplyComposer);\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/LogInModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","import app from 'flarum/forum/app';\n\nimport Modal from 'flarum/common/components/Modal';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport Stream from 'flarum/common/utils/Stream';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default class ListVotersModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = Stream(true);\n\n app.store\n .find('fof/polls', this.attrs.poll.id(), {\n include: 'votes,votes.user,votes.option',\n })\n .then(() => this.loading(false))\n .finally(() => m.redraw());\n }\n\n className() {\n return 'Modal--medium VotesModal';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return
{this.loading() ? : this.attrs.poll.options().map(this.optionContent.bind(this))}
;\n }\n\n optionContent(opt) {\n const votes = (this.attrs.poll.votes() || []).filter((v) => opt.id() === v.option().id());\n\n return (\n
\n

{opt.answer() + ':'}

\n\n {votes.length ? (\n
{votes.map(this.voteContent.bind(this))}
\n ) : (\n

{app.translator.trans('fof-polls.forum.modal.no_voters')}

\n )}\n
\n );\n }\n\n voteContent(vote) {\n const user = vote.user();\n const attrs = user && { href: app.route.user(user) };\n\n return (\n \n {avatar(user)} {username(user)}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.poll = this.attrs.poll;\n\n this.options = this.poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl()));\n this.question = Stream(this.poll.question());\n this.endDate = Stream(this.formatDate(this.poll.endDate()));\n this.publicPoll = Stream(this.poll.publicPoll());\n this.allowMultipleVotes = Stream(this.poll.allowMultipleVotes());\n this.hideVotes = Stream(this.poll.hideVotes());\n this.allowChangeVote = Stream(this.poll.allowChangeVote());\n this.maxVotes = Stream(this.poll.maxVotes() || 0);\n\n if (this.endDate() && dayjs(this.poll.endDate()).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(this.endDate());\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n\n displayOptions() {\n return this.options.map((opt, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n this.optionImageUrls.splice(i, 1);\n }\n\n data() {\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n o.data.attributes.imageUrl = this.optionImageUrls[i]();\n\n return o.data;\n });\n\n return {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowChangeVote: this.allowChangeVote(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options,\n };\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (this.loading) return;\n\n this.loading = true;\n\n return this.poll\n .save(this.data())\n .then(() => {\n this.hide();\n m.redraw();\n })\n .catch((e) => {\n this.loaded();\n this.onerror(e);\n });\n }\n}\n","import app from 'flarum/forum/app';\n\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LogInModal from 'flarum/forum/components/LogInModal';\nimport ListVotersModal from './ListVotersModal';\nimport classList from 'flarum/common/utils/classList';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport icon from 'flarum/common/helpers/icon';\nimport EditPollModal from './EditPollModal';\n\nexport default class PostPoll extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadingOptions = false;\n\n this.useSubmitUI = !this.attrs.poll?.canChangeVote() && this.attrs.poll?.allowMultipleVotes();\n this.pendingSubmit = false;\n this.pendingOptions = null;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.preventClose = this.preventClose.bind(this);\n window.addEventListener('beforeunload', this.preventClose);\n }\n\n onremove(vnode) {\n super.onremove(vnode);\n\n window.removeEventListener('beforeunload', this.preventClose);\n }\n\n view() {\n const poll = this.attrs.poll;\n const options = poll.options() || [];\n let maxVotes = poll.allowMultipleVotes() ? poll.maxVotes() : 1;\n\n if (maxVotes === 0) maxVotes = options.length;\n\n const infoItems = this.infoItems(maxVotes);\n\n return (\n
\n
\n

{poll.question()}

\n\n {poll.canSeeVoters() && (\n \n
\n\n
\n
{options.map(this.viewOption.bind(this))}
\n\n
\n {!infoItems.isEmpty() &&
{infoItems.toArray()}
}\n\n {this.useSubmitUI && this.pendingSubmit && (\n \n )}\n
\n
\n
\n );\n }\n\n infoItems(maxVotes) {\n const items = new ItemList();\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n\n if (app.session.user && !poll.canVote() && !poll.hasEnded()) {\n items.add(\n 'no-permission',\n \n \n {app.translator.trans('fof-polls.forum.no_permission')}\n \n );\n }\n\n if (poll.endDate()) {\n items.add(\n 'end-date',\n \n \n {poll.hasEnded()\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(poll.endDate()).fromNow() })}\n \n );\n }\n\n if (poll.canVote()) {\n items.add(\n 'max-votes',\n \n \n {app.translator.trans('fof-polls.forum.max_votes_allowed', { max: maxVotes })}\n \n );\n\n if (!poll.canChangeVote()) {\n items.add(\n 'cannot-change-vote',\n \n \n {app.translator.trans('fof-polls.forum.poll.cannot_change_vote')}\n \n );\n }\n }\n\n return items;\n }\n\n viewOption(opt) {\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n const totalVotes = poll.voteCount();\n\n const voted = this.pendingOptions ? this.pendingOptions.has(opt.id()) : poll.myVotes()?.some?.((vote) => vote.option() === opt);\n const votes = opt.voteCount();\n const percent = totalVotes > 0 ? Math.round((votes / totalVotes) * 100) : 0;\n\n // isNaN(null) is false, so we have to check type directly now that API always returns the field\n const canSeeVoteCount = typeof votes === 'number';\n const isDisabled = this.loadingOptions || (hasVoted && !poll.canChangeVote());\n const width = canSeeVoteCount ? percent : (Number(voted) / (poll.myVotes()?.length || 1)) * 100;\n\n const showCheckmark = !app.session.user || (!poll.hasEnded() && poll.canVote() && (!hasVoted || poll.canChangeVote()));\n\n const bar = (\n
\n {showCheckmark && (\n \n )}\n\n
\n {opt.answer()}\n {voted && !showCheckmark && icon('fas fa-check-circle', { className: 'PollAnswer-check' })}\n {canSeeVoteCount && {percent}%}\n
\n\n {opt.imageUrl() ? {opt.answer()} : null}\n
\n );\n\n return (\n \n {canSeeVoteCount ? (\n \n {bar}\n \n ) : (\n bar\n )}\n \n );\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n const optionIds = this.pendingOptions || new Set(this.attrs.poll.myVotes().map?.((v) => v.option().id()));\n const isUnvoting = optionIds.delete(option.id());\n const allowsMultiple = this.attrs.poll.allowMultipleVotes();\n\n if (!allowsMultiple) {\n optionIds.clear();\n }\n\n if (!isUnvoting) {\n optionIds.add(option.id());\n }\n\n if (this.useSubmitUI) {\n this.pendingOptions = optionIds.size ? optionIds : null;\n this.pendingSubmit = !!this.pendingOptions;\n return;\n }\n\n return this.submit(optionIds, null, () => (evt.target.checked = isUnvoting));\n }\n\n onsubmit() {\n return this.submit(this.pendingOptions, () => {\n this.pendingOptions = null;\n this.pendingSubmit = false;\n });\n }\n\n submit(optionIds, cb, onerror) {\n this.loadingOptions = true;\n m.redraw();\n\n return app\n .request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.attrs.poll.id()}/votes`,\n body: {\n data: {\n optionIds: Array.from(optionIds),\n },\n },\n })\n .then((res) => {\n app.store.pushPayload(res);\n cb?.();\n })\n .catch((err) => {\n onerror?.(err);\n })\n .finally(() => {\n this.loadingOptions = false;\n\n m.redraw();\n });\n }\n\n showVoters() {\n // Load all the votes only when opening the votes list\n app.modal.show(ListVotersModal, {\n poll: this.attrs.poll,\n post: this.attrs.post,\n });\n }\n\n deletePoll() {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n this.attrs.poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n }\n\n /**\n * Attempting to use the `tooltipVisible` attr on the Tooltip component set to 'false' when no vote count\n * caused the tooltip to break on click. This is a workaround to hide the tooltip when no vote count is available,\n * called on 'onremove' of the Tooltip component. It doesn't always work as intended either, but it does the job.\n */\n hideOptionTooltip(vnode) {\n vnode.attrs.tooltipVisible = false;\n vnode.state.updateVisibility();\n }\n\n /**\n * Alert before navigating away using browser's 'beforeunload' event\n */\n preventClose(e) {\n if (this.pendingOptions) {\n e.preventDefault();\n return true;\n }\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","import CreatePollModal from './CreatePollModal';\nimport PostPoll from './PostPoll';\nimport EditPollModal from './EditPollModal';\nimport ListVotersModal from './ListVotersModal';\n\nexport const components = {\n CreatePollModal,\n PostPoll,\n EditPollModal,\n ListVotersModal,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from 'flarum/common/Model';\n\nexport default class Poll extends Model {\n question = Model.attribute('question');\n hasEnded = Model.attribute('hasEnded');\n endDate = Model.attribute('endDate');\n\n publicPoll = Model.attribute('publicPoll');\n hideVotes = Model.attribute('hideVotes');\n allowChangeVote = Model.attribute('allowChangeVote');\n allowMultipleVotes = Model.attribute('allowMultipleVotes');\n maxVotes = Model.attribute('maxVotes');\n\n voteCount = Model.attribute('voteCount');\n\n canVote = Model.attribute('canVote');\n canEdit = Model.attribute('canEdit');\n canDelete = Model.attribute('canDelete');\n canSeeVoters = Model.attribute('canSeeVoters');\n canChangeVote = Model.attribute('canChangeVote');\n\n options = Model.hasMany('options');\n votes = Model.hasMany('votes');\n myVotes = Model.hasMany('myVotes');\n\n apiEndpoint() {\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollOption extends Model {\n answer = Model.attribute('answer');\n imageUrl = Model.attribute('imageUrl');\n voteCount = Model.attribute('voteCount');\n\n poll = Model.hasOne('polls');\n votes = Model.hasMany('votes');\n\n apiEndpoint() {\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollVote extends Model {\n poll = Model.hasOne('poll');\n option = Model.hasOne('option');\n user = Model.hasOne('user');\n\n pollId = Model.attribute('pollId');\n optionId = Model.attribute('optionId');\n\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Poll from './Poll';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport const models = {\n Poll,\n PollOption,\n PollVote,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Forum'];","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport Forum from 'flarum/common/models/Forum';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\n\nexport default [\n new Extend.Store().add('polls', Poll).add('poll_options', PollOption).add('poll_votes', PollVote),\n\n new Extend.Model(Post).hasMany('polls').attribute('canStartPoll'),\n\n new Extend.Model(Forum).attribute('canStartPolls'),\n\n new Extend.Model(Discussion).attribute('hasPoll').attribute('canStartPoll'),\n];\n","import app from 'flarum/forum/app';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addComposerItems from './addComposerItems';\nimport addPollsToPost from './addPollsToPost';\nimport addPostControls from './addPostControls';\n\nexport * from './components';\nexport * from './models';\n\napp.initializers.add('fof/polls', () => {\n addDiscussionBadge();\n addComposerItems();\n addPollsToPost();\n addPostControls();\n});\n\nexport { default as extend } from './extend';\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CreatePollModal from './components/CreatePollModal';\nimport Button from 'flarum/common/components/Button';\n\nexport default () => {\n const createPoll = (post) =>\n app.modal.show(CreatePollModal, {\n onsubmit: (data) =>\n app.store\n .createRecord('polls')\n .save(\n {\n ...data,\n relationships: {\n post,\n },\n },\n {\n data: {\n include: 'options,myVotes,myVotes.option',\n },\n }\n )\n .then((poll) => {\n post.rawRelationship('polls')?.push?.({ type: 'polls', id: poll.id() });\n\n return poll;\n }),\n });\n\n extend(PostControls, 'moderationControls', function (items, post) {\n if (!post.isHidden() && post.canStartPoll()) {\n items.add(\n 'addPoll',\n \n );\n }\n });\n};\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPoll from './components/PostPoll';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const post = this.attrs.post;\n\n if ((!post.isHidden() || this.revealContent) && post.polls()) {\n for (const poll of post.polls()) {\n if (poll) {\n content.push();\n }\n }\n }\n });\n\n extend(CommentPost.prototype, 'oninit', function () {\n this.subtree.check(() => {\n const polls = this.attrs.post.polls();\n\n const checks = polls?.map?.(\n (poll) =>\n poll && [\n poll.data?.attributes,\n poll.options().map?.((option) => option?.data?.attributes),\n poll.myVotes().map?.((vote) => vote.option()?.id()),\n ]\n );\n\n return JSON.stringify(checks);\n });\n });\n\n extend(DiscussionPage.prototype, 'oncreate', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n // We will listen for updates to all polls and options\n // Even if that model is not in the current discussion, it doesn't really matter\n binding.channels.main.bind('updatedPollOptions', (data) => {\n const poll = app.store.getById('polls', data['pollId']);\n\n if (poll) {\n poll.pushAttributes({\n voteCount: data['pollVoteCount'],\n });\n\n // Not redrawing here, as the option below should trigger the redraw already\n }\n\n const changedOptions = data['options'];\n\n for (const optionId in changedOptions) {\n const option = app.store.getById('poll_options', optionId);\n\n if (option && option.voteCount() !== undefined) {\n option.pushAttributes({\n voteCount: changedOptions[optionId],\n });\n }\n }\n\n m.redraw();\n });\n });\n }\n });\n\n extend(DiscussionPage.prototype, 'onremove', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n binding.channels.main.unbind('updatedPollOptions');\n });\n }\n });\n};\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","CreatePollModal","_Modal","apply","arguments","_proto","oninit","vnode","_this","this","options","Stream","optionImageUrls","question","endDate","publicPoll","hideVotes","allowChangeVote","allowMultipleVotes","maxVotes","datepickerMinDate","formatDate","undefined","poll","attrs","Array","isArray","forEach","option","push","answer","imageUrl","dayjs","isAfter","title","app","trans","className","content","m","fields","toArray","items","ItemList","add","type","name","bidi","Button","icon","onclick","addOption","displayOptions","min","max","class","isBefore","time","fromNow","Switch","state","onchange","disabled","length","loading","_this2","keys","map","el","i","placeholder","attribute","removeOption","Math","alert","extractText","splice","data","_this3","dateToTimestamp","index","onsubmit","e","_this4","preventDefault","promise","Promise","then","hide","err","console","error","onerror","loaded","close","date","def","dayjsDate","isValid","format","Modal","addToComposer","composer","addPoll","show","extend","_this$composer$body","_this$composer$body$a","_discussion$canStartP","discussion","body","canStartPoll","canStartPolls","classList","ListVotersModal","find","id","include","redraw","LoadingIndicator","optionContent","opt","votes","filter","v","voteContent","vote","user","href","Link","avatar","username","EditPollModal","_CreatePollModal","optionAnswers","createRecord","attributes","save","PostPoll","_Component","_this$attrs$poll","_this$attrs$poll2","loadingOptions","useSubmitUI","canChangeVote","pendingSubmit","pendingOptions","oncreate","preventClose","window","addEventListener","onremove","removeEventListener","view","infoItems","canSeeVoters","Tooltip","text","showVoters","canEdit","canDelete","deletePoll","viewOption","isEmpty","_poll$myVotes","hasVoted","myVotes","canVote","hasEnded","_poll$myVotes2","_poll$myVotes3","_poll$myVotes4","totalVotes","voteCount","voted","has","some","percent","round","canSeeVoteCount","isDisabled","width","Number","showCheckmark","bar","style","changeVote","checked","src","alt","count","hideOptionTooltip","evt","_this$attrs$poll$myVo","_this$attrs$poll$myVo2","LogInModal","target","optionIds","Set","isUnvoting","clear","size","submit","cb","method","url","from","res","pushPayload","post","confirm","sync","tooltipVisible","updateVisibility","Component","_extends","assign","source","components","Poll","_Model","_len","args","_key","concat","Model","apiEndpoint","exists","PollOption","PollVote","pollId","optionId","models","Extend","Post","hasMany","Forum","Discussion","createPoll","DiscussionList","params","badges","hasPoll","Badge","label","DiscussionComposer","ReplyComposer","CommentPost","isHidden","revealContent","polls","_step","_iterator","_createForOfIteratorHelperLoose","done","subtree","check","checks","_poll$data","_poll$options$map","_poll$options","_poll$myVotes$map","_option$data","_vote$option","JSON","stringify","DiscussionPage","binding","channels","main","getById","pushAttributes","changedOptions","unbind","relationships","_post$rawRelationship","rawRelationship","PostControls"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";;;;;;;;;;;;;;AAAO,IAAMA,IAAI,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAI;AAEW;AACQ;AACsB;AACV;AAEP;AAEpD,IAAMO,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,QAAQ,EAAK;EACzCA,QAAQ,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yC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@fof/polls/./src/common/index.js","webpack://@fof/polls/./src/forum/addComposerItems.js","webpack://@fof/polls/./src/forum/addDiscussionBadge.js","webpack://@fof/polls/./src/forum/addNavItem.ts","webpack://@fof/polls/./src/forum/addPollsLink.js","webpack://@fof/polls/./src/forum/addPollsToPost.js","webpack://@fof/polls/./src/forum/addPostControls.js","webpack://@fof/polls/./src/forum/components/CreatePollModal.js","webpack://@fof/polls/./src/forum/components/EditPollModal.js","webpack://@fof/polls/./src/forum/components/ListVotersModal.js","webpack://@fof/polls/./src/forum/components/PollForm.js","webpack://@fof/polls/./src/forum/components/PollsDirectory.tsx","webpack://@fof/polls/./src/forum/components/PostPoll.js","webpack://@fof/polls/./src/forum/components/form/FormError.js","webpack://@fof/polls/./src/forum/components/index.ts","webpack://@fof/polls/./src/forum/extend.ts","webpack://@fof/polls/./src/forum/index.ts","webpack://@fof/polls/./src/forum/models/Poll.ts","webpack://@fof/polls/./src/forum/models/PollOption.ts","webpack://@fof/polls/./src/forum/models/PollVote.ts","webpack://@fof/polls/./src/forum/models/index.ts","webpack://@fof/polls/./src/forum/states/PollFormState.js","webpack://@fof/polls/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Link']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Page']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Select']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/SelectDropdown']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/extenders']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/listItems']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Forum']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Post']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionComposer']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/LogInModal']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/typeof.js","webpack://@fof/polls/./node_modules/@babel/runtime/regenerator/index.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/construct.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js","webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object"],"sourcesContent":["export const slug = 'fof-polls';","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\nimport DiscussionComposer from 'flarum/forum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport const addToComposer = (composer) => {\n composer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.composer.fields.poll,\n onsubmit: (poll) => (this.composer.fields.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(composer.prototype, 'headerItems', function (items) {\n const discussion = this.composer.body?.attrs?.discussion;\n const canStartPoll = discussion?.canStartPoll() ?? app.forum.canStartPolls();\n\n if (canStartPoll) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.composer.fields.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(composer.prototype, 'data', function (data) {\n if (this.composer.fields.poll) {\n data.poll = this.composer.fields.poll;\n }\n });\n};\n\nexport default () => {\n addToComposer(DiscussionComposer);\n addToComposer(ReplyComposer);\n};\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport Discussion from 'flarum/common/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.hasPoll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fas fa-signal',\n }),\n 5\n );\n }\n });\n};\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\n\nexport default function addNavItem() {\n extend(IndexPage.prototype, 'navItems', (items) => {\n items.add(\n 'fof-polls-directory',\n LinkButton.component(\n {\n href: app.route('fof_polls_directory'),\n icon: 'fas fa-poll',\n },\n app.translator.trans('fof-polls.forum.page.nav')\n ),\n 35\n );\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\n\nimport app from 'flarum/forum/app';\n\nexport default function () {\n extend(IndexPage.prototype, 'navItems', function (items) {\n items.add(\n 'polls',\n \n Polls\n ,\n -11\n );\n });\n}\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPoll from './components/PostPoll';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const post = this.attrs.post;\n\n if ((!post.isHidden() || this.revealContent) && post.polls()) {\n for (const poll of post.polls()) {\n if (poll) {\n content.push();\n }\n }\n }\n });\n\n extend(CommentPost.prototype, 'oninit', function () {\n this.subtree.check(() => {\n const polls = this.attrs.post.polls();\n\n const checks = polls?.map?.(\n (poll) =>\n poll && [\n poll.data?.attributes,\n poll.options().map?.((option) => option?.data?.attributes),\n poll.myVotes().map?.((vote) => vote.option()?.id()),\n ]\n );\n\n return JSON.stringify(checks);\n });\n });\n\n extend(DiscussionPage.prototype, 'oncreate', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n // We will listen for updates to all polls and options\n // Even if that model is not in the current discussion, it doesn't really matter\n binding.channels.main.bind('updatedPollOptions', (data) => {\n const poll = app.store.getById('polls', data['pollId']);\n\n if (poll) {\n poll.pushAttributes({\n voteCount: data['pollVoteCount'],\n });\n\n // Not redrawing here, as the option below should trigger the redraw already\n }\n\n const changedOptions = data['options'];\n\n for (const optionId in changedOptions) {\n const option = app.store.getById('poll_options', optionId);\n\n if (option && option.voteCount() !== undefined) {\n option.pushAttributes({\n voteCount: changedOptions[optionId],\n });\n }\n }\n\n m.redraw();\n });\n });\n }\n });\n\n extend(DiscussionPage.prototype, 'onremove', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n binding.channels.main.unbind('updatedPollOptions');\n });\n }\n });\n};\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CreatePollModal from './components/CreatePollModal';\nimport Button from 'flarum/common/components/Button';\n\nexport default () => {\n const createPoll = (post) =>\n app.modal.show(CreatePollModal, {\n onsubmit: (data) =>\n app.store\n .createRecord('polls')\n .save(\n {\n ...data,\n relationships: {\n post,\n },\n },\n {\n data: {\n include: 'options,myVotes,myVotes.option',\n },\n }\n )\n .then((poll) => {\n post.rawRelationship('polls')?.push?.({ type: 'polls', id: poll.id() });\n\n return poll;\n }),\n });\n\n extend(PostControls, 'moderationControls', function (items, post) {\n if (!post.isHidden() && post.canStartPoll()) {\n items.add(\n 'addPoll',\n \n );\n }\n });\n};\n","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport PollForm from './PollForm';\n\nexport default class CreatePollModal extends Modal {\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--medium';\n }\n\n content() {\n //@todo check if bind is needed for onsubmit\n return [\n
\n \n
,\n ];\n }\n\n onsubmit(poll) {\n this.hide();\n this.attrs.onsubmit(poll);\n }\n}\n","import app from 'flarum/forum/app';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n}\n","import app from 'flarum/forum/app';\n\nimport Modal from 'flarum/common/components/Modal';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport Stream from 'flarum/common/utils/Stream';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default class ListVotersModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = Stream(true);\n\n app.store\n .find('fof/polls', this.attrs.poll.id(), {\n include: 'votes,votes.user,votes.option',\n })\n .then(() => this.loading(false))\n .finally(() => m.redraw());\n }\n\n className() {\n return 'Modal--medium VotesModal';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return
{this.loading() ? : this.attrs.poll.options().map(this.optionContent.bind(this))}
;\n }\n\n optionContent(opt) {\n const votes = (this.attrs.poll.votes() || []).filter((v) => opt.id() === v.option().id());\n\n return (\n
\n

{opt.answer() + ':'}

\n\n {votes.length ? (\n
{votes.map(this.voteContent.bind(this))}
\n ) : (\n

{app.translator.trans('fof-polls.forum.modal.no_voters')}

\n )}\n
\n );\n }\n\n voteContent(vote) {\n const user = vote.user();\n const attrs = user && { href: app.route.user(user) };\n\n return (\n \n {avatar(user)} {username(user)}\n \n );\n }\n}\n","import {slug} from '../../common';\nimport Component from 'flarum/common/Component';\nimport app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport Switch from 'flarum/common/components/Switch';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\nimport FormError from './form/FormError';\nimport PollFormState from \"../states/PollFormState\";\n\n// Make translation calls shorter\nconst t = app.translator.trans.bind(app.translator);\nconst prfx = `${slug}.forum.poll_form`;\n\nexport default class PollForm extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n this.state = new PollFormState(this.attrs.poll);\n\n // state handles poll initialization\n const poll = this.state.poll;\n\n //@todo way the options are destructured into options (answers) and optionImageUrls\n this.options = poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl()));\n\n this.question = Stream(poll.question());\n this.endDate = Stream(this.formatDate(poll.endDate()));\n this.publicPoll = Stream(poll.publicPoll());\n this.allowMultipleVotes = Stream(poll.allowMultipleVotes());\n this.hideVotes = Stream(poll.hideVotes());\n this.allowChangeVote = Stream(poll.allowChangeVote());\n this.maxVotes = Stream(poll.maxVotes() || 0);\n\n this.datepickerMinDate = this.formatDate(undefined);\n\n // Replace minimum of 'today' for poll end date only if the poll is not already closed\n if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(poll.endDate);\n }\n }\n\n view() {\n return (\n
\n
{this.fields().toArray()}
\n
\n )\n }\n\n fields() {\n const items = new ItemList();\n\n items.add(\n 'question',\n
\n \n\n \n
,\n 100\n );\n\n items.add(\n 'answers',\n
\n \n\n {this.displayOptions()}\n
,\n 80\n );\n\n items.add(\n 'date',\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n onclick: this.endDate.bind(this, null),\n })}\n
\n\n {this.endDate() && (\n

\n \n  \n {dayjs(this.endDate()).isBefore(dayjs())\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', {time: dayjs(this.endDate()).fromNow()})}\n

\n )}\n
,\n 40\n );\n\n items.add(\n 'public',\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
,\n 20\n );\n\n items.add(\n 'hide-votes',\n
\n \n {app.translator.trans('fof-polls.forum.modal.hide_votes_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-change-vote',\n
\n \n {app.translator.trans('fof-polls.forum.modal.allow_change_vote_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-multiple-votes',\n
\n {Switch.component(\n {\n state: this.allowMultipleVotes() || false,\n onchange: this.allowMultipleVotes,\n },\n app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label')\n )}\n
,\n 15\n );\n\n if (this.allowMultipleVotes()) {\n items.add(\n 'max-votes',\n
\n \n\n \n\n

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

\n
,\n 15\n );\n }\n\n items.add(\n 'submit',\n
\n \n {t('fof-polls.forum.modal.submit')}\n \n {this.state.poll.exists && (\n \n {t(`${prfx}.delete`)}\n \n )}\n
,\n -10\n );\n\n return items;\n }\n\n displayOptions() {\n return Object.keys(this.options).map((option, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n this.optionImageUrls.splice(i, 1);\n }\n\n data() {\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n o.data.attributes.imageUrl = this.optionImageUrls[i]();\n\n return o.data;\n });\n\n if (this.question() === '') {\n throw new FormError(app.translator.trans('fof-polls.forum.modal.include_question'));\n }\n\n if (options.length < 2) {\n throw new FormError(app.translator.trans('fof-polls.forum.modal.min'));\n }\n\n return {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowChangeVote: this.allowChangeVote(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options,\n };\n }\n\n async onsubmit(e) {\n e.preventDefault();\n\n try {\n await this.state.save(this.data());\n\n // Show success alert\n const alertId = app.alerts.show(\n {\n type: 'success',\n controls: [\n \n m.route.set(\n app.route('compose-poll', {\n edit: this.state.collection.id(),\n }),\n )\n }>\n {t(`${prfx}.continue_editing`)}\n ,\n ],\n },\n t(`${prfx}.success`),\n );\n\n // Hide alert after 10 seconds\n setTimeout(() => app.alerts.dismiss(alertId), 10000);\n\n // Check if we need to call a custom onsubmit callback\n if(this.attrs.onsubmit) {\n this.attrs.onsubmit(this.state.poll);\n }\n else {\n // Otherwise redirect to pools list\n m.route.set(app.route('polls-manager'));\n }\n } catch (e) {\n if (e instanceof FormError) {\n app.alerts.show({type: 'error'}, e.message);\n } else {\n // Show error alert\n app.alerts.show({type: 'error'}, t(`${prfx}.error`));\n }\n } finally {\n this.state.loading = false;\n m.redraw();\n }\n }\n\n async delete() {\n if (!confirm(t(`${prfx}.delete_confirm`))) {\n return;\n }\n\n try {\n await this.state.delete();\n // Show success alert\n const alertId = app.alerts.show({type: 'success'}, t(`${prfx}.delete_success`));\n\n // Hide alert after 10 seconds\n setTimeout(() => app.alerts.dismiss(alertId), 10000);\n\n // Redirect to polls list\n m.route.set(app.route('polls-manager'));\n } catch (e) {\n // Show error alert\n app.alerts.show({type: 'error'}, t(`${prfx}.delete_error`));\n }\n }\n\n formatDate(date, def = false) {\n const dayjsDate = dayjs(date);\n\n if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null;\n\n return dayjsDate.format('YYYY-MM-DDTHH:mm');\n }\n\n dateToTimestamp(date) {\n const dayjsDate = dayjs(date);\n\n if (!date || !dayjsDate.isValid()) return false;\n\n return dayjsDate.format();\n }\n}","import app from 'flarum/forum/app';\nimport Page from 'flarum/common/components/Page';\nimport extractText from 'flarum/common/utils/extractText';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport listItems from 'flarum/common/helpers/listItems';\nimport SelectDropdown from 'flarum/common/components/SelectDropdown';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport Select from 'flarum/common/components/Select';\nimport Button from 'flarum/common/components/Button';\nimport Mithril from 'mithril';\n\nexport default class PollsDirectory extends Page {\n oncreate(vnode: Mithril.Vnode) {\n super.oncreate(vnode);\n\n app.setTitle(extractText(app.translator.trans('fof-polls.forum.page.nav')));\n }\n\n view() {\n return (\n
\n {IndexPage.prototype.hero()}\n
\n
\n \n
\n
\n
    {listItems(this.viewItems().toArray())}
\n
    {listItems(this.actionItems().toArray())}
\n
\n {/* */}\n
\n
\n
\n
\n );\n }\n\n /**\n * Our own sidebar. Re-uses Index.sidebarItems as the base\n * Elements added here will only show up on the user directory page\n */\n sidebarItems(): ItemList {\n const items = IndexPage.prototype.sidebarItems();\n\n items.setContent(\n 'nav',\n SelectDropdown.component(\n {\n buttonClassName: 'Button',\n className: 'App-titleControl',\n },\n this.navItems().toArray()\n )\n );\n\n return items;\n }\n\n /**\n * Our own sidebar navigation. Re-uses Index.navItems as the base\n * Elements added here will only show up on the user directory page\n */\n navItems(): ItemList {\n const items = IndexPage.prototype.navItems();\n const params = this.stickyParams();\n\n items.setContent(\n 'fof-polls-directory',\n LinkButton.component(\n {\n href: app.route('fof_polls_directory', params),\n icon: 'fas fa-poll',\n },\n app.translator.trans('fof-polls.forum.page.nav')\n )\n );\n\n return items;\n }\n\n stickyParams() {\n return {\n sort: m.route.param('sort'),\n q: m.route.param('q'),\n };\n }\n\n changeParams(sort: string) {\n const params = this.params();\n\n if (sort === app.forum.attribute('pollsDirectoryDefaultSort')) {\n delete params.sort;\n } else {\n params.sort = sort;\n }\n\n this.state.refreshParams(params);\n\n const routeParams = { ...params };\n delete routeParams.qBuilder;\n\n m.route.set(app.route('fof_polls_directory', routeParams));\n }\n\n viewItems() {\n const items = new ItemList();\n const sortMap = this.state.sortMap();\n\n const sortOptions = {};\n for (const i in sortMap) {\n sortOptions[i] = app.translator.trans('fof-polls.lib.sort.' + i);\n }\n\n items.add(\n 'sort',\n Select.component({\n options: sortOptions,\n value: this.state.getParams().sort || app.forum.attribute('pollsDirectoryDefaultSort'),\n onchange: this.changeParams.bind(this),\n }),\n 100\n );\n\n return items;\n }\n\n actionItems(): ItemList {\n const items = new ItemList();\n\n items.add(\n 'refresh',\n Button.component({\n title: app.translator.trans('fof-polls.forum.page.refresh_tooltip'),\n icon: 'fas fa-sync',\n className: 'Button Button--icon',\n onclick: () => {\n this.state.refresh();\n },\n })\n );\n\n return items;\n }\n}\n","import app from 'flarum/forum/app';\n\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LogInModal from 'flarum/forum/components/LogInModal';\nimport ListVotersModal from './ListVotersModal';\nimport classList from 'flarum/common/utils/classList';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport icon from 'flarum/common/helpers/icon';\nimport EditPollModal from './EditPollModal';\n\nexport default class PostPoll extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadingOptions = false;\n\n this.useSubmitUI = !this.attrs.poll?.canChangeVote() && this.attrs.poll?.allowMultipleVotes();\n this.pendingSubmit = false;\n this.pendingOptions = null;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.preventClose = this.preventClose.bind(this);\n window.addEventListener('beforeunload', this.preventClose);\n }\n\n onremove(vnode) {\n super.onremove(vnode);\n\n window.removeEventListener('beforeunload', this.preventClose);\n }\n\n view() {\n const poll = this.attrs.poll;\n const options = poll.options() || [];\n let maxVotes = poll.allowMultipleVotes() ? poll.maxVotes() : 1;\n\n if (maxVotes === 0) maxVotes = options.length;\n\n const infoItems = this.infoItems(maxVotes);\n\n return (\n
\n
\n

{poll.question()}

\n\n {poll.canSeeVoters() && (\n \n
\n\n
\n
{options.map(this.viewOption.bind(this))}
\n\n
\n {!infoItems.isEmpty() &&
{infoItems.toArray()}
}\n\n {this.useSubmitUI && this.pendingSubmit && (\n \n )}\n
\n
\n
\n );\n }\n\n infoItems(maxVotes) {\n const items = new ItemList();\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n\n if (app.session.user && !poll.canVote() && !poll.hasEnded()) {\n items.add(\n 'no-permission',\n \n \n {app.translator.trans('fof-polls.forum.no_permission')}\n \n );\n }\n\n if (poll.endDate()) {\n items.add(\n 'end-date',\n \n \n {poll.hasEnded()\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(poll.endDate()).fromNow() })}\n \n );\n }\n\n if (poll.canVote()) {\n items.add(\n 'max-votes',\n \n \n {app.translator.trans('fof-polls.forum.max_votes_allowed', { max: maxVotes })}\n \n );\n\n if (!poll.canChangeVote()) {\n items.add(\n 'cannot-change-vote',\n \n \n {app.translator.trans('fof-polls.forum.poll.cannot_change_vote')}\n \n );\n }\n }\n\n return items;\n }\n\n viewOption(opt) {\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n const totalVotes = poll.voteCount();\n\n const voted = this.pendingOptions ? this.pendingOptions.has(opt.id()) : poll.myVotes()?.some?.((vote) => vote.option() === opt);\n const votes = opt.voteCount();\n const percent = totalVotes > 0 ? Math.round((votes / totalVotes) * 100) : 0;\n\n // isNaN(null) is false, so we have to check type directly now that API always returns the field\n const canSeeVoteCount = typeof votes === 'number';\n const isDisabled = this.loadingOptions || (hasVoted && !poll.canChangeVote());\n const width = canSeeVoteCount ? percent : (Number(voted) / (poll.myVotes()?.length || 1)) * 100;\n\n const showCheckmark = !app.session.user || (!poll.hasEnded() && poll.canVote() && (!hasVoted || poll.canChangeVote()));\n\n const bar = (\n
\n {showCheckmark && (\n \n )}\n\n
\n {opt.answer()}\n {voted && !showCheckmark && icon('fas fa-check-circle', { className: 'PollAnswer-check' })}\n {canSeeVoteCount && {percent}%}\n
\n\n {opt.imageUrl() ? {opt.answer()} : null}\n
\n );\n\n return (\n \n {canSeeVoteCount ? (\n \n {bar}\n \n ) : (\n bar\n )}\n \n );\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n const optionIds = this.pendingOptions || new Set(this.attrs.poll.myVotes().map?.((v) => v.option().id()));\n const isUnvoting = optionIds.delete(option.id());\n const allowsMultiple = this.attrs.poll.allowMultipleVotes();\n\n if (!allowsMultiple) {\n optionIds.clear();\n }\n\n if (!isUnvoting) {\n optionIds.add(option.id());\n }\n\n if (this.useSubmitUI) {\n this.pendingOptions = optionIds.size ? optionIds : null;\n this.pendingSubmit = !!this.pendingOptions;\n return;\n }\n\n return this.submit(optionIds, null, () => (evt.target.checked = isUnvoting));\n }\n\n onsubmit() {\n return this.submit(this.pendingOptions, () => {\n this.pendingOptions = null;\n this.pendingSubmit = false;\n });\n }\n\n submit(optionIds, cb, onerror) {\n this.loadingOptions = true;\n m.redraw();\n\n return app\n .request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.attrs.poll.id()}/votes`,\n body: {\n data: {\n optionIds: Array.from(optionIds),\n },\n },\n })\n .then((res) => {\n app.store.pushPayload(res);\n cb?.();\n })\n .catch((err) => {\n onerror?.(err);\n })\n .finally(() => {\n this.loadingOptions = false;\n\n m.redraw();\n });\n }\n\n showVoters() {\n // Load all the votes only when opening the votes list\n app.modal.show(ListVotersModal, {\n poll: this.attrs.poll,\n post: this.attrs.post,\n });\n }\n\n deletePoll() {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n this.attrs.poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n }\n\n /**\n * Attempting to use the `tooltipVisible` attr on the Tooltip component set to 'false' when no vote count\n * caused the tooltip to break on click. This is a workaround to hide the tooltip when no vote count is available,\n * called on 'onremove' of the Tooltip component. It doesn't always work as intended either, but it does the job.\n */\n hideOptionTooltip(vnode) {\n vnode.attrs.tooltipVisible = false;\n vnode.state.updateVisibility();\n }\n\n /**\n * Alert before navigating away using browser's 'beforeunload' event\n */\n preventClose(e) {\n if (this.pendingOptions) {\n e.preventDefault();\n return true;\n }\n }\n}\n","export default class FormError extends Error {\n\n}","import CreatePollModal from './CreatePollModal';\nimport PostPoll from './PostPoll';\nimport EditPollModal from './EditPollModal';\nimport ListVotersModal from './ListVotersModal';\nimport PollForm from './PollForm';\n\nexport const components = {\n CreatePollModal,\n PostPoll,\n EditPollModal,\n ListVotersModal,\n PollForm,\n};\n","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport Forum from 'flarum/common/models/Forum';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\nimport PollsDirectory from './components/PollsDirectory';\n\nexport default [\n new Extend.Routes() //\n .add('fof_polls_directory', '/polls', PollsDirectory),\n\n new Extend.Store() //\n .add('polls', Poll)\n .add('poll_options', PollOption)\n .add('poll_votes', PollVote),\n\n new Extend.Model(Post) //\n .hasMany('polls')\n .attribute('canStartPoll'),\n\n new Extend.Model(Forum) //\n .attribute('canStartPolls'),\n\n new Extend.Model(Discussion) //\n .attribute('hasPoll')\n .attribute('canStartPoll'),\n];\n","import app from 'flarum/forum/app';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addComposerItems from './addComposerItems';\nimport addPollsLink from './addPollsLink';\nimport addPollsToPost from './addPollsToPost';\nimport addPostControls from './addPostControls';\nimport addNavItem from './addNavItem';\n\nexport * from './components';\nexport * from './models';\n\nimport PollsPage from './components/PollsPage';\n\napp.initializers.add('fof/polls', () => {\n addDiscussionBadge();\n addComposerItems();\n addPollsLink();\n addPollsToPost();\n addPostControls();\n addNavItem();\n});\n\nexport { default as extend } from './extend';\n","import Model from 'flarum/common/Model';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport default class Poll extends Model {\n question() {\n return Model.attribute('question').call(this);\n }\n\n hasEnded() {\n return Model.attribute('hasEnded').call(this);\n }\n\n endDate() {\n return Model.attribute('endDate', Model.transformDate).call(this);\n }\n\n publicPoll() {\n return Model.attribute('publicPoll').call(this);\n }\n\n hideVotes() {\n return Model.attribute('hideVotes').call(this);\n }\n\n allowChangeVote() {\n return Model.attribute('allowChangeVote').call(this);\n }\n\n allowMultipleVotes() {\n return Model.attribute('allowMultipleVotes').call(this);\n }\n\n maxVotes() {\n return Model.attribute('maxVotes').call(this);\n }\n\n voteCount() {\n return Model.attribute('voteCount').call(this);\n }\n\n canVote() {\n return Model.attribute('canVote').call(this);\n }\n\n canEdit() {\n return Model.attribute('canEdit').call(this);\n }\n\n canDelete() {\n return Model.attribute('canDelete').call(this);\n }\n\n canSeeVoters() {\n return Model.attribute('canSeeVoters').call(this);\n }\n\n canChangeVote() {\n return Model.attribute('canChangeVote').call(this);\n }\n\n options() {\n return Model.hasMany('options').call(this);\n }\n\n votes() {\n return Model.hasMany('votes').call(this);\n }\n\n myVotes() {\n return Model.hasMany('myVotes').call(this);\n }\n\n isGlobal() {\n return Model.attribute('isGlobal').call(this);\n }\n\n apiEndpoint() {\n /** @ts-ignore */\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\nimport Poll from './Poll';\nimport PollVote from './PollVote';\n\nexport default class PollOption extends Model {\n answer() {\n return Model.attribute('answer').call(this);\n }\n\n imageUrl() {\n return Model.attribute('imageUrl').call(this);\n }\n\n voteCount() {\n return Model.attribute('voteCount').call(this);\n }\n\n poll() {\n return Model.hasOne('polls').call(this);\n }\n\n votes() {\n return Model.hasMany('votes').call(this);\n }\n\n apiEndpoint() {\n /** @ts-ignore */\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\nimport Poll from './Poll';\nimport PollOption from './PollOption';\nimport User from 'flarum/common/models/User';\n\nexport default class PollVote extends Model {\n poll() {\n return Model.hasOne('poll').call(this);\n }\n\n option() {\n return Model.hasOne('option').call(this);\n }\n\n user() {\n return Model.hasOne('user').call(this);\n }\n\n pollId() {\n return Model.attribute('pollId').call(this);\n }\n\n optionId() {\n return Model.attribute('optionId').call(this);\n }\n\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Poll from './Poll';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport const models = {\n Poll,\n PollOption,\n PollVote,\n};\n","import app from 'flarum/forum/app';\n\nexport default class PollFormState {\n constructor(poll) {\n if (!poll) {\n poll = app.store.createRecord('polls');\n poll.pushAttributes( {\n question: '',\n endDate: '',\n publicPoll: false,\n allowMultipleVotes: false,\n hideVotes: false,\n allowChangeVote: false,\n maxVotes: 0,\n });\n poll.pushData({relationships: {options: []}});\n }\n\n this.loading = false;\n this.deleting = false;\n this.poll = poll;\n this.expandedGroup = 'setup';\n }\n\n isExpanded(groupKey) {\n return this.expandedGroup === groupKey;\n }\n\n expand(groupKey) {\n this.expandedGroup = groupKey;\n m.redraw();\n }\n\n async save(data) {\n this.loading = true;\n m.redraw();\n\n try {\n this.poll = await this.poll.save(data);\n } finally {\n this.loading = false;\n m.redraw();\n }\n }\n\n async delete() {\n this.loading = true;\n m.redraw();\n\n try {\n await this.poll.delete();\n this.deleting = true;\n } finally {\n this.loading = false;\n m.redraw();\n }\n }\n}\n","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/components/Badge'];","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/components/Link'];","module.exports = flarum.core.compat['common/components/LinkButton'];","module.exports = flarum.core.compat['common/components/LoadingIndicator'];","module.exports = flarum.core.compat['common/components/Modal'];","module.exports = flarum.core.compat['common/components/Page'];","module.exports = flarum.core.compat['common/components/Select'];","module.exports = flarum.core.compat['common/components/SelectDropdown'];","module.exports = flarum.core.compat['common/components/Switch'];","module.exports = flarum.core.compat['common/components/Tooltip'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['common/extenders'];","module.exports = flarum.core.compat['common/helpers/avatar'];","module.exports = flarum.core.compat['common/helpers/icon'];","module.exports = flarum.core.compat['common/helpers/listItems'];","module.exports = flarum.core.compat['common/helpers/username'];","module.exports = flarum.core.compat['common/models/Discussion'];","module.exports = flarum.core.compat['common/models/Forum'];","module.exports = flarum.core.compat['common/models/Post'];","module.exports = flarum.core.compat['common/utils/ItemList'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/utils/classList'];","module.exports = flarum.core.compat['common/utils/extractText'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/CommentPost'];","module.exports = flarum.core.compat['forum/components/DiscussionComposer'];","module.exports = flarum.core.compat['forum/components/DiscussionList'];","module.exports = flarum.core.compat['forum/components/DiscussionPage'];","module.exports = flarum.core.compat['forum/components/IndexPage'];","module.exports = flarum.core.compat['forum/components/LogInModal'];","module.exports = flarum.core.compat['forum/components/ReplyComposer'];","module.exports = flarum.core.compat['forum/utils/PostControls'];","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = Object.defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof Symbol ? Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return Object.defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = Object.getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);\n function defineIteratorMethods(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw new Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], t.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) r.push(n);\n return r.reverse(), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw new Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nexport default function _construct(t, e, r) {\n if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);\n var o = [null];\n o.push.apply(o, e);\n var p = new (t.bind.apply(t, o))();\n return r && setPrototypeOf(p, r.prototype), p;\n}","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","export default function _isNativeFunction(fn) {\n try {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n } catch (e) {\n return typeof fn === \"function\";\n }\n}","export default function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {\n return !!t;\n })();\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeFunction from \"./isNativeFunction.js\";\nimport construct from \"./construct.js\";\nexport default function _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["slug","app","extend","classList","DiscussionComposer","ReplyComposer","CreatePollModal","addToComposer","composer","prototype","addPoll","_this","modal","show","poll","fields","onsubmit","items","_this$composer$body","_discussion$canStartP","discussion","body","attrs","canStartPoll","forum","canStartPolls","add","m","className","onclick","bind","translator","trans","data","Badge","DiscussionList","Discussion","params","include","push","badges","hasPoll","component","type","label","icon","IndexPage","LinkButton","addNavItem","href","route","CommentPost","PostPoll","DiscussionPage","content","post","isHidden","revealContent","polls","_iterator","_createForOfIteratorHelperLoose","_step","done","value","subtree","check","checks","map","_poll$data","_poll$options$map","_poll$options","_poll$myVotes$map","_poll$myVotes","attributes","options","call","option","_option$data","myVotes","vote","_vote$option","id","JSON","stringify","pusher","then","binding","channels","main","store","getById","pushAttributes","voteCount","changedOptions","optionId","undefined","redraw","unbind","PostControls","Button","createPoll","createRecord","save","_extends","relationships","_post$rawRelationship","rawRelationship","Modal","PollForm","_Modal","_inheritsLoose","apply","arguments","_proto","title","hide","default","EditPollModal","_CreatePollModal","avatar","username","Link","Stream","LoadingIndicator","ListVotersModal","oninit","vnode","loading","find","optionContent","opt","votes","filter","v","answer","length","voteContent","user","Component","Switch","ItemList","extractText","FormError","PollFormState","t","prfx","_Component","state","optionAnswers","o","optionImageUrls","imageUrl","question","endDate","formatDate","publicPoll","allowMultipleVotes","hideVotes","allowChangeVote","maxVotes","datepickerMinDate","dayjs","isAfter","view","toArray","name","bidi","addOption","displayOptions","min","max","isBefore","time","fromNow","onchange","disabled","exists","deleting","Object","keys","i","placeholder","attribute","removeOption","Math","alert","splice","_this2","dateToTimestamp","_onsubmit","_asyncToGenerator","_regeneratorRuntime","mark","_callee","e","_this3","alertId","wrap","_callee$","_context","prev","next","preventDefault","alerts","controls","set","edit","collection","setTimeout","dismiss","t0","message","finish","stop","_x","_delete2","_callee2","_callee2$","_context2","confirm","abrupt","_delete","date","def","dayjsDate","isValid","format","Page","listItems","SelectDropdown","Select","PollsDirectory","_Page","oncreate","setTitle","hero","sidebarItems","viewItems","actionItems","setContent","buttonClassName","navItems","stickyParams","sort","param","q","changeParams","refreshParams","routeParams","qBuilder","sortMap","sortOptions","getParams","refresh","LogInModal","Tooltip","_this$attrs$poll","_this$attrs$poll2","loadingOptions","useSubmitUI","canChangeVote","pendingSubmit","pendingOptions","preventClose","window","addEventListener","onremove","removeEventListener","infoItems","canSeeVoters","text","showVoters","canEdit","canDelete","deletePoll","viewOption","isEmpty","hasVoted","session","canVote","hasEnded","_poll$myVotes2","_poll$myVotes3","_poll$myVotes4","totalVotes","voted","has","some","percent","round","canSeeVoteCount","isDisabled","width","Number","showCheckmark","bar","style","changeVote","checked","src","alt","count","hideOptionTooltip","evt","_this$attrs$poll$myVo","_this$attrs$poll$myVo2","target","optionIds","Set","isUnvoting","allowsMultiple","clear","size","submit","cb","onerror","request","method","url","Array","from","res","pushPayload","err","sync","tooltipVisible","updateVisibility","_Error","_wrapNativeSuper","Error","components","Extend","Post","Forum","Poll","PollOption","PollVote","Routes","Store","Model","hasMany","addDiscussionBadge","addComposerItems","addPollsLink","addPollsToPost","addPostControls","initializers","_Model","transformDate","isGlobal","apiEndpoint","hasOne","pollId","models","pushData","expandedGroup","isExpanded","groupKey","expand","_save","sent","_typeof","require","module","exports","__esModule","r","n","hasOwnProperty","defineProperty","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","Generator","create","Context","makeInvokeMethod","tryCatch","arg","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","resolve","__await","callInvokeWithMethodAndArg","delegate","maybeInvokeDelegate","_sent","dispatchException","TypeError","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","isNaN","displayName","isGeneratorFunction","constructor","setPrototypeOf","__proto__","awrap","async","Promise","reverse","pop","charAt","slice","rval","handle","complete","_catch","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","globalThis","Function","asyncGeneratorStep","gen","reject","_next","_throw","key","info","error","fn","self","args","isNativeReflectConstruct","_construct","Reflect","construct","assign","source","_getPrototypeOf","subClass","superClass","_isNativeFunction","toString","indexOf","_isNativeReflectConstruct","Boolean","valueOf","_setPrototypeOf","isNativeFunction","Class","_cache","Map","get","Wrapper"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/common/index.js b/js/src/common/index.js new file mode 100644 index 00000000..b6f1cc5a --- /dev/null +++ b/js/src/common/index.js @@ -0,0 +1 @@ +export const slug = 'fof-polls'; \ No newline at end of file diff --git a/js/src/forum/components/CreatePollModal.js b/js/src/forum/components/CreatePollModal.js index 6eace313..bbff6ed0 100755 --- a/js/src/forum/components/CreatePollModal.js +++ b/js/src/forum/components/CreatePollModal.js @@ -1,57 +1,8 @@ import app from 'flarum/forum/app'; - -import Button from 'flarum/common/components/Button'; import Modal from 'flarum/common/components/Modal'; -import Switch from 'flarum/common/components/Switch'; -import ItemList from 'flarum/common/utils/ItemList'; -import Stream from 'flarum/common/utils/Stream'; -import extractText from 'flarum/common/utils/extractText'; +import PollForm from './PollForm'; export default class CreatePollModal extends Modal { - oninit(vnode) { - super.oninit(vnode); - - this.options = [Stream(''), Stream('')]; - this.optionImageUrls = [Stream(''), Stream('')]; - - this.question = Stream(''); - - this.endDate = Stream(); - - this.publicPoll = Stream(false); - this.hideVotes = Stream(false); - this.allowChangeVote = Stream(true); - this.allowMultipleVotes = Stream(false); - this.maxVotes = Stream(0); - - this.datepickerMinDate = this.formatDate(undefined); - - const { poll } = this.attrs; - - // When re-opening the modal for the same discussion composer where we already set poll attributes - if (poll && Array.isArray(poll.options)) { - this.options = []; - this.optionImageUrls = []; - poll.options.forEach((option) => { - this.options.push(Stream(option.answer)); - this.optionImageUrls.push(Stream(option.imageUrl)); - }); - - this.question(poll.question); - this.publicPoll(poll.publicPoll); - this.hideVotes(poll.hideVotes); - this.allowChangeVote(poll.allowChangeVote); - this.allowMultipleVotes(poll.allowMultipleVotes); - this.maxVotes(poll.maxVotes || 0); - - this.endDate(this.formatDate(poll.endDate)); - - // Replace minimum of 'today' for poll end date only if the poll is not already closed - if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) { - this.datepickerMinDate = this.formatDate(poll.endDate); - } - } - } title() { return app.translator.trans('fof-polls.forum.modal.add_title'); @@ -62,280 +13,16 @@ export default class CreatePollModal extends Modal { } content() { + //@todo check if bind is needed for onsubmit return [
-
{this.fields().toArray()}
+
, ]; } - fields() { - const items = new ItemList(); - - items.add( - 'question', -
- - - -
, - 100 - ); - - items.add( - 'answers', -
- - - {this.displayOptions()} -
, - 80 - ); - - items.add( - 'date', -
- - -
- - {Button.component({ - className: 'Button PollModal--button', - icon: 'fas fa-times', - onclick: this.endDate.bind(this, null), - })} -
- - {this.endDate() && ( -

- -   - {dayjs(this.endDate()).isBefore(dayjs()) - ? app.translator.trans('fof-polls.forum.poll_ended') - : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.endDate()).fromNow() })} -

- )} -
, - 40 - ); - - items.add( - 'public', -
- {Switch.component( - { - state: this.publicPoll() || false, - onchange: this.publicPoll, - }, - app.translator.trans('fof-polls.forum.modal.public_poll_label') - )} -
, - 20 - ); - - items.add( - 'hide-votes', -
- - {app.translator.trans('fof-polls.forum.modal.hide_votes_label')} - -
, - 20 - ); - - items.add( - 'allow-change-vote', -
- - {app.translator.trans('fof-polls.forum.modal.allow_change_vote_label')} - -
, - 20 - ); - - items.add( - 'allow-multiple-votes', -
- {Switch.component( - { - state: this.allowMultipleVotes() || false, - onchange: this.allowMultipleVotes, - }, - app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label') - )} -
, - 15 - ); - - if (this.allowMultipleVotes()) { - items.add( - 'max-votes', -
- - - - -

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

-
, - 15 - ); - } - - items.add( - 'submit', -
- {Button.component( - { - type: 'submit', - className: 'Button Button--primary PollModal-SubmitButton', - loading: this.loading, - }, - app.translator.trans('fof-polls.forum.modal.submit') - )} -
, - -10 - ); - - return items; - } - - displayOptions() { - return Object.keys(this.options).map((el, i) => ( -
-
- - {app.forum.attribute('allowPollOptionImage') ? ( - - ) : null} -
- {i >= 2 - ? Button.component({ - type: 'button', - className: 'Button Button--warning PollModal--button', - icon: 'fas fa-minus', - onclick: i >= 2 ? this.removeOption.bind(this, i) : '', - }) - : ''} -
- )); - } - - addOption() { - const max = Math.max(app.forum.attribute('pollMaxOptions'), 2); - - if (this.options.length < max) { - this.options.push(Stream('')); - this.optionImageUrls.push(Stream('')); - } else { - alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max }))); - } - } - - removeOption(option) { - this.options.splice(option, 1); - this.optionImageUrls.splice(option, 1); - } - - data() { - const poll = { - question: this.question(), - endDate: this.dateToTimestamp(this.endDate()), - publicPoll: this.publicPoll(), - hideVotes: this.hideVotes(), - allowChangeVote: this.allowChangeVote(), - allowMultipleVotes: this.allowMultipleVotes(), - maxVotes: this.maxVotes(), - options: [], - }; - - this.options.forEach((answer, index) => { - if (answer()) { - poll.options.push({ - answer: answer(), - imageUrl: this.optionImageUrls[index](), - }); - } - }); - - if (this.question() === '') { - alert(app.translator.trans('fof-polls.forum.modal.include_question')); - - return null; - } - - if (poll.options.length < 2) { - alert(app.translator.trans('fof-polls.forum.modal.min')); - - return null; - } - - return poll; - } - - onsubmit(e) { - e.preventDefault(); - - const data = this.data(); - - if (data === null) { - return; - } - - const promise = this.attrs.onsubmit(data); - - if (promise instanceof Promise) { - this.loading = true; - - promise.then(this.hide.bind(this), (err) => { - console.error(err); - this.onerror(err); - this.loaded(); - }); - } else { - app.modal.close(); - } - } - - formatDate(date, def = false) { - const dayjsDate = dayjs(date); - - if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null; - - return dayjsDate.format('YYYY-MM-DDTHH:mm'); - } - - dateToTimestamp(date) { - const dayjsDate = dayjs(date); - - if (!date || !dayjsDate.isValid()) return false; - - return dayjsDate.format(); + onsubmit(poll) { + this.hide(); + this.attrs.onsubmit(poll); } } diff --git a/js/src/forum/components/EditPollModal.js b/js/src/forum/components/EditPollModal.js index 23203a35..304a6470 100755 --- a/js/src/forum/components/EditPollModal.js +++ b/js/src/forum/components/EditPollModal.js @@ -1,126 +1,8 @@ import app from 'flarum/forum/app'; - -import Button from 'flarum/common/components/Button'; -import Stream from 'flarum/common/utils/Stream'; -import extractText from 'flarum/common/utils/extractText'; import CreatePollModal from './CreatePollModal'; export default class EditPollModal extends CreatePollModal { - oninit(vnode) { - super.oninit(vnode); - - this.poll = this.attrs.poll; - - this.options = this.poll.options(); - this.optionAnswers = this.options.map((o) => Stream(o.answer())); - this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl())); - this.question = Stream(this.poll.question()); - this.endDate = Stream(this.formatDate(this.poll.endDate())); - this.publicPoll = Stream(this.poll.publicPoll()); - this.allowMultipleVotes = Stream(this.poll.allowMultipleVotes()); - this.hideVotes = Stream(this.poll.hideVotes()); - this.allowChangeVote = Stream(this.poll.allowChangeVote()); - this.maxVotes = Stream(this.poll.maxVotes() || 0); - - if (this.endDate() && dayjs(this.poll.endDate()).isAfter(dayjs())) { - this.datepickerMinDate = this.formatDate(this.endDate()); - } - } - title() { return app.translator.trans('fof-polls.forum.modal.edit_title'); } - - displayOptions() { - return this.options.map((opt, i) => ( -
-
- - {app.forum.attribute('allowPollOptionImage') ? ( - - ) : null} -
- - {i >= 2 - ? Button.component({ - type: 'button', - className: 'Button PollModal--button', - icon: 'fas fa-minus', - onclick: i >= 2 ? this.removeOption.bind(this, i) : '', - }) - : ''} -
- )); - } - - addOption() { - const max = Math.max(app.forum.attribute('pollMaxOptions'), 2); - - if (this.options.length < max) { - this.options.push(app.store.createRecord('poll_options')); - this.optionAnswers.push(Stream('')); - this.optionImageUrls.push(Stream('')); - } else { - alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max }))); - } - } - - removeOption(i) { - this.options.splice(i, 1); - this.optionAnswers.splice(i, 1); - this.optionImageUrls.splice(i, 1); - } - - data() { - const options = this.options.map((o, i) => { - if (!o.data.attributes) o.data.attributes = {}; - - o.data.attributes.answer = this.optionAnswers[i](); - o.data.attributes.imageUrl = this.optionImageUrls[i](); - - return o.data; - }); - - return { - question: this.question(), - endDate: this.dateToTimestamp(this.endDate()), - publicPoll: this.publicPoll(), - hideVotes: this.hideVotes(), - allowChangeVote: this.allowChangeVote(), - allowMultipleVotes: this.allowMultipleVotes(), - maxVotes: this.maxVotes(), - options, - }; - } - - onsubmit(e) { - e.preventDefault(); - - if (this.loading) return; - - this.loading = true; - - return this.poll - .save(this.data()) - .then(() => { - this.hide(); - m.redraw(); - }) - .catch((e) => { - this.loaded(); - this.onerror(e); - }); - } } diff --git a/js/src/forum/components/PollForm.js b/js/src/forum/components/PollForm.js new file mode 100644 index 00000000..4ca9ff5a --- /dev/null +++ b/js/src/forum/components/PollForm.js @@ -0,0 +1,374 @@ +import {slug} from '../../common'; +import Component from 'flarum/common/Component'; +import app from 'flarum/forum/app'; +import Button from 'flarum/common/components/Button'; +import Switch from 'flarum/common/components/Switch'; +import ItemList from 'flarum/common/utils/ItemList'; +import Stream from 'flarum/common/utils/Stream'; +import extractText from 'flarum/common/utils/extractText'; +import FormError from './form/FormError'; +import PollFormState from "../states/PollFormState"; + +// Make translation calls shorter +const t = app.translator.trans.bind(app.translator); +const prfx = `${slug}.forum.poll_form`; + +export default class PollForm extends Component { + oninit(vnode) { + super.oninit(vnode); + this.state = new PollFormState(this.attrs.poll); + + // state handles poll initialization + const poll = this.state.poll; + + //@todo way the options are destructured into options (answers) and optionImageUrls + this.options = poll.options(); + this.optionAnswers = this.options.map((o) => Stream(o.answer())); + this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl())); + + this.question = Stream(poll.question()); + this.endDate = Stream(this.formatDate(poll.endDate())); + this.publicPoll = Stream(poll.publicPoll()); + this.allowMultipleVotes = Stream(poll.allowMultipleVotes()); + this.hideVotes = Stream(poll.hideVotes()); + this.allowChangeVote = Stream(poll.allowChangeVote()); + this.maxVotes = Stream(poll.maxVotes() || 0); + + this.datepickerMinDate = this.formatDate(undefined); + + // Replace minimum of 'today' for poll end date only if the poll is not already closed + if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) { + this.datepickerMinDate = this.formatDate(poll.endDate); + } + } + + view() { + return ( +
+
{this.fields().toArray()}
+
+ ) + } + + fields() { + const items = new ItemList(); + + items.add( + 'question', +
+ + + +
, + 100 + ); + + items.add( + 'answers', +
+ + + {this.displayOptions()} +
, + 80 + ); + + items.add( + 'date', +
+ + +
+ + {Button.component({ + className: 'Button PollModal--button', + icon: 'fas fa-times', + onclick: this.endDate.bind(this, null), + })} +
+ + {this.endDate() && ( +

+ +   + {dayjs(this.endDate()).isBefore(dayjs()) + ? app.translator.trans('fof-polls.forum.poll_ended') + : app.translator.trans('fof-polls.forum.days_remaining', {time: dayjs(this.endDate()).fromNow()})} +

+ )} +
, + 40 + ); + + items.add( + 'public', +
+ {Switch.component( + { + state: this.publicPoll() || false, + onchange: this.publicPoll, + }, + app.translator.trans('fof-polls.forum.modal.public_poll_label') + )} +
, + 20 + ); + + items.add( + 'hide-votes', +
+ + {app.translator.trans('fof-polls.forum.modal.hide_votes_label')} + +
, + 20 + ); + + items.add( + 'allow-change-vote', +
+ + {app.translator.trans('fof-polls.forum.modal.allow_change_vote_label')} + +
, + 20 + ); + + items.add( + 'allow-multiple-votes', +
+ {Switch.component( + { + state: this.allowMultipleVotes() || false, + onchange: this.allowMultipleVotes, + }, + app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label') + )} +
, + 15 + ); + + if (this.allowMultipleVotes()) { + items.add( + 'max-votes', +
+ + + + +

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

+
, + 15 + ); + } + + items.add( + 'submit', +
+ + {this.state.poll.exists && ( + + )} +
, + -10 + ); + + return items; + } + + displayOptions() { + return Object.keys(this.options).map((option, i) => ( +
+
+ + {app.forum.attribute('allowPollOptionImage') ? ( + + ) : null} +
+ {i >= 2 + ? Button.component({ + type: 'button', + className: 'Button Button--warning PollModal--button', + icon: 'fas fa-minus', + onclick: i >= 2 ? this.removeOption.bind(this, i) : '', + }) + : ''} +
+ )); + } + + addOption() { + const max = Math.max(app.forum.attribute('pollMaxOptions'), 2); + + if (this.options.length < max) { + this.options.push(app.store.createRecord('poll_options')); + this.optionAnswers.push(Stream('')); + this.optionImageUrls.push(Stream('')); + } else { + alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max }))); + } + } + + removeOption(i) { + this.options.splice(i, 1); + this.optionAnswers.splice(i, 1); + this.optionImageUrls.splice(i, 1); + } + + data() { + const options = this.options.map((o, i) => { + if (!o.data.attributes) o.data.attributes = {}; + + o.data.attributes.answer = this.optionAnswers[i](); + o.data.attributes.imageUrl = this.optionImageUrls[i](); + + return o.data; + }); + + if (this.question() === '') { + throw new FormError(app.translator.trans('fof-polls.forum.modal.include_question')); + } + + if (options.length < 2) { + throw new FormError(app.translator.trans('fof-polls.forum.modal.min')); + } + + return { + question: this.question(), + endDate: this.dateToTimestamp(this.endDate()), + publicPoll: this.publicPoll(), + hideVotes: this.hideVotes(), + allowChangeVote: this.allowChangeVote(), + allowMultipleVotes: this.allowMultipleVotes(), + maxVotes: this.maxVotes(), + options, + }; + } + + async onsubmit(e) { + e.preventDefault(); + + try { + await this.state.save(this.data()); + + // Show success alert + const alertId = app.alerts.show( + { + type: 'success', + controls: [ + , + ], + }, + t(`${prfx}.success`), + ); + + // Hide alert after 10 seconds + setTimeout(() => app.alerts.dismiss(alertId), 10000); + + // Check if we need to call a custom onsubmit callback + if(this.attrs.onsubmit) { + this.attrs.onsubmit(this.state.poll); + } + else { + // Otherwise redirect to pools list + m.route.set(app.route('polls-manager')); + } + } catch (e) { + if (e instanceof FormError) { + app.alerts.show({type: 'error'}, e.message); + } else { + // Show error alert + app.alerts.show({type: 'error'}, t(`${prfx}.error`)); + } + } finally { + this.state.loading = false; + m.redraw(); + } + } + + async delete() { + if (!confirm(t(`${prfx}.delete_confirm`))) { + return; + } + + try { + await this.state.delete(); + // Show success alert + const alertId = app.alerts.show({type: 'success'}, t(`${prfx}.delete_success`)); + + // Hide alert after 10 seconds + setTimeout(() => app.alerts.dismiss(alertId), 10000); + + // Redirect to polls list + m.route.set(app.route('polls-manager')); + } catch (e) { + // Show error alert + app.alerts.show({type: 'error'}, t(`${prfx}.delete_error`)); + } + } + + formatDate(date, def = false) { + const dayjsDate = dayjs(date); + + if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null; + + return dayjsDate.format('YYYY-MM-DDTHH:mm'); + } + + dateToTimestamp(date) { + const dayjsDate = dayjs(date); + + if (!date || !dayjsDate.isValid()) return false; + + return dayjsDate.format(); + } +} \ No newline at end of file diff --git a/js/src/forum/components/form/FormError.js b/js/src/forum/components/form/FormError.js new file mode 100644 index 00000000..b8783c6a --- /dev/null +++ b/js/src/forum/components/form/FormError.js @@ -0,0 +1,3 @@ +export default class FormError extends Error { + +} \ No newline at end of file diff --git a/js/src/forum/components/index.ts b/js/src/forum/components/index.ts index 2ad916c3..19cc5224 100644 --- a/js/src/forum/components/index.ts +++ b/js/src/forum/components/index.ts @@ -2,10 +2,12 @@ import CreatePollModal from './CreatePollModal'; import PostPoll from './PostPoll'; import EditPollModal from './EditPollModal'; import ListVotersModal from './ListVotersModal'; +import PollForm from './PollForm'; export const components = { CreatePollModal, PostPoll, EditPollModal, ListVotersModal, + PollForm, }; diff --git a/js/src/forum/states/PollDirectoryState.ts b/js/src/forum/states/PollDirectoryState.ts deleted file mode 100644 index 28446910..00000000 --- a/js/src/forum/states/PollDirectoryState.ts +++ /dev/null @@ -1,135 +0,0 @@ -import app from 'flarum/forum/app'; - -/** - * Based on Flarum's DiscussionListState - */ -import SortMap from '../../common/utils/SortMap'; - -export default class UserDirectoryState { - constructor(params = {}, app = window.app) { - this.params = params; - - this.app = app; - - this.users = []; - - this.moreResults = false; - - this.loading = false; - - this.qBuilder = {}; - } - - requestParams() { - const params = { include: [], filter: {} }; - - const sortKey = this.params.sort || app.forum.attribute('userDirectoryDefaultSort'); - - // sort might be set to null if no sort params has been passed - params.sort = this.sortMap()[sortKey]; - - if (this.params.q) { - params.filter.q = this.params.q; - } - - return params; - } - - sortMap() { - return { - default: '', - ...new SortMap().sortMap(), - }; - } - - getParams() { - return this.params; - } - - clear() { - this.users = []; - m.redraw(); - } - - refreshParams(newParams) { - if (!this.hasUsers() || Object.keys(newParams).some((key) => this.getParams()[key] !== newParams[key])) { - const q = ''; - this.params = newParams; - - if (newParams.qBuilder) { - Object.assign(this.qBuilder, newParams.qBuilder || {}); - this.params.q = Object.values(this.qBuilder).join(' ').trim(); - } - - if (!this.params.q && q) { - this.params.q = q; - } - - this.refresh(); - } - } - - refresh() { - this.loading = true; - - this.clear(); - - return this.loadResults().then( - (results) => { - this.users = []; - this.parseResults(results); - }, - () => { - this.loading = false; - m.redraw(); - } - ); - } - - loadResults(offset) { - const preloadedUsers = this.app.preloadedApiDocument(); - - if (preloadedUsers) { - return Promise.resolve(preloadedUsers); - } - - const params = this.requestParams(); - params.page = { offset }; - params.include = params.include.join(','); - - return this.app.store.find('users', params); - } - - loadMore() { - this.loading = true; - - this.loadResults(this.users.length).then(this.parseResults.bind(this)); - } - - parseResults(results) { - this.users.push(...results); - - this.loading = false; - this.moreResults = !!results.payload.links && !!results.payload.links.next; - - m.redraw(); - - return results; - } - - hasUsers() { - return this.users.length > 0; - } - - isLoading() { - return this.loading; - } - - isSearchResults() { - return !!this.params.q; - } - - empty() { - return !this.hasUsers() && !this.isLoading(); - } -} diff --git a/js/src/forum/states/PollFormState.js b/js/src/forum/states/PollFormState.js new file mode 100644 index 00000000..c4f16b7d --- /dev/null +++ b/js/src/forum/states/PollFormState.js @@ -0,0 +1,58 @@ +import app from 'flarum/forum/app'; + +export default class PollFormState { + constructor(poll) { + if (!poll) { + poll = app.store.createRecord('polls'); + poll.pushAttributes( { + question: '', + endDate: '', + publicPoll: false, + allowMultipleVotes: false, + hideVotes: false, + allowChangeVote: false, + maxVotes: 0, + }); + poll.pushData({relationships: {options: []}}); + } + + this.loading = false; + this.deleting = false; + this.poll = poll; + this.expandedGroup = 'setup'; + } + + isExpanded(groupKey) { + return this.expandedGroup === groupKey; + } + + expand(groupKey) { + this.expandedGroup = groupKey; + m.redraw(); + } + + async save(data) { + this.loading = true; + m.redraw(); + + try { + this.poll = await this.poll.save(data); + } finally { + this.loading = false; + m.redraw(); + } + } + + async delete() { + this.loading = true; + m.redraw(); + + try { + await this.poll.delete(); + this.deleting = true; + } finally { + this.loading = false; + m.redraw(); + } + } +}