Skip to content

Commit

Permalink
BUG Update modal API for Reactstrap in SilverStripe 4.2, bump constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Jun 25, 2018
1 parent 53ecc52 commit 6c56694
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/contentreview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions client/src/bundles/ContentReviewForm.js
Expand Up @@ -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) {
Expand All @@ -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() {
Expand All @@ -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();
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Extensions/SiteTreeContentReview.php
Expand Up @@ -491,7 +491,7 @@ public function advanceReviewDate()
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();
}

Expand Down
3 changes: 3 additions & 0 deletions src/Forms/ReviewContentHandler.php
Expand Up @@ -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;
Expand Down Expand Up @@ -84,6 +86,7 @@ public function Form($object)
*/
public function submitReview($record, $data)
{
/** @var DataObject|SiteTreeContentReview $record */
if (!$this->canSubmitReview($record)) {
throw new ValidationException(_t(
__CLASS__ . '.ErrorReviewPermissionDenied',
Expand Down

0 comments on commit 6c56694

Please sign in to comment.