silverstripe-contentreview/client/dist/js/contentreview.js
2023-02-03 10:21:00 +13:00

1 line
3.0 KiB
JavaScript

!function(){"use strict";var e={30:function(e,t,n){var o=a(n(754)),i=a(n(311)),s=a(n(363)),r=n(691);function a(e){return e&&e.__esModule?e:{default:e}}const l=(0,n(648).loadComponent)("FormBuilderModal");i.default.entwine("ss",(e=>{e(".cms-content-actions .content-review__button").entwine({onclick(t){t.preventDefault();let n=e("#content-review__dialog-wrapper");return n.length||(n=e('<div id="content-review__dialog-wrapper" />'),e("body").append(n)),n.open(),!1}}),e(".content-review-modal .content-review-modal__nav-link").entwine({onclick:t=>{t.preventDefault();const n=e(t.target);window.location=n.attr("href")}}),e("#content-review__dialog-wrapper").entwine({ReactRoot:null,onunmatch(){this._clearModal()},open(){this._renderModal(!0)},close(){this._renderModal(!1)},_renderModal(t){var n=this;const i=e("form.cms-edit-form :input[name=ID]").val(),a=`${window.ss.store.getState().config.sections.find((e=>"SilverStripe\\CMS\\Controllers\\CMSPageEditController"===e.name)).form.ReviewContentForm.schemaUrl}/${i}`,d=o.default._t("ContentReview.CONTENT_DUE_FOR_REVIEW","Content due for review");let c=this.getReactRoot();c||(c=(0,r.createRoot)(this[0]),this.setReactRoot(c)),c.render(s.default.createElement(l,{title:d,isOpen:t,onSubmit:function(){return n._handleSubmitModal(...arguments)},onClosed:()=>this.close(),schemaUrl:a,bodyClassName:"modal__dialog",className:"content-review-modal",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good",identifier:"ContentReview.CONTENT_DUE_FOR_REVIEW"}))},_clearModal(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},_handleSubmitModal(t,n,o){return e(".content-review__button-holder").remove(),o()}})}))},933:function(e,t,n){var o;((o=n(311))&&o.__esModule?o:{default:o}).default.entwine("ss",(e=>{e(".cms-edit-form #Form_EditForm_ContentReviewType_Holder").entwine({onmatch(){const e=this;this.find(".optionset :input").bind("change",(t=>{e.show_option(t.target.value)}));const t=this.find("input[name=ContentReviewType]:checked").val();this.show_option(t),this._super()},onunmatch(){return this._super()},show_option(e){"Custom"===e?this._custom():"Inherit"===e?this._inherited():this._disabled()},_custom(){e(".review-settings").show(),e(".field.custom-setting").show()},_inherited(){e(".review-settings").show(),e(".field.custom-setting").hide()},_disabled(){e(".review-settings").hide()}})}))},154:function(e,t,n){var o;((o=n(311))&&o.__esModule?o:{default:o}).default.entwine("ss",(e=>{function t(t){const n=`ContentReviewOwnerID${t}`,o=e("div.subsiteSpecificOwnerID");let i=0;for(i=0;i<o.length;i++)o[i].id===n?e(o[i]).show():e(o[i]).hide()}e("#Form_EditForm_SubsiteIDWithOwner").entwine({onmatch(){t(this.value)},change(){t(this.value)}})}))},648:function(e){e.exports=Injector},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}n(30),n(933),n(154)}();