diff --git a/js/dist/admin.js b/js/dist/admin.js index 84d8242..ce776d3 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}([function(e,t){e.exports=flarum.core.compat.extend},,function(e,t){e.exports=flarum.core.compat.app},function(e,t,n){"use strict";function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}n.d(t,"a",(function(){return i}))},,function(e,t){e.exports=flarum.core.compat["components/Switch"]},,,,,,,function(e,t){e.exports=flarum.core.compat["components/PermissionGrid"]},function(e,t){e.exports=flarum.core.compat["components/SettingsModal"]},,function(e,t,n){"use strict";n.r(t);var i=n(0),s=n(2),r=n.n(s),o=n(12),a=n.n(o),u=n(3),c=n(13),l=n.n(c),p=n(5),f=n.n(p),d=function(e){function t(){return e.apply(this,arguments)||this}Object(u.a)(t,e);var n=t.prototype;return n.className=function(){return"Modal--small"},n.title=function(){return app.translator.trans("flarum_discussion_views.admin.settings.title")},n.form=function(){return[m("div",{className:"Form-group"},f.a.component({state:1==this.setting("michaelbelgium-discussionviews.track_unique")(),onchange:this.setting("michaelbelgium-discussionviews.track_unique"),children:app.translator.trans("flarum_discussion_views.admin.settings.track_unique")}),f.a.component({state:1==this.setting("michaelbelgium-discussionviews.abbr_numbers")(),onchange:this.setting("michaelbelgium-discussionviews.abbr_numbers"),children:app.translator.trans("flarum_discussion_views.admin.settings.abbr_numbers")}),f.a.component({state:1==this.setting("michaelbelgium-discussionviews.show_filter")(),onchange:this.setting("michaelbelgium-discussionviews.show_filter"),children:app.translator.trans("flarum_discussion_views.admin.settings.show_filter")}))]},t}(l.a);r.a.initializers.add("michaelbelgium-admin-discussion-views",(function(){Object(i.extend)(a.a.prototype,"moderateItems",(function(e){e.add("resetViews",{icon:"far fa-eye",label:r.a.translator.trans("flarum_discussion_views.admin.permissions.reset_views_label"),permission:"discussion.resetViews"})})),r.a.extensionSettings["michaelbelgium-discussion-views"]=function(){return r.a.modal.show(new d)}}))}]); +module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}([function(e,t){e.exports=flarum.core.compat.extend},,function(e,t){e.exports=flarum.core.compat.app},function(e,t,n){"use strict";function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}n.d(t,"a",(function(){return i}))},,,function(e,t){e.exports=flarum.core.compat["components/Switch"]},,,,,,function(e,t){e.exports=flarum.core.compat["components/PermissionGrid"]},function(e,t){e.exports=flarum.core.compat["components/SettingsModal"]},,function(e,t,n){"use strict";n.r(t);var i=n(0),s=n(2),r=n.n(s),o=n(12),a=n.n(o),u=n(3),c=n(13),l=n.n(c),p=n(6),f=n.n(p),d=function(e){function t(){return e.apply(this,arguments)||this}Object(u.a)(t,e);var n=t.prototype;return n.className=function(){return"Modal--small"},n.title=function(){return app.translator.trans("flarum_discussion_views.admin.settings.title")},n.form=function(){return[m("div",{className:"Form-group"},f.a.component({state:1==this.setting("michaelbelgium-discussionviews.track_unique")(),onchange:this.setting("michaelbelgium-discussionviews.track_unique"),children:app.translator.trans("flarum_discussion_views.admin.settings.track_unique")}),f.a.component({state:1==this.setting("michaelbelgium-discussionviews.abbr_numbers")(),onchange:this.setting("michaelbelgium-discussionviews.abbr_numbers"),children:app.translator.trans("flarum_discussion_views.admin.settings.abbr_numbers")}),f.a.component({state:1==this.setting("michaelbelgium-discussionviews.show_filter")(),onchange:this.setting("michaelbelgium-discussionviews.show_filter"),children:app.translator.trans("flarum_discussion_views.admin.settings.show_filter")}))]},t}(l.a);r.a.initializers.add("michaelbelgium-admin-discussion-views",(function(){Object(i.extend)(a.a.prototype,"moderateItems",(function(e){e.add("resetViews",{icon:"far fa-eye",label:r.a.translator.trans("flarum_discussion_views.admin.permissions.reset_views_label"),permission:"discussion.resetViews"})})),r.a.extensionSettings["michaelbelgium-discussion-views"]=function(){return r.a.modal.show(new d)}}))}]); //# 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 c98965b..4e22ec6 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['app']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Switch']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/SettingsModal']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/admin/components/DiscussionviewSettingsModal.js","webpack://@michaelbelgium/flarum-discussion-views/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","DiscussionviewSettingsModal","className","title","app","translator","trans","form","Switch","component","state","this","setting","onchange","children","SettingsModal","initializers","add","extend","PermissionGrid","items","icon","label","permission","extensionSettings","modal","show"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhE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C,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,8B,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,6B,yHCGfM,E,0GACjBC,UAAA,WACI,MAAO,gB,EAGXC,MAAA,WACI,OAAOC,IAAIC,WAAWC,MAAM,iD,EAGhCC,KAAA,WACI,MAAO,CACH,SAAKL,UAAU,cACVM,IAAOC,UAAU,CACdC,MAAwE,GAAjEC,KAAKC,QAAQ,8CAAbD,GACPE,SAAUF,KAAKC,QAAQ,+CACvBE,SAAUV,IAAIC,WAAWC,MAAM,yDAGlCE,IAAOC,UAAU,CACdC,MAAwE,GAAjEC,KAAKC,QAAQ,8CAAbD,GACPE,SAAUF,KAAKC,QAAQ,+CACvBE,SAAUV,IAAIC,WAAWC,MAAM,yDAGlCE,IAAOC,UAAU,CACdC,MAAuE,GAAhEC,KAAKC,QAAQ,6CAAbD,GACPE,SAAUF,KAAKC,QAAQ,8CACvBE,SAAUV,IAAIC,WAAWC,MAAM,2D,GA3BMS,KCEzDX,IAAIY,aAAaC,IAAI,yCAAyC,WAC7DC,iBAAOC,IAAe9B,UAAW,iBAAiB,SAAA+B,GACjDA,EAAMH,IAAI,aAAc,CACvBI,KAAM,aACNC,MAAOlB,IAAIC,WAAWC,MAAM,+DAC5BiB,WAAY,6BAIdnB,IAAIoB,kBAAkB,mCAAqC,kBAAMpB,IAAIqB,MAAMC,KAAK,IAAIzB","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 15);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['app'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/PermissionGrid'];","module.exports = flarum.core.compat['components/SettingsModal'];","import SettingsModal from 'flarum/components/SettingsModal';\r\nimport Switch from 'flarum/components/Switch';\r\n\r\nexport default class DiscussionviewSettingsModal extends SettingsModal {\r\n className() {\r\n return 'Modal--small';\r\n }\r\n\r\n title() {\r\n return app.translator.trans('flarum_discussion_views.admin.settings.title');\r\n }\r\n\r\n form() {\r\n return [\r\n
\r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.track_unique')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.track_unique'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.track_unique')\r\n })}\r\n \r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.abbr_numbers')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.abbr_numbers'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.abbr_numbers')\r\n })}\r\n \r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.show_filter')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.show_filter'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.show_filter')\r\n })}\r\n
\r\n ];\r\n }\r\n}","import { extend } from 'flarum/extend';\r\nimport app from 'flarum/app';\r\nimport PermissionGrid from 'flarum/components/PermissionGrid';\r\nimport DiscussionviewSettingsModal from './components/DiscussionviewSettingsModal';\r\n\r\napp.initializers.add('michaelbelgium-admin-discussion-views', () => {\r\n\textend(PermissionGrid.prototype, 'moderateItems', items => {\r\n\t\titems.add('resetViews', {\r\n\t\t\ticon: 'far fa-eye',\r\n\t\t\tlabel: app.translator.trans('flarum_discussion_views.admin.permissions.reset_views_label'),\r\n\t\t\tpermission: 'discussion.resetViews'\r\n\t\t});\r\n\t});\r\n\r\n\tapp.extensionSettings['michaelbelgium-discussion-views'] = () => app.modal.show(new DiscussionviewSettingsModal());\r\n});\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['app']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Switch']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/SettingsModal']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/admin/components/DiscussionviewSettingsModal.js","webpack://@michaelbelgium/flarum-discussion-views/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","DiscussionviewSettingsModal","className","title","app","translator","trans","form","Switch","component","state","this","setting","onchange","children","SettingsModal","initializers","add","extend","PermissionGrid","items","icon","label","permission","extensionSettings","modal","show"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAA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,OAAY,K,6BCA1B,SAASC,EAAeC,EAAUC,GAC/CD,EAASR,UAAYlB,OAAOY,OAAOe,EAAWT,WAC9CQ,EAASR,UAAUU,YAAcF,EACjCA,EAASG,UAAYF,EAHvB,mC,gBCAAtC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,sB,mBCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,8B,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,6B,yHCGfM,E,0GACjBC,UAAA,WACI,MAAO,gB,EAGXC,MAAA,WACI,OAAOC,IAAIC,WAAWC,MAAM,iD,EAGhCC,KAAA,WACI,MAAO,CACH,SAAKL,UAAU,cACVM,IAAOC,UAAU,CACdC,MAAwE,GAAjEC,KAAKC,QAAQ,8CAAbD,GACPE,SAAUF,KAAKC,QAAQ,+CACvBE,SAAUV,IAAIC,WAAWC,MAAM,yDAGlCE,IAAOC,UAAU,CACdC,MAAwE,GAAjEC,KAAKC,QAAQ,8CAAbD,GACPE,SAAUF,KAAKC,QAAQ,+CACvBE,SAAUV,IAAIC,WAAWC,MAAM,yDAGlCE,IAAOC,UAAU,CACdC,MAAuE,GAAhEC,KAAKC,QAAQ,6CAAbD,GACPE,SAAUF,KAAKC,QAAQ,8CACvBE,SAAUV,IAAIC,WAAWC,MAAM,2D,GA3BMS,KCEzDX,IAAIY,aAAaC,IAAI,yCAAyC,WAC7DC,iBAAOC,IAAe9B,UAAW,iBAAiB,SAAA+B,GACjDA,EAAMH,IAAI,aAAc,CACvBI,KAAM,aACNC,MAAOlB,IAAIC,WAAWC,MAAM,+DAC5BiB,WAAY,6BAIdnB,IAAIoB,kBAAkB,mCAAqC,kBAAMpB,IAAIqB,MAAMC,KAAK,IAAIzB","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 15);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['app'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['components/PermissionGrid'];","module.exports = flarum.core.compat['components/SettingsModal'];","import SettingsModal from 'flarum/components/SettingsModal';\r\nimport Switch from 'flarum/components/Switch';\r\n\r\nexport default class DiscussionviewSettingsModal extends SettingsModal {\r\n className() {\r\n return 'Modal--small';\r\n }\r\n\r\n title() {\r\n return app.translator.trans('flarum_discussion_views.admin.settings.title');\r\n }\r\n\r\n form() {\r\n return [\r\n
\r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.track_unique')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.track_unique'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.track_unique')\r\n })}\r\n \r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.abbr_numbers')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.abbr_numbers'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.abbr_numbers')\r\n })}\r\n \r\n {Switch.component({\r\n state: this.setting('michaelbelgium-discussionviews.show_filter')() == 1,\r\n onchange: this.setting('michaelbelgium-discussionviews.show_filter'),\r\n children: app.translator.trans('flarum_discussion_views.admin.settings.show_filter')\r\n })}\r\n
\r\n ];\r\n }\r\n}","import { extend } from 'flarum/extend';\r\nimport app from 'flarum/app';\r\nimport PermissionGrid from 'flarum/components/PermissionGrid';\r\nimport DiscussionviewSettingsModal from './components/DiscussionviewSettingsModal';\r\n\r\napp.initializers.add('michaelbelgium-admin-discussion-views', () => {\r\n\textend(PermissionGrid.prototype, 'moderateItems', items => {\r\n\t\titems.add('resetViews', {\r\n\t\t\ticon: 'far fa-eye',\r\n\t\t\tlabel: app.translator.trans('flarum_discussion_views.admin.permissions.reset_views_label'),\r\n\t\t\tpermission: 'discussion.resetViews'\r\n\t\t});\r\n\t});\r\n\r\n\tapp.extensionSettings['michaelbelgium-discussion-views'] = () => app.modal.show(new DiscussionviewSettingsModal());\r\n});\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 987b1ea..3f82988 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=14)}([function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.app},function(t,e,n){"use strict";function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["components/Button"]},,function(t,e){t.exports=flarum.core.compat["models/Discussion"]},function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionList"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionListItem"]},function(t,e){t.exports=flarum.core.compat["utils/abbreviateNumber"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},,,function(t,e,n){"use strict";n.r(e);var o=n(2),r=n.n(o),s=n(0),i=n(8),a=n.n(i),u=n(1),c=n.n(u),l=n(6),p=n.n(l),f=n(9),d=n.n(f),b=n(10),v=n.n(b);function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var w=n(3);function y(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r0&&t.add("reset",g.a.component({children:app.translator.trans("flarum_discussion_views.forum.discussion_controls.resetviews_button"),icon:"far fa-eye-slash",onclick:this.resetViewsAction.bind(e)}))})),j.a.resetViewsAction=function(){return app.modal.show(new C({discussion:this}))}}))}]); +module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=14)}([function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.app},function(t,e,n){"use strict";function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["components/DiscussionList"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},,function(t,e){t.exports=flarum.core.compat["models/Discussion"]},function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionListItem"]},function(t,e){t.exports=flarum.core.compat["utils/abbreviateNumber"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},,,function(t,e,n){"use strict";n.r(e);var o=n(2),r=n.n(o),s=n(0),i=n(4),a=n.n(i),u=n(1),c=n.n(u),l=n(7),p=n.n(l),f=n(9),d=n.n(f),b=n(10),v=n.n(b);function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var w=n(3);function y(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r0&&t.add("reset",g.a.component({children:app.translator.trans("flarum_discussion_views.forum.discussion_controls.resetviews_button"),icon:"far fa-eye-slash",onclick:this.resetViewsAction.bind(e)}))})),j.a.resetViewsAction=function(){return app.modal.show(new P({discussion:this}))}}))}]); //# 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 3681dc8..606925d 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['Model']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['app']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Button']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['models/Discussion']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['utils/DiscussionControls']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/DiscussionListItem']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['utils/abbreviateNumber']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Modal']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/models/DiscussionView.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/ResetDiscussionViewsModal.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/index.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddPopularSort.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddViewsToModelAndDisplay.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddModerationControl.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","_assertThisInitialized","self","ReferenceError","_defineProperty","obj","configurable","writable","DiscussionView","Model","attribute","transformDate","hasOne","ResetDiscussionViewsModal","init","this","discussion","props","currentViewsCount","views","length","content","className","app","translator","transChoice","count","Button","component","type","loading","children","trans","title","onsubmit","e","preventDefault","save","resetViews","then","redraw","reason","console","log","hide","Modal","initializers","add","extend","DiscussionList","map","forum","popular","unpopular","store","models","discussionviews","Discussion","hasMany","canReset","DiscussionListItem","items","number","abbreviateNumber","DiscussionControls","icon","onclick","resetViewsAction","modal","show"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,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UAAUsE,SAAWlD,IAAMC,UAAU,YAEhDsC,iBAAOY,IAAmBvE,UAAW,aAAa,SAASwE,GACvD,IAAM7C,EAAaD,KAAKE,MAAMD,WAE1B8C,EAAmE,GAA1DvC,IAAI4B,MAAMzC,UAAU,mCAA0CqD,IAAiB/C,EAAWG,QAAQC,QAAUJ,EAAWG,QAAQC,OAC5IyC,EAAMd,IAAI,mBAAoBe,MCXlCd,iBAAOgB,IAAoB,sBAAsB,SAASH,EAAO7C,GAC1DA,EAAW2C,YAAc3C,EAAWG,QAAQC,OAAS,GAEpDyC,EAAMd,IAAI,QAASpB,IAAOC,UAAU,CAChCG,SAAUR,IAAIC,WAAWQ,MAAM,uEAC/BiC,KAAM,mBACNC,QAASnD,KAAKoD,iBAAiBlF,KAAK+B,SAKhDgD,IAAmBG,iBAAmB,WAClC,OAAO5C,IAAI6C,MAAMC,KAAK,IAAIxD,EAA0B,CAChDG,WAAYD","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['models/Discussion'];","module.exports = flarum.core.compat['utils/DiscussionControls'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/DiscussionListItem'];","module.exports = flarum.core.compat['utils/abbreviateNumber'];","module.exports = flarum.core.compat['components/Modal'];","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import Model from 'flarum/Model';\r\n\r\nexport default class DiscussionView extends Model {\r\n //comes from DiscussionViewSerializer (user(), discussion(), visited_at)\r\n visitedAt = Model.attribute('visited_at', Model.transformDate);\r\n user = Model.hasOne('user');\r\n discussion = Model.hasOne('discussion');\r\n}","import Modal from 'flarum/components/Modal';\r\nimport Button from 'flarum/components/Button';\r\n\r\nexport default class ResetDiscussionViewsModal extends Modal {\r\n init()\r\n {\r\n super.init();\r\n\r\n this.discussion = this.props.discussion;\r\n this.currentViewsCount = this.discussion.views().length;\r\n }\r\n\r\n content()\r\n {\r\n return (\r\n
\r\n
\r\n

{app.translator.transChoice('flarum_discussion_views.forum.modal_resetviews.label', this.currentViewsCount, {count: this.currentViewsCount })}

\r\n
\r\n {Button.component({\r\n className: 'Button Button--primary Button--block',\r\n type: 'submit',\r\n loading: this.loading,\r\n children: app.translator.trans('flarum_discussion_views.forum.modal_resetviews.submit')\r\n })}\r\n
\r\n
\r\n
\r\n )\r\n }\r\n\r\n title()\r\n {\r\n return app.translator.trans('flarum_discussion_views.forum.modal_resetviews.title');\r\n }\r\n\r\n className()\r\n {\r\n return 'Modal--small';\r\n }\r\n\r\n onsubmit(e)\r\n {\r\n e.preventDefault();\r\n this.loading = true;\r\n\r\n this.props.discussion\r\n .save({ resetViews: true })\r\n .then(() => { m.redraw(); })\r\n .catch((reason) => {\r\n this.loading = false;\r\n console.log(reason)\r\n });\r\n\r\n this.hide();\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport AddPopularSort from './components/AddPopularSort';\r\nimport AddViewsToModelAndDisplay from './components/AddViewsToModelAndDisplay';\r\nimport AddModerationControl from './components/AddModerationControl';\r\n\r\napp.initializers.add('michaelbelgium-discussion-views', function () {\r\n AddPopularSort();\r\n AddViewsToModelAndDisplay();\r\n AddModerationControl();\r\n});\r\n","import { extend } from 'flarum/extend';\r\nimport DiscussionList from 'flarum/components/DiscussionList';\r\n\r\nexport default function () {\r\n extend(DiscussionList.prototype, 'sortMap', function (map) {\r\n if(app.forum.attribute('mb-discussionviews.show_filter') == 1) {\r\n map.popular = '-view_count';\r\n map.unpopular = 'view_count';\r\n }\r\n });\r\n}\r\n","import { extend } from 'flarum/extend';\r\nimport Model from 'flarum/Model';\r\nimport Discussion from 'flarum/models/Discussion';\r\nimport DiscussionListItem from 'flarum/components/DiscussionListItem';\r\nimport abbreviateNumber from 'flarum/utils/abbreviateNumber';\r\nimport DiscussionView from '../models/DiscussionView';\r\n\r\nexport default function () {\r\n app.store.models.discussionviews = DiscussionView; //discussionviews = serializer type\r\n\r\n Discussion.prototype.views = Model.hasMany('views');\r\n Discussion.prototype.canReset = Model.attribute('canReset');\r\n\r\n extend(DiscussionListItem.prototype, 'infoItems', function(items) {\r\n const discussion = this.props.discussion;\r\n\r\n var number = app.forum.attribute('mb-discussionviews.abbr_numbers') == 1 ? abbreviateNumber(discussion.views().length) : discussion.views().length;\r\n items.add('discussion-views', number);\r\n });\r\n}\r\n","import { extend } from 'flarum/extend';\r\nimport Button from 'flarum/components/Button';\r\nimport DiscussionControls from 'flarum/utils/DiscussionControls';\r\nimport ResetDiscussionViewsModal from './ResetDiscussionViewsModal';\r\n\r\nexport default function () {\r\n extend(DiscussionControls, 'moderationControls', function(items, discussion) {\r\n if(discussion.canReset() && discussion.views().length > 0)\r\n {\r\n items.add('reset', Button.component({\r\n children: app.translator.trans('flarum_discussion_views.forum.discussion_controls.resetviews_button'),\r\n icon: 'far fa-eye-slash',\r\n onclick: this.resetViewsAction.bind(discussion)\r\n }));\r\n }\r\n });\r\n\r\n DiscussionControls.resetViewsAction = function() {\r\n return app.modal.show(new ResetDiscussionViewsModal({\r\n discussion: this\r\n }));\r\n };\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['Model']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['app']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Button']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['models/Discussion']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['utils/DiscussionControls']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/DiscussionListItem']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['utils/abbreviateNumber']\"","webpack://@michaelbelgium/flarum-discussion-views/external \"flarum.core.compat['components/Modal']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/models/DiscussionView.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/ResetDiscussionViewsModal.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/index.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddPopularSort.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddViewsToModelAndDisplay.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddModerationControl.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","_assertThisInitialized","self","ReferenceError","_defineProperty","obj","configurable","writable","DiscussionView","Model","attribute","transformDate","hasOne","ResetDiscussionViewsModal","init","this","discussion","props","currentViewsCount","views","length","content","className","app","translator","transChoice","count","Button","component","type","loading","children","trans","title","onsubmit","e","preventDefault","save","resetViews","then","redraw","reason","console","log","hide","Modal","initializers","add","extend","DiscussionList","map","forum","popular","unpopular","store","models","discussionviews","Discussion","hasMany","canReset","DiscussionListItem","items","number","abbreviateNumber","params","include","push","DiscussionControls","icon","onclick","resetViewsAction","modal","show"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EA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pDC,iBAAOC,IAAe5D,UAAW,WAAW,SAAU6D,GACU,GAAzD3B,IAAI4B,MAAMzC,UAAU,oCACnBwC,EAAIE,QAAU,cACdF,EAAIG,UAAY,iBCExB9B,IAAI+B,MAAMC,OAAOC,gBAAkBhD,EAEnCiD,IAAWpE,UAAU8B,MAAQV,IAAMiD,QAAQ,SAC3CD,IAAWpE,UAAUsE,SAAWlD,IAAMC,UAAU,YAEhDsC,iBAAOY,IAAmBvE,UAAW,aAAa,SAASwE,GACvD,IAAM7C,EAAaD,KAAKE,MAAMD,WAE1B8C,EAAmE,GAA1DvC,IAAI4B,MAAMzC,UAAU,mCAA0CqD,IAAiB/C,EAAWG,QAAQC,QAAUJ,EAAWG,QAAQC,OAC5IyC,EAAMd,IAAI,mBAAoBe,MAGlCd,iBAAOC,IAAe5D,UAAW,iBAAiB,SAAS2E,GACvDA,EAAOC,QAAQC,KAAK,YChBxBlB,iBAAOmB,IAAoB,sBAAsB,SAASN,EAAO7C,GAC1DA,EAAW2C,YAAc3C,EAAWG,QAAQC,OAAS,GAEpDyC,EAAMd,IAAI,QAASpB,IAAOC,UAAU,CAChCG,SAAUR,IAAIC,WAAWQ,MAAM,uEAC/BoC,KAAM,mBACNC,QAAStD,KAAKuD,iBAAiBrF,KAAK+B,SAKhDmD,IAAmBG,iBAAmB,WAClC,OAAO/C,IAAIgD,MAAMC,KAAK,IAAI3D,EAA0B,CAChDG,WAAYD","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['app'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['models/Discussion'];","module.exports = flarum.core.compat['utils/DiscussionControls'];","module.exports = flarum.core.compat['components/DiscussionListItem'];","module.exports = flarum.core.compat['utils/abbreviateNumber'];","module.exports = flarum.core.compat['components/Modal'];","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import Model from 'flarum/Model';\r\n\r\nexport default class DiscussionView extends Model {\r\n //comes from DiscussionViewSerializer (user(), discussion(), visited_at)\r\n visitedAt = Model.attribute('visited_at', Model.transformDate);\r\n user = Model.hasOne('user');\r\n discussion = Model.hasOne('discussion');\r\n}","import Modal from 'flarum/components/Modal';\r\nimport Button from 'flarum/components/Button';\r\n\r\nexport default class ResetDiscussionViewsModal extends Modal {\r\n init()\r\n {\r\n super.init();\r\n\r\n this.discussion = this.props.discussion;\r\n this.currentViewsCount = this.discussion.views().length;\r\n }\r\n\r\n content()\r\n {\r\n return (\r\n
\r\n
\r\n

{app.translator.transChoice('flarum_discussion_views.forum.modal_resetviews.label', this.currentViewsCount, {count: this.currentViewsCount })}

\r\n
\r\n {Button.component({\r\n className: 'Button Button--primary Button--block',\r\n type: 'submit',\r\n loading: this.loading,\r\n children: app.translator.trans('flarum_discussion_views.forum.modal_resetviews.submit')\r\n })}\r\n
\r\n
\r\n
\r\n )\r\n }\r\n\r\n title()\r\n {\r\n return app.translator.trans('flarum_discussion_views.forum.modal_resetviews.title');\r\n }\r\n\r\n className()\r\n {\r\n return 'Modal--small';\r\n }\r\n\r\n onsubmit(e)\r\n {\r\n e.preventDefault();\r\n this.loading = true;\r\n\r\n this.props.discussion\r\n .save({ resetViews: true })\r\n .then(() => { m.redraw(); })\r\n .catch((reason) => {\r\n this.loading = false;\r\n console.log(reason)\r\n });\r\n\r\n this.hide();\r\n }\r\n}\r\n","import app from 'flarum/app';\r\nimport AddPopularSort from './components/AddPopularSort';\r\nimport AddViewsToModelAndDisplay from './components/AddViewsToModelAndDisplay';\r\nimport AddModerationControl from './components/AddModerationControl';\r\n\r\napp.initializers.add('michaelbelgium-discussion-views', function () {\r\n AddPopularSort();\r\n AddViewsToModelAndDisplay();\r\n AddModerationControl();\r\n});\r\n","import { extend } from 'flarum/extend';\r\nimport DiscussionList from 'flarum/components/DiscussionList';\r\n\r\nexport default function () {\r\n extend(DiscussionList.prototype, 'sortMap', function (map) {\r\n if(app.forum.attribute('mb-discussionviews.show_filter') == 1) {\r\n map.popular = '-view_count';\r\n map.unpopular = 'view_count';\r\n }\r\n });\r\n}\r\n","import { extend } from 'flarum/extend';\r\nimport Model from 'flarum/Model';\r\nimport Discussion from 'flarum/models/Discussion';\r\nimport DiscussionListItem from 'flarum/components/DiscussionListItem';\r\nimport DiscussionList from 'flarum/components/DiscussionList';\r\nimport abbreviateNumber from 'flarum/utils/abbreviateNumber';\r\nimport DiscussionView from '../models/DiscussionView';\r\n\r\nexport default function () {\r\n app.store.models.discussionviews = DiscussionView; //discussionviews = serializer type\r\n\r\n Discussion.prototype.views = Model.hasMany('views');\r\n Discussion.prototype.canReset = Model.attribute('canReset');\r\n\r\n extend(DiscussionListItem.prototype, 'infoItems', function(items) {\r\n const discussion = this.props.discussion;\r\n\r\n var number = app.forum.attribute('mb-discussionviews.abbr_numbers') == 1 ? abbreviateNumber(discussion.views().length) : discussion.views().length;\r\n items.add('discussion-views', number);\r\n });\r\n\r\n extend(DiscussionList.prototype, 'requestParams', function(params) {\r\n params.include.push('views'); //fixes not loading relationship when navigating back to the discussion list if you directly went to a discussion or another page\r\n })\r\n}\r\n","import { extend } from 'flarum/extend';\r\nimport Button from 'flarum/components/Button';\r\nimport DiscussionControls from 'flarum/utils/DiscussionControls';\r\nimport ResetDiscussionViewsModal from './ResetDiscussionViewsModal';\r\n\r\nexport default function () {\r\n extend(DiscussionControls, 'moderationControls', function(items, discussion) {\r\n if(discussion.canReset() && discussion.views().length > 0)\r\n {\r\n items.add('reset', Button.component({\r\n children: app.translator.trans('flarum_discussion_views.forum.discussion_controls.resetviews_button'),\r\n icon: 'far fa-eye-slash',\r\n onclick: this.resetViewsAction.bind(discussion)\r\n }));\r\n }\r\n });\r\n\r\n DiscussionControls.resetViewsAction = function() {\r\n return app.modal.show(new ResetDiscussionViewsModal({\r\n discussion: this\r\n }));\r\n };\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/components/AddViewsToModelAndDisplay.js b/js/src/forum/components/AddViewsToModelAndDisplay.js index 844466c..b42c9da 100644 --- a/js/src/forum/components/AddViewsToModelAndDisplay.js +++ b/js/src/forum/components/AddViewsToModelAndDisplay.js @@ -2,6 +2,7 @@ import { extend } from 'flarum/extend'; import Model from 'flarum/Model'; import Discussion from 'flarum/models/Discussion'; import DiscussionListItem from 'flarum/components/DiscussionListItem'; +import DiscussionList from 'flarum/components/DiscussionList'; import abbreviateNumber from 'flarum/utils/abbreviateNumber'; import DiscussionView from '../models/DiscussionView'; @@ -17,4 +18,8 @@ export default function () { var number = app.forum.attribute('mb-discussionviews.abbr_numbers') == 1 ? abbreviateNumber(discussion.views().length) : discussion.views().length; items.add('discussion-views', number); }); + + extend(DiscussionList.prototype, 'requestParams', function(params) { + params.include.push('views'); //fixes not loading relationship when navigating back to the discussion list if you directly went to a discussion or another page + }) }