diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100755 index 0000000..f808751 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: JavaScript + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - uses: flarum/action-build@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100755 index 0000000..8264b3d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +name: Lint + +on: + push: + paths: + - 'js/src/**' + pull_request: + paths: + - 'js/src/**' + +jobs: + prettier: + runs-on: ubuntu-latest + + name: JS / Prettier + + steps: + - uses: actions/checkout@master + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: "12" + + - name: Install JS dependencies + run: npm ci + working-directory: ./js + + - name: Check JS code for formatting + run: node_modules/.bin/prettier --check src + working-directory: ./js \ No newline at end of file diff --git a/extend.php b/extend.php index 6419a3d..29fe60a 100644 --- a/extend.php +++ b/extend.php @@ -6,10 +6,12 @@ use Illuminate\Events\Dispatcher; // Flarum classes +use Flarum\Api\Controller as FlarumController; +use Flarum\Api\Serializer\BasicDiscussionSerializer; +use Flarum\Api\Serializer\ForumSerializer; use Flarum\Extend; -use Extend\Locales; -use Extend\Routes; use Flarum\Discussion\Discussion; +use Flarum\Discussion\Event\Saving; use Flarum\Discussion\Event\Searching; // Controllers @@ -17,20 +19,15 @@ use V17Development\FlarumBlog\Controller\BlogItemController; use V17Development\FlarumBlog\Controller\BlogComposerController; -// Extender -use V17Development\FlarumBlog\Extenders\ThemeExtender; - // Access -use V17Development\FlarumBlog\Access\DiscussionPolicy; - +use V17Development\FlarumBlog\Access\ScopeDiscussionVisibility; // API controllers +use V17Development\FlarumBlog\Api\AttachForumSerializerAttributes; use V17Development\FlarumBlog\Api\Controller\CreateBlogMetaController; use V17Development\FlarumBlog\Api\Controller\UpdateBlogMetaController; - +use V17Development\FlarumBlog\Api\Serializer\BlogMetaSerializer; // Listeners -use V17Development\FlarumBlog\Listeners\AddDiscussionBlogMetaRelationship; use V17Development\FlarumBlog\Listeners\FilterBlogArticles; -use V17Development\FlarumBlog\Listeners\ForumAttributesListener; use V17Development\FlarumBlog\Listeners\CreateBlogMetaOnDiscussionCreate; // Models @@ -60,21 +57,35 @@ new Extend\Locales(__DIR__ . '/locale'), - // Add theme extender - new ThemeExtender(), - (new Extend\Model(Discussion::class)) ->hasOne('blogMeta', BlogMeta::class, 'discussion_id'), - new Extend\Compat(function (Dispatcher $events) { - $events->subscribe(AddDiscussionBlogMetaRelationship::class); - $events->subscribe(ForumAttributesListener::class); - $events->subscribe(CreateBlogMetaOnDiscussionCreate::class); + (new Extend\ModelVisibility(Discussion::class)) + ->scope(ScopeDiscussionVisibility::class), - $events->subscribe(DiscussionPolicy::class); + (new Extend\ApiController(FlarumController\CreateDiscussionController::class)) + ->addInclude(['blogMeta', 'firstPost', 'user']), - $events->listen(Searching::class, FilterDiscussionsForBlogPosts::class); + (new Extend\ApiController(FlarumController\ListDiscussionsController::class)) + ->addInclude(['blogMeta', 'firstPost', 'user']), + + (new Extend\ApiController(FlarumController\ShowDiscussionController::class)) + ->addInclude(['blogMeta', 'firstPost', 'user']), + (new Extend\ApiController(FlarumController\UpdateDiscussionController::class)) + ->addInclude(['blogMeta', 'firstPost', 'user']), + + (new Extend\ApiSerializer(BasicDiscussionSerializer::class)) + ->hasOne('blogMeta', BlogMetaSerializer::class), + + (new Extend\ApiSerializer(ForumSerializer::class)) + ->mutate(AttachForumSerializerAttributes::class), + + (new Extend\Event) + ->listen(Saving::class, CreateBlogMetaOnDiscussionCreate::class), + + new Extend\Compat(function (Dispatcher $events) { + $events->listen(Searching::class, FilterDiscussionsForBlogPosts::class); $events->subscribe(FilterBlogArticles::class); }) ]; diff --git a/js/dist/admin.js b/js/dist/admin.js index 972bdad..57d50c4 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function s(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)s.d(n,a,function(t){return e[t]}.bind(null,a));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=36)}([function(e,t,s){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}s.d(t,"a",(function(){return n}))},function(e,t){e.exports=flarum.core.compat["components/Button"]},,function(e,t){e.exports=flarum.core.compat["components/Switch"]},,,function(e,t){e.exports=flarum.core.compat["components/Alert"]},,function(e,t){e.exports=flarum.core.compat.extend},,function(e,t){e.exports=flarum.core.compat["components/Modal"]},,,,,function(e,t){e.exports=flarum.core.compat["utils/saveSettings"]},,function(e,t){e.exports=flarum.core.compat["components/FieldSet"]},,,,,,,,,,,,,,,,function(e,t){e.exports=flarum.core.compat["components/PermissionGrid"]},function(e,t){e.exports=flarum.core.compat["components/ExtensionPage"]},,function(e,t,s){"use strict";s.r(t);var n=s(8),a=s(33),o=s.n(a),i=s(0),r=s(34),l=s.n(r),c=s(15),g=s.n(c),d=s(6),p=s.n(d),h=s(1),u=s.n(h),b=s(17),f=s.n(b),_=s(3),y=s.n(_),v=s(10),x=function(e){function t(){return e.apply(this,arguments)||this}Object(i.a)(t,e);var s=t.prototype;return s.oninit=function(t){e.prototype.oninit.call(this,t),this.blogCategoriesOriginal=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.blogCategories=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.isSaving=!1,this.hasChanges=!1},s.title=function(){return"Select blog categories"},s.className=function(){return"Modal modal-dialog FlarumBlog-TagsModal"},s.content=function(){var e=this;return m("div",null,m("div",{className:"Modal-body"},m("p",null,"Please select one or more tags that are considered blog tags. ",m("a",{href:app.forum.attribute("baseUrl")+"/blog",target:"_blank"},"Visit your blog.")),m("table",{className:"FlarumBlog-TagsTable"},m("thead",null,m("th",{width:"35"}),m("th",null,"Tag name"),m("th",{width:"50"})),m("tbody",null,0===app.store.all("tags").length&&m("tr",null,m("td",{colspan:"3"},"You currently have no tags.")),app.store.all("tags").map((function(t){if(!t.parent()){var s=function(){var s=e.blogCategories.indexOf(t.id());e.hasChanges=!0,s>=0?e.blogCategories.splice(s,1):e.blogCategories.push(t.id())};return m("tr",null,m("td",null,m("i",{className:t.icon()})),m("td",{onclick:s},t.name()),m("td",null,m(y.a,{state:e.blogCategories.indexOf(t.id())>=0,onchange:s})))}}))))),m("div",{style:"padding: 25px 30px; text-align: center;"},m(u.a,{type:"submit",className:"Button Button--primary",loading:this.loading},this.hasChanges?"Save changes":"Close")))},s.onsubmit=function(e){var t=this;e.preventDefault(),this.hasChanges?(this.isSaving=!0,g()({blog_tags:this.blogCategories.join("|")}).then((function(){app.alerts.show(p.a,{type:"success"},app.translator.trans("core.admin.basics.saved_message")),t.hide()})).catch((function(){app.alerts.show(p.a,{type:"error"},app.translator.trans("core.lib.error.generic_message"))})).then((function(){t.isSaving=!1}))):this.hide()},t}(s.n(v).a),C=function(e){function t(){return e.apply(this,arguments)||this}Object(i.a)(t,e);var s=t.prototype;return s.oninit=function(t){e.prototype.oninit.call(this,t),this.hasChanges=!1,this.isSaving=!1,this.blogCategories=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.redirectsEnabled=app.data.settings.blog_redirects_enabled?app.data.settings.blog_redirects_enabled:"both",this.hideTagsInList=!app.data.settings.blog_hide_tags||app.data.settings.blog_hide_tags,this.allowComments=!app.data.settings.blog_allow_comments||app.data.settings.blog_allow_comments,this.hideOnDiscussionList=!!app.data.settings.blog_filter_discussion_list&&app.data.settings.blog_filter_discussion_list,this.requiresReviewOnPost=!!app.data.settings.blog_requires_review&&app.data.settings.blog_requires_review,this.addCategoryHierarchy=!app.data.settings.blog_category_hierarchy||app.data.settings.blog_category_hierarchy},s.content=function(){var e=this;return m("div",{className:"BasicsPage FlarumBlog"},m("div",{className:"container"},m("div",{className:"FlarumBlog-SelectCategories"},this.blogCategories.length>=1?"You have "+this.blogCategories.length+" categories selected":"No categories selected",m(u.a,{className:"Button",onclick:function(){return app.modal.show(x)}},"Select blog categories")),f.a.component({label:"Blog"},[y.a.component({state:1==this.allowComments,onchange:function(t){e.allowComments=t,e.hasChanges=!0}},[m("b",null,"Allow comments"),m("div",{className:"helpText"},"By default, allow comments on blog posts. When disabled, it can be enabled individually per blog post. ",m("b",null,"Note:")," Changing this setting will not affect pre-existing blog posts.")]),y.a.component({state:1==this.requiresReviewOnPost,onchange:function(t){e.requiresReviewOnPost=t,e.hasChanges=!0}},[m("b",null,"Blog posts requires review"),m("div",{className:"helpText"},"When posting an article, it will not be visible directly and needs to be reviewed by a moderator.")]),y.a.component({state:1==this.hideOnDiscussionList,onchange:function(t){e.hideOnDiscussionList=t,e.hasChanges=!0}},[m("b",null,"Don't show on discussion list"),m("div",{className:"helpText"},"Hide blog posts from the discussions list.")])]),f.a.component({label:"Categories"},[y.a.component({state:1==this.hideTagsInList,onchange:function(t){e.hideTagsInList=t,e.hasChanges=!0}},[m("b",null,"Hide tags in taglist"),m("div",{className:"helpText"},"When enabled, this extension will hide the blog tags from your homepage. After changing this setting, clear the cache of your forum.")]),y.a.component({state:1==this.addCategoryHierarchy,onchange:function(t){e.addCategoryHierarchy=t,e.hasChanges=!0}},[m("b",null,"Show tag hierarchy"),m("div",{className:"helpText"},"Add spacing to child-categories and give the category-list a hierarchy.")])]),f.a.component({label:"Redirects"},[y.a.component({state:"both"===this.redirectsEnabled||"discussions_only"===this.redirectsEnabled,onchange:function(t){t?"tags_only"===e.redirectsEnabled?e.redirectsEnabled="both":"none"===e.redirectsEnabled&&(e.redirectsEnabled="discussions_only"):"discussions_only"===e.redirectsEnabled?e.redirectsEnabled="none":e.redirectsEnabled="tags_only",e.hasChanges=!0}},[m("b",null,"Redirect blog articles"),m("div",{className:"helpText"},"When enabled, this extension will redirect original discussion URLs to their blog URL.")]),y.a.component({state:"both"===this.redirectsEnabled||"tags_only"===this.redirectsEnabled,onchange:function(t){t?"discussions_only"===e.redirectsEnabled?e.redirectsEnabled="both":"none"===e.redirectsEnabled&&(e.redirectsEnabled="tags_only"):"tags_only"===e.redirectsEnabled?e.redirectsEnabled="none":e.redirectsEnabled="discussions_only",e.hasChanges=!0}},[m("b",null,"Redirect blog tags"),m("div",{className:"helpText"},"When enabled, this extension redirects blog tag URLs to the blog category URL.")])]),m(u.a,{loading:this.isSaving,className:"Button Button--primary",onclick:function(){return e.save()},disabled:!this.hasChanges},app.translator.trans("core.admin.basics.submit_button"))))},s.save=function(){var e=this;this.isSaving=!0,g()({blog_redirects_enabled:this.redirectsEnabled,blog_hide_tags:this.hideTagsInList,blog_requires_review:this.requiresReviewOnPost,blog_allow_comments:this.allowComments,blog_category_hierarchy:this.addCategoryHierarchy,blog_filter_discussion_list:this.hideOnDiscussionList}).then((function(){e.hasChanges=!1,app.alerts.show(p.a,{type:"success"},app.translator.trans("core.admin.basics.saved_message"))})).catch((function(){})).then((function(){e.isSaving=!1,m.redraw()}))},t}(l.a);app.initializers.add("v17development-flarum-blog",(function(){app.extensionData.for("v17development-blog").registerPage(C),app.extensionData.for("v17development-blog").registerPermission({icon:"fas fa-pencil-alt",label:"Write and edit blog articles",permission:"blog.writeArticles"},"blog",90).registerPermission({icon:"far fa-star",label:"Auto approve articles",permission:"blog.autoApprovePosts"},"blog",90).registerPermission({icon:"far fa-thumbs-up",label:"Can approve blog articles",permission:"blog.canApprovePosts"},"blog",90),Object(n.extend)(o.a.prototype,"permissionItems",(function(e){e.add("blog",{label:"Blog",children:this.attrs.extensionId?app.extensionData.getExtensionPermissions(this.extensionId,"blog").toArray():app.extensionData.getAllExtensionPermissions("blog").toArray()},80)}))}))}]); +module.exports=function(t){var e={};function a(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)a.d(n,s,function(e){return t[e]}.bind(null,s));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=39)}([function(t,e,a){"use strict";function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}a.d(e,"a",(function(){return n}))},function(t,e){t.exports=flarum.core.compat["components/Button"]},,function(t,e){t.exports=flarum.core.compat["components/Switch"]},function(t,e){t.exports=flarum.core.compat.extend},,,function(t,e){t.exports=flarum.core.compat["components/Alert"]},,,,function(t,e){t.exports=flarum.core.compat["components/Modal"]},,,,,function(t,e){t.exports=flarum.core.compat["utils/saveSettings"]},,function(t,e){t.exports=flarum.core.compat["components/FieldSet"]},,,,,,,,,,,,,,,,,function(t,e){t.exports=flarum.core.compat["components/BasicsPage"]},function(t,e){t.exports=flarum.core.compat["components/PermissionGrid"]},function(t,e){t.exports=flarum.core.compat["components/ExtensionPage"]},,function(t,e,a){"use strict";a.r(e);var n=a(4),s=a(35),o=a.n(s),i=a(36),r=a.n(i),l=a(0),p=a(37),d=a.n(p),c=a(16),g=a.n(c),u=a(7),b=a.n(u),h=a(1),_=a.n(h),v=a(18),f=a.n(v),y=a(3),x=a.n(y),C=a(11),w=function(t){function e(){return t.apply(this,arguments)||this}Object(l.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.blogCategoriesOriginal=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.blogCategories=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.isSaving=!1,this.hasChanges=!1},a.title=function(){return"Select blog categories"},a.className=function(){return"Modal modal-dialog FlarumBlog-TagsModal"},a.content=function(){var t=this;return m("div",null,m("div",{className:"Modal-body"},m("p",null,"Please select one or more tags that are considered blog tags."," ",m("a",{href:app.forum.attribute("baseUrl")+"/blog",target:"_blank"},"Visit your blog.")),m("table",{className:"FlarumBlog-TagsTable"},m("thead",null,m("th",{width:"35"}),m("th",null,"Tag name"),m("th",{width:"50"})),m("tbody",null,0===app.store.all("tags").length&&m("tr",null,m("td",{colspan:"3"},"You currently have no tags.")),app.store.all("tags").map((function(e){if(!e.parent()){var a=function(){var a=t.blogCategories.indexOf(e.id());t.hasChanges=!0,a>=0?t.blogCategories.splice(a,1):t.blogCategories.push(e.id())};return m("tr",null,m("td",null,m("i",{className:e.icon()})),m("td",{onclick:a},e.name()),m("td",null,m(x.a,{state:t.blogCategories.indexOf(e.id())>=0,onchange:a})))}}))))),m("div",{style:"padding: 25px 30px; text-align: center;"},m(_.a,{type:"submit",className:"Button Button--primary",loading:this.loading},this.hasChanges?"Save changes":"Close")))},a.onsubmit=function(t){var e=this;t.preventDefault(),this.hasChanges?(this.isSaving=!0,g()({blog_tags:this.blogCategories.join("|")}).then((function(){app.alerts.show(b.a,{type:"success"},app.translator.trans("core.admin.basics.saved_message")),e.hide()})).catch((function(){app.alerts.show(b.a,{type:"error"},app.translator.trans("core.lib.error.generic_message"))})).then((function(){e.isSaving=!1}))):this.hide()},e}(a.n(C).a),E=function(t){function e(){return t.apply(this,arguments)||this}Object(l.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.hasChanges=!1,this.isSaving=!1,this.blogCategories=app.data.settings.blog_tags?app.data.settings.blog_tags.split("|"):[],this.redirectsEnabled=app.data.settings.blog_redirects_enabled?app.data.settings.blog_redirects_enabled:"both",this.hideTagsInList=!app.data.settings.blog_hide_tags||app.data.settings.blog_hide_tags,this.allowComments=!app.data.settings.blog_allow_comments||app.data.settings.blog_allow_comments,this.hideOnDiscussionList=!!app.data.settings.blog_filter_discussion_list&&app.data.settings.blog_filter_discussion_list,this.requiresReviewOnPost=!!app.data.settings.blog_requires_review&&app.data.settings.blog_requires_review,this.addCategoryHierarchy=!app.data.settings.blog_category_hierarchy||app.data.settings.blog_category_hierarchy,this.addSidebarNav=!app.data.settings.blog_add_sidebar_nav||app.data.settings.blog_add_sidebar_nav},a.content=function(){var t=this;return m("div",{className:"BasicsPage FlarumBlog"},m("div",{className:"container"},m("div",{className:"FlarumBlog-SelectCategories"},0===this.blogCategories.length?app.translator.transChoice("v17development-flarum-blog.admin.settings.no_categories_selected"):app.translator.transChoice("v17development-flarum-blog.admin.settings.selected_category_count",this.blogCategories.length,{count:this.blogCategories.length}),m(_.a,{className:"Button",onclick:function(){return app.modal.show(w)}},app.translator.trans("v17development-flarum-blog.admin.settings.select_categories_button"))),f.a.component({label:app.translator.trans("v17development-flarum-blog.admin.settings.blog_heading")},[x.a.component({state:1==this.allowComments,onchange:function(e){t.allowComments=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.allow_comments_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.allow_comments_text"))]),x.a.component({state:1==this.requiresReviewOnPost,onchange:function(e){t.requiresReviewOnPost=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.require_review_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.require_review_text"))]),x.a.component({state:1==this.hideOnDiscussionList,onchange:function(e){t.hideOnDiscussionList=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.hide_on_discussion_list_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.hide_on_discussion_list_text"))]),x.a.component({state:1==this.addSidebarNav,onchange:function(e){t.addSidebarNav=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.add_sidebar_nav_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.add_sidebar_nav_text"))])]),f.a.component({label:app.translator.trans("v17development-flarum-blog.admin.settings.categories_heading")},[x.a.component({state:1==this.hideTagsInList,onchange:function(e){t.hideTagsInList=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.hide_tags_in_taglist_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.hide_tags_in_taglist_text"))]),x.a.component({state:1==this.addCategoryHierarchy,onchange:function(e){t.addCategoryHierarchy=e,t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.show_tag_hierarchy_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.show_tag_hierarchy_text"))])]),f.a.component({label:app.translator.trans("v17development-flarum-blog.admin.settings.redirects_heading")},[x.a.component({state:"both"===this.redirectsEnabled||"discussions_only"===this.redirectsEnabled,onchange:function(e){e?"tags_only"===t.redirectsEnabled?t.redirectsEnabled="both":"none"===t.redirectsEnabled&&(t.redirectsEnabled="discussions_only"):"discussions_only"===t.redirectsEnabled?t.redirectsEnabled="none":t.redirectsEnabled="tags_only",t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.redirect_articles_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.redirect_articles_text"))]),x.a.component({state:"both"===this.redirectsEnabled||"tags_only"===this.redirectsEnabled,onchange:function(e){e?"discussions_only"===t.redirectsEnabled?t.redirectsEnabled="both":"none"===t.redirectsEnabled&&(t.redirectsEnabled="tags_only"):"tags_only"===t.redirectsEnabled?t.redirectsEnabled="none":t.redirectsEnabled="discussions_only",t.hasChanges=!0}},[m("b",null,app.translator.trans("v17development-flarum-blog.admin.settings.redirect_tags_label")),m("div",{className:"helpText"},app.translator.trans("v17development-flarum-blog.admin.settings.redirect_tags_text"))])]),m(_.a,{loading:this.isSaving,className:"Button Button--primary",onclick:function(){return t.save()},disabled:!this.hasChanges},app.translator.trans("core.admin.basics.submit_button"))))},a.save=function(){var t=this;this.isSaving=!0,g()({blog_add_sidebar_nav:this.addSidebarNav,blog_redirects_enabled:this.redirectsEnabled,blog_hide_tags:this.hideTagsInList,blog_requires_review:this.requiresReviewOnPost,blog_allow_comments:this.allowComments,blog_category_hierarchy:this.addCategoryHierarchy,blog_filter_discussion_list:this.hideOnDiscussionList}).then((function(){t.hasChanges=!1,app.alerts.show(b.a,{type:"success"},app.translator.trans("core.admin.basics.saved_message"))})).catch((function(){})).then((function(){t.isSaving=!1,m.redraw()}))},e}(d.a);app.initializers.add("v17development-flarum-blog",(function(){app.extensionData.for("v17development-blog").registerPage(E),app.extensionData.for("v17development-blog").registerPermission({icon:"fas fa-pencil-alt",label:app.translator.trans("v17development-flarum-blog.admin.permissions.write_articles"),permission:"blog.writeArticles"},"blog",90).registerPermission({icon:"far fa-star",label:app.translator.trans("v17development-flarum-blog.admin.permissions.auto_approve_posts"),permission:"blog.autoApprovePosts"},"blog",90).registerPermission({icon:"far fa-thumbs-up",label:app.translator.trans("v17development-flarum-blog.admin.permissions.approve_posts"),permission:"blog.canApprovePosts"},"blog",90),Object(n.extend)(r.a.prototype,"permissionItems",(function(t){t.add("blog",{label:app.translator.trans("v17development-flarum-blog.admin.blog"),children:this.attrs.extensionId?app.extensionData.getExtensionPermissions(this.extensionId,"blog").toArray():app.extensionData.getAllExtensionPermissions("blog").toArray()},80)})),Object(n.extend)(o.a.prototype,"homePageItems",(function(t){t.add("blog",{path:"/blog",label:app.translator.trans("v17development-flarum-blog.admin.blog")})}))}))}]); //# 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 43d02b0..b3695b0 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@v17development/flarum-blog/webpack/bootstrap","webpack://@v17development/flarum-blog/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Switch']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Alert']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['extend']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/FieldSet']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@v17development/flarum-blog/./src/admin/components/Modals/SelectCategoriesModal.js","webpack://@v17development/flarum-blog/./src/admin/pages/BlogSettings.js","webpack://@v17development/flarum-blog/./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","_inheritsLoose","subClass","superClass","constructor","__proto__","flarum","core","compat","SelectCategoriesModal","oninit","vnode","this","blogCategoriesOriginal","app","data","settings","blog_tags","split","blogCategories","isSaving","hasChanges","title","className","content","href","forum","attribute","target","width","store","all","length","colspan","map","obj","parent","toggleTag","currentIndex","indexOf","id","splice","push","icon","onclick","state","onchange","style","type","loading","onsubmit","e","preventDefault","saveSettings","join","then","alerts","show","Alert","translator","trans","hide","Modal","BlogSettings","attrs","redirectsEnabled","blog_redirects_enabled","hideTagsInList","blog_hide_tags","allowComments","blog_allow_comments","hideOnDiscussionList","blog_filter_discussion_list","requiresReviewOnPost","blog_requires_review","addCategoryHierarchy","blog_category_hierarchy","modal","FieldSet","component","label","Switch","val","save","disabled","redraw","ExtensionPage","initializers","add","extensionData","registerPage","registerPermission","permission","extend","PermissionGrid","items","children","extensionId","getExtensionPermissions","toArray","getAllExtensionPermissions"],"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,I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BACX,OAAQ,IACVD,mBAAmB,CAClBhD,KAAM,mBACNqC,MAAO,4BACPY,WAAY,wBACX,OAAQ,IAGbC,iBAAOC,IAAejG,UAAW,mBAAmB,SAASkG,GAE3DA,EAAMP,IAAI,OAAQ,CAChBR,MAAO,OACPgB,SACEpF,KAAKoD,MAAMiC,YACTnF,IAAI2E,cAAcS,wBAAwBtF,KAAKqF,YAAa,QAAQE,UACpErF,IAAI2E,cAAcW,2BAA2B,QAAQD,WACxD","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 = 36);\n","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['components/Switch'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['components/FieldSet'];","module.exports = flarum.core.compat['components/PermissionGrid'];","module.exports = flarum.core.compat['components/ExtensionPage'];","import Modal from 'flarum/components/Modal';\r\nimport Button from 'flarum/components/Button';\r\nimport Alert from 'flarum/components/Alert';\r\nimport saveSettings from 'flarum/utils/saveSettings';\r\nimport Switch from 'flarum/components/Switch';\r\n\r\nexport default class SelectCategoriesModal extends Modal {\r\n oninit(vnode) {\r\n super.oninit(vnode);\r\n\r\n this.blogCategoriesOriginal = app.data.settings.blog_tags ? app.data.settings.blog_tags.split(\"|\") : [];\r\n this.blogCategories = app.data.settings.blog_tags ? app.data.settings.blog_tags.split(\"|\") : [];\r\n\r\n this.isSaving = false;\r\n this.hasChanges = false;\r\n }\r\n\r\n title() {\r\n return 'Select blog categories';\r\n }\r\n\r\n className() {\r\n return 'Modal modal-dialog FlarumBlog-TagsModal';\r\n }\r\n\r\n content() {\r\n return (\r\n
\r\n
\r\n

