diff --git a/composer.json b/composer.json
index d7f2d96..0aa70df 100644
--- a/composer.json
+++ b/composer.json
@@ -19,7 +19,7 @@
"source": "https://github.com/FriendsOfFlarum/pretty-mail"
},
"require": {
- "flarum/core": "^0.1.0-beta.10"
+ "flarum/core": "^0.1.0-beta.14"
},
"replace": {
"reflar/pretty-mail": "*"
diff --git a/extend.php b/extend.php
index c416e53..399ed93 100644
--- a/extend.php
+++ b/extend.php
@@ -13,13 +13,13 @@
namespace FoF\PrettyMail;
-use Flarum\Extend as Native;
+use Flarum\Extend;
use Flarum\Foundation\Application;
return [
- (new Native\Frontend('admin'))
+ (new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
- new Native\Locales(__DIR__.'/resources/locale'),
+ new Extend\Locales(__DIR__.'/resources/locale'),
function (Application $app) {
$app->register(Providers\MailerProvider::class);
},
diff --git a/js/dist/admin.js b/js/dist/admin.js
index f614c1b..73cbffd 100644
--- a/js/dist/admin.js
+++ b/js/dist/admin.js
@@ -1,2 +1,2 @@
-module.exports=function(t){var n={};function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(o,i,function(n){return t[n]}.bind(null,i));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=9)}([function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n){t.exports=flarum.core.compat.app},function(t,n){t.exports=flarum.core.compat.extend},function(t,n){t.exports=flarum.core.compat["components/AdminNav"]},function(t,n){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,n){t.exports=flarum.core.compat["components/Alert"]},function(t,n){t.exports=flarum.core.compat["components/Page"]},function(t,n){t.exports=flarum.core.compat["utils/saveSettings"]},function(t,n){t.exports=flarum.core.compat["components/Switch"]},function(t,n,e){"use strict";e.r(n);var o=e(1),i=e.n(o),a=e(2),s=e(3),r=e.n(s),l=e(4),p=e.n(l);var d=e(5),c=e.n(d),u=e(0),f=e.n(u),y=e(6),h=e.n(y),g=e(7),b=e.n(g),v=e(8),x=e.n(v),$=function(t){var n,e;function o(){return t.apply(this,arguments)||this}e=t,(n=o).prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var i=o.prototype;return i.init=function(){var t=this;this.fields=["mailhtml","newPost","postMentioned","userMentioned","includeCSS"],this.values={},this.settingsPrefix="fof-pretty-mail";var n=app.data.settings;this.fields.forEach((function(e){return t.values[e]=m.prop(n[t.addPrefix(e)])}))},i.view=function(){var t=this;return[m("div",{style:"padding-bottom: 20px",className:"SettingsPage"},[m("div",{className:"container"},[m("Form-group",[m("Form",{onsubmit:this.onsubmit.bind(this)},[m("h1",app.translator.trans("fof-pretty-mail.admin.settings.label")),m("div",{className:"helpText",style:"margin: 10px 0 10px"},app.translator.trans("fof-pretty-mail.admin.settings.help",{strong:m("strong",null)})),m("label",app.translator.trans("fof-pretty-mail.admin.settings.default")),m("br"),f.a.component({type:"button",style:"margin-bottom: 10px",className:"Button Button--primary",children:app.translator.trans("fof-pretty-mail.admin.settings.reset"),onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" default?")&&t.values.mailhtml('\n
\n \n \n @if ($forumStyle !== \'\')\n \n @endif\n \n\n\n \n \n {!! $body !!}\n
\n \n')}}),m("textarea.FormControl",{rows:"15",value:this.values.mailhtml(),style:"margin: 10px 0 10px",oninput:m.withAttr("value",this.values.mailhtml)}),m("h3",app.translator.trans("fof-pretty-mail.admin.settings.notifications")),m("div",{className:"helpText",style:"margin-top: 10px"},app.translator.trans("fof-pretty-mail.admin.settings.notificationHelp")),m("label",app.translator.trans("fof-pretty-mail.admin.settings.newPost")),m("br"),f.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",children:app.translator.trans("fof-pretty-mail.admin.settings.reset"),onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" newPost?")&&t.values.newPost('\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->post->user->display_name !!} made a post in a discussion you\'re following: {!! $blueprint->post->discussion->title !!}
\n\n
To view the new activity, check out the following link:
\n
{!! $baseUrl !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n ---\n\n
You won\'t receive any more notifications about this discussion until you\'re up-to-date.
\n
\n
\n \n')}}),m("textarea.FormControl",{rows:"15",value:this.values.newPost(),style:"margin-bottom: 10px",oninput:m.withAttr("value",this.values.newPost)}),m("label",app.translator.trans("fof-pretty-mail.admin.settings.userMentioned")),m("br"),f.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",children:app.translator.trans("fof-pretty-mail.admin.settings.reset"),onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" userMentioned?")&&t.values.userMentioned('\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->post->user->username !!} mentioned you in a post in {!! $blueprint->post->discussion->title !!}.
\n\n
{!! $baseUrl !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n \n')}}),m("textarea.FormControl",{rows:"15",value:this.values.userMentioned(),style:"margin-bottom: 10px",oninput:m.withAttr("value",this.values.userMentioned)}),m("label",app.translator.trans("fof-pretty-mail.admin.settings.postMentioned")),m("br"),f.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",children:app.translator.trans("fof-pretty-mail.admin.settings.reset"),onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" postMentioned?")&&t.values.postMentioned('\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->reply->user->username !!} replied to your post (#{!! $blueprint->post->number !!}) in {!! $blueprint->post->discussion->title !!}.
\n\n
{!! app()->url() !!}/d/{!! $blueprint->reply->discussion_id !!}/{!! $blueprint->reply->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->reply->formatContent() !!}\n
\n
\n
\n \n')}}),m("textarea.FormControl",{rows:"15",value:this.values.postMentioned(),style:"margin-bottom: 10px",oninput:m.withAttr("value",this.values.postMentioned)}),m("h1",app.translator.trans("fof-pretty-mail.admin.css_settings.label")),m("div",{className:"helpText",style:"margin: 10px 0 10px"},app.translator.trans("fof-pretty-mail.admin.css_settings.help",{strong:m("strong",null)})),x.a.component({className:"Form-group",state:"1"===this.values.includeCSS(),onchange:function(n){return t.values.includeCSS(n?"1":"0")},children:app.translator.trans("fof-pretty-mail.admin.css_settings.switch_label")}),f.a.component({type:"submit",className:"Button Button--primary",children:app.translator.trans("core.admin.settings.submit_button"),loading:this.loading,disabled:!this.changed()})])])])])]},i.changed=function(){var t=this;return this.fields.some((function(n){return t.values[n]()!==app.data.settings[t.addPrefix(n)]}))},i.onsubmit=function(t){var n=this;if(t.preventDefault(),!this.loading){this.loading=!0,app.alerts.dismiss(this.successAlert);var e={};this.fields.forEach((function(t){return e[n.addPrefix(t)]=n.values[t]()})),b()(e).then((function(){n.loading=!1,app.alerts.show(n.successAlert=new c.a({type:"success",children:app.translator.trans("core.admin.basics.saved_message")}))}))}},i.addPrefix=function(t){return this.settingsPrefix+"."+t},o}(h.a);i.a.initializers.add("fof-pretty-mail",(function(){app.routes["fof-pretty-mail"]={path:"/fof/pretty-mail",component:$.component()},app.extensionSettings["fof-pretty-mail"]=function(){return m.route(app.route("fof-pretty-mail"))},Object(a.extend)(r.a.prototype,"items",(function(t){t.add("fof-pretty-mail",p.a.component({href:app.route("fof-pretty-mail"),icon:"fas fa-envelope-open",children:"Pretty Mail",description:app.translator.trans("fof-pretty-mail.admin.nav.desc")}))}))}))}]);
+module.exports=function(t){var n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(n){return t[n]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=10)}([function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n){t.exports=flarum.core.compat["utils/withAttr"]},function(t,n){t.exports=flarum.core.compat.app},function(t,n){t.exports=flarum.core.compat.extend},function(t,n){t.exports=flarum.core.compat["components/AdminNav"]},function(t,n){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,n){t.exports=flarum.core.compat["components/Page"]},function(t,n){t.exports=flarum.core.compat["utils/saveSettings"]},function(t,n){t.exports=flarum.core.compat["components/Switch"]},function(t,n){t.exports=flarum.core.compat["utils/Stream"]},function(t,n,e){"use strict";e.r(n);var o=e(2),r=e.n(o),a=e(3),s=e(4),i=e.n(s),l=e(5),p=e.n(l);var u=e(0),d=e.n(u),c=e(6),f=e.n(c),y=e(7),h=e.n(y),b=e(8),g=e.n(b),v=e(1),x=e.n(v),$=e(9),_=e.n($),w=function(t){var n,e;function o(){return t.apply(this,arguments)||this}e=t,(n=o).prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var r=o.prototype;return r.oninit=function(n){var e=this;t.prototype.oninit.call(this,n),this.fields=["mailhtml","newPost","postMentioned","userMentioned","includeCSS"],this.values={},this.settingsPrefix="fof-pretty-mail";var o=app.data.settings;this.fields.forEach((function(t){return e.values[t]=_()(o[e.addPrefix(t)])}))},r.view=function(){var t=this;return[m("div",{style:"padding-bottom: 20px",className:"SettingsPage"},[m("div",{className:"container"},[m("Form-group",[m("Form",{onsubmit:this.onsubmit.bind(this)},[m("h1",app.translator.trans("fof-pretty-mail.admin.settings.label")),m("div",{className:"helpText",style:"margin: 10px 0 10px"},app.translator.trans("fof-pretty-mail.admin.settings.help",{strong:m("strong",null)})),m("label",app.translator.trans("fof-pretty-mail.admin.settings.default")),m("br"),d.a.component({type:"button",style:"margin-bottom: 10px",className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" default?")&&t.values.mailhtml('\n\n \n \n @if ($forumStyle !== \'\')\n \n @endif\n\n\n\n\n {!! $body !!}\n
\n\n\n')}},app.translator.trans("fof-pretty-mail.admin.settings.reset")),m("textarea.FormControl",{rows:"15",value:this.values.mailhtml(),style:"margin: 10px 0 10px",oninput:x()("value",this.values.mailhtml)}),m("h3",app.translator.trans("fof-pretty-mail.admin.settings.notifications")),m("div",{className:"helpText",style:"margin-top: 10px"},app.translator.trans("fof-pretty-mail.admin.settings.notificationHelp")),m("label",app.translator.trans("fof-pretty-mail.admin.settings.newPost")),m("br"),d.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" newPost?")&&t.values.newPost('\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n ---\n\n
You won\'t receive any more notifications about this discussion until you\'re up-to-date.
\n
\n
\n\n\n')}},app.translator.trans("fof-pretty-mail.admin.settings.reset")),m("textarea.FormControl",{rows:"15",value:this.values.newPost(),style:"margin-bottom: 10px",oninput:x()("value",this.values.newPost)}),m("label",app.translator.trans("fof-pretty-mail.admin.settings.userMentioned")),m("br"),d.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" userMentioned?")&&t.values.userMentioned('\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n\n\n')}},app.translator.trans("fof-pretty-mail.admin.settings.reset")),m("textarea.FormControl",{rows:"15",value:this.values.userMentioned(),style:"margin-bottom: 10px",oninput:x()("value",this.values.userMentioned)}),m("label",app.translator.trans("fof-pretty-mail.admin.settings.postMentioned")),m("br"),d.a.component({type:"button",style:"margin: 10px 0 10px",className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("fof-pretty-mail.admin.settings.confirm")+" postMentioned?")&&t.values.postMentioned('\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->reply->formatContent() !!}\n
\n
\n
\n\n\n')}},app.translator.trans("fof-pretty-mail.admin.settings.reset")),m("textarea.FormControl",{rows:"15",value:this.values.postMentioned(),style:"margin-bottom: 10px",oninput:x()("value",this.values.postMentioned)}),m("h1",app.translator.trans("fof-pretty-mail.admin.css_settings.label")),m("div",{className:"helpText",style:"margin: 10px 0 10px"},app.translator.trans("fof-pretty-mail.admin.css_settings.help",{strong:m("strong",null)})),g.a.component({className:"Form-group",state:"1"===this.values.includeCSS(),onchange:function(n){return t.values.includeCSS(n?"1":"0")}},app.translator.trans("fof-pretty-mail.admin.css_settings.switch_label")),d.a.component({type:"submit",className:"Button Button--primary",loading:this.loading,disabled:!this.changed()},app.translator.trans("core.admin.settings.submit_button"))])])])])]},r.changed=function(){var t=this;return this.fields.some((function(n){return t.values[n]()!==app.data.settings[t.addPrefix(n)]}))},r.onsubmit=function(t){var n=this;if(t.preventDefault(),this.fields.forEach((function(t){return n.checkContent(t)})),!this.loading){this.loading=!0;var e={};this.fields.forEach((function(t){return e[n.addPrefix(t)]=n.values[t]()})),h()(e).then((function(){n.loading=!1,app.alerts.show({type:"success"},app.translator.trans("core.admin.basics.saved_message"))}))}},r.addPrefix=function(t){return this.settingsPrefix+"."+t},r.checkContent=function(t){this.values[t]().includes("$baseUrl")&&app.alerts.show({type:"warning"},t+": The use of $baseUrl is deprecated. Use $url->to('forum')->base() instead."),this.values[t]().includes("app()->url()")&&app.alerts.show({type:"error"},t+": app()->url() has been replaced. Use $url->to('forum')->base() instead.")},o}(f.a);r.a.initializers.add("fof-pretty-mail",(function(){app.routes["fof-pretty-mail"]={path:"/fof/pretty-mail",component:w},app.extensionSettings["fof-pretty-mail"]=function(){return m.route.get(app.route("fof-pretty-mail"))},Object(a.extend)(i.a.prototype,"items",(function(t){t.add("fof-pretty-mail",p.a.component({href:app.route("fof-pretty-mail"),icon:"fas fa-envelope-open",description:app.translator.trans("fof-pretty-mail.admin.nav.desc")},"Pretty Mail"))}))}))}]);
//# 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 4b299ff..89df5b1 100644
--- a/js/dist/admin.js.map
+++ b/js/dist/admin.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack://@fof/pretty-mail/webpack/bootstrap","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Button']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['app']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['extend']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Page']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/pretty-mail/./src/admin/components/SettingsPage.js","webpack://@fof/pretty-mail/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/pretty-mail/./src/admin/defaults.js","webpack://@fof/pretty-mail/./src/admin/index.js","webpack://@fof/pretty-mail/./src/admin/addSettingsPage.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","SettingsPage","subClass","superClass","constructor","__proto__","init","this","fields","values","settingsPrefix","settings","app","data","forEach","prop","addPrefix","view","style","className","onsubmit","translator","trans","strong","Button","component","type","children","onclick","confirm","mailhtml","rows","oninput","withAttr","newPost","userMentioned","postMentioned","Switch","state","includeCSS","onchange","enabled","loading","disabled","changed","some","e","preventDefault","alerts","dismiss","successAlert","saveSettings","then","show","Alert","Page","initializers","add","routes","path","extensionSettings","route","extend","AdminNav","items","AdminLinkButton","href","icon","description"],"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,E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M,UACNC,SAAUf,IAAIS,WAAWC,MAAM,2C,EAS/CN,UAAA,SAAU3B,GACN,OAAOkB,KAAKG,eAAiB,IAAMrB,G,GArLDkE,KGL1C3C,IAAI4C,aAAaC,IAAI,mBAAmB,WCGpC7C,IAAI8C,OAAO,mBAAqB,CAAEC,KAAM,mBAAoBlC,UAAWxB,EAAawB,aAEpFb,IAAIgD,kBAAkB,mBAAqB,kBAAM1F,EAAE2F,MAAMjD,IAAIiD,MAAM,qBAEnEC,iBAAOC,IAASrE,UAAW,SAAS,SAAAsE,GAChCA,EAAMP,IACF,kBACAQ,IAAgBxC,UAAU,CACtByC,KAAMtD,IAAIiD,MAAM,mBAChBM,KAAM,uBACNxC,SAAU,cACVyC,YAAaxD,IAAIS,WAAWC,MAAM","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 = 9);\n","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['components/Switch'];","import Alert from 'flarum/components/Alert';\r\nimport Button from 'flarum/components/Button';\r\nimport Page from 'flarum/components/Page';\r\nimport saveSettings from 'flarum/utils/saveSettings';\r\nimport Switch from 'flarum/components/Switch';\r\n\r\nimport * as defaults from '../defaults';\r\n\r\nexport default class SettingsPage extends Page {\r\n init() {\r\n this.fields = ['mailhtml', 'newPost', 'postMentioned', 'userMentioned', 'includeCSS'];\r\n\r\n this.values = {};\r\n\r\n this.settingsPrefix = 'fof-pretty-mail';\r\n\r\n const settings = app.data.settings;\r\n\r\n this.fields.forEach(key => (this.values[key] = m.prop(settings[this.addPrefix(key)])));\r\n }\r\n\r\n view() {\r\n return [\r\n m('div', { style: 'padding-bottom: 20px', className: 'SettingsPage' }, [\r\n m('div', { className: 'container' }, [\r\n m('Form-group', [\r\n m('Form', { onsubmit: this.onsubmit.bind(this) }, [\r\n m('h1', app.translator.trans('fof-pretty-mail.admin.settings.label')),\r\n m(\r\n 'div',\r\n {\r\n className: 'helpText',\r\n style: 'margin: 10px 0 10px',\r\n },\r\n app.translator.trans('fof-pretty-mail.admin.settings.help', { strong: })\r\n ),\r\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.default')),\r\n m('br'),\r\n Button.component({\r\n type: 'button',\r\n style: 'margin-bottom: 10px',\r\n className: 'Button Button--primary',\r\n children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),\r\n onclick: () => {\r\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' default?')) {\r\n this.values.mailhtml(defaults.mailto);\r\n }\r\n },\r\n }),\r\n m('textarea.FormControl', {\r\n rows: '15',\r\n value: this.values.mailhtml(),\r\n style: 'margin: 10px 0 10px',\r\n oninput: m.withAttr('value', this.values.mailhtml),\r\n }),\r\n m('h3', app.translator.trans('fof-pretty-mail.admin.settings.notifications')),\r\n m(\r\n 'div',\r\n {\r\n className: 'helpText',\r\n style: 'margin-top: 10px',\r\n },\r\n app.translator.trans('fof-pretty-mail.admin.settings.notificationHelp')\r\n ),\r\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.newPost')),\r\n m('br'),\r\n Button.component({\r\n type: 'button',\r\n style: 'margin: 10px 0 10px',\r\n className: 'Button Button--primary',\r\n children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),\r\n onclick: () => {\r\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' newPost?')) {\r\n this.values.newPost(defaults.newPost);\r\n }\r\n },\r\n }),\r\n m('textarea.FormControl', {\r\n rows: '15',\r\n value: this.values.newPost(),\r\n style: 'margin-bottom: 10px',\r\n oninput: m.withAttr('value', this.values.newPost),\r\n }),\r\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.userMentioned')),\r\n m('br'),\r\n Button.component({\r\n type: 'button',\r\n style: 'margin: 10px 0 10px',\r\n className: 'Button Button--primary',\r\n children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),\r\n onclick: () => {\r\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' userMentioned?')) {\r\n this.values.userMentioned(defaults.userMentioned);\r\n }\r\n },\r\n }),\r\n m('textarea.FormControl', {\r\n rows: '15',\r\n value: this.values.userMentioned(),\r\n style: 'margin-bottom: 10px',\r\n oninput: m.withAttr('value', this.values.userMentioned),\r\n }),\r\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.postMentioned')),\r\n m('br'),\r\n Button.component({\r\n type: 'button',\r\n style: 'margin: 10px 0 10px',\r\n className: 'Button Button--primary',\r\n children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),\r\n onclick: () => {\r\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' postMentioned?')) {\r\n this.values.postMentioned(defaults.postMentioned);\r\n }\r\n },\r\n }),\r\n m('textarea.FormControl', {\r\n rows: '15',\r\n value: this.values.postMentioned(),\r\n style: 'margin-bottom: 10px',\r\n oninput: m.withAttr('value', this.values.postMentioned),\r\n }),\r\n m('h1', app.translator.trans('fof-pretty-mail.admin.css_settings.label')),\r\n m(\r\n 'div',\r\n {\r\n className: 'helpText',\r\n style: 'margin: 10px 0 10px',\r\n },\r\n app.translator.trans('fof-pretty-mail.admin.css_settings.help', { strong: })\r\n ),\r\n Switch.component({\r\n className: 'Form-group',\r\n state: this.values.includeCSS() === '1',\r\n onchange: enabled => this.values.includeCSS(enabled ? '1' : '0'),\r\n children: app.translator.trans('fof-pretty-mail.admin.css_settings.switch_label'),\r\n }),\r\n Button.component({\r\n type: 'submit',\r\n className: 'Button Button--primary',\r\n children: app.translator.trans('core.admin.settings.submit_button'),\r\n loading: this.loading,\r\n disabled: !this.changed(),\r\n }),\r\n ]),\r\n ]),\r\n ]),\r\n ]),\r\n ];\r\n }\r\n\r\n /**\r\n * @returns {boolean}\r\n */\r\n changed() {\r\n var fieldsCheck = this.fields.some(key => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\r\n return fieldsCheck;\r\n }\r\n\r\n /**\r\n * @param e\r\n */\r\n onsubmit(e) {\r\n e.preventDefault();\r\n\r\n if (this.loading) return;\r\n\r\n this.loading = true;\r\n\r\n app.alerts.dismiss(this.successAlert);\r\n\r\n const settings = {};\r\n\r\n this.fields.forEach(key => (settings[this.addPrefix(key)] = this.values[key]()));\r\n\r\n saveSettings(settings).then(() => {\r\n this.loading = false;\r\n app.alerts.show(\r\n (this.successAlert = new Alert({\r\n type: 'success',\r\n children: app.translator.trans('core.admin.basics.saved_message'),\r\n }))\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * @returns string\r\n */\r\n addPrefix(key) {\r\n return this.settingsPrefix + '.' + key;\r\n }\r\n}\r\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export const mailto = `\n \n \n \n @if ($forumStyle !== '')\n \n @endif\n \n\n\n \n \n {!! $body !!}\n
\n \n`;\n\nexport const newPost = `\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->post->user->display_name !!} made a post in a discussion you're following: {!! $blueprint->post->discussion->title !!}
\n\n
To view the new activity, check out the following link:
\n
{!! $baseUrl !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n ---\n\n
You won't receive any more notifications about this discussion until you're up-to-date.
\n
\n
\n \n`;\n\nexport const userMentioned = `\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->post->user->username !!} mentioned you in a post in {!! $blueprint->post->discussion->title !!}.
\n\n
{!! $baseUrl !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n \n`;\n\nexport const postMentioned = `\n \n \n \n \n \n\n\n \n \n
\n
Hey {!! $user->display_name !!}!
\n\n
{!! $blueprint->reply->user->username !!} replied to your post (#{!! $blueprint->post->number !!}) in {!! $blueprint->post->discussion->title !!}.
\n\n
{!! app()->url() !!}/d/{!! $blueprint->reply->discussion_id !!}/{!! $blueprint->reply->number !!}
\n\n ---\n\n
\n
\n
\n {!! $blueprint->reply->formatContent() !!}\n
\n
\n
\n \n`;\n","import app from 'flarum/app';\r\nimport addSettingsPage from './addSettingsPage';\r\n\r\napp.initializers.add('fof-pretty-mail', () => {\r\n // Add a settings pane for the extension\r\n addSettingsPage();\r\n});\r\n","import { extend } from 'flarum/extend';\r\nimport AdminNav from 'flarum/components/AdminNav';\r\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\r\nimport SettingsPage from './components/SettingsPage';\r\n\r\nexport default function() {\r\n app.routes['fof-pretty-mail'] = { path: '/fof/pretty-mail', component: SettingsPage.component() };\r\n\r\n app.extensionSettings['fof-pretty-mail'] = () => m.route(app.route('fof-pretty-mail'));\r\n\r\n extend(AdminNav.prototype, 'items', items => {\r\n items.add(\r\n 'fof-pretty-mail',\r\n AdminLinkButton.component({\r\n href: app.route('fof-pretty-mail'),\r\n icon: 'fas fa-envelope-open',\r\n children: 'Pretty Mail',\r\n description: app.translator.trans('fof-pretty-mail.admin.nav.desc'),\r\n })\r\n );\r\n });\r\n}\r\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack://@fof/pretty-mail/webpack/bootstrap","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Button']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['utils/withAttr']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['app']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['extend']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Page']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/pretty-mail/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/pretty-mail/./src/admin/components/SettingsPage.js","webpack://@fof/pretty-mail/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/pretty-mail/./src/admin/defaults.js","webpack://@fof/pretty-mail/./src/admin/index.js","webpack://@fof/pretty-mail/./src/admin/addSettingsPage.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","SettingsPage","subClass","superClass","constructor","__proto__","oninit","vnode","this","fields","values","settingsPrefix","settings","app","data","forEach","Stream","addPrefix","view","style","className","onsubmit","translator","trans","strong","Button","component","type","onclick","confirm","mailhtml","rows","oninput","withAttr","newPost","userMentioned","postMentioned","Switch","state","includeCSS","onchange","enabled","loading","disabled","changed","some","e","preventDefault","checkContent","saveSettings","then","alerts","show","includes","Page","initializers","add","routes","path","extensionSettings","route","extend","AdminNav","items","AdminLinkButton","href","icon","description"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB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AG,OAAI,EAAK2D,aAAa3D,OAEzCmB,KAAKkC,QAAT,CAEAlC,KAAKkC,SAAU,EAEf,IAAM9B,EAAW,GAEjBJ,KAAKC,OAAOM,SAAQ,SAAA1B,GAAG,OAAKuB,EAAS,EAAKK,UAAU5B,IAAQ,EAAKqB,OAAOrB,QAExE4D,IAAarC,GAAUsC,MAAK,WACxB,EAAKR,SAAU,EACf7B,IAAIsC,OAAOC,KAAK,CAAEzB,KAAM,WAAad,IAAIS,WAAWC,MAAM,yC,EAOlEN,UAAA,SAAU5B,GACN,OAAOmB,KAAKG,eAAiB,IAAMtB,G,EAGvC2D,aAAA,SAAa3D,GACLmB,KAAKE,OAAOrB,KAAOgE,SAAS,aAC5BxC,IAAIsC,OAAOC,KAAK,CAAEzB,KAAM,WAAatC,EAAM,+EAE3CmB,KAAKE,OAAOrB,KAAOgE,SAAS,iBAC5BxC,IAAIsC,OAAOC,KAAK,CAAEzB,KAAM,SAAWtC,EAAM,6E,GApMXiE,KGN1CzC,IAAI0C,aAAaC,IAAI,mBAAmB,WCGpC3C,IAAI4C,OAAO,mBAAqB,CAAEC,KAAM,mBAAoBhC,UAAWzB,GAEvEY,IAAI8C,kBAAkB,mBAAqB,kBAAMzF,EAAE0F,MAAMjF,IAAIkC,IAAI+C,MAAM,qBAEvEC,iBAAOC,IAASpE,UAAW,SAAS,SAAAqE,GAChCA,EAAMP,IACF,kBACAQ,IAAgBtC,UACZ,CACIuC,KAAMpD,IAAI+C,MAAM,mBAChBM,KAAM,uBACNC,YAAatD,IAAIS,WAAWC,MAAM,mCAEtC","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 = 10);\n","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['utils/withAttr'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['utils/Stream'];","import Button from 'flarum/components/Button';\nimport Page from 'flarum/components/Page';\nimport saveSettings from 'flarum/utils/saveSettings';\nimport Switch from 'flarum/components/Switch';\nimport withAttr from 'flarum/utils/withAttr';\nimport Stream from 'flarum/utils/Stream';\n\nimport * as defaults from '../defaults';\n\nexport default class SettingsPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n this.fields = ['mailhtml', 'newPost', 'postMentioned', 'userMentioned', 'includeCSS'];\n\n this.values = {};\n\n this.settingsPrefix = 'fof-pretty-mail';\n\n const settings = app.data.settings;\n\n this.fields.forEach(key => (this.values[key] = Stream(settings[this.addPrefix(key)])));\n }\n\n view() {\n return [\n m('div', { style: 'padding-bottom: 20px', className: 'SettingsPage' }, [\n m('div', { className: 'container' }, [\n m('Form-group', [\n m('Form', { onsubmit: this.onsubmit.bind(this) }, [\n m('h1', app.translator.trans('fof-pretty-mail.admin.settings.label')),\n m(\n 'div',\n {\n className: 'helpText',\n style: 'margin: 10px 0 10px',\n },\n app.translator.trans('fof-pretty-mail.admin.settings.help', { strong: })\n ),\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.default')),\n m('br'),\n Button.component(\n {\n type: 'button',\n style: 'margin-bottom: 10px',\n className: 'Button Button--primary',\n onclick: () => {\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' default?')) {\n this.values.mailhtml(defaults.mailto);\n }\n },\n },\n app.translator.trans('fof-pretty-mail.admin.settings.reset')\n ),\n m('textarea.FormControl', {\n rows: '15',\n value: this.values.mailhtml(),\n style: 'margin: 10px 0 10px',\n oninput: withAttr('value', this.values.mailhtml),\n }),\n m('h3', app.translator.trans('fof-pretty-mail.admin.settings.notifications')),\n m(\n 'div',\n {\n className: 'helpText',\n style: 'margin-top: 10px',\n },\n app.translator.trans('fof-pretty-mail.admin.settings.notificationHelp')\n ),\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.newPost')),\n m('br'),\n Button.component(\n {\n type: 'button',\n style: 'margin: 10px 0 10px',\n className: 'Button Button--primary',\n onclick: () => {\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' newPost?')) {\n this.values.newPost(defaults.newPost);\n }\n },\n },\n app.translator.trans('fof-pretty-mail.admin.settings.reset')\n ),\n m('textarea.FormControl', {\n rows: '15',\n value: this.values.newPost(),\n style: 'margin-bottom: 10px',\n oninput: withAttr('value', this.values.newPost),\n }),\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.userMentioned')),\n m('br'),\n Button.component(\n {\n type: 'button',\n style: 'margin: 10px 0 10px',\n className: 'Button Button--primary',\n onclick: () => {\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' userMentioned?')) {\n this.values.userMentioned(defaults.userMentioned);\n }\n },\n },\n app.translator.trans('fof-pretty-mail.admin.settings.reset')\n ),\n m('textarea.FormControl', {\n rows: '15',\n value: this.values.userMentioned(),\n style: 'margin-bottom: 10px',\n oninput: withAttr('value', this.values.userMentioned),\n }),\n m('label', app.translator.trans('fof-pretty-mail.admin.settings.postMentioned')),\n m('br'),\n Button.component(\n {\n type: 'button',\n style: 'margin: 10px 0 10px',\n className: 'Button Button--primary',\n onclick: () => {\n if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' postMentioned?')) {\n this.values.postMentioned(defaults.postMentioned);\n }\n },\n },\n app.translator.trans('fof-pretty-mail.admin.settings.reset')\n ),\n m('textarea.FormControl', {\n rows: '15',\n value: this.values.postMentioned(),\n style: 'margin-bottom: 10px',\n oninput: withAttr('value', this.values.postMentioned),\n }),\n m('h1', app.translator.trans('fof-pretty-mail.admin.css_settings.label')),\n m(\n 'div',\n {\n className: 'helpText',\n style: 'margin: 10px 0 10px',\n },\n app.translator.trans('fof-pretty-mail.admin.css_settings.help', { strong: })\n ),\n Switch.component(\n {\n className: 'Form-group',\n state: this.values.includeCSS() === '1',\n onchange: enabled => this.values.includeCSS(enabled ? '1' : '0'),\n },\n app.translator.trans('fof-pretty-mail.admin.css_settings.switch_label')\n ),\n Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n disabled: !this.changed(),\n },\n app.translator.trans('core.admin.settings.submit_button')\n ),\n ]),\n ]),\n ]),\n ]),\n ];\n }\n\n /**\n * @returns {boolean}\n */\n changed() {\n var fieldsCheck = this.fields.some(key => this.values[key]() !== app.data.settings[this.addPrefix(key)]);\n return fieldsCheck;\n }\n\n /**\n * @param e\n */\n onsubmit(e) {\n e.preventDefault();\n this.fields.forEach(key => this.checkContent(key));\n\n if (this.loading) return;\n\n this.loading = true;\n\n const settings = {};\n\n this.fields.forEach(key => (settings[this.addPrefix(key)] = this.values[key]()));\n\n saveSettings(settings).then(() => {\n this.loading = false;\n app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));\n });\n }\n\n /**\n * @returns string\n */\n addPrefix(key) {\n return this.settingsPrefix + '.' + key;\n }\n\n checkContent(key) {\n if (this.values[key]().includes('$baseUrl')) {\n app.alerts.show({ type: 'warning' }, key + \": The use of $baseUrl is deprecated. Use $url->to('forum')->base() instead.\");\n }\n if (this.values[key]().includes('app()->url()')) {\n app.alerts.show({ type: 'error' }, key + \": app()->url() has been replaced. Use $url->to('forum')->base() instead.\");\n }\n }\n}\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export const mailto = `\n\n \n \n @if ($forumStyle !== '')\n \n @endif\n\n\n\n\n {!! $body !!}\n
\n\n\n`;\n\nexport const newPost = `\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n ---\n\n
You won't receive any more notifications about this discussion until you're up-to-date.
\n
\n
\n\n\n`;\n\nexport const userMentioned = `\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->post->formatContent() !!}\n
\n
\n
\n\n\n`;\n\nexport const postMentioned = `\n\n \n \n \n\n\n\n\n
\n
\n
\n {!! $blueprint->reply->formatContent() !!}\n
\n
\n
\n\n\n`;\n","import app from 'flarum/app';\nimport addSettingsPage from './addSettingsPage';\n\napp.initializers.add('fof-pretty-mail', () => {\n // Add a settings pane for the extension\n addSettingsPage();\n});\n","import { extend } from 'flarum/extend';\nimport AdminNav from 'flarum/components/AdminNav';\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\nimport SettingsPage from './components/SettingsPage';\n\nexport default function() {\n app.routes['fof-pretty-mail'] = { path: '/fof/pretty-mail', component: SettingsPage };\n\n app.extensionSettings['fof-pretty-mail'] = () => m.route.get(app.route('fof-pretty-mail'));\n\n extend(AdminNav.prototype, 'items', items => {\n items.add(\n 'fof-pretty-mail',\n AdminLinkButton.component(\n {\n href: app.route('fof-pretty-mail'),\n icon: 'fas fa-envelope-open',\n description: app.translator.trans('fof-pretty-mail.admin.nav.desc'),\n },\n 'Pretty Mail'\n )\n );\n });\n}\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/js/src/admin/addSettingsPage.js b/js/src/admin/addSettingsPage.js
index 2771e13..0dfb9ad 100644
--- a/js/src/admin/addSettingsPage.js
+++ b/js/src/admin/addSettingsPage.js
@@ -4,19 +4,21 @@ import AdminLinkButton from 'flarum/components/AdminLinkButton';
import SettingsPage from './components/SettingsPage';
export default function() {
- app.routes['fof-pretty-mail'] = { path: '/fof/pretty-mail', component: SettingsPage.component() };
+ app.routes['fof-pretty-mail'] = { path: '/fof/pretty-mail', component: SettingsPage };
- app.extensionSettings['fof-pretty-mail'] = () => m.route(app.route('fof-pretty-mail'));
+ app.extensionSettings['fof-pretty-mail'] = () => m.route.get(app.route('fof-pretty-mail'));
extend(AdminNav.prototype, 'items', items => {
items.add(
'fof-pretty-mail',
- AdminLinkButton.component({
- href: app.route('fof-pretty-mail'),
- icon: 'fas fa-envelope-open',
- children: 'Pretty Mail',
- description: app.translator.trans('fof-pretty-mail.admin.nav.desc'),
- })
+ AdminLinkButton.component(
+ {
+ href: app.route('fof-pretty-mail'),
+ icon: 'fas fa-envelope-open',
+ description: app.translator.trans('fof-pretty-mail.admin.nav.desc'),
+ },
+ 'Pretty Mail'
+ )
);
});
}
diff --git a/js/src/admin/components/SettingsPage.js b/js/src/admin/components/SettingsPage.js
index 994fab5..6e619d4 100644
--- a/js/src/admin/components/SettingsPage.js
+++ b/js/src/admin/components/SettingsPage.js
@@ -1,13 +1,15 @@
-import Alert from 'flarum/components/Alert';
import Button from 'flarum/components/Button';
import Page from 'flarum/components/Page';
import saveSettings from 'flarum/utils/saveSettings';
import Switch from 'flarum/components/Switch';
+import withAttr from 'flarum/utils/withAttr';
+import Stream from 'flarum/utils/Stream';
import * as defaults from '../defaults';
export default class SettingsPage extends Page {
- init() {
+ oninit(vnode) {
+ super.oninit(vnode);
this.fields = ['mailhtml', 'newPost', 'postMentioned', 'userMentioned', 'includeCSS'];
this.values = {};
@@ -16,7 +18,7 @@ export default class SettingsPage extends Page {
const settings = app.data.settings;
- this.fields.forEach(key => (this.values[key] = m.prop(settings[this.addPrefix(key)])));
+ this.fields.forEach(key => (this.values[key] = Stream(settings[this.addPrefix(key)])));
}
view() {
@@ -36,22 +38,24 @@ export default class SettingsPage extends Page {
),
m('label', app.translator.trans('fof-pretty-mail.admin.settings.default')),
m('br'),
- Button.component({
- type: 'button',
- style: 'margin-bottom: 10px',
- className: 'Button Button--primary',
- children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),
- onclick: () => {
- if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' default?')) {
- this.values.mailhtml(defaults.mailto);
- }
+ Button.component(
+ {
+ type: 'button',
+ style: 'margin-bottom: 10px',
+ className: 'Button Button--primary',
+ onclick: () => {
+ if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' default?')) {
+ this.values.mailhtml(defaults.mailto);
+ }
+ },
},
- }),
+ app.translator.trans('fof-pretty-mail.admin.settings.reset')
+ ),
m('textarea.FormControl', {
rows: '15',
value: this.values.mailhtml(),
style: 'margin: 10px 0 10px',
- oninput: m.withAttr('value', this.values.mailhtml),
+ oninput: withAttr('value', this.values.mailhtml),
}),
m('h3', app.translator.trans('fof-pretty-mail.admin.settings.notifications')),
m(
@@ -64,60 +68,66 @@ export default class SettingsPage extends Page {
),
m('label', app.translator.trans('fof-pretty-mail.admin.settings.newPost')),
m('br'),
- Button.component({
- type: 'button',
- style: 'margin: 10px 0 10px',
- className: 'Button Button--primary',
- children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),
- onclick: () => {
- if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' newPost?')) {
- this.values.newPost(defaults.newPost);
- }
+ Button.component(
+ {
+ type: 'button',
+ style: 'margin: 10px 0 10px',
+ className: 'Button Button--primary',
+ onclick: () => {
+ if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' newPost?')) {
+ this.values.newPost(defaults.newPost);
+ }
+ },
},
- }),
+ app.translator.trans('fof-pretty-mail.admin.settings.reset')
+ ),
m('textarea.FormControl', {
rows: '15',
value: this.values.newPost(),
style: 'margin-bottom: 10px',
- oninput: m.withAttr('value', this.values.newPost),
+ oninput: withAttr('value', this.values.newPost),
}),
m('label', app.translator.trans('fof-pretty-mail.admin.settings.userMentioned')),
m('br'),
- Button.component({
- type: 'button',
- style: 'margin: 10px 0 10px',
- className: 'Button Button--primary',
- children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),
- onclick: () => {
- if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' userMentioned?')) {
- this.values.userMentioned(defaults.userMentioned);
- }
+ Button.component(
+ {
+ type: 'button',
+ style: 'margin: 10px 0 10px',
+ className: 'Button Button--primary',
+ onclick: () => {
+ if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' userMentioned?')) {
+ this.values.userMentioned(defaults.userMentioned);
+ }
+ },
},
- }),
+ app.translator.trans('fof-pretty-mail.admin.settings.reset')
+ ),
m('textarea.FormControl', {
rows: '15',
value: this.values.userMentioned(),
style: 'margin-bottom: 10px',
- oninput: m.withAttr('value', this.values.userMentioned),
+ oninput: withAttr('value', this.values.userMentioned),
}),
m('label', app.translator.trans('fof-pretty-mail.admin.settings.postMentioned')),
m('br'),
- Button.component({
- type: 'button',
- style: 'margin: 10px 0 10px',
- className: 'Button Button--primary',
- children: app.translator.trans('fof-pretty-mail.admin.settings.reset'),
- onclick: () => {
- if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' postMentioned?')) {
- this.values.postMentioned(defaults.postMentioned);
- }
+ Button.component(
+ {
+ type: 'button',
+ style: 'margin: 10px 0 10px',
+ className: 'Button Button--primary',
+ onclick: () => {
+ if (confirm(app.translator.trans('fof-pretty-mail.admin.settings.confirm') + ' postMentioned?')) {
+ this.values.postMentioned(defaults.postMentioned);
+ }
+ },
},
- }),
+ app.translator.trans('fof-pretty-mail.admin.settings.reset')
+ ),
m('textarea.FormControl', {
rows: '15',
value: this.values.postMentioned(),
style: 'margin-bottom: 10px',
- oninput: m.withAttr('value', this.values.postMentioned),
+ oninput: withAttr('value', this.values.postMentioned),
}),
m('h1', app.translator.trans('fof-pretty-mail.admin.css_settings.label')),
m(
@@ -128,19 +138,23 @@ export default class SettingsPage extends Page {
},
app.translator.trans('fof-pretty-mail.admin.css_settings.help', { strong: })
),
- Switch.component({
- className: 'Form-group',
- state: this.values.includeCSS() === '1',
- onchange: enabled => this.values.includeCSS(enabled ? '1' : '0'),
- children: app.translator.trans('fof-pretty-mail.admin.css_settings.switch_label'),
- }),
- Button.component({
- type: 'submit',
- className: 'Button Button--primary',
- children: app.translator.trans('core.admin.settings.submit_button'),
- loading: this.loading,
- disabled: !this.changed(),
- }),
+ Switch.component(
+ {
+ className: 'Form-group',
+ state: this.values.includeCSS() === '1',
+ onchange: enabled => this.values.includeCSS(enabled ? '1' : '0'),
+ },
+ app.translator.trans('fof-pretty-mail.admin.css_settings.switch_label')
+ ),
+ Button.component(
+ {
+ type: 'submit',
+ className: 'Button Button--primary',
+ loading: this.loading,
+ disabled: !this.changed(),
+ },
+ app.translator.trans('core.admin.settings.submit_button')
+ ),
]),
]),
]),
@@ -161,25 +175,19 @@ export default class SettingsPage extends Page {
*/
onsubmit(e) {
e.preventDefault();
+ this.fields.forEach(key => this.checkContent(key));
if (this.loading) return;
this.loading = true;
- app.alerts.dismiss(this.successAlert);
-
const settings = {};
this.fields.forEach(key => (settings[this.addPrefix(key)] = this.values[key]()));
saveSettings(settings).then(() => {
this.loading = false;
- app.alerts.show(
- (this.successAlert = new Alert({
- type: 'success',
- children: app.translator.trans('core.admin.basics.saved_message'),
- }))
- );
+ app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));
});
}
@@ -189,4 +197,13 @@ export default class SettingsPage extends Page {
addPrefix(key) {
return this.settingsPrefix + '.' + key;
}
+
+ checkContent(key) {
+ if (this.values[key]().includes('$baseUrl')) {
+ app.alerts.show({ type: 'warning' }, key + ": The use of $baseUrl is deprecated. Use $url->to('forum')->base() instead.");
+ }
+ if (this.values[key]().includes('app()->url()')) {
+ app.alerts.show({ type: 'error' }, key + ": app()->url() has been replaced. Use $url->to('forum')->base() instead.");
+ }
+ }
}
diff --git a/js/src/admin/defaults.js b/js/src/admin/defaults.js
index 46407eb..abeb78e 100644
--- a/js/src/admin/defaults.js
+++ b/js/src/admin/defaults.js
@@ -1,249 +1,242 @@
export const mailto = `
-
-
-
- @if ($forumStyle !== '')
-
- @endif
-
-
+
+
+
+ @if ($forumStyle !== '')
+
+ @endif
+
-
+