Merge pull request #80 from creative-commoners/pulls/4.0/fix-close-modal

FIX Remove unused variables import and fix the close modal button after submitting
This commit is contained in:
Dylan Wagstaff 2018-01-12 13:18:25 +13:00 committed by GitHub
commit f5052ed511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 27 deletions

View File

@ -1 +1 @@
!function(e){function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var t={};n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=4)}([function(e,n){e.exports=jQuery},function(e,n,t){"use strict";var o=t(10),i=t.n(o),r=t(0),s=t.n(r),c=t(7),a=t.n(c),u=t(8),d=t.n(u),l=t(9),f=(t.n(l),t(6)),_=(t.n(f),t(5)),p=t.n(_),h=t.i(f.provideInjector)(p.a);s.a.entwine("ss",function(e){e(".cms-content-actions .content-review__button").entwine({onclick:function(n){n.preventDefault();var t=e("#content-review__dialog-wrapper");return t.length||(t=e('<div id="content-review__dialog-wrapper" />'),e("body").append(t)),t.open(),!1}}),e(".content-review-modal .content-review-modal__nav-link").entwine({onclick:function(n){n.preventDefault();var t=e(n.target);window.location=t.attr("href")}}),e("#content-review__dialog-wrapper").entwine({onunmatch:function(){this._clearModal()},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(n){var t=this,o=function(){return t.close()},r=function(){return t._handleSubmitModal.apply(t,arguments)},s=e("form.cms-edit-form :input[name=ID]").val(),c=window.ss.store,u=c.getState().config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPageEditController"===e.name}),f=u.form.ReviewContentForm.schemaUrl+"/"+s,_=i.a._t("ContentReview.CONTENT_DUE_FOR_REVIEW","Content due for review");d.a.render(a.a.createElement(l.Provider,{store:c},a.a.createElement(h,{title:_,show:n,handleSubmit:r,handleHide:o,schemaUrl:f,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"})),this[0])},_clearModal:function(){d.a.unmountComponentAtNode(this[0])},_handleSubmitModal:function(e,n,t){return t()}})})},function(e,n,t){"use strict";var o=t(0);t.n(o).a.entwine("ss",function(e){e(".cms-edit-form #Form_EditForm_ContentReviewType_Holder").entwine({onmatch:function(){var e=this;this.find(".optionset :input").bind("change",function(n){e.show_option(n.target.value)});var n=this.find("input[name=ContentReviewType]:checked").val();this.show_option(n),this._super()},onunmatch:function(){return this._super()},show_option:function(e){"Custom"===e?this._custom():"Inherit"===e?this._inherited():this._disabled()},_custom:function(){e(".review-settings").show(),e(".field.custom-setting").show()},_inherited:function(){e(".review-settings").show(),e(".field.custom-setting").hide()},_disabled:function(){e(".review-settings").hide()}})})},function(e,n,t){"use strict";var o=t(0);t.n(o).a.entwine("ss",function(e){function n(n){var t="ContentReviewOwnerID"+n,o=e("div.subsiteSpecificOwnerID"),i=0;for(i=0;i<o.length;i++)o[i].id===t?e(o[i]).show():e(o[i]).hide()}e("#Form_EditForm_SubsiteIDWithOwner").entwine({onmatch:function(){n(this.value)},change:function(){n(this.value)}})})},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),t(1),t(2),t(3)},function(e,n){e.exports=FormBuilderModal},function(e,n){e.exports=Injector},function(e,n){e.exports=React},function(e,n){e.exports=ReactDom},function(e,n){e.exports=ReactRedux},function(e,n){e.exports=i18n}]);
!function(n){function e(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var t={};e.m=n,e.c=t,e.i=function(n){return n},e.d=function(n,t,o){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:o})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=4)}([function(n,e){n.exports=jQuery},function(n,e,t){"use strict";var o=t(8),i=t.n(o),r=t(0),s=t.n(r),c=t(6),a=t.n(c),u=t(7),d=t.n(u),l=t(5),f=(t.n(l),t.i(l.loadComponent)("FormBuilderModal"));s.a.entwine("ss",function(n){n(".cms-content-actions .content-review__button").entwine({onclick:function(){var e=n("#content-review__dialog-wrapper");return e.length||(e=n('<div id="content-review__dialog-wrapper" />'),n("body").append(e)),e.open(),!1}}),n(".content-review-modal .content-review-modal__nav-link").entwine({onclick:function(e){e.preventDefault();var t=n(e.target);window.location=t.attr("href")}}),n("#content-review__dialog-wrapper").entwine({onunmatch:function(){this._clearModal()},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,o=function(){return t.close()},r=function(){return t._handleSubmitModal.apply(t,arguments)},s=n("form.cms-edit-form :input[name=ID]").val(),c=window.ss.store,u=c.getState().config.sections.find(function(n){return"SilverStripe\\CMS\\Controllers\\CMSPageEditController"===n.name}),l=u.form.ReviewContentForm.schemaUrl+"/"+s,_=i.a._t("ContentReview.CONTENT_DUE_FOR_REVIEW","Content due for review");d.a.render(a.a.createElement(f,{title:_,show:e,onSubmit:r,onHide:o,schemaUrl:l,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"}),this[0])},_clearModal:function(){d.a.unmountComponentAtNode(this[0])},_handleSubmitModal:function(e,t,o){return n(".content-review__button-holder").remove(),o()}})})},function(n,e,t){"use strict";var o=t(0);t.n(o).a.entwine("ss",function(n){n(".cms-edit-form #Form_EditForm_ContentReviewType_Holder").entwine({onmatch:function(){var n=this;this.find(".optionset :input").bind("change",function(e){n.show_option(e.target.value)});var e=this.find("input[name=ContentReviewType]:checked").val();this.show_option(e),this._super()},onunmatch:function(){return this._super()},show_option:function(n){"Custom"===n?this._custom():"Inherit"===n?this._inherited():this._disabled()},_custom:function(){n(".review-settings").show(),n(".field.custom-setting").show()},_inherited:function(){n(".review-settings").show(),n(".field.custom-setting").hide()},_disabled:function(){n(".review-settings").hide()}})})},function(n,e,t){"use strict";var o=t(0);t.n(o).a.entwine("ss",function(n){function e(e){var t="ContentReviewOwnerID"+e,o=n("div.subsiteSpecificOwnerID"),i=0;for(i=0;i<o.length;i++)o[i].id===t?n(o[i]).show():n(o[i]).hide()}n("#Form_EditForm_SubsiteIDWithOwner").entwine({onmatch:function(){e(this.value)},change:function(){e(this.value)}})})},function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t(1),t(2),t(3)},function(n,e){n.exports=Injector},function(n,e){n.exports=React},function(n,e){n.exports=ReactDom},function(n,e){n.exports=i18n}]);

View File

@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 2e84be8a35a52c0a303b","webpack:///external \"jQuery\"","webpack:///./client/src/bundles/ContentReviewForm.js","webpack:///./client/src/bundles/ContentReviewSettings.js","webpack:///./client/src/bundles/PagesDueForReview.js","webpack:///./client/src/bundles/bundle.js","webpack:///external \"FormBuilderModal\"","webpack:///external \"Injector\"","webpack:///external \"React\"","webpack:///external \"ReactDom\"","webpack:///external \"ReactRedux\"","webpack:///external \"i18n\""],"names":["InjectableFormBuilderModal","provideInjector","jQuery","entwine","$","onclick","e","preventDefault","dialog","length","append","open","$link","target","window","location","attr","onunmatch","_clearModal","_renderModal","close","show","handleHide","handleSubmit","_handleSubmitModal","id","val","store","ss","sectionConfigKey","sectionConfig","getState","config","sections","find","section","name","modalSchemaUrl","form","ReviewContentForm","schemaUrl","title","i18n","_t","ReactDOM","render","unmountComponentAtNode","data","action","submitFn","onmatch","self","bind","show_option","value","currentVal","_super","_custom","_inherited","_disabled","hide","showCorrectSubsiteIDDropdown","domid","ownerIDDropdowns","i","change"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AChEA,wB;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMA,6BAA6B,oFAAAC,CAAgB,oFAAhB,CAAnC;;AAMA,8CAAAC,CAAOC,OAAP,CAAe,IAAf,EAAqB,UAACC,CAAD,EAAO;AAI1BA,IAAE,8CAAF,EAAkDD,OAAlD,CAA0D;AACxDE,WADwD,mBAChDC,CADgD,EAC7C;AACTA,QAAEC,cAAF;;AAEA,UAAIC,SAASJ,EAAE,iCAAF,CAAb;;AAEA,UAAI,CAACI,OAAOC,MAAZ,EAAoB;AAClBD,iBAASJ,EAAE,6CAAF,CAAT;AACAA,UAAE,MAAF,EAAUM,MAAV,CAAiBF,MAAjB;AACD;;AAEDA,aAAOG,IAAP;;AAEA,aAAO,KAAP;AACD;AAduD,GAA1D;;AAmBAP,IAAE,uDAAF,EAA2DD,OAA3D,CAAmE;AACjEE,aAAS,iBAACC,CAAD,EAAO;AACdA,QAAEC,cAAF;AACA,UAAMK,QAAQR,EAAEE,EAAEO,MAAJ,CAAd;AACAC,aAAOC,QAAP,GAAkBH,MAAMI,IAAN,CAAW,MAAX,CAAlB;AACD;AALgE,GAAnE;;AAWAZ,IAAE,iCAAF,EAAqCD,OAArC,CAA6C;AAC3Cc,aAD2C,uBAC/B;AAEV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,GAApE;AA0CD,CAjDD,E;;;;;;;;;ACFA;;AAKA,8CAAA1D,CAAOC,OAAP,CAAe,IAAf,EAAqB,UAACC,CAAD,EAAO;AAE1B,WAASyD,4BAAT,CAAsCP,KAAtC,EAA6C;AAC3C,QAAMQ,iCAA+BR,KAArC;;AAEA,QAAMS,mBAAmB3D,EAAE,4BAAF,CAAzB;AACA,QAAI4D,IAAI,CAAR;AACA,SAAKA,IAAI,CAAT,EAAYA,IAAID,iBAAiBtD,MAAjC,EAAyCuD,GAAzC,EAA8C;AAC5C,UAAID,iBAAiBC,CAAjB,EAAoBvC,EAApB,KAA2BqC,KAA/B,EAAsC;AACpC1D,UAAE2D,iBAAiBC,CAAjB,CAAF,EAAuB3C,IAAvB;AACD,OAFD,MAEO;AACLjB,UAAE2D,iBAAiBC,CAAjB,CAAF,EAAuBJ,IAAvB;AACD;AACF;AACF;;AAEDxD,IAAE,mCAAF,EAAuCD,OAAvC,CAA+C;AAE7C+C,WAF6C,qBAEnC;AACRW,mCAA6B,KAAKP,KAAlC;AACD,KAJ4C;AAO7CW,UAP6C,oBAOpC;AACPJ,mCAA6B,KAAKP,KAAlC;AACD;AAT4C,GAA/C;AAWD,CA3BD,E;;;;;;;;;;;ACLA;AACA;;;;;;;ACDA,kC;;;;;;ACAA,0B;;;;;;ACAA,uB;;;;;;ACAA,0B;;;;;;ACAA,4B;;;;;;ACAA,sB","file":"js/contentreview.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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2e84be8a35a52c0a303b","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0","import i18n from 'i18n';\nimport jQuery from 'jquery';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { provideInjector } from 'lib/Injector';\nimport FormBuilderModal from 'components/FormBuilderModal/FormBuilderModal';\n\nconst InjectableFormBuilderModal = provideInjector(FormBuilderModal);\n\n/**\n * \"Content due for review\" modal popup. See AddToCampaignForm.js in\n * silverstripe/admin for reference.\n */\njQuery.entwine('ss', ($) => {\n\t/**\n * Kick off a \"content due for review\" dialog from the CMS actions.\n */\n $('.cms-content-actions .content-review__button').entwine({\n onclick(e) {\n e.preventDefault();\n\n let dialog = $('#content-review__dialog-wrapper');\n\n if (!dialog.length) {\n dialog = $('<div id=\"content-review__dialog-wrapper\" />');\n $('body').append(dialog);\n }\n\n dialog.open();\n\n return false;\n },\n });\n\n // This is required because the React version of e.preventDefault() doesn't work\n // this is to prevent PJAX request to occur when clicking a link the modal\n $('.content-review-modal .content-review-modal__nav-link').entwine({\n onclick: (e) => {\n e.preventDefault();\n const $link = $(e.target);\n window.location = $link.attr('href');\n },\n });\n\n\t/**\n * Uses React-Bootstrap in order to replicate the bootstrap styling and JavaScript behaviour.\n */\n $('#content-review__dialog-wrapper').entwine({\n onunmatch() {\n // solves errors given by ReactDOM \"no matched root found\" error.\n this._clearModal();\n },\n\n open() {\n this._renderModal(true);\n },\n\n close() {\n this._renderModal(false);\n },\n\n _renderModal(show) {\n const handleHide = () => this.close();\n const handleSubmit = (...args) => this._handleSubmitModal(...args);\n const id = $('form.cms-edit-form :input[name=ID]').val();\n const store = window.ss.store;\n const sectionConfigKey = 'SilverStripe\\\\CMS\\\\Controllers\\\\CMSPageEditController';\n const sectionConfig = store.getState().config.sections\n .find((section) => section.name === sectionConfigKey);\n const modalSchemaUrl = `${sectionConfig.form.ReviewContentForm.schemaUrl}/${id}`;\n const title = i18n._t(\n 'SilverStripe\\\\ContentReview\\\\Models\\\\ContentReviewLog.CONTENT_DUE_FOR_REVIEW',\n 'Content due for review'\n );\n\n ReactDOM.render(\n <Provider store={store}>\n <InjectableFormBuilderModal\n title={title}\n show={show}\n handleSubmit={handleSubmit}\n handleHide={handleHide}\n schemaUrl={modalSchemaUrl}\n bodyClassName=\"modal__dialog\"\n className=\"content-review-modal\"\n responseClassBad=\"modal__response modal__response--error\"\n responseClassGood=\"modal__response modal__response--good\"\n identifier=\"SilverStripe\\\\ContentReview\\\\Models\\\\ContentReviewLog.CONTENT_DUE_FOR_REVIEW\"\n />\n </Provider>,\n this[0]\n );\n },\n\n _clearModal() {\n ReactDOM.unmountComponentAtNode(this[0]);\n // this.empty();\n },\n\n _handleSubmitModal(data, action, submitFn) {\n return submitFn();\n },\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/ContentReviewForm.js","import jQuery from 'jquery';\n\njQuery.entwine('ss', ($) => {\n /**\n * Class: .cms-edit-form #Form_EditForm_ContentReviewType_Holder\n *\n * Toggle display of group dropdown in \"access\" tab,\n * based on selection of radiobuttons.\n */\n $('.cms-edit-form #Form_EditForm_ContentReviewType_Holder').entwine({\n // Constructor: onmatch\n onmatch() {\n const self = this;\n this.find('.optionset :input').bind('change', (e) => {\n self.show_option(e.target.value);\n });\n\n // initial state\n const currentVal = this.find('input[name=ContentReviewType]:checked').val();\n this.show_option(currentVal);\n this._super();\n },\n\n onunmatch() {\n return this._super();\n },\n\n show_option(value) {\n if (value === 'Custom') {\n this._custom();\n } else if (value === 'Inherit') {\n this._inherited();\n } else {\n this._disabled();\n }\n },\n\n _custom() {\n $('.review-settings').show();\n $('.field.custom-setting').show();\n },\n\n _inherited() {\n $('.review-settings').show();\n $('.field.custom-setting').hide();\n },\n\n _disabled() {\n $('.review-settings').hide();\n },\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/ContentReviewSettings.js","import jQuery from 'jquery';\n\n/**\n * @todo Re-validate this with Subsites\n */\njQuery.entwine('ss', ($) => {\n // Hide all owner dropdowns except the one for the current subsite\n function showCorrectSubsiteIDDropdown(value) {\n const domid = `ContentReviewOwnerID${value}`;\n\n const ownerIDDropdowns = $('div.subsiteSpecificOwnerID');\n let i = 0;\n for (i = 0; i < ownerIDDropdowns.length; i++) {\n if (ownerIDDropdowns[i].id === domid) {\n $(ownerIDDropdowns[i]).show();\n } else {\n $(ownerIDDropdowns[i]).hide();\n }\n }\n }\n\n $('#Form_EditForm_SubsiteIDWithOwner').entwine({\n // Call method to show on report load\n onmatch() {\n showCorrectSubsiteIDDropdown(this.value);\n },\n\n // Call method to show on dropdown change\n change() {\n showCorrectSubsiteIDDropdown(this.value);\n },\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/PagesDueForReview.js","import 'bundles/ContentReviewForm.js';\nimport 'bundles/ContentReviewSettings.js';\nimport 'bundles/PagesDueForReview.js';\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/bundle.js","module.exports = FormBuilderModal;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"FormBuilderModal\"\n// module id = 5\n// module chunks = 0","module.exports = Injector;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"Injector\"\n// module id = 6\n// module chunks = 0","module.exports = React;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"React\"\n// module id = 7\n// module chunks = 0","module.exports = ReactDom;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"ReactDom\"\n// module id = 8\n// module chunks = 0","module.exports = ReactRedux;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"ReactRedux\"\n// module id = 9\n// module chunks = 0","module.exports = i18n;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"i18n\"\n// module id = 10\n// module chunks = 0"],"sourceRoot":""}

View File

@ -1,12 +1,11 @@
/* global window */
import i18n from 'i18n';
import jQuery from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { provideInjector } from 'lib/Injector';
import FormBuilderModal from 'components/FormBuilderModal/FormBuilderModal';
import { loadComponent } from 'lib/Injector';
const InjectableFormBuilderModal = provideInjector(FormBuilderModal);
const FormBuilderModal = loadComponent('FormBuilderModal');
/**
* "Content due for review" modal popup. See AddToCampaignForm.js in
@ -17,9 +16,7 @@ jQuery.entwine('ss', ($) => {
* Kick off a "content due for review" dialog from the CMS actions.
*/
$('.cms-content-actions .content-review__button').entwine({
onclick(e) {
e.preventDefault();
onclick() {
let dialog = $('#content-review__dialog-wrapper');
if (!dialog.length) {
@ -64,28 +61,26 @@ jQuery.entwine('ss', ($) => {
const handleHide = () => this.close();
const handleSubmit = (...args) => this._handleSubmitModal(...args);
const id = $('form.cms-edit-form :input[name=ID]').val();
const store = window.ss.store;
const sectionConfigKey = 'SilverStripe\\CMS\\Controllers\\CMSPageEditController';
const store = window.ss.store;
const sectionConfig = store.getState().config.sections
.find((section) => section.name === sectionConfigKey);
const modalSchemaUrl = `${sectionConfig.form.ReviewContentForm.schemaUrl}/${id}`;
const title = i18n._t('ContentReview.CONTENT_DUE_FOR_REVIEW', 'Content due for review');
ReactDOM.render(
<Provider store={store}>
<InjectableFormBuilderModal
title={title}
show={show}
handleSubmit={handleSubmit}
handleHide={handleHide}
schemaUrl={modalSchemaUrl}
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"
/>
</Provider>,
<FormBuilderModal
title={title}
show={show}
onSubmit={handleSubmit}
onHide={handleHide}
schemaUrl={modalSchemaUrl}
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"
/>,
this[0]
);
},
@ -95,6 +90,10 @@ jQuery.entwine('ss', ($) => {
},
_handleSubmitModal(data, action, submitFn) {
// Remove the "review content" bell button so users won't do it again
$('.content-review__button-holder').remove();
// Handle the review submission
return submitFn();
},
});

View File

@ -1,4 +1 @@
// See includePaths in webpack.config.js
@import "variables";
@import "ContentReviewForm";