mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
FIX Simplify JS requirements in SiteTreeContentReview and fix linting errors
This commit is contained in:
parent
f64561e1b4
commit
e55931f874
@ -8,30 +8,27 @@ use SilverStripe\ContentReview\Jobs\ContentReviewNotificationJob;
|
|||||||
use SilverStripe\ContentReview\Models\ContentReviewLog;
|
use SilverStripe\ContentReview\Models\ContentReviewLog;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
|
||||||
use SilverStripe\Forms\FieldList;
|
|
||||||
use SilverStripe\Forms\LiteralField;
|
|
||||||
use SilverStripe\Forms\FormAction;
|
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
use SilverStripe\Forms\Tab;
|
|
||||||
use SilverStripe\Forms\DateField;
|
use SilverStripe\Forms\DateField;
|
||||||
use SilverStripe\Forms\DateTimeField;
|
use SilverStripe\Forms\DateTimeField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldConfig;
|
use SilverStripe\Forms\GridField\GridFieldConfig;
|
||||||
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
|
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
|
||||||
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
||||||
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
|
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
|
||||||
|
use SilverStripe\Forms\HeaderField;
|
||||||
use SilverStripe\Forms\ListboxField;
|
use SilverStripe\Forms\ListboxField;
|
||||||
|
use SilverStripe\Forms\LiteralField;
|
||||||
use SilverStripe\Forms\OptionsetField;
|
use SilverStripe\Forms\OptionsetField;
|
||||||
use SilverStripe\Forms\ReadonlyField;
|
use SilverStripe\Forms\ReadonlyField;
|
||||||
use SilverStripe\Forms\HeaderField;
|
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
|
||||||
use SilverStripe\ORM\FieldType\DBDate;
|
use SilverStripe\ORM\FieldType\DBDate;
|
||||||
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\Security\Group;
|
use SilverStripe\Security\Group;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
@ -332,9 +329,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module = ModuleLoader::getModule('silverstripe/contentreview');
|
Requirements::javascript('silverstripe/contentreview:client/dist/js/contentreview.js');
|
||||||
Requirements::javascript($module->getResource('client/dist/js/contentreview.js')->getRelativePath());
|
|
||||||
|
|
||||||
// Display read-only version only
|
// Display read-only version only
|
||||||
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
|
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
|
||||||
$schedule = self::get_schedule();
|
$schedule = self::get_schedule();
|
||||||
|
@ -70,8 +70,9 @@ class ContentReviewNotificationTest extends SapphireTest
|
|||||||
$email = $this->findEmail($ToEmail, null, $Subject);
|
$email = $this->findEmail($ToEmail, null, $Subject);
|
||||||
$this->assertNotNull($email, "Email haven't been sent.");
|
$this->assertNotNull($email, "Email haven't been sent.");
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
"<h1>$Subject</h1><p>There are $PagesCount pages that are due for review today by you, "
|
"<h1>$Subject</h1>".
|
||||||
. "$ToFirstName.</p><p>This email was sent to $ToEmail</p>",
|
"<p>There are $PagesCount pages that are due for review today by you, $ToFirstName.</p>".
|
||||||
|
"<p>This email was sent to $ToEmail</p>",
|
||||||
$email['HtmlContent']
|
$email['HtmlContent']
|
||||||
);
|
);
|
||||||
$this->assertContains('Staff', $email['HtmlContent']);
|
$this->assertContains('Staff', $email['HtmlContent']);
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\ContentReview\Tests;
|
|||||||
|
|
||||||
use function date;
|
use function date;
|
||||||
use Page;
|
use Page;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
|
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
|
||||||
@ -117,7 +118,10 @@ class ContentReviewSettingsTest extends SapphireTest
|
|||||||
$page->write();
|
$page->write();
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
date('Y-m-d', strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")),
|
date(
|
||||||
|
'Y-m-d',
|
||||||
|
strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")
|
||||||
|
),
|
||||||
$page->NextReviewDate
|
$page->NextReviewDate
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -177,7 +181,13 @@ class ContentReviewSettingsTest extends SapphireTest
|
|||||||
$page = $this->objFromFixture(Page::class, "inherit");
|
$page = $this->objFromFixture(Page::class, "inherit");
|
||||||
|
|
||||||
$this->assertEquals("Inherit", $page->ContentReviewType);
|
$this->assertEquals("Inherit", $page->ContentReviewType);
|
||||||
$this->assertEquals($this->objFromFixture(SiteConfig::class, "default")->ID, $page->getOptions()->ID);
|
$this->assertEquals(
|
||||||
|
$this->objFromFixture(
|
||||||
|
SiteConfig::class,
|
||||||
|
"default"
|
||||||
|
)->ID,
|
||||||
|
$page->getOptions()->ID
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNextReviewDateFromCustomSettings()
|
public function testGetNextReviewDateFromCustomSettings()
|
||||||
|
Loading…
Reference in New Issue
Block a user