mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
Merge pull request #86 from creative-commoners/pulls/4.1/fix-for-ss42
BUG Update modal API for Reactstrap in SilverStripe 4.2, bump constraint
This commit is contained in:
commit
c2f0d754c2
16
.travis.yml
16
.travis.yml
@ -7,20 +7,22 @@ addons:
|
||||
|
||||
env:
|
||||
global:
|
||||
- COMPOSER_ROOT_VERSION=4.0.x-dev
|
||||
- COMPOSER_ROOT_VERSION=4.1.x-dev
|
||||
- DISPLAY=":99"
|
||||
- XVFBARGS=":99 -ac -screen 0 1024x768x16"
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||
env: DB=MYSQL RECIPE_VERSION=4.2.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||
- php: 7.0
|
||||
env: DB=PGSQL PHPUNIT_TEST=1
|
||||
env: DB=PGSQL RECIPE_VERSION=4.2.x-dev PHPUNIT_TEST=1
|
||||
- php: 7.1
|
||||
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
|
||||
env: DB=MYSQL RECIPE_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1
|
||||
- php: 7.1
|
||||
env: DB=MYSQL BEHAT_TEST=1
|
||||
env: DB=MYSQL RECIPE_VERSION=4.2.x-dev BEHAT_TEST=1
|
||||
- php: 7.2
|
||||
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
|
||||
|
||||
before_script:
|
||||
# Init PHP
|
||||
@ -29,8 +31,8 @@ before_script:
|
||||
|
||||
# Install composer dependencies
|
||||
- composer validate
|
||||
- composer require --no-update silverstripe/recipe-cms:1.0.x-dev
|
||||
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi
|
||||
- composer require --no-update silverstripe/recipe-cms:"$RECIPE_VERSION"
|
||||
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.1.x-dev; fi
|
||||
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
|
||||
|
||||
# Start behat services
|
||||
|
2
client/dist/js/contentreview.js
vendored
2
client/dist/js/contentreview.js
vendored
@ -1 +1 @@
|
||||
!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}]);
|
||||
!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(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(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}),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:_,isOpen:n,onSubmit:r,onClosed: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(n,t,o){return e(".content-review__button-holder").remove(),o()}})})},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=Injector},function(e,n){e.exports=React},function(e,n){e.exports=ReactDom},function(e,n){e.exports=i18n}]);
|
@ -16,7 +16,9 @@ jQuery.entwine('ss', ($) => {
|
||||
* Kick off a "content due for review" dialog from the CMS actions.
|
||||
*/
|
||||
$('.cms-content-actions .content-review__button').entwine({
|
||||
onclick() {
|
||||
onclick(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let dialog = $('#content-review__dialog-wrapper');
|
||||
|
||||
if (!dialog.length) {
|
||||
@ -41,7 +43,7 @@ jQuery.entwine('ss', ($) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* Uses React-Bootstrap in order to replicate the bootstrap styling and JavaScript behaviour.
|
||||
* Uses reactstrap in order to replicate the bootstrap styling and JavaScript behaviour.
|
||||
*/
|
||||
$('#content-review__dialog-wrapper').entwine({
|
||||
onunmatch() {
|
||||
@ -57,7 +59,7 @@ jQuery.entwine('ss', ($) => {
|
||||
this._renderModal(false);
|
||||
},
|
||||
|
||||
_renderModal(show) {
|
||||
_renderModal(isOpen) {
|
||||
const handleHide = () => this.close();
|
||||
const handleSubmit = (...args) => this._handleSubmitModal(...args);
|
||||
const id = $('form.cms-edit-form :input[name=ID]').val();
|
||||
@ -71,9 +73,9 @@ jQuery.entwine('ss', ($) => {
|
||||
ReactDOM.render(
|
||||
<FormBuilderModal
|
||||
title={title}
|
||||
show={show}
|
||||
isOpen={isOpen}
|
||||
onSubmit={handleSubmit}
|
||||
onHide={handleHide}
|
||||
onClosed={handleHide}
|
||||
schemaUrl={modalSchemaUrl}
|
||||
bodyClassName="modal__dialog"
|
||||
className="content-review-modal"
|
||||
|
@ -21,10 +21,10 @@
|
||||
],
|
||||
"require": {
|
||||
"silverstripe/vendor-plugin": "^1",
|
||||
"silverstripe/framework": "^4",
|
||||
"silverstripe/cms": "^4",
|
||||
"silverstripe/reports": "^4",
|
||||
"silverstripe/siteconfig": "^4"
|
||||
"silverstripe/framework": "^4.2",
|
||||
"silverstripe/cms": "^4.2",
|
||||
"silverstripe/reports": "^4.2",
|
||||
"silverstripe/siteconfig": "^4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7",
|
||||
|
@ -491,7 +491,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
DBDatetime::now()->getTimestamp()
|
||||
);
|
||||
|
||||
$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format('y-MM-dd');
|
||||
$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format(DBDate::ISO_DATE);
|
||||
$this->owner->write();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace SilverStripe\ContentReview\Forms;
|
||||
|
||||
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
@ -84,6 +86,7 @@ class ReviewContentHandler
|
||||
*/
|
||||
public function submitReview($record, $data)
|
||||
{
|
||||
/** @var DataObject|SiteTreeContentReview $record */
|
||||
if (!$this->canSubmitReview($record)) {
|
||||
throw new ValidationException(_t(
|
||||
__CLASS__ . '.ErrorReviewPermissionDenied',
|
||||
|
Loading…
Reference in New Issue
Block a user