Please select one or more tags that are considered blog tags. Visit your blog.

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {app.store.all('tags').length === 0 && (\r\n \r\n \r\n \r\n )}\r\n\r\n {app.store.all('tags').map(obj => {\r\n // Skip all tags who aren't main categories\r\n if(obj.parent()) {\r\n return;\r\n }\r\n\r\n // Toggle tag\r\n const toggleTag = () => {\r\n const currentIndex = this.blogCategories.indexOf(obj.id());\r\n this.hasChanges = true;\r\n\r\n // Remove tag\r\n if(currentIndex >= 0) {\r\n this.blogCategories.splice(currentIndex, 1);\r\n }else {\r\n // Add tag\r\n this.blogCategories.push(obj.id());\r\n }\r\n }\r\n\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n )\r\n })}\r\n \r\n
Tag name
You currently have no tags.
{obj.name()}\r\n = 0}\r\n onchange={toggleTag}\r\n />\r\n
\r\n
\r\n
\r\n \r\n {this.hasChanges ? 'Save changes' : 'Close'}\r\n \r\n
\r\n
\r\n );\r\n }\r\n\r\n // Close or save setting\r\n onsubmit(e) {\r\n e.preventDefault();\r\n\r\n if(!this.hasChanges) {\r\n this.hide();\r\n return;\r\n }\r\n\r\n this.isSaving = true;\r\n\r\n saveSettings({\r\n blog_tags: this.blogCategories.join('|')\r\n })\r\n .then(() => {\r\n app.alerts.show(Alert, {\r\n type: 'success'\r\n }, app.translator.trans('core.admin.basics.saved_message'));\r\n\r\n this.hide();\r\n })\r\n .catch(() => {\r\n app.alerts.show(Alert, {\r\n type: 'error'\r\n }, app.translator.trans('core.lib.error.generic_message'));\r\n })\r\n .then(() => {\r\n this.isSaving = false;\r\n });\r\n }\r\n}","import ExtensionPage from 'flarum/components/ExtensionPage';\r\nimport saveSettings from 'flarum/utils/saveSettings';\r\nimport Alert from 'flarum/components/Alert';\r\nimport Button from 'flarum/components/Button';\r\nimport FieldSet from 'flarum/components/FieldSet';\r\nimport Switch from 'flarum/components/Switch';\r\nimport SelectCategoriesModal from '../components/Modals/SelectCategoriesModal';\r\n\r\nexport default class BlogSettings extends ExtensionPage {\r\n oninit(attrs) {\r\n super.oninit(attrs);\r\n\r\n // Form\r\n this.hasChanges = false;\r\n this.isSaving = false;\r\n\r\n // Settings\r\n this.blogCategories = app.data.settings.blog_tags ? app.data.settings.blog_tags.split(\"|\") : [];\r\n this.redirectsEnabled = app.data.settings.blog_redirects_enabled ? app.data.settings.blog_redirects_enabled : 'both';\r\n this.hideTagsInList = app.data.settings.blog_hide_tags ? app.data.settings.blog_hide_tags : true;\r\n this.allowComments = app.data.settings.blog_allow_comments ? app.data.settings.blog_allow_comments : true;\r\n this.hideOnDiscussionList = app.data.settings.blog_filter_discussion_list ? app.data.settings.blog_filter_discussion_list : false;\r\n this.requiresReviewOnPost = app.data.settings.blog_requires_review ? app.data.settings.blog_requires_review : false;\r\n this.addCategoryHierarchy = app.data.settings.blog_category_hierarchy ? app.data.settings.blog_category_hierarchy : true;\r\n }\r\n\r\n content() {\r\n return (\r\n
\r\n
\r\n
\r\n {this.blogCategories.length >= 1 ? `You have ${this.blogCategories.length} categories selected` : 'No categories selected'}\r\n\r\n \r\n
\r\n\r\n {FieldSet.component({\r\n label: \"Blog\",\r\n }, [\r\n Switch.component({\r\n state: this.allowComments == true,\r\n onchange: (val) => {\r\n this.allowComments = val;\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Allow comments, \r\n
By default, allow comments on blog posts. When disabled, it can be enabled individually per blog post. Note: Changing this setting will not affect pre-existing blog posts.
,\r\n ]),\r\n Switch.component({\r\n state: this.requiresReviewOnPost == true,\r\n onchange: (val) => {\r\n this.requiresReviewOnPost = val;\r\n this.hasChanges = true;\r\n }, \r\n }, [\r\n Blog posts requires review, \r\n
When posting an article, it will not be visible directly and needs to be reviewed by a moderator.
,\r\n ]),\r\n Switch.component({\r\n state: this.hideOnDiscussionList == true,\r\n onchange: (val) => {\r\n this.hideOnDiscussionList = val;\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Don't show on discussion list, \r\n
Hide blog posts from the discussions list.
,\r\n ])\r\n ]\r\n )}\r\n \r\n {FieldSet.component({\r\n label: \"Categories\"\r\n }, [\r\n Switch.component({\r\n state: this.hideTagsInList == true,\r\n onchange: (val) => {\r\n this.hideTagsInList = val;\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Hide tags in taglist, \r\n
When enabled, this extension will hide the blog tags from your homepage. After changing this setting, clear the cache of your forum.
,\r\n ]),\r\n Switch.component({\r\n state: this.addCategoryHierarchy == true,\r\n onchange: (val) => {\r\n this.addCategoryHierarchy = val;\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Show tag hierarchy, \r\n
Add spacing to child-categories and give the category-list a hierarchy.
,\r\n ]),\r\n ])}\r\n\r\n {FieldSet.component({\r\n label: \"Redirects\"\r\n }, [\r\n Switch.component({\r\n state: this.redirectsEnabled === 'both' || this.redirectsEnabled === 'discussions_only',\r\n onchange: (val) => {\r\n if(val) {\r\n // Add\r\n if(this.redirectsEnabled === 'tags_only') {\r\n this.redirectsEnabled = 'both';\r\n }else if(this.redirectsEnabled === 'none') {\r\n this.redirectsEnabled = 'discussions_only';\r\n }\r\n }else{\r\n if(this.redirectsEnabled === 'discussions_only') {\r\n this.redirectsEnabled = 'none';\r\n }else {\r\n this.redirectsEnabled = 'tags_only';\r\n }\r\n }\r\n\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Redirect blog articles, \r\n
When enabled, this extension will redirect original discussion URLs to their blog URL.
\r\n ]),\r\n Switch.component({\r\n state: this.redirectsEnabled === 'both' || this.redirectsEnabled === 'tags_only',\r\n onchange: (val) => {\r\n if(val) {\r\n // Add\r\n if(this.redirectsEnabled === 'discussions_only') {\r\n this.redirectsEnabled = 'both';\r\n }else if(this.redirectsEnabled === 'none') {\r\n this.redirectsEnabled = 'tags_only';\r\n }\r\n }else{\r\n if(this.redirectsEnabled === 'tags_only') {\r\n this.redirectsEnabled = 'none';\r\n }else {\r\n this.redirectsEnabled = 'discussions_only';\r\n }\r\n }\r\n\r\n this.hasChanges = true;\r\n }\r\n }, [\r\n Redirect blog tags, \r\n
When enabled, this extension redirects blog tag URLs to the blog category URL.
\r\n ])\r\n ])}\r\n\r\n \r\n
\r\n
\r\n );\r\n }\r\n\r\n /**\r\n * Save data\r\n */\r\n save() {\r\n this.isSaving = true;\r\n\r\n saveSettings({\r\n blog_redirects_enabled: this.redirectsEnabled,\r\n blog_hide_tags: this.hideTagsInList,\r\n blog_requires_review: this.requiresReviewOnPost,\r\n blog_allow_comments: this.allowComments,\r\n blog_category_hierarchy: this.addCategoryHierarchy,\r\n blog_filter_discussion_list: this.hideOnDiscussionList\r\n })\r\n .then(() => {\r\n this.hasChanges = false;\r\n\r\n // Show saved message\r\n app.alerts.show(Alert, { type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));\r\n })\r\n .catch(() => {})\r\n .then(() => {\r\n this.isSaving = false;\r\n m.redraw();\r\n });\r\n }\r\n}","import { extend } from 'flarum/extend';\r\nimport PermissionGrid from 'flarum/components/PermissionGrid';\r\nimport BlogSettings from './pages/BlogSettings';\r\n\r\napp.initializers.add('v17development-flarum-blog', () => {\r\n // Register extension settings page\r\n app.extensionData.for('v17development-blog').registerPage(BlogSettings);\r\n\r\n app.extensionData.for('v17development-blog')\r\n .registerPermission({\r\n icon: 'fas fa-pencil-alt',\r\n label: \"Write and edit blog articles\",\r\n permission: 'blog.writeArticles',\r\n }, 'blog', 90)\r\n .registerPermission({\r\n icon: 'far fa-star',\r\n label: \"Auto approve articles\",\r\n permission: 'blog.autoApprovePosts'\r\n }, 'blog', 90)\r\n .registerPermission({\r\n icon: 'far fa-thumbs-up',\r\n label: \"Can approve blog articles\",\r\n permission: 'blog.canApprovePosts'\r\n }, 'blog', 90);\r\n\r\n // Add addPermissions\r\n extend(PermissionGrid.prototype, 'permissionItems', function(items) {\r\n // Add knowledge base permissions\r\n items.add('blog', {\r\n label: \"Blog\",\r\n children: \r\n this.attrs.extensionId ? \r\n app.extensionData.getExtensionPermissions(this.extensionId, 'blog').toArray() : \r\n app.extensionData.getAllExtensionPermissions('blog').toArray()\r\n }, 80);\r\n });\r\n});"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@v17development/flarum-blog/webpack/bootstrap","webpack://@v17development/flarum-blog/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Switch']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['extend']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Alert']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['utils/saveSettings']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/FieldSet']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/BasicsPage']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@v17development/flarum-blog/external \"flarum.core.compat['components/ExtensionPage']\"","webpack://@v17development/flarum-blog/./src/admin/components/Modals/SelectCategoriesModal.js","webpack://@v17development/flarum-blog/./src/admin/pages/BlogSettings.js","webpack://@v17development/flarum-blog/./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","_inheritsLoose","subClass","superClass","constructor","__proto__","flarum","core","compat","SelectCategoriesModal","oninit","vnode","this","blogCategoriesOriginal","app","data","settings","blog_tags","split","blogCategories","isSaving","hasChanges","title","className","content","href","forum","attribute","target","width","store","all","length","colspan","map","obj","parent","toggleTag","currentIndex","indexOf","id","splice","push","icon","onclick","state","onchange","style","type","loading","onsubmit","e","preventDefault","saveSettings","join","then","alerts","show","Alert","translator","trans","hide","Modal","BlogSettings","attrs","redirectsEnabled","blog_redirects_enabled","hideTagsInList","blog_hide_tags","allowComments","blog_allow_comments","hideOnDiscussionList","blog_filter_discussion_list","requiresReviewOnPost","blog_requires_review","addCategoryHierarchy","blog_category_hierarchy","addSidebarNav","blog_add_sidebar_nav","transChoice","count","modal","FieldSet","component","label","Switch","val","save","disabled","redraw","ExtensionPage","initializers","add","extensionData","registerPage","registerPermission","permission","extend","PermissionGrid","items","children","extensionId","getExtensionPermissions","toArray","getAllExtensionPermissions","BasicsPage","path"],"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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Aa,QAC1CE,UACHzF,IAAI+E,cAAcW,2BAA2B,QAAQD,WAE3D,OAIJN,iBAAOQ,IAAW5G,UAAW,iBAAiB,SAACsG,GAC7CA,EAAMP,IAAI,OAAQ,CAChBc,KAAM,QACNtB,MAAOtE,IAAI6C,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 = 39);\n","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['components/Switch'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['utils/saveSettings'];","module.exports = flarum.core.compat['components/FieldSet'];","module.exports = flarum.core.compat['components/BasicsPage'];","module.exports = flarum.core.compat['components/PermissionGrid'];","module.exports = flarum.core.compat['components/ExtensionPage'];","import Modal from \"flarum/components/Modal\";\nimport Button from \"flarum/components/Button\";\nimport Alert from \"flarum/components/Alert\";\nimport saveSettings from \"flarum/utils/saveSettings\";\nimport Switch from \"flarum/components/Switch\";\n\nexport default class SelectCategoriesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.blogCategoriesOriginal = app.data.settings.blog_tags\n ? app.data.settings.blog_tags.split(\"|\")\n : [];\n this.blogCategories = app.data.settings.blog_tags\n ? app.data.settings.blog_tags.split(\"|\")\n : [];\n\n this.isSaving = false;\n this.hasChanges = false;\n }\n\n title() {\n return \"Select blog categories\";\n }\n\n className() {\n return \"Modal modal-dialog FlarumBlog-TagsModal\";\n }\n\n content() {\n return (\n
\n
\n

\n Please select one or more tags that are considered blog tags.{\" \"}\n \n Visit your blog.\n \n

\n\n \n \n \n \n \n \n \n {app.store.all(\"tags\").length === 0 && (\n \n \n \n )}\n\n {app.store.all(\"tags\").map((obj) => {\n // Skip all tags who aren't main categories\n if (obj.parent()) {\n return;\n }\n\n // Toggle tag\n const toggleTag = () => {\n const currentIndex = this.blogCategories.indexOf(obj.id());\n this.hasChanges = true;\n\n // Remove tag\n if (currentIndex >= 0) {\n this.blogCategories.splice(currentIndex, 1);\n } else {\n // Add tag\n this.blogCategories.push(obj.id());\n }\n };\n\n return (\n \n \n \n \n \n );\n })}\n \n
Tag name
You currently have no tags.
\n \n {obj.name()}\n = 0}\n onchange={toggleTag}\n />\n
\n
\n
\n \n {this.hasChanges ? \"Save changes\" : \"Close\"}\n \n
\n
\n );\n }\n\n // Close or save setting\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.hasChanges) {\n this.hide();\n return;\n }\n\n this.isSaving = true;\n\n saveSettings({\n blog_tags: this.blogCategories.join(\"|\"),\n })\n .then(() => {\n app.alerts.show(\n Alert,\n {\n type: \"success\",\n },\n app.translator.trans(\"core.admin.basics.saved_message\")\n );\n\n this.hide();\n })\n .catch(() => {\n app.alerts.show(\n Alert,\n {\n type: \"error\",\n },\n app.translator.trans(\"core.lib.error.generic_message\")\n );\n })\n .then(() => {\n this.isSaving = false;\n });\n }\n}\n","import ExtensionPage from \"flarum/components/ExtensionPage\";\nimport saveSettings from \"flarum/utils/saveSettings\";\nimport Alert from \"flarum/components/Alert\";\nimport Button from \"flarum/components/Button\";\nimport FieldSet from \"flarum/components/FieldSet\";\nimport Switch from \"flarum/components/Switch\";\nimport SelectCategoriesModal from \"../components/Modals/SelectCategoriesModal\";\n\nexport default class BlogSettings extends ExtensionPage {\n oninit(attrs) {\n super.oninit(attrs);\n\n // Form\n this.hasChanges = false;\n this.isSaving = false;\n\n // Settings\n this.blogCategories = app.data.settings.blog_tags\n ? app.data.settings.blog_tags.split(\"|\")\n : [];\n this.redirectsEnabled = app.data.settings.blog_redirects_enabled\n ? app.data.settings.blog_redirects_enabled\n : \"both\";\n this.hideTagsInList = app.data.settings.blog_hide_tags\n ? app.data.settings.blog_hide_tags\n : true;\n this.allowComments = app.data.settings.blog_allow_comments\n ? app.data.settings.blog_allow_comments\n : true;\n this.hideOnDiscussionList = app.data.settings.blog_filter_discussion_list\n ? app.data.settings.blog_filter_discussion_list\n : false;\n this.requiresReviewOnPost = app.data.settings.blog_requires_review\n ? app.data.settings.blog_requires_review\n : false;\n this.addCategoryHierarchy = app.data.settings.blog_category_hierarchy\n ? app.data.settings.blog_category_hierarchy\n : true;\n this.addSidebarNav = app.data.settings.blog_add_sidebar_nav\n ? app.data.settings.blog_add_sidebar_nav\n : true;\n }\n\n content() {\n return (\n
\n
\n
\n {this.blogCategories.length === 0\n ? app.translator.transChoice(\n \"v17development-flarum-blog.admin.settings.no_categories_selected\"\n )\n : app.translator.transChoice(\n \"v17development-flarum-blog.admin.settings.selected_category_count\",\n this.blogCategories.length,\n { count: this.blogCategories.length }\n )}\n\n app.modal.show(SelectCategoriesModal)}\n >\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.select_categories_button\"\n )}\n \n
\n\n {FieldSet.component(\n {\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.settings.blog_heading\"\n ),\n },\n [\n Switch.component(\n {\n state: this.allowComments == true,\n onchange: (val) => {\n this.allowComments = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.allow_comments_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.allow_comments_text\"\n )}\n
,\n ]\n ),\n Switch.component(\n {\n state: this.requiresReviewOnPost == true,\n onchange: (val) => {\n this.requiresReviewOnPost = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.require_review_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.require_review_text\"\n )}\n
,\n ]\n ),\n Switch.component(\n {\n state: this.hideOnDiscussionList == true,\n onchange: (val) => {\n this.hideOnDiscussionList = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.hide_on_discussion_list_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.hide_on_discussion_list_text\"\n )}\n
,\n ]\n ),\n Switch.component(\n {\n state: this.addSidebarNav == true,\n onchange: (val) => {\n this.addSidebarNav = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.add_sidebar_nav_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.add_sidebar_nav_text\"\n )}\n
,\n ]\n ),\n ]\n )}\n\n {FieldSet.component(\n {\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.settings.categories_heading\"\n ),\n },\n [\n Switch.component(\n {\n state: this.hideTagsInList == true,\n onchange: (val) => {\n this.hideTagsInList = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.hide_tags_in_taglist_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.hide_tags_in_taglist_text\"\n )}\n
,\n ]\n ),\n Switch.component(\n {\n state: this.addCategoryHierarchy == true,\n onchange: (val) => {\n this.addCategoryHierarchy = val;\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.show_tag_hierarchy_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.show_tag_hierarchy_text\"\n )}\n
,\n ]\n ),\n ]\n )}\n\n {FieldSet.component(\n {\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.settings.redirects_heading\"\n ),\n },\n [\n Switch.component(\n {\n state:\n this.redirectsEnabled === \"both\" ||\n this.redirectsEnabled === \"discussions_only\",\n onchange: (val) => {\n if (val) {\n // Add\n if (this.redirectsEnabled === \"tags_only\") {\n this.redirectsEnabled = \"both\";\n } else if (this.redirectsEnabled === \"none\") {\n this.redirectsEnabled = \"discussions_only\";\n }\n } else {\n if (this.redirectsEnabled === \"discussions_only\") {\n this.redirectsEnabled = \"none\";\n } else {\n this.redirectsEnabled = \"tags_only\";\n }\n }\n\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.redirect_articles_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.redirect_articles_text\"\n )}\n
,\n ]\n ),\n Switch.component(\n {\n state:\n this.redirectsEnabled === \"both\" ||\n this.redirectsEnabled === \"tags_only\",\n onchange: (val) => {\n if (val) {\n // Add\n if (this.redirectsEnabled === \"discussions_only\") {\n this.redirectsEnabled = \"both\";\n } else if (this.redirectsEnabled === \"none\") {\n this.redirectsEnabled = \"tags_only\";\n }\n } else {\n if (this.redirectsEnabled === \"tags_only\") {\n this.redirectsEnabled = \"none\";\n } else {\n this.redirectsEnabled = \"discussions_only\";\n }\n }\n\n this.hasChanges = true;\n },\n },\n [\n \n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.redirect_tags_label\"\n )}\n ,\n
\n {app.translator.trans(\n \"v17development-flarum-blog.admin.settings.redirect_tags_text\"\n )}\n
,\n ]\n ),\n ]\n )}\n\n this.save()}\n disabled={!this.hasChanges}\n >\n {app.translator.trans(\"core.admin.basics.submit_button\")}\n \n
\n
\n );\n }\n\n /**\n * Save data\n */\n save() {\n this.isSaving = true;\n\n saveSettings({\n blog_add_sidebar_nav: this.addSidebarNav,\n blog_redirects_enabled: this.redirectsEnabled,\n blog_hide_tags: this.hideTagsInList,\n blog_requires_review: this.requiresReviewOnPost,\n blog_allow_comments: this.allowComments,\n blog_category_hierarchy: this.addCategoryHierarchy,\n blog_filter_discussion_list: this.hideOnDiscussionList,\n })\n .then(() => {\n this.hasChanges = false;\n\n // Show saved message\n app.alerts.show(\n Alert,\n { type: \"success\" },\n app.translator.trans(\"core.admin.basics.saved_message\")\n );\n })\n .catch(() => {})\n .then(() => {\n this.isSaving = false;\n m.redraw();\n });\n }\n}\n","import { extend } from \"flarum/extend\";\nimport BasicsPage from \"flarum/components/BasicsPage\";\nimport PermissionGrid from \"flarum/components/PermissionGrid\";\nimport BlogSettings from \"./pages/BlogSettings\";\n\napp.initializers.add(\"v17development-flarum-blog\", () => {\n // Register extension settings page\n app.extensionData.for(\"v17development-blog\").registerPage(BlogSettings);\n\n app.extensionData\n .for(\"v17development-blog\")\n .registerPermission(\n {\n icon: \"fas fa-pencil-alt\",\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.permissions.write_articles\"\n ),\n permission: \"blog.writeArticles\",\n },\n \"blog\",\n 90\n )\n .registerPermission(\n {\n icon: \"far fa-star\",\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.permissions.auto_approve_posts\"\n ),\n permission: \"blog.autoApprovePosts\",\n },\n \"blog\",\n 90\n )\n .registerPermission(\n {\n icon: \"far fa-thumbs-up\",\n label: app.translator.trans(\n \"v17development-flarum-blog.admin.permissions.approve_posts\"\n ),\n permission: \"blog.canApprovePosts\",\n },\n \"blog\",\n 90\n );\n\n // Add addPermissions\n extend(PermissionGrid.prototype, \"permissionItems\", function (items) {\n // Add knowledge base permissions\n items.add(\n \"blog\",\n {\n label: app.translator.trans(\"v17development-flarum-blog.admin.blog\"),\n children: this.attrs.extensionId\n ? app.extensionData\n .getExtensionPermissions(this.extensionId, \"blog\")\n .toArray()\n : app.extensionData.getAllExtensionPermissions(\"blog\").toArray(),\n },\n 80\n );\n });\n\n extend(BasicsPage.prototype, \"homePageItems\", (items) => {\n items.add(\"blog\", {\n path: \"/blog\",\n label: app.translator.trans(\"v17development-flarum-blog.admin.blog\"),\n });\n });\n});\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 02c417a..fd3f0c7 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function a(o){if(e[o])return e[o].exports;var s=e[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=t,a.c=e,a.d=function(t,e,o){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)a.d(o,s,function(e){return t[e]}.bind(null,s));return o},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=35)}([function(t,e,a){"use strict";function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}a.d(e,"a",(function(){return o}))},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/Switch"]},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/Alert"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["components/Page"]},function(t,e){t.exports=flarum.core.compat["tags/components/TagDiscussionModal"]},function(t,e){t.exports=flarum.core.compat["components/Dropdown"]},function(t,e){t.exports=flarum.core.compat["helpers/listItems"]},,function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},,function(t,e){t.exports=flarum.core.compat["helpers/humanTime"]},function(t,e){t.exports=flarum.core.compat["components/CommentPost"]},function(t,e){t.exports=flarum.core.compat["components/PostStream"]},function(t,e){t.exports=flarum.core.compat["states/PostStreamState"]},function(t,e){t.exports=flarum.core.compat["components/EditPostComposer"]},function(t,e){t.exports=flarum.core.compat["utils/extractText"]},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["models/Discussion"]},function(t,e){t.exports=flarum.core.compat["components/IndexPage"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionPage"]},function(t,e){t.exports=flarum.core.compat["utils/mixin"]},function(t,e){t.exports=flarum.core.compat["tags/components/TagsPage"]},function(t,e){t.exports=flarum.core.compat["components/ComposerBody"]},function(t,e){t.exports=flarum.core.compat["components/TextEditor"]},function(t,e){t.exports=flarum.core},,,function(t,e,a){"use strict";a.r(e);var o=a(0),s=a(11),i=a.n(s),r=a(19),n=a.n(r),l=a(20),u=a.n(l),c=a(21),p=a.n(c),d=a(2),g=a.n(d),f=a(12),h=a.n(f),v=a(16),b=a.n(v),y=a(6),N=a.n(y),B=a(1),w=a.n(B),A=a(13),F=a.n(A),M=a(10),C=a.n(M),x=a(7),_=a.n(x),P=a(9),k=a.n(P),S=a(3),I=a.n(S),L=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.attrs.article?this.meta=this.attrs.article&&this.attrs.article.blogMeta()?this.attrs.article.blogMeta():app.store.createRecord("blogMeta"):this.meta=this.attrs.meta?this.attrs.meta:app.store.createRecord("blogMeta"),this.isNew=!this.meta.exists,this.summary=k()(this.meta.summary()||""),this.featuredImage=k()(this.meta.featuredImage()||""),this.isFeatured=k()(this.meta.isFeatured()||!1),this.isSized=k()(this.meta.isSized()||!1),this.isPendingReview=k()(this.meta.isPendingReview()||!1)},a.className=function(){return"Modal--small Support-Modal"},a.title=function(){return"Blog post settings"},a.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray()))},a.fields=function(){var t=this,e=new _.a;return e.add("summary",m("div",{className:"Form-group"},m("label",null,"Article summary:"),m("textarea",{className:"FormControl",style:{maxWidth:"100%",minWidth:"100%",width:"100%",minHeight:"120px"},bidi:this.summary,placeholder:"Please enter a summary"}),m("small",null,"This summary will be visible on the blog overview page and will be used for SEO purposes.")),30),e.add("image",m("div",{className:"Form-group"},m("label",null,"Article image URL:"),m("input",{type:"text",className:"FormControl",bidi:this.featuredImage,placeholder:"https://"}),m("small",null,"Best image resolution for social media: 1200x630"),""!=this.featuredImage()&&m("img",{src:this.featuredImage(),alt:"Article image",title:"Blog post image",width:"100%",style:{marginTop:"15px"}})),30),e.add("sized",m("div",{className:"Form-group"},I.a.component({state:1==this.isSized(),onchange:function(e){t.isSized(e)}},[m("b",null,"Highlighted post"),m("div",{className:"helpText",style:{fontWeight:500}},"Give this post a big image on the blog overview page.")])),-10),e.add("submit",m("div",{className:"Form-group"},w.a.component({type:"submit",className:"Button Button--primary SupportModal-save",loading:this.loading},"Update")),-10),e},a.submitData=function(){return{summary:this.summary(),featuredImage:this.featuredImage(),isFeatured:this.isFeatured(),isSized:this.isSized(),isPendingReview:this.isPendingReview(),relationships:this.isNew&&!this.attrs.isComposer?{discussion:this.attrs.article}:null}},a.onsubmit=function(t){var e=this;if(t.preventDefault(),this.attrs.onsubmit)return this.meta.pushData({attributes:this.submitData()}),this.attrs.onsubmit(this.meta),void this.hide();this.loading=!0,this.meta.save(this.submitData()).then((function(){e.attrs.article&&e.attrs.article.pushData({relationships:{blogMeta:e.meta}}),e.hide(),m.redraw()}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(C.a),O=a(22),T=a.n(O),D=a(23),j=a.n(D),R=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.article=this.attrs.article,this.name=k()(this.article.title()||""),this.redirect=this.attrs.redirect},a.className=function(){return"Modal--small Support-Modal"},a.title=function(){return app.translator.trans("v17development-flarum-blog.forum.tools.rename_article")},a.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray()))},a.fields=function(){var t=new _.a;return t.add("name",m("div",{className:"Form-group"},m("label",null,app.translator.trans("v17development-flarum-blog.forum.article.title"),":"),m("input",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-blog.forum.article.title"),bidi:this.name})),50),t.add("submit",m("div",{className:"Form-group"},w.a.component({type:"submit",className:"Button Button--primary SupportModal-save",loading:this.loading},"Update")),-10),t},a.submitData=function(){return{title:this.name()}},a.onsubmit=function(t){var e=this;if(t.preventDefault(),this.loading=!0,this.attrs.onChange)return this.attrs.onChange(this.name()),void this.hide();this.article.save({title:this.name()}).then((function(){if(e.hide(),e.redirect){var t="/blog/"+e.article.slug();m.route.set(t,!0),window.history.replaceState(null,document.title,t)}}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(C.a),E=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.init=function(){this.loadedPost=!1},a.view=function(){var t=this,e=this.attrs.article,a=[],o=flarum.extensions["fof-discussion-language"]&&void 0!==flarum.extensions["fof-discussion-language"].components?flarum.extensions["fof-discussion-language"].components.LanguageDiscussionModal:null;e.canRename()&&a.push(w.a.component({className:"Button",onclick:function(){return app.modal.show(R,{article:e})},icon:"fas fa-pencil-alt"},app.translator.trans("v17development-flarum-blog.forum.tools.rename_article")));var s=e.firstPost()?e.firstPost():app.store.getById("posts",e.firstPostId());return a.push(w.a.component({className:"Button",disabled:!s||!s.canEdit(),onclick:function(){app.composer.load(T.a,{post:s}),app.composer.show()},icon:"fas fa-edit"},app.translator.trans("v17development-flarum-blog.forum.tools.edit_article"))),a.push(w.a.component({className:"Button",onclick:function(){return app.modal.show(L,{article:e})},icon:"fas fa-cogs"},app.translator.trans("v17development-flarum-blog.forum.tools.article_settings"))),e.canTag()&&a.push(w.a.component({className:"Button",onclick:function(){return app.modal.show(h.a,{discussion:e})},icon:"fas fa-tag"},app.translator.trans("v17development-flarum-blog.forum.tools.update_category"))),e.blogMeta()&&e.blogMeta().isPendingReview()&&(a.push(m("li",{className:"Dropdown-separator"})),a.push(w.a.component({className:"Button",disabled:!app.forum.attribute("canApproveBlogPosts"),onclick:function(){e.blogMeta().save({isPendingReview:!1}).then((function(){app.alerts.show(N.a,{type:"success"},app.translator.trans("v17development-flarum-blog.forum.review_article.approve_article_approved"))}),(function(e){t.loading=!1,t.handleErrors(e)}))},icon:"fas fa-thumbs-up"},app.translator.trans("v17development-flarum-blog.forum.review_article.approve_article")))),e.canChangeLanguage&&e.canChangeLanguage()&&o&&a.push(w.a.component({icon:"fas fa-globe",onclick:function(){return app.modal.show(o,{discussion:e})}},app.translator.trans("fof-discussion-language.forum.discussion_controls.change_language_button"))),a.push(m("li",{className:"Dropdown-separator"})),e.canLock()&&a.push(w.a.component({className:"Button",onclick:b.a.lockAction.bind(e),icon:"fas "+(e.isLocked()?"fa-comments":"fa-comment-slash")},e.isLocked()?app.translator.trans("v17development-flarum-blog.forum.tools.enable_comments"):app.translator.trans("v17development-flarum-blog.forum.tools.disable_comments"))),e.canHide()&&(e.isHidden()?(a.push(w.a.component({className:"Button",onclick:b.a.restoreAction.bind(e),icon:"fas fa-eye"},app.translator.trans("v17development-flarum-blog.forum.tools.recover_article"))),e.canDelete()&&a.push(w.a.component({className:"Button",onclick:function(){if(confirm(j()(app.translator.trans("core.forum.discussion_controls.delete_confirmation"))))return"blogArticle"===app.history.getCurrent().name&&(app.previous?app.history.back():m.route.set(app.route("blog"))),e.delete().then((function(){m.redraw()}))},icon:"far fa-trash-alt"},app.translator.trans("v17development-flarum-blog.forum.tools.delete_forever")))):a.push(w.a.component({className:"Button",onclick:b.a.hideAction.bind(e),icon:"fas fa-eye-slash"},app.translator.trans("v17development-flarum-blog.forum.tools.hide_article")))),m("div",{className:"FlarumBlog-Article-Content-Edit-Button"},m("div",{className:"FlarumBlog-Article-Content-Edit-Dropdown"},F.a.component({icon:"fas fa-cog",label:"Manage",buttonClassName:"Button",menuClassName:"Dropdown-menu--right",onshow:function(){!s||s.canEdit()||t.loadedPost||(t.loadedPost=!0,app.store.find("posts",e.firstPost()?e.firstPost().id():e.firstPostId()).then((function(){})).catch((function(){})).then((function(){return m.redraw()})))}},a)))},e}(g.a),z=a(14),G=a.n(z),H=a(24),U=a.n(H),W=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.view=function(){var t=this.attrs.loading?null:this.attrs.article?this.attrs.article.user():this.attrs.user;return m("div",{className:"FlarumBlog-Article-Author"},m("div",{className:"FlarumBlog-Article-Author-background "+(this.attrs.loading?"FlarumBlog-Author-Ghost":""),style:{backgroundColor:t&&t.color()?t.color():null}}),m("div",{className:"FlarumBlog-Article-Author-Avatar"},t?U()(t):m("span",{className:"Avatar FlarumBlog-Author-Ghost"})),t&&m("div",{className:"FlarumBlog-Article-Author-Info"},m("span",{className:"FlarumBlog-Article-Author-Name"},t.displayName()),m("p",{className:"FlarumBlog-Article-Author-Bio"},t.bio&&t.bio()),m("ul",{className:"FlarumBlog-Article-Author-Extended"},G()(this.items().toArray()))),this.attrs.loading&&m("div",null,m("span",{className:"FlarumBlog-Article-Author-Name FlarumBlog-Author-Ghost"}," "),m("p",{className:"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}," "),m("p",{className:"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}," "),m("p",{className:"FlarumBlog-Article-Author-Bio FlarumBlog-Author-Ghost"}," ")))},a.items=function(){return new _.a},e}(g.a),q=a(4),J=a.n(q),K=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.blogCategories=app.forum.attribute("blogTags")},a.view=function(){var t=this;return m("div",{className:"BlogCategories"},m("h3",null,app.translator.trans("v17development-flarum-blog.forum.categories")),this.blogCategories&&this.blogCategories.map((function(e){var a=app.store.getById("tags",e);if(!a)return null;var o=[];return o.push(t.categoryItem(a)),app.store.all("tags").forEach((function(e){e.isChild()&&e.parent().id()===a.id()&&o.push(t.categoryItem(e))})),o})))},a.categoryItem=function(t){return m(J.a,{href:app.route("blogCategory",{slug:t.slug()}),className:"BlogCategories-item BlogCategories-item-"+t.id()+" "+(t.isChild()&&1==app.forum.attribute("blogCategoryHierarchy")?"BlogCategories-item-child":"")},m("span",{className:""===t.icon()?"BlogCategories-item-colored":"",style:{backgroundColor:""===t.icon()?t.color():null}},m("i",{className:t.icon()})),t.name())},e}(g.a),Q=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.view=function(){return m("div",{className:"FlarumBlog-Article-Sidebar"},m("ul",null,G()(this.items().toArray())))},a.items=function(){var t=new _.a;return t.add("author",W.component(this.attrs),0),t.add("categories",K.component(this.attrs),0),t},e}(g.a),V=a(18),X=a.n(V);function Y(t){$(t).tooltip()}var Z=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.languages=app.store.all("discussion-languages"),this.options=this.languages.reduce((function(t,e){return t[e.code()]=m("span",null,m("i",{className:"fas fa-globe"})," ",e.name()),t}),this.attrs.extra||{})},a.view=function(){var t=this.attrs,e=t.language,a=t.uppercase,o=e.name()||"";return m("span",null,m("i",{className:"fas fa-globe"})," ",a?o.toUpperCase():o)},e}(g.a),tt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.languages=app.store.all("discussion-languages"),this.options=this.languages.reduce((function(t,e){return t[e.code()]=m(Z,{language:e}),t}),this.attrs.extra||{})},a.view=function(){var t=this,e=this.attrs.selected,a=Object.keys(this.options).map((function(a){var o=a===(e||"any");return w.a.component({active:o,icon:!o||"fas fa-check",onclick:function(){return t.attrs.onclick(a)}},t.options[a])}));return F.a.component({buttonClassName:"Button",label:this.options[e]||this.options[this.attrs.default],menuClassName:"Dropdown-menu--right"},a)},e}(g.a),et=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),app.setTitle(app.translator.trans("v17development-flarum-blog.forum.blog")),this.bodyClass="BlogOverviewPage",this.isLoading=!0,this.featuredPosts=[],this.posts=[],this.hasMore=null,this.isLoadingMore=!1,this.languages=app.store.all("discussion-languages"),this.currentSelectedLanguage=m.route.param("lang")?m.route.param("lang"):app.translator.locale,app.history.push("blog"),this.loadBlogOverview()},a.loadBlogOverview=function(){var t=app.preloadedApiDocument();t?setTimeout(this.show.bind(this,t),0):this.reloadData(),m.redraw()},a.reloadData=function(){var t="is:blog"+(m.route.param("slug")?" tag:"+m.route.param("slug"):"");null!==this.languages&&this.languages.length>=1&&(t+=" language:"+this.currentSelectedLanguage),app.store.find("discussions",{filter:{q:t},sort:"-createdAt"}).then(this.show.bind(this)).catch((function(){m.redraw()}))},a.show=function(t){if(0===t.length)return this.isLoading=!1,void m.redraw();this.hasMore=t.payload.links&&t.payload.links.next?t.payload.links.next:null,this.featuredPosts=t.slice(0,3),this.posts=t.length>=4?t.slice(3,t.length):[],this.isLoading=!1,m.redraw()},a.loadMore=function(){var t=this;this.isLoadingMore=!0,app.store.find(this.hasMore.replace(app.forum.attribute("apiUrl"),"")).then((function(e){e.map((function(e){return t.posts.push(e)})),t.hasMore=e.payload.links&&e.payload.links.next?e.payload.links.next:null})).catch((function(){})).then((function(){t.isLoadingMore=!1,m.redraw()}))},a.title=function(){if(!m.route.param("slug"))return m("h2",null,app.translator.trans("v17development-flarum-blog.forum.recent_posts"));var t=app.store.all("tags").filter((function(t){return t.slug()===m.route.param("slug")}));return m("h2",null,t&&t[0]&&t[0].name(),m("small",null," - ",m(J.a,{href:app.route("blog")},app.translator.trans("v17development-flarum-blog.forum.return_to_overview"))))},a.view=function(){var t=this;return m("div",{className:"FlarumBlogOverview"},m("div",{className:"container"},m("div",{className:"BlogFeatured"},m("div",{className:"BlogOverviewButtons"},app.forum.attribute("canWriteBlogPosts")&&m(w.a,{className:"Button",onclick:function(){return t.newArticle()},icon:"fas fa-pencil-alt"},app.translator.trans("v17development-flarum-blog.forum.compose.write_article")),null!==this.languages&&this.languages.length>=1&&m(tt,{selected:this.currentSelectedLanguage,onclick:function(e){t.currentSelectedLanguage=e,m.route.set(document.location.pathname,{lang:e}),t.reloadData()}})),this.title(),m("div",{style:{clear:"both"}}),m("div",{className:"BlogFeatured-list"},this.isLoading&&[0,1,2].map((function(){return m("div",{className:"BlogFeatured-list-item BlogFeatured-list-item-ghost"},m("div",{className:"BlogFeatured-list-item-details"},m("h4",null," "),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-wave"})))))})),!this.isLoading&&this.featuredPosts.length>=0&&this.featuredPosts.map((function(e){var a=e.blogMeta()&&e.blogMeta().featuredImage()?"url("+e.blogMeta().featuredImage()+")":null,o=e.tags()?e.tags().filter((function(t){return t.isChild()})):[];return m(J.a,{href:app.route("blogArticle",{id:""+e.slug()}),className:"BlogFeatured-list-item FlarumBlog-default-image",style:{backgroundImage:a}},m("div",{className:"BlogFeatured-list-item-top"},o[0]&&m("span",null,o[0].name()),e.isSticky()&&m("span",null,m("i",{className:"fas fa-thumbtack"})),(e.blogMeta()&&1==e.blogMeta().isPendingReview()||e.isHidden())&&m("span",null,m("i",{className:"fas fa-eye-slash"})),e.blogMeta()&&1==e.blogMeta().isPendingReview()&&m("span",{title:app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review"),config:Y.bind(t),"data-placement":"bottom"},m("i",{className:"far fa-clock"})," ",app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review_title"))),m("div",{className:"BlogFeatured-list-item-details"},m("h4",null,e.title()),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-clock"})," ",X()(e.createdAt())),m("span",null,m("i",{className:"far fa-user"})," ",e.user()?e.user().displayName():"[Deleted]"),m("span",null,m("i",{className:"far fa-comment"})," ",e.commentCount()-1))))})))),m("div",{className:"BlogScrubber"},m("div",{className:"BlogList"},this.isLoading&&[!1,!1,!0,!1].map((function(t){return m("div",{className:"BlogList-item BlogList-item-"+(!0===t?"sized":"default")+" BlogList-item-ghost"},m("div",{className:"BlogList-item-photo FlarumBlog-default-image"}),m("div",{className:"BlogList-item-content"},m("h4",null," "),m("p",null," "),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-wave"})))))})),!this.isLoading&&this.posts.length>=1&&this.posts.map((function(e){var a=e.blogMeta()&&e.blogMeta().featuredImage()?"url("+e.blogMeta().featuredImage()+")":null,o=e.blogMeta()&&e.blogMeta().isSized(),s=e.blogMeta()&&e.blogMeta().summary()?e.blogMeta().summary():"";return m(J.a,{href:app.route("blogArticle",{id:""+e.slug()}),className:"BlogList-item BlogList-item-"+(o?"sized":"default")},m("div",{className:"BlogList-item-photo FlarumBlog-default-image",style:{backgroundImage:a}}),m("div",{className:"BlogList-item-content"},m("h4",null,e.title(),(e.blogMeta()&&1==e.blogMeta().isPendingReview()||e.isHidden())&&m("i",{className:"fas fa-eye-slash"}),e.blogMeta()&&1==e.blogMeta().isPendingReview()&&m("i",{className:"far fa-clock",title:app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review"),config:Y.bind(t)})),m("p",null,s),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-clock"})," ",X()(e.createdAt())),m("span",null,m("i",{className:"far fa-user"})," ",e.user()?e.user().displayName():"[Deleted]"),m("span",null,m("i",{className:"far fa-comment"})," ",e.commentCount()-1))))})),!this.isLoading&&this.featuredPosts.length>0&&null===this.hasMore&&m("p",{className:"FlarumBlog-reached-end"},app.translator.trans("v17development-flarum-blog.forum.no_more_posts")),!this.isLoading&&0===this.featuredPosts.length&&0===this.posts.length&&m("p",{className:"FlarumBlog-reached-end"},app.translator.trans("v17development-flarum-blog.forum.category_empty")),!this.isLoading&&null!==this.hasMore&&m("div",{className:"FlarumBlog-reached-load-more"},m(w.a,{className:"Button",onclick:function(){return t.loadMore()},icon:"fas fa-chevron-down",loading:this.isLoadingMore},app.translator.trans("core.forum.discussion_list.load_more_button")))),m("div",{className:"Sidebar"},m(K,null)))))},a.newArticle=function(){var t=[],e=app.forum.attribute("blogTags");app.store.all("tags").forEach((function(a){!a.isChild()&&e.indexOf(a.id())>=0&&t.push(a)}));var a=app.store.getBy("tags","slug",m.route.param("slug"));a&&t.push(a),m.route.set(app.route("blogComposer",{tags:t.map((function(t){return t.id()})).join(),lang:this.languages.length>0?this.currentSelectedLanguage:void 0}))},e}(i.a),at=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),app.setTitle(app.translator.trans("v17development-flarum-blog.forum.blog")),app.history.push("blogArticle"),this.bodyClass="BlogItemPage",this.loading=!0,this.found=!1,this.article=null,this.loadBlogItem()},a.loadBlogItem=function(){var t=app.preloadedApiDocument();t?setTimeout(this.show.bind(this,t),0):app.store.find("discussions",m.route.param("id").split("-")[0]).then(this.show.bind(this)).catch((function(){m.redraw()})),m.redraw()},a.show=function(t){this.article=t,app.setTitle(t.title()+" - "+app.translator.trans("v17development-flarum-blog.forum.blog")),this.loading=!1;var e=[];if(t.payload&&t.payload.included){var a=t.id();e=t.payload.included.filter((function(t){return"posts"===t.type&&t.relationships&&t.relationships.discussion&&t.relationships.discussion.data.id===a})).map((function(t){return app.store.getById("posts",t.id)})).sort((function(t,e){return t.id()-e.id()})).slice(0,20)}this.stream=new p.a(t,e),m.redraw()},a.view=function(){var t=this.article&&this.article.blogMeta()&&this.article.blogMeta().featuredImage()?"url("+this.article.blogMeta().featuredImage()+")":null,e=null;return!this.loading&&this.article&&(e=this.article.firstPost()?this.article.firstPost():app.store.getById("posts",this.article.firstPostId())),m("div",{className:"FlarumBlogItem"},m("div",{className:"container"},m("div",{className:"FlarumBlog-ToolButtons"},m(J.a,{href:app.route("blog"),className:"Button",onclick:function(t){app.previous.matches(et)&&(t.preventDefault(),history.back())}},m("i",{class:"icon fas fa-angle-left Button-icon"}),m("span",{class:"Button-label"},app.translator.trans("v17development-flarum-blog.forum.return_to_overview")))),m("div",{className:"FlarumBlog-Article"},m("div",{className:"FlarumBlog-Article-Container"},m("div",{className:"FlarumBlog-Article-Content"},m("div",{className:"FlarumBlog-Article-Image FlarumBlog-default-image "+(this.loading?"FlarumBlog-Article-GhostImage":""),style:{backgroundImage:t,opacity:this.article&&this.article.isHidden()?.4:null}}),this.article&&app.session.user&&(app.session.user.canEdit()||this.article.canRename()||this.article.posts()&&this.article.posts()[0].canEdit())&&m(E,{article:this.article}),m("div",{className:"FlarumBlog-Article-Categories"},!this.loading&&this.article&&this.article.tags()&&this.article.tags().map((function(t){return m(J.a,{href:app.route("blogCategory",{slug:t.slug()})},t.name())})),this.loading&&[0,1].map((function(){return m("span",{className:"FlarumBlog-Article-GhostCategory"},"Category")}))),m("div",{className:"FlarumBlog-Article-Post"},m("h3",{className:this.loading?"FlarumBlog-Article-GhostTitle":null},this.article?this.article.title():"Ghost title",this.article&&this.article.isHidden()&&"("+app.translator.trans("v17development-flarum-blog.forum.hidden")+")"),this.loading&&[0,1,2].map((function(){return m("div",null,m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",null," "))})),!this.loading&&this.article.blogMeta()&&1==this.article.blogMeta().isPendingReview()&&m("div",{className:"Post"},m("blockquote",{class:"uncited",style:{fontSize:"16px"}},m("div",null,m("span",{className:"far fa-clock",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review")))),!this.loading&&e&&m(n.a,{post:e}))),m("div",{className:"FlarumBlog-Article-Comments"},m("h4",null,app.translator.trans("v17development-flarum-blog.forum.comment_section.comments")," (",this.article?this.article.commentCount()-1:0,")"),!this.loading&&this.article.isLocked&&this.article.isLocked()&&m("div",{className:"Post-body"},m("blockquote",{class:"uncited"},m("div",null,m("span",{className:"far fa-lock",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.comment_section.locked")))),!this.loading&&this.article&&u.a.component({discussion:this.article,stream:this.stream,onPositionChange:function(){}}))),m(Q,{article:this.article,loading:this.loading}))))},a.positionChanged=function(t,e){var a=this.article;app.session.user&&e>(a.lastReadPostNumber()||0)&&(a.save({lastReadPostNumber:e}),m.redraw())},e}(i.a),ot=a(5),st=a.n(ot),it=a(25),rt=a.n(it),nt=a(26),lt=a.n(nt),ut=a(27),mt=a.n(ut),ct=a(8),pt=function(){Object(ct.extend)(lt.a.prototype,"config",(function(){var t=this.currentTag(),e="both"===app.forum.attribute("blogRedirectsEnabled")||"tags_only"===app.forum.attribute("blogRedirectsEnabled");if(t&&e){var a=app.forum.attribute("blogTags");(a.indexOf(t.id())>=0||t.parent()&&a.indexOf(t.parent().id())>=0)&&m.route.set(app.route("blog"))}})),Object(ct.override)(mt.a.prototype,"show",(function(t,e){if(("both"===app.forum.attribute("blogRedirectsEnabled")||"discussions_only"===app.forum.attribute("blogRedirectsEnabled"))&&e&&e&&e.tags().length>0){var a=app.forum.attribute("blogTags");if(e.tags().filter((function(t){return a.indexOf(t.id())>=0||t.parent()&&a.indexOf(t.parent().id())>=0})).length>0){var o=app.route("blogArticle",{id:e.slug()});return m.route.set(o,null,!0),null}}return t(e)}))},dt=a(28),gt=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e}(a.n(dt)()(st.a,{discussion:st.a.hasOne("discussion"),featuredImage:st.a.attribute("featuredImage"),summary:st.a.attribute("summary"),isFeatured:st.a.attribute("isFeatured"),isSized:st.a.attribute("isSized"),isPendingReview:st.a.attribute("isPendingReview")})),ft=a(29),ht=a.n(ft);function vt(){Object(ct.extend)(ht.a.prototype,"view",(function(t){var e=this;if(0==app.forum.attribute("blogHideTags"))return t;var a=app.forum.attribute("blogTags")||[],o=t.children[1].children[1].children[0].children;return t.children[1].children[1].children[0].children=o.map((function(t,o){return a.indexOf(e.tags[o].id())>=0?null:t})),t}))}var bt=function(){var t=app.route.discussion;app.route.discussion=function(e,a){var o=!1;if(("both"===app.forum.attribute("blogRedirectsEnabled")||"discussions_only"===app.forum.attribute("blogRedirectsEnabled"))&&e.tags().length>0){var s=app.forum.attribute("blogTags");e.tags().filter((function(t){return s.indexOf(t.id())>=0||t.parent()&&s.indexOf(t.parent().id())>=0})).length>0&&(o=!0)}return o?app.route("blogArticle",{id:e.slug()}):t(e,a)}},yt=a(30),Nt=a.n(yt),Bt=a(31),wt=a.n(Bt),At=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.view=function(){return m("div",null)},a.oncreate=function(e){t.prototype.oncreate.call(this,e),s9e.TextFormatter.preview(e.attrs.content||"",e.dom)},e}(g.a),Ft=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.previewContent=!1},a.view=function(){var t=this,e=this.composer.fields.content()&&""!==this.composer.fields.content(),a=this.loading||this.attrs.disabled;return m("div",{className:"Flarum-Blog-Composer "+(a?"Flarum-Blog-Composer-Loading":"")},m("div",{className:"Flarum-Blog-Composer-tabs"},m(w.a,{className:!this.previewContent&&"AricleComposerButtonSelected",onclick:function(){return t.previewContent=!1}},app.translator.trans("v17development-flarum-blog.forum.composer.write")),m(w.a,{className:this.previewContent&&"AricleComposerButtonSelected",onclick:function(){return t.previewContent=!0}},app.translator.trans("v17development-flarum-blog.forum.composer.view"))),m("div",{className:"Composer Flarum-Blog-Composer-body "+(this.previewContent?"Flarum-Blog-Composer-HideEditor":"")},this.previewContent&&m("div",{className:"Flarum-Blog-Composer-preview"},!e&&app.translator.trans("v17development-flarum-blog.forum.composer.nothing_to_preview"),m(At,{content:this.composer.fields.content()})),wt.a.component({submitLabel:this.attrs.submitLabel||app.translator.trans("core.forum.composer_edit.submit_button"),placeholder:this.attrs.placeholder,disabled:a,composer:this.composer,preview:this.jumpToPreview&&this.jumpToPreview.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()})))},a.onsubmit=function(){this.attrs.onsubmit&&this.attrs.onsubmit()},e}(Nt.a),Mt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;if(t.prototype.oninit.call(this,e),app.setTitle(app.translator.trans("v17development-flarum-blog.forum.blog")),app.forum.attribute("canWriteBlogPosts")){if(app.history.push("blogComposer"),this.languages=app.store.all("discussion-languages"),this.bodyClass="BlogItemPage",this.articleLanguage=m.route.param("lang")?m.route.param("lang"):app.translator.locale,this.article=app.store.createRecord("discussions"),this.blogMeta=null,this.tags=[],m.route.param().tags){var o=Array.isArray(m.route.param().tags)?m.route.param().tags:m.route.param().tags.split(",");m.route.param().tags.length>0&&o.forEach((function(t){var e=app.store.getById("tags",t);e&&a.tags.push(e)}))}this.isSaving=!1}else m.route.set(app.route("blog"))},a.openTagsModal=function(t){var e=this;void 0===t&&(t=null),t&&t.preventDefault(),this.isSaving||app.modal.show(h.a,{selectedTags:this.tags,onsubmit:function(t){e.tags=t}})},a.openNameArticleModal=function(t){var e=this;void 0===t&&(t=null),t&&t.preventDefault(),this.isSaving||app.modal.show(R,{article:this.article,onChange:function(t){e.article.pushData({attributes:{title:t}})}})},a.openBlogSettings=function(t){var e=this;t.preventDefault(),this.isSaving||app.modal.show(L,{meta:this.blogMeta,onsubmit:function(t){return e.blogMeta=t}})},a.view=function(){var t=this,e=this.blogMeta&&this.blogMeta.featuredImage()?"url("+this.blogMeta.featuredImage()+")":null;return m("div",{className:"FlarumBlogItem"},m("div",{className:"container"},m("div",{className:"FlarumBlog-ToolButtons"},m(J.a,{href:app.route("blog"),className:"Button",loading:this.isSaving,icon:"fas fa-angle-left"},m("i",{class:"icon fas fa-angle-left Button-icon"}),m("span",{class:"Button-label"},app.translator.trans("v17development-flarum-blog.forum.return_to_overview")))),m("div",{className:"FlarumBlog-Article"},m("div",{className:"FlarumBlog-Article-Container"},m("div",{className:"FlarumBlog-Article-Content"},m("div",{className:"FlarumBlog-Article-Image FlarumBlog-default-image",style:{backgroundImage:e,cursor:"pointer"},onclick:function(e){return t.openBlogSettings(e)}}),m("div",{className:"FlarumBlog-Article-Content-Edit-Button"},m("div",{className:0===this.languages.length?"FlarumBlog-Article-Content-Edit-Dropdown":"FlarumBlog-Article-Content-EditButtons"},null!==this.languages&&this.languages.length>=1&&m(tt,{selected:this.articleLanguage,onclick:function(e){return t.articleLanguage=e}}),m(w.a,{className:"Button",onclick:function(e){return t.openBlogSettings(e)},icon:"fas fa-pencil-alt",loading:this.isSaving},"Update blog settings"))),m("div",{className:"FlarumBlog-Article-Categories"},this.tags.map((function(e){return m("a",{href:"#",onclick:function(e){return t.openTagsModal(e)}},e.name())})),m("a",{href:"#",onclick:function(e){return t.openTagsModal(e)}},0===this.tags.length?app.translator.trans("v17development-flarum-blog.forum.composer.select_category"):app.translator.trans("v17development-flarum-blog.forum.composer.edit_categories")," ",m("i",{className:"fas fa-edit"}))),m("div",{className:"FlarumBlog-Article-Post"},m("h3",{onclick:function(){return t.openNameArticleModal()},style:{cursor:"pointer"}},this.article&&this.article.title()&&""!==this.article.title()?this.article.title():app.translator.trans("v17development-flarum-blog.forum.composer.no_title"),m("a",{href:"#",onclick:function(t){return t.preventDefault()}},m("i",{className:"fas fa-edit"}))),m("div",{className:"Post-body"},m(Ft,{composer:app.composer,originalContent:"",submitLabel:app.translator.trans("v17development-flarum-blog.forum.composer.post_article"),placeholder:app.translator.trans("v17development-flarum-blog.forum.composer.enter_message_here"),onsubmit:function(){return t.create()},disabled:this.isSaving})))),m("div",{className:"FlarumBlog-Article-Comments"},m("h4",null,app.translator.trans("v17development-flarum-blog.forum.comment_section.comments")," (0)"),m("div",{className:"Post-body"},m("blockquote",{class:"uncited"},m("div",null,m("span",{className:"fas fa-ban",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.composer.comment_section")))))),m("div",{className:"FlarumBlog-Article-Sidebar"},m(W,{user:app.session.user})))))},a.create=function(){var t=this,e=app.forum.attribute("blogTags")||[];if(0!==this.tags.length)if(this.article.title()&&""!==this.article.title())if(0!==this.tags.filter((function(t){return e.indexOf(t.id())>=0})).length){if(null!==this.blogMeta&&this.blogMeta.featuredImage()&&this.blogMeta.summary()||confirm(app.translator.trans("v17development-flarum-blog.forum.composer.post_without_blog_info"))){var a={tags:this.tags};this.languages.length>0&&(a.language=app.store.getBy("discussion-languages","code",this.articleLanguage));var o={title:this.article.title(),content:app.composer.fields.content(),relationships:a,blogMeta:null!==this.blogMeta?{featuredImage:this.blogMeta.featuredImage(),summary:this.blogMeta.summary(),isSized:this.blogMeta.isSized()}:null};this.isSaving=!0,this.article.save(o).then((function(t){setTimeout((function(){m.route.set(app.route("blogArticle",{id:""+t.slug()}))}),500)})).catch((function(){t.isSaving=!1,m.redraw()}))}}else alert(app.translator.trans("v17development-flarum-blog.forum.composer.no_blog_tags_selected"));else this.openNameArticleModal();else this.openTagsModal()},e}(i.a);function Ct(){return(Ct=Object.assign||function(t){for(var e=1;e=1&&(t+=" language:"+this.currentSelectedLanguage),app.store.find("discussions",{filter:{q:t},sort:"-createdAt"}).then(this.show.bind(this)).catch((function(){m.redraw()}))},a.show=function(t){if(0===t.length)return this.isLoading=!1,void m.redraw();this.hasMore=t.payload.links&&t.payload.links.next?t.payload.links.next:null,this.featuredPosts=t.slice(0,3),this.posts=t.length>=4?t.slice(3,t.length):[],this.isLoading=!1,m.redraw()},a.loadMore=function(){var t=this;this.isLoadingMore=!0,app.store.find(this.hasMore.replace(app.forum.attribute("apiUrl"),"")).then((function(e){e.map((function(e){return t.posts.push(e)})),t.hasMore=e.payload.links&&e.payload.links.next?e.payload.links.next:null})).catch((function(){})).then((function(){t.isLoadingMore=!1,m.redraw()}))},a.title=function(){if(!m.route.param("slug"))return m("h2",null,app.translator.trans("v17development-flarum-blog.forum.recent_posts"));var t=app.store.all("tags").filter((function(t){return t.slug()===m.route.param("slug")}));return m("h2",null,t&&t[0]&&t[0].name(),m("small",null," ","-"," ",m(J.a,{href:app.route("blog")},app.translator.trans("v17development-flarum-blog.forum.return_to_overview"))))},a.view=function(){var t=this;return m("div",{className:"FlarumBlogOverview"},m("div",{className:"container"},m("div",{className:"BlogFeatured"},m("div",{className:"BlogOverviewButtons"},app.forum.attribute("canWriteBlogPosts")&&m(w.a,{className:"Button",onclick:function(){return t.newArticle()},icon:"fas fa-pencil-alt"},app.translator.trans("v17development-flarum-blog.forum.compose.write_article")),null!==this.languages&&this.languages.length>=1&&m(rt,{selected:this.currentSelectedLanguage,onclick:function(e){t.currentSelectedLanguage=e,m.route.set(document.location.pathname,{lang:e}),t.reloadData()}})),this.title(),m("div",{style:{clear:"both"}}),m("div",{className:"BlogFeatured-list"},this.isLoading&&[0,1,2].map((function(){return m("div",{className:"BlogFeatured-list-item BlogFeatured-list-item-ghost"},m("div",{className:"BlogFeatured-list-item-details"},m("h4",null," "),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-wave"})))))})),!this.isLoading&&this.featuredPosts.length>=0&&this.featuredPosts.map((function(e){var a=e.blogMeta()&&e.blogMeta().featuredImage()?"url("+e.blogMeta().featuredImage()+")":null,o=e.tags()?e.tags().filter((function(t){return t.isChild()})):[];return m(J.a,{href:app.route("blogArticle",{id:""+e.slug()}),className:"BlogFeatured-list-item FlarumBlog-default-image",style:{backgroundImage:a}},m("div",{className:"BlogFeatured-list-item-top"},o[0]&&m("span",null,o[0].name()),e.isSticky()&&m("span",null,m("i",{className:"fas fa-thumbtack"})),(e.blogMeta()&&1==e.blogMeta().isPendingReview()||e.isHidden())&&m("span",null,m("i",{className:"fas fa-eye-slash"})),e.blogMeta()&&1==e.blogMeta().isPendingReview()&&m("span",{title:app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review"),config:ot.bind(t),"data-placement":"bottom"},m("i",{className:"far fa-clock"})," ",app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review_title"))),m("div",{className:"BlogFeatured-list-item-details"},m("h4",null,e.title()),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-clock"})," ",at()(e.createdAt())),m("span",null,m("i",{className:"far fa-user"})," ",e.user()?e.user().displayName():"[Deleted]"),m("span",null,m("i",{className:"far fa-comment"})," ",e.commentCount()-1))))})))),m("div",{className:"BlogScrubber"},m("div",{className:"BlogList"},this.isLoading&&[!1,!1,!0,!1].map((function(t){return m("div",{className:"BlogList-item BlogList-item-"+(!0===t?"sized":"default")+" BlogList-item-ghost"},m("div",{className:"BlogList-item-photo FlarumBlog-default-image"}),m("div",{className:"BlogList-item-content"},m("h4",null," "),m("p",null," "),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-wave"})))))})),!this.isLoading&&this.posts.length>=1&&this.posts.map((function(e){var a=e.blogMeta()&&e.blogMeta().featuredImage()?"url("+e.blogMeta().featuredImage()+")":null,o=e.blogMeta()&&e.blogMeta().isSized(),s=e.blogMeta()&&e.blogMeta().summary()?e.blogMeta().summary():"";return m(J.a,{href:app.route("blogArticle",{id:""+e.slug()}),className:"BlogList-item BlogList-item-"+(o?"sized":"default")},m("div",{className:"BlogList-item-photo FlarumBlog-default-image",style:{backgroundImage:a}}),m("div",{className:"BlogList-item-content"},m("h4",null,e.title(),(e.blogMeta()&&1==e.blogMeta().isPendingReview()||e.isHidden())&&m("i",{className:"fas fa-eye-slash"}),e.blogMeta()&&1==e.blogMeta().isPendingReview()&&m("i",{className:"far fa-clock",title:app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review"),config:ot.bind(t)})),m("p",null,s),m("div",{className:"data"},m("span",null,m("i",{className:"far fa-clock"})," ",at()(e.createdAt())),m("span",null,m("i",{className:"far fa-user"})," ",e.user()?e.user().displayName():"[Deleted]"),m("span",null,m("i",{className:"far fa-comment"})," ",e.commentCount()-1))))})),!this.isLoading&&this.featuredPosts.length>0&&null===this.hasMore&&m("p",{className:"FlarumBlog-reached-end"},app.translator.trans("v17development-flarum-blog.forum.no_more_posts")),!this.isLoading&&0===this.featuredPosts.length&&0===this.posts.length&&m("p",{className:"FlarumBlog-reached-end"},app.translator.trans("v17development-flarum-blog.forum.category_empty")),!this.isLoading&&null!==this.hasMore&&m("div",{className:"FlarumBlog-reached-load-more"},m(w.a,{className:"Button",onclick:function(){return t.loadMore()},icon:"fas fa-chevron-down",loading:this.isLoadingMore},app.translator.trans("core.forum.discussion_list.load_more_button")))),m("div",{className:"Sidebar"},m(K,null),m(Z,null)))))},a.newArticle=function(){var t=[],e=app.forum.attribute("blogTags");app.store.all("tags").forEach((function(a){!a.isChild()&&e.indexOf(a.id())>=0&&t.push(a)}));var a=app.store.getBy("tags","slug",m.route.param("slug"));a&&t.push(a),m.route.set(app.route("blogComposer",{tags:t.map((function(t){return t.id()})).join(),lang:this.languages.length>0?this.currentSelectedLanguage:void 0}))},e}(r.a),it=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),app.setTitle(app.translator.trans("v17development-flarum-blog.forum.blog")),app.history.push("blogArticle"),this.bodyClass="BlogItemPage",this.loading=!0,this.found=!1,this.article=null,this.loadBlogItem()},a.loadBlogItem=function(){var t=app.preloadedApiDocument();t?setTimeout(this.show.bind(this,t),0):app.store.find("discussions",m.route.param("id").split("-")[0]).then(this.show.bind(this)).catch((function(){m.redraw()})),m.redraw()},a.show=function(t){this.article=t,app.setTitle(t.title()+" - "+app.translator.trans("v17development-flarum-blog.forum.blog")),this.loading=!1;var e=[];if(t.payload&&t.payload.included){var a=t.id();e=t.payload.included.filter((function(t){return"posts"===t.type&&t.relationships&&t.relationships.discussion&&t.relationships.discussion.data.id===a})).map((function(t){return app.store.getById("posts",t.id)})).sort((function(t,e){return t.id()-e.id()})).slice(0,20)}this.stream=new p.a(t,e),m.redraw()},a.view=function(){var t=this.article&&this.article.blogMeta()&&this.article.blogMeta().featuredImage()?"url("+this.article.blogMeta().featuredImage()+")":null,e=null;return!this.loading&&this.article&&(e=this.article.firstPost()?this.article.firstPost():app.store.getById("posts",this.article.firstPostId())),m("div",{className:"FlarumBlogItem"},m("div",{className:"container"},m("div",{className:"FlarumBlog-ToolButtons"},m(J.a,{href:app.route("blog"),className:"Button",onclick:function(t){app.previous.matches(nt)&&(t.preventDefault(),history.back())}},m("i",{class:"icon fas fa-angle-left Button-icon"}),m("span",{class:"Button-label"},app.translator.trans("v17development-flarum-blog.forum.return_to_overview")))),m("div",{className:"FlarumBlog-Article"},m("div",{className:"FlarumBlog-Article-Container"},m("div",{className:"FlarumBlog-Article-Content"},m("div",{className:"FlarumBlog-Article-Image FlarumBlog-default-image "+(this.loading?"FlarumBlog-Article-GhostImage":""),style:{backgroundImage:t,opacity:this.article&&this.article.isHidden()?.4:null}}),this.article&&app.session.user&&(app.session.user.canEdit()||this.article.canRename()||this.article.posts()&&this.article.posts()[0].canEdit())&&m(E,{article:this.article}),m("div",{className:"FlarumBlog-Article-Categories"},!this.loading&&this.article&&this.article.tags()&&this.article.tags().map((function(t){return m(J.a,{href:app.route("blogCategory",{slug:t.slug()})},t.name())})),this.loading&&[0,1].map((function(){return m("span",{className:"FlarumBlog-Article-GhostCategory"},"Category")}))),m("div",{className:"FlarumBlog-Article-Post"},m("h3",{className:this.loading?"FlarumBlog-Article-GhostTitle":null},this.article?this.article.title():"Ghost title",this.article&&this.article.isHidden()&&"("+app.translator.trans("v17development-flarum-blog.forum.hidden")+")"),this.loading&&[0,1,2].map((function(){return m("div",null,m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",{className:"FlarumBlog-Article-GhostParagraph"}," "),m("p",null," "))})),!this.loading&&this.article.blogMeta()&&1==this.article.blogMeta().isPendingReview()&&m("div",{className:"Post"},m("blockquote",{class:"uncited",style:{fontSize:"16px"}},m("div",null,m("span",{className:"far fa-clock",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.review_article.pending_review")))),!this.loading&&e&&m(i.a,{post:e}))),m("div",{className:"FlarumBlog-Article-Comments"},m("h4",null,app.translator.trans("v17development-flarum-blog.forum.comment_section.comments")," ","(",this.article?this.article.commentCount()-1:0,")"),!this.loading&&this.article.isLocked&&this.article.isLocked()&&m("div",{className:"Post-body"},m("blockquote",{class:"uncited"},m("div",null,m("span",{className:"far fa-lock",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.comment_section.locked")))),!this.loading&&this.article&&u.a.component({discussion:this.article,stream:this.stream,onPositionChange:function(){}}))),m(tt,{article:this.article,loading:this.loading}))))},a.positionChanged=function(t,e){var a=this.article;app.session.user&&e>(a.lastReadPostNumber()||0)&&(a.save({lastReadPostNumber:e}),m.redraw())},e}(r.a),lt=a(6),ut=a.n(lt),mt=a(27),ct=a.n(mt),pt=a(28),dt=a.n(pt),gt=a(4),ft=function(){Object(gt.extend)(V.a.prototype,"oncreate",(function(){var t=this.currentTag(),e="both"===app.forum.attribute("blogRedirectsEnabled")||"tags_only"===app.forum.attribute("blogRedirectsEnabled");if(t&&e){var a=app.forum.attribute("blogTags");(a.indexOf(t.id())>=0||t.parent()&&a.indexOf(t.parent().id())>=0)&&m.route.set(app.route("blog"))}})),Object(gt.override)(dt.a.prototype,"show",(function(t,e){if(("both"===app.forum.attribute("blogRedirectsEnabled")||"discussions_only"===app.forum.attribute("blogRedirectsEnabled"))&&e&&e&&e.tags().length>0){var a=app.forum.attribute("blogTags");if(e.tags().filter((function(t){return a.indexOf(t.id())>=0||t.parent()&&a.indexOf(t.parent().id())>=0})).length>0){var o=app.route("blogArticle",{id:e.slug()});return m.route.set(o,null,!0),null}}return t(e)}))},ht=a(29),vt=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e}(a.n(ht)()(ut.a,{discussion:ut.a.hasOne("discussion"),featuredImage:ut.a.attribute("featuredImage"),summary:ut.a.attribute("summary"),isFeatured:ut.a.attribute("isFeatured"),isSized:ut.a.attribute("isSized"),isPendingReview:ut.a.attribute("isPendingReview")})),bt=a(30),yt=a.n(bt);function Nt(){Object(gt.extend)(yt.a.prototype,"view",(function(t){var e=this;if(0==app.forum.attribute("blogHideTags"))return t;var a=app.forum.attribute("blogTags")||[],o=t.children[1].children[1].children[0].children;return t.children[1].children[1].children[0].children=o.map((function(t,o){return a.indexOf(e.tags[o].id())>=0?null:t})),t})),Object(gt.extend)(V.a.prototype,"navItems",(function(t){return 0==app.forum.attribute("blogHideTags")||(app.forum.attribute("blogTags")||[]).forEach((function(e){t.remove("tag"+e)})),t}))}var Bt=function(){var t=app.route.discussion;app.route.discussion=function(e,a){var o=!1;if(("both"===app.forum.attribute("blogRedirectsEnabled")||"discussions_only"===app.forum.attribute("blogRedirectsEnabled"))&&e.tags().length>0){var s=app.forum.attribute("blogTags");e.tags().filter((function(t){return s.indexOf(t.id())>=0||t.parent()&&s.indexOf(t.parent().id())>=0})).length>0&&(o=!0)}return o?app.route("blogArticle",{id:e.slug()}):t(e,a)}},wt=a(31),At=a.n(wt),Ft=a(32),Mt=a.n(Ft),xt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.view=function(){return m("div",null)},a.oncreate=function(e){t.prototype.oncreate.call(this,e),s9e.TextFormatter.preview(e.attrs.content||"",e.dom)},e}(g.a),Ct=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.previewContent=!1},a.view=function(){var t=this,e=this.composer.fields.content()&&""!==this.composer.fields.content(),a=this.loading||this.attrs.disabled;return m("div",{className:"Flarum-Blog-Composer "+(a?"Flarum-Blog-Composer-Loading":"")},m("div",{className:"Flarum-Blog-Composer-tabs"},m(w.a,{className:!this.previewContent&&"AricleComposerButtonSelected",onclick:function(){return t.previewContent=!1}},app.translator.trans("v17development-flarum-blog.forum.composer.write")),m(w.a,{className:this.previewContent&&"AricleComposerButtonSelected",onclick:function(){return t.previewContent=!0}},app.translator.trans("v17development-flarum-blog.forum.composer.view"))),m("div",{className:"Composer Flarum-Blog-Composer-body "+(this.previewContent?"Flarum-Blog-Composer-HideEditor":"")},this.previewContent&&m("div",{className:"Flarum-Blog-Composer-preview"},!e&&app.translator.trans("v17development-flarum-blog.forum.composer.nothing_to_preview"),m(xt,{content:this.composer.fields.content()})),Mt.a.component({submitLabel:this.attrs.submitLabel||app.translator.trans("core.forum.composer_edit.submit_button"),placeholder:this.attrs.placeholder,disabled:a,composer:this.composer,preview:this.jumpToPreview&&this.jumpToPreview.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()})))},a.onsubmit=function(){this.attrs.onsubmit&&this.attrs.onsubmit()},e}(At.a),_t=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;if(t.prototype.oninit.call(this,e),app.setTitle(app.translator.trans("v17development-flarum-blog.forum.blog")),app.forum.attribute("canWriteBlogPosts")){if(app.history.push("blogComposer"),this.languages=app.store.all("discussion-languages"),this.bodyClass="BlogItemPage",this.articleLanguage=m.route.param("lang")?m.route.param("lang"):app.translator.locale,this.article=app.store.createRecord("discussions"),this.blogMeta=null,this.tags=[],m.route.param().tags){var o=Array.isArray(m.route.param().tags)?m.route.param().tags:m.route.param().tags.split(",");m.route.param().tags.length>0&&o.forEach((function(t){var e=app.store.getById("tags",t);e&&a.tags.push(e)}))}this.isSaving=!1}else m.route.set(app.route("blog"))},a.openTagsModal=function(t){var e=this;void 0===t&&(t=null),t&&t.preventDefault(),this.isSaving||app.modal.show(h.a,{selectedTags:this.tags,onsubmit:function(t){e.tags=t}})},a.openNameArticleModal=function(t){var e=this;void 0===t&&(t=null),t&&t.preventDefault(),this.isSaving||app.modal.show(R,{article:this.article,onChange:function(t){e.article.pushData({attributes:{title:t}})}})},a.openBlogSettings=function(t){var e=this;t.preventDefault(),this.isSaving||app.modal.show(L,{meta:this.blogMeta,onsubmit:function(t){return e.blogMeta=t}})},a.view=function(){var t=this,e=this.blogMeta&&this.blogMeta.featuredImage()?"url("+this.blogMeta.featuredImage()+")":null;return m("div",{className:"FlarumBlogItem"},m("div",{className:"container"},m("div",{className:"FlarumBlog-ToolButtons"},m(J.a,{href:app.route("blog"),className:"Button",loading:this.isSaving,icon:"fas fa-angle-left"},m("i",{class:"icon fas fa-angle-left Button-icon"}),m("span",{class:"Button-label"},app.translator.trans("v17development-flarum-blog.forum.return_to_overview")))),m("div",{className:"FlarumBlog-Article"},m("div",{className:"FlarumBlog-Article-Container"},m("div",{className:"FlarumBlog-Article-Content"},m("div",{className:"FlarumBlog-Article-Image FlarumBlog-default-image",style:{backgroundImage:e,cursor:"pointer"},onclick:function(e){return t.openBlogSettings(e)}}),m("div",{className:"FlarumBlog-Article-Content-Edit-Button"},m("div",{className:0===this.languages.length?"FlarumBlog-Article-Content-Edit-Dropdown":"FlarumBlog-Article-Content-EditButtons"},null!==this.languages&&this.languages.length>=1&&m(rt,{selected:this.articleLanguage,onclick:function(e){return t.articleLanguage=e}}),m(w.a,{className:"Button",onclick:function(e){return t.openBlogSettings(e)},icon:"fas fa-pencil-alt",loading:this.isSaving},"Update blog settings"))),m("div",{className:"FlarumBlog-Article-Categories"},this.tags.map((function(e){return m("a",{href:"#",onclick:function(e){return t.openTagsModal(e)}},e.name())})),m("a",{href:"#",onclick:function(e){return t.openTagsModal(e)}},0===this.tags.length?app.translator.trans("v17development-flarum-blog.forum.composer.select_category"):app.translator.trans("v17development-flarum-blog.forum.composer.edit_categories")," ",m("i",{className:"fas fa-edit"}))),m("div",{className:"FlarumBlog-Article-Post"},m("h3",{onclick:function(){return t.openNameArticleModal()},style:{cursor:"pointer"}},this.article&&this.article.title()&&""!==this.article.title()?this.article.title():app.translator.trans("v17development-flarum-blog.forum.composer.no_title"),m("a",{href:"#",onclick:function(t){return t.preventDefault()}},m("i",{className:"fas fa-edit"}))),m("div",{className:"Post-body"},m(Ct,{composer:app.composer,originalContent:"",submitLabel:app.translator.trans("v17development-flarum-blog.forum.composer.post_article"),placeholder:app.translator.trans("v17development-flarum-blog.forum.composer.enter_message_here"),onsubmit:function(){return t.create()},disabled:this.isSaving})))),m("div",{className:"FlarumBlog-Article-Comments"},m("h4",null,app.translator.trans("v17development-flarum-blog.forum.comment_section.comments")," ","(0)"),m("div",{className:"Post-body"},m("blockquote",{class:"uncited"},m("div",null,m("span",{className:"fas fa-ban",style:{marginRight:"5px"}})," ",app.translator.trans("v17development-flarum-blog.forum.composer.comment_section")))))),m("div",{className:"FlarumBlog-Article-Sidebar"},m(U,{user:app.session.user})))))},a.create=function(){var t=this,e=app.forum.attribute("blogTags")||[];if(0!==this.tags.length)if(this.article.title()&&""!==this.article.title())if(0!==this.tags.filter((function(t){return e.indexOf(t.id())>=0})).length){if(null!==this.blogMeta&&this.blogMeta.featuredImage()&&this.blogMeta.summary()||confirm(app.translator.trans("v17development-flarum-blog.forum.composer.post_without_blog_info"))){var a={tags:this.tags};this.languages.length>0&&(a.language=app.store.getBy("discussion-languages","code",this.articleLanguage));var o={title:this.article.title(),content:app.composer.fields.content(),relationships:a,blogMeta:null!==this.blogMeta?{featuredImage:this.blogMeta.featuredImage(),summary:this.blogMeta.summary(),isSized:this.blogMeta.isSized()}:null};this.isSaving=!0,this.article.save(o).then((function(t){setTimeout((function(){m.route.set(app.route("blogArticle",{id:""+t.slug()}))}),500)})).catch((function(){t.isSaving=!1,m.redraw()}))}}else alert(app.translator.trans("v17development-flarum-blog.forum.composer.no_blog_tags_selected"));else this.openNameArticleModal();else this.openTagsModal()},e}(r.a);function Pt(){return(Pt=Object.assign||function(t){for(var e=1;e\r\n
\r\n {this.fields().toArray()}\r\n
\r\n \r\n );\r\n }\r\n\r\n fields() {\r\n const items = new ItemList();\r\n\r\n items.add('summary', (\r\n
\r\n \r\